TP-000000 | onboarding flow fetching loader issue (#7754)

This commit is contained in:
Mohit Rajput
2023-09-06 12:41:16 +05:30
committed by GitHub
parent 397b34cd48
commit 88e8e486e1
2 changed files with 27 additions and 3 deletions

View File

@@ -225,6 +225,22 @@ class NaviPayAnalytics private constructor() {
}
}
fun onGetCustomerCallAfterBindingEnd(
deviceData: DeviceData?,
errors: List<GenericErrorResponse>?,
customerStatus: String
) {
deviceData?.let {
NaviTrackEvent.trackEventOnClickStream(
"Dev_NaviPay_OnGetCustomerCallAfterBindingEnds", mapOf(
Pair("deviceData", it.toString()),
Pair("error", errors?.firstOrNull().toString()),
Pair("customerStatus", customerStatus),
)
)
}
}
fun onBindDeviceCallForBinding(deviceDetails: DeviceDetails) {
NaviTrackEvent.trackEventOnClickStream(
"Dev_NaviPay_OnBindDeviceCallForBinding", mapOf(

View File

@@ -500,6 +500,12 @@ class NaviPayOnboardingViewModel @Inject constructor(
val customerAPIResponse =
commonRepository.getCustomer(customerRequest = CustomerRequest(deviceData = deviceInfoProvider.getDeviceData()))
naviPayAnalytics.onGetCustomerCallAfterBindingEnd(
deviceData = deviceInfoProvider.getDeviceData(),
errors = customerAPIResponse.errors,
customerStatus = customerAPIResponse.data?.customerStatus ?: ""
)
if (customerAPIResponse.isError()) {
onBindingError(customerAPIResponse)
return@launch
@@ -653,15 +659,17 @@ class NaviPayOnboardingViewModel @Inject constructor(
// Grant phone state permission before calling this method
viewModelScope.launch(Dispatchers.IO) {
val customerStatus = naviPayCustomerStatusHandler.getCustomerStatusOnMainThread()
val isCustomerStatusOnboarded =
customerStatus == NaviPayCustomerStatus.LINKED_VPA || customerStatus == NaviPayCustomerStatus.DEVICE_BOUNDED
val isCustomerStatusSet = customerStatus != NaviPayCustomerStatus.NOT_SET
val isLocalDeviceDataNotAvailable = !isLocalDeviceDataAvailable()
naviPayAnalytics.verifySetupCalled(
customerStatus = customerStatus.name,
isLocalDeviceDataNotAvailable = isLocalDeviceDataNotAvailable
)
Timber.d("verifyNaviPaySetup(): initial customerStatus: $customerStatus, isLocalDeviceDataNotAvailable: $isLocalDeviceDataNotAvailable")
if (isCustomerStatusOnboarded || isLocalDeviceDataNotAvailable) {
// isCustomerStatusSet - If customer status is set, then no need to call customer status api here. Next action will happen based on onSetupSuccess()
// base on available customer status
if (isCustomerStatusSet || isLocalDeviceDataNotAvailable) {
// Setup is done at app launch. App can proceed with the normal flow
onSetupSuccess(customerStatus = customerStatus.name)
return@launch