NTP-1234 | Loans tab issue fix (#15575)

Co-authored-by: Kishan Kumar <kishan.kumar@navi.com>
This commit is contained in:
Sanjay P
2025-04-01 15:12:55 +05:30
committed by GitHub
parent 20cb933ded
commit 4fab34a70d
3 changed files with 19 additions and 13 deletions

View File

@@ -357,9 +357,6 @@ class HomePageActivity :
BottomBarTabType.INSURANCE.name -> {
setStatusBarColor(R.color.white)
}
BottomBarTabType.LOAN.name -> {
setStatusBarColor(R.color.white)
}
}
}

View File

@@ -10,6 +10,7 @@ package com.naviapp.home.dashboard.ui.compose.loansTab
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.mutableStateOf
@@ -43,8 +44,10 @@ fun LoansTabScreen(
LaunchedEffect(Unit) {
uiController.setStatusBarColor(color = Color.Transparent, darkIcons = true)
}
val loansTabHelper by lazy { LoansTabHelper() }
LoansTabWebView(loansTabVm, activity, loansTabHelper)
DisposableEffect(Unit) { onDispose { loansTabVm.updateWebViewUrl(AuthTokenState.Nothing) } }
}
@Composable

View File

@@ -38,7 +38,7 @@ class LoanTabVm
@Inject
constructor(private val webRedirectionRepository: WebRedirectionRepository) : BaseVM() {
private val _webViewUrl = MutableStateFlow<AuthTokenState<String?>>(AuthTokenState.Nothing())
private val _webViewUrl = MutableStateFlow<AuthTokenState>(AuthTokenState.Nothing)
val webViewUrl = _webViewUrl.asStateFlow()
private val redirectionCta = SingleLiveEvent<CtaData>()
@@ -60,6 +60,7 @@ constructor(private val webRedirectionRepository: WebRedirectionRepository) : Ba
is CtaAction -> {
handleCtaAction(ctaAction = uiTronAction)
}
is AnalyticsAction -> {
NaviTrackEvent.trackEvent(
uiTronAction.eventName ?: EMPTY,
@@ -90,11 +91,12 @@ constructor(private val webRedirectionRepository: WebRedirectionRepository) : Ba
if (response.isValidResponse()) {
_webViewUrl.value =
AuthTokenState.Success(
LoansTabHelper()
.generateLoansTabWebViewUrl(
codeVerifier = codeVerifier,
token = response.data?.code.toString(),
)
data =
LoansTabHelper()
.generateLoansTabWebViewUrl(
codeVerifier = codeVerifier,
token = response.data?.code.toString(),
)
)
} else {
val errorUnifiedResponse =
@@ -108,6 +110,10 @@ constructor(private val webRedirectionRepository: WebRedirectionRepository) : Ba
isLoansTabInitCalled = status
}
fun updateWebViewUrl(webViewUrlState: AuthTokenState) {
_webViewUrl.value = webViewUrlState
}
sealed interface LoansTabUiTronScreenState {
data object Loading : LoansTabUiTronScreenState
@@ -116,12 +122,12 @@ constructor(private val webRedirectionRepository: WebRedirectionRepository) : Ba
data class Error(val error: GenericErrorResponse? = null) : LoansTabUiTronScreenState
}
sealed class AuthTokenState<T>(val data: T? = null) {
sealed class AuthTokenState {
class Nothing<T> : AuthTokenState<T>()
data object Nothing : AuthTokenState()
data class Error<T>(val error: GenericErrorResponse? = null) : AuthTokenState<T>()
data class Error(val error: GenericErrorResponse? = null) : AuthTokenState()
class Success<T>(data: T?) : AuthTokenState<T>(data)
data class Success(val data: String?) : AuthTokenState()
}
}