NTP-66133 | Divyesh | update notify error handling (#16385)

This commit is contained in:
Divyesh Shinde
2025-05-30 14:56:19 +05:30
committed by GitHub
parent fb650c7946
commit 4c6bcb4ce1
2 changed files with 24 additions and 4 deletions

View File

@@ -589,6 +589,17 @@ class NaviBbpsAnalytics private constructor() {
),
)
}
fun alchemistResponseFailureEvent(error: String, sessionAttribute: Map<String, String>) {
NaviTrackEvent.trackEventOnClickStream(
eventName = "NaviBBPS_Dev_CategoryPage_AlchemistResponseFailure",
eventValues =
mapOf(
"error" to error,
NAVI_BBPS_SESSION_ID to sessionAttribute[NAVI_BBPS_SESSION_ID].orEmpty(),
),
)
}
}
inner class BillerList {

View File

@@ -56,6 +56,7 @@ import com.navi.bbps.network.di.NaviBbpsGsonBuilder
import com.navi.common.alchemist.model.AlchemistScreenDefinition
import com.navi.common.constants.DBCacheConstants
import com.navi.common.di.CoroutineDispatcherProvider
import com.navi.common.network.models.RepoResult
import com.navi.common.network.models.isSuccessWithData
import dagger.Lazy
import dagger.hilt.android.lifecycle.HiltViewModel
@@ -158,6 +159,8 @@ constructor(
private val _startOriginBillDetectionFlow = MutableSharedFlow<Boolean>(replay = 1)
val startOriginBillDetectionFlow = _startOriginBillDetectionFlow.asSharedFlow()
private var latestBillCategoriesApiResponse: RepoResult<AlchemistScreenDefinition>? = null
internal fun setOnOriginSmsNuxCtaClicked(value: Boolean) {
viewModelScope.launch(dispatcherProvider.main) { _onOriginSmsNuxCtaClicked.emit(value) }
}
@@ -359,10 +362,14 @@ constructor(
}
} else if (_billCategoriesStateV2.value !is BillCategoryStateV2.Loaded) {
_billCategoriesStateV2.update { BillCategoryStateV2.Error }
if (!naviNetworkConnectivity.isInternetConnected()) {
notifyError(errorConfig = getNoInternetErrorConfig())
} else {
notifyError(errorConfig = getGenericErrorConfig())
latestBillCategoriesApiResponse?.let {
val error = getError(response = it)
notifyError(response = it)
naviBbpsAnalytics.alchemistResponseFailureEvent(
error = error.code,
sessionAttribute =
naviBbpsSessionHelper.getNaviBbpsSessionAttributes(),
)
}
}
}
@@ -379,6 +386,8 @@ constructor(
)
)
latestBillCategoriesApiResponse = billCategoriesResponseFromAlchemist
if (!billCategoriesResponseFromAlchemist.isSuccessWithData()) {
return NaviCacheAltSourceEntity(isSuccess = false)
}