NTP-42153 | Clear All BBPS Tables on App Logout (#15140)
This commit is contained in:
@@ -181,6 +181,7 @@ object NaviSDKHelper {
|
||||
RazorpayHelper().clearRazorPayData(context)
|
||||
DeeplinkManager().logOut()
|
||||
NaviApplication.instance.naviPayManager.get().onAppLogout()
|
||||
NaviApplication.instance.naviBbpsManager.get().onLogout()
|
||||
NaviApplication.instance.notificationManager.get().logout()
|
||||
NaviApplication.instance.mmLibManager.get().clearMoneyManagerData()
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.appcompat.app.AppCompatDelegate
|
||||
import coil.ImageLoader
|
||||
import coil.ImageLoaderFactory
|
||||
import com.navi.base.cache.repository.NaviCacheRepository
|
||||
import com.navi.bbps.common.model.NaviBbpsManager
|
||||
import com.navi.moneymanager.common.manager.MMLibManager
|
||||
import com.navi.pay.common.setup.NaviPayManager
|
||||
import com.navi.traceflow.Config
|
||||
@@ -35,6 +36,8 @@ open class NaviApplication : BaseApplication(), ImageLoaderFactory {
|
||||
// This will initialize NaviPayManager lazily i.e. when NaviPayManager::init() will be called
|
||||
@Inject lateinit var naviPayManager: Lazy<NaviPayManager>
|
||||
|
||||
@Inject lateinit var naviBbpsManager: Lazy<NaviBbpsManager>
|
||||
|
||||
@Inject lateinit var mmLibManager: Lazy<MMLibManager>
|
||||
|
||||
@Inject lateinit var naviCacheRepository: Lazy<NaviCacheRepository>
|
||||
|
||||
@@ -7,71 +7,19 @@
|
||||
|
||||
package com.navi.bbps.common.model
|
||||
|
||||
import com.navi.bbps.common.NaviBbpsScreen
|
||||
import com.navi.bbps.common.usecase.BbpsRefreshConfigUseCase
|
||||
import com.navi.bbps.common.usecase.BillerListUseCase
|
||||
import com.navi.bbps.common.usecase.PhoneSeriesToOperatorCircleMappingUseCase
|
||||
import com.navi.bbps.common.usecase.PrepaidPlansUseCase
|
||||
import com.navi.bbps.common.usecase.SyncABTestingUseCase
|
||||
import com.navi.bbps.feature.mybills.MyBillsSyncJob
|
||||
import com.navi.common.payments.arc.usecase.ArcNudgeSyncUseCase
|
||||
import com.navi.bbps.db.NaviBbpsAppDatabase
|
||||
import dagger.Lazy
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import javax.inject.Singleton
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Singleton
|
||||
class NaviBbpsManager
|
||||
@Inject
|
||||
constructor(
|
||||
private val billerListUseCase: BillerListUseCase,
|
||||
private val phoneSeriesToOperatorCircleMappingUseCase:
|
||||
PhoneSeriesToOperatorCircleMappingUseCase,
|
||||
private val prepaidPlansUseCase: PrepaidPlansUseCase,
|
||||
private val bbpsRefreshConfigUseCase: BbpsRefreshConfigUseCase,
|
||||
private val myBillsSyncJob: MyBillsSyncJob,
|
||||
private val syncABTestingUseCase: SyncABTestingUseCase,
|
||||
private val arcNudgeSyncUseCase: ArcNudgeSyncUseCase,
|
||||
) {
|
||||
private var isInitInProgress = false
|
||||
|
||||
suspend fun init() {
|
||||
coroutineScope {
|
||||
if (isInitInProgress) {
|
||||
return@coroutineScope
|
||||
}
|
||||
|
||||
isInitInProgress = true
|
||||
|
||||
val taskList = mutableListOf<Deferred<Unit>>()
|
||||
taskList.add(
|
||||
async { myBillsSyncJob.refreshBills(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async { bbpsRefreshConfigUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async { billerListUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async {
|
||||
phoneSeriesToOperatorCircleMappingUseCase.execute(
|
||||
NaviBbpsScreen.NAVI_BBPS_MAIN.screenName
|
||||
)
|
||||
}
|
||||
)
|
||||
taskList.add(
|
||||
async { prepaidPlansUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async { syncABTestingUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
|
||||
taskList.add(async { arcNudgeSyncUseCase.execute() })
|
||||
|
||||
taskList.awaitAll()
|
||||
|
||||
isInitInProgress = false
|
||||
}
|
||||
constructor(private val naviBbpsAppDatabase: Lazy<NaviBbpsAppDatabase>) {
|
||||
fun onLogout() {
|
||||
CoroutineScope(Dispatchers.IO).launch { naviBbpsAppDatabase.get().clearAllTables() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.navi.bbps.common.model
|
||||
|
||||
import com.navi.bbps.common.NaviBbpsScreen
|
||||
import com.navi.bbps.common.usecase.BbpsRefreshConfigUseCase
|
||||
import com.navi.bbps.common.usecase.BillerListUseCase
|
||||
import com.navi.bbps.common.usecase.PhoneSeriesToOperatorCircleMappingUseCase
|
||||
import com.navi.bbps.common.usecase.PrepaidPlansUseCase
|
||||
import com.navi.bbps.common.usecase.SyncABTestingUseCase
|
||||
import com.navi.bbps.feature.mybills.MyBillsSyncJob
|
||||
import com.navi.common.payments.arc.usecase.ArcNudgeSyncUseCase
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
||||
class NaviBbpsSyncManager
|
||||
@Inject
|
||||
constructor(
|
||||
private val billerListUseCase: BillerListUseCase,
|
||||
private val phoneSeriesToOperatorCircleMappingUseCase:
|
||||
PhoneSeriesToOperatorCircleMappingUseCase,
|
||||
private val prepaidPlansUseCase: PrepaidPlansUseCase,
|
||||
private val bbpsRefreshConfigUseCase: BbpsRefreshConfigUseCase,
|
||||
private val myBillsSyncJob: MyBillsSyncJob,
|
||||
private val syncABTestingUseCase: SyncABTestingUseCase,
|
||||
private val arcNudgeSyncUseCase: ArcNudgeSyncUseCase,
|
||||
) {
|
||||
private var isInitInProgress = false
|
||||
|
||||
suspend fun init() {
|
||||
coroutineScope {
|
||||
if (isInitInProgress) {
|
||||
return@coroutineScope
|
||||
}
|
||||
|
||||
isInitInProgress = true
|
||||
|
||||
val taskList = mutableListOf<Deferred<Unit>>()
|
||||
taskList.add(
|
||||
async { myBillsSyncJob.refreshBills(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async { bbpsRefreshConfigUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async { billerListUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async {
|
||||
phoneSeriesToOperatorCircleMappingUseCase.execute(
|
||||
NaviBbpsScreen.NAVI_BBPS_MAIN.screenName
|
||||
)
|
||||
}
|
||||
)
|
||||
taskList.add(
|
||||
async { prepaidPlansUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
taskList.add(
|
||||
async { syncABTestingUseCase.execute(NaviBbpsScreen.NAVI_BBPS_MAIN.screenName) }
|
||||
)
|
||||
|
||||
taskList.add(async { arcNudgeSyncUseCase.execute() })
|
||||
|
||||
taskList.awaitAll()
|
||||
|
||||
isInitInProgress = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
package com.navi.bbps.entry
|
||||
|
||||
import androidx.compose.runtime.key
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.google.gson.Gson
|
||||
import com.navi.base.cache.model.NaviCacheEntity
|
||||
@@ -20,7 +19,7 @@ import com.navi.bbps.common.AB_TESTING_OFFER_EXPERIENCE_EXPERIMENT_NAME
|
||||
import com.navi.bbps.common.DEFAULT_RETRY_COUNT
|
||||
import com.navi.bbps.common.NaviBbpsScreen
|
||||
import com.navi.bbps.common.RETRY_INTERVAL_IN_SECONDS
|
||||
import com.navi.bbps.common.model.NaviBbpsManager
|
||||
import com.navi.bbps.common.model.NaviBbpsSyncManager
|
||||
import com.navi.bbps.common.model.NaviBbpsVmData
|
||||
import com.navi.bbps.common.model.view.BbpsNudgeDetailEntity
|
||||
import com.navi.bbps.common.model.view.BbpsNudgeOfferEntity
|
||||
@@ -41,7 +40,7 @@ import kotlinx.coroutines.launch
|
||||
class NaviBbpsMainViewModel
|
||||
@Inject
|
||||
constructor(
|
||||
private val naviBbpsManager: NaviBbpsManager,
|
||||
private val naviBbpsSyncManager: NaviBbpsSyncManager,
|
||||
private val naviBbpsSessionHelper: NaviBbpsSessionHelper,
|
||||
private val bbpsCommonRepository: BbpsCommonRepository,
|
||||
private val naviCacheRepository: NaviCacheRepository,
|
||||
@@ -51,7 +50,7 @@ constructor(
|
||||
|
||||
init {
|
||||
viewModelScope.launch(coroutineDispatcherProvider.io) {
|
||||
launch { naviBbpsManager.init() }
|
||||
launch { naviBbpsSyncManager.init() }
|
||||
launch { updateNaviBbpsSessionId() }
|
||||
launch { processNaviBbpsNudgeDetailResponse() }
|
||||
launch { fetchOfferABExperiment() }
|
||||
|
||||
Reference in New Issue
Block a user