Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-08 14:33:06 +05:00
parent 04bcb44f76
commit e599995315
18 changed files with 142 additions and 30 deletions

View file

@ -11,6 +11,7 @@ import com.tangem.domain.settings.repositories.SettingsRepository
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.domain.wallets.legacy.asLockable
import com.tangem.domain.core.wallets.UserWalletsListRepository
import com.tangem.domain.wallets.usecase.ClearAllHotWalletContextualUnlockUseCase
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.tap.LockTimerWorker.Companion.TAG
import com.tangem.tap.common.extensions.dispatchNavigationAction
@ -22,6 +23,7 @@ import timber.log.Timber
import java.util.concurrent.TimeUnit
import kotlin.time.Duration
@Suppress("LongParameterList")
internal class LockUserWalletsTimer(
private val context: Context,
private val settingsRepository: SettingsRepository,
@ -30,6 +32,7 @@ internal class LockUserWalletsTimer(
private val userWalletsListRepository: UserWalletsListRepository,
private val hotWalletFeatureToggles: HotWalletFeatureToggles,
private val coroutineScope: CoroutineScope,
private val clearAllHotWalletContextualUnlockUseCase: ClearAllHotWalletContextualUnlockUseCase,
) : LifecycleOwner by context as LifecycleOwner,
DefaultLifecycleObserver {
@ -55,6 +58,9 @@ internal class LockUserWalletsTimer(
)
if (shouldOpenWelcomeScreenOnResume) {
if (hotWalletFeatureToggles.isHotWalletEnabled) {
clearAllHotWalletContextualUnlockUseCase.invoke()
}
store.dispatchNavigationAction { replaceAll(AppRoute.Welcome()) }
settingsRepository.setShouldOpenWelcomeScreenOnResume(value = false)
}
@ -120,6 +126,7 @@ internal class LockUserWalletsTimer(
start()
}
.onRight {
clearAllHotWalletContextualUnlockUseCase.invoke()
store.dispatchNavigationAction { replaceAll(AppRoute.Welcome()) }
}
}

View file

@ -50,6 +50,7 @@ import com.tangem.domain.staking.SendUnsubmittedHashesUseCase
import com.tangem.domain.tokens.GetPolkadotCheckHasImmortalUseCase
import com.tangem.domain.tokens.GetPolkadotCheckHasResetUseCase
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.domain.wallets.usecase.ClearAllHotWalletContextualUnlockUseCase
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.features.tangempay.TangemPayFeatureToggles
@ -186,6 +187,9 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
@Inject
internal lateinit var hotWalletFeatureToggles: HotWalletFeatureToggles
@Inject
internal lateinit var clearAllHotWalletContextualUnlockUseCase: ClearAllHotWalletContextualUnlockUseCase
@Inject
internal lateinit var tangemPayFeatureToggles: TangemPayFeatureToggles
@ -274,6 +278,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
coroutineScope = mainScope,
userWalletsListRepository = userWalletsListRepository,
hotWalletFeatureToggles = hotWalletFeatureToggles,
clearAllHotWalletContextualUnlockUseCase = clearAllHotWalletContextualUnlockUseCase,
)
initIntentHandlers()

View file

@ -384,6 +384,16 @@ internal object WalletsDomainModule {
)
}
@Provides
@Singleton
fun providesGetHotWalletContextualUnlockUseCase(
hotWalletAccessor: HotWalletAccessor,
): GetHotWalletContextualUnlockUseCase {
return GetHotWalletContextualUnlockUseCase(
hotWalletAccessor = hotWalletAccessor,
)
}
@Provides
@Singleton
fun providesClearHotWalletContextualUnlockUseCase(
@ -394,6 +404,16 @@ internal object WalletsDomainModule {
)
}
@Provides
@Singleton
fun providesClearAllHotWalletContextualUnlockUseCase(
hotWalletAccessor: HotWalletAccessor,
): ClearAllHotWalletContextualUnlockUseCase {
return ClearAllHotWalletContextualUnlockUseCase(
hotWalletAccessor = hotWalletAccessor,
)
}
@Provides
@Singleton
fun providesExportSeedPhraseUseCase(hotWalletAccessor: HotWalletAccessor): ExportSeedPhraseUseCase {