Updated on 2026-08-14

This commit is contained in:
Tangem 2023-06-07 07:02:28 +03:00
parent 4affe1293d
commit e73e91e07a
4 changed files with 17 additions and 14 deletions

View file

@ -32,7 +32,7 @@ import com.tangem.tap.domain.TangemSdkManager
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation
import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation
import com.tangem.tap.features.intentHandler.MainIntentHandler
import com.tangem.tap.features.intentHandler.IntentProcessor
import com.tangem.tap.features.intentHandler.handlers.BackgroundScanIntentHandler
import com.tangem.tap.features.intentHandler.handlers.BuyCurrencyIntentHandler
import com.tangem.tap.features.intentHandler.handlers.SellCurrencyIntentHandler
@ -102,7 +102,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
lateinit var walletConnectInteractor: WalletConnectInteractor
// TODO: fixme: inject through DI
private val intentHandler: MainIntentHandler = MainIntentHandler()
private val intentProcessor: IntentProcessor = IntentProcessor()
private var snackbar: Snackbar? = null
private val dialogManager = DialogManager()
@ -145,10 +145,10 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
private fun initIntentHandlers() {
val hasSavedWalletsProvider = { store.state.globalState.userWalletsListManager?.hasUserWallets == true }
intentHandler.addHandler(BackgroundScanIntentHandler(hasSavedWalletsProvider))
intentHandler.addHandler(WalletConnectLinkIntentHandler())
intentHandler.addHandler(BuyCurrencyIntentHandler())
intentHandler.addHandler(SellCurrencyIntentHandler())
intentProcessor.addHandler(BackgroundScanIntentHandler(hasSavedWalletsProvider))
intentProcessor.addHandler(WalletConnectLinkIntentHandler())
intentProcessor.addHandler(BuyCurrencyIntentHandler())
intentProcessor.addHandler(SellCurrencyIntentHandler())
}
private fun initUserWalletsListManager() {
@ -188,7 +188,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
scope.launch {
intentHandler.handleIntent(intent)
intentProcessor.handleIntent(intent)
}
}
@ -205,7 +205,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
override fun onDestroy() {
store.dispatch(NavigationAction.ActivityDestroyed(WeakReference(this)))
intentHandler.removeAll()
intentProcessor.removeAll()
super.onDestroy()
}
@ -286,7 +286,7 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
} else {
store.dispatchOnMain(NavigationAction.NavigateTo(AppScreen.Home))
scope.launch {
intentHandler.handleIntent(intentWhichStartedActivity)
intentProcessor.handleIntent(intentWhichStartedActivity)
}
}
store.dispatch(BackupAction.CheckForUnfinishedBackup)