Updated on 2026-08-14
This commit is contained in:
parent
2746ee308a
commit
a139dbca40
22 changed files with 252 additions and 39 deletions
|
|
@ -162,6 +162,7 @@ dependencies {
|
|||
implementation(projects.domain.walletManager.models)
|
||||
implementation(projects.domain.yieldSupply)
|
||||
implementation(projects.domain.blockaid)
|
||||
implementation(projects.domain.hotWallet)
|
||||
|
||||
implementation(projects.common)
|
||||
implementation(projects.common.routing)
|
||||
|
|
@ -212,6 +213,7 @@ dependencies {
|
|||
implementation(projects.data.swap)
|
||||
implementation(projects.data.walletManager)
|
||||
implementation(projects.data.yieldSupply)
|
||||
implementation(projects.data.hotWallet)
|
||||
|
||||
/** Features */
|
||||
implementation(projects.features.referral.impl)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.tangem.tap.di.domain
|
||||
|
||||
import com.tangem.domain.hotwallet.GetAccessCodeSkippedUseCase
|
||||
import com.tangem.domain.hotwallet.SetAccessCodeSkippedUseCase
|
||||
import com.tangem.domain.hotwallet.repository.HotWalletRepository
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
internal object HotWalletDomainModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideGetAccessCodeSkippedUseCase(hotWalletRepository: HotWalletRepository): GetAccessCodeSkippedUseCase {
|
||||
return GetAccessCodeSkippedUseCase(hotWalletRepository)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideSetAccessCodeSkippedUseCase(hotWalletRepository: HotWalletRepository): SetAccessCodeSkippedUseCase {
|
||||
return SetAccessCodeSkippedUseCase(hotWalletRepository)
|
||||
}
|
||||
}
|
||||
|
|
@ -551,6 +551,7 @@ internal class ChildFactory @Inject constructor(
|
|||
context = context,
|
||||
params = WalletActivationComponent.Params(
|
||||
userWalletId = route.userWalletId,
|
||||
isBackupExists = route.isBackupExists,
|
||||
),
|
||||
componentFactory = walletActivationComponentFactory,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ sealed class AppRoute(val path: String) : Route {
|
|||
@Serializable
|
||||
data class WalletActivation(
|
||||
val userWalletId: UserWalletId,
|
||||
val isBackupExists: Boolean,
|
||||
) : AppRoute(path = "/wallet_activation/${userWalletId.stringValue}")
|
||||
|
||||
@Serializable
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ object PreferencesKeys {
|
|||
|
||||
val YIELD_SUPPLY_WARNINGS_STATES_KEY by lazy { stringPreferencesKey(name = "yieldSupplyWarningsStates") }
|
||||
|
||||
val ACCESS_CODE_SKIPPED_STATES_KEY by lazy { stringPreferencesKey(name = "accessCodeSkippedStates") }
|
||||
|
||||
// region Notifications
|
||||
val NOTIFICATIONS_APPLICATION_ID_KEY by lazy { stringPreferencesKey(name = "notificationsApplicationId") }
|
||||
|
||||
|
|
|
|||
1
data/hot-wallet/.gitignore
vendored
Normal file
1
data/hot-wallet/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
27
data/hot-wallet/build.gradle.kts
Normal file
27
data/hot-wallet/build.gradle.kts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
plugins {
|
||||
alias(deps.plugins.android.library)
|
||||
alias(deps.plugins.kotlin.android)
|
||||
alias(deps.plugins.kotlin.kapt)
|
||||
alias(deps.plugins.hilt.android)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tangem.data.hotwallet"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.datasource)
|
||||
implementation(projects.core.utils)
|
||||
|
||||
implementation(projects.domain.hotWallet)
|
||||
implementation(projects.domain.models)
|
||||
|
||||
implementation(deps.hilt.android)
|
||||
kapt(deps.hilt.kapt)
|
||||
|
||||
implementation(deps.androidx.datastore)
|
||||
implementation(deps.kotlin.coroutines)
|
||||
implementation(deps.moshi)
|
||||
implementation(deps.moshi.kotlin)
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.tangem.data.hotwallet
|
||||
|
||||
import com.tangem.datasource.local.preferences.AppPreferencesStore
|
||||
import com.tangem.datasource.local.preferences.PreferencesKeys
|
||||
import com.tangem.datasource.local.preferences.utils.getObjectMap
|
||||
import com.tangem.domain.hotwallet.repository.HotWalletRepository
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
internal class DefaultHotWalletRepository(
|
||||
private val appPreferencesStore: AppPreferencesStore,
|
||||
) : HotWalletRepository {
|
||||
|
||||
override fun accessCodeSkipped(userWalletId: UserWalletId): Flow<Boolean> = appPreferencesStore
|
||||
.getObjectMap<Boolean>(PreferencesKeys.ACCESS_CODE_SKIPPED_STATES_KEY)
|
||||
.map { it[userWalletId.stringValue] == true }
|
||||
|
||||
override suspend fun setAccessCodeSkipped(userWalletId: UserWalletId, skipped: Boolean) {
|
||||
appPreferencesStore.editData {
|
||||
it.setObjectMap(
|
||||
key = PreferencesKeys.ACCESS_CODE_SKIPPED_STATES_KEY,
|
||||
value = it.getObjectMap<Boolean>(PreferencesKeys.ACCESS_CODE_SKIPPED_STATES_KEY)
|
||||
.plus(userWalletId.stringValue to skipped),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.tangem.data.hotwallet.di
|
||||
|
||||
import com.tangem.data.hotwallet.DefaultHotWalletRepository
|
||||
import com.tangem.datasource.local.preferences.AppPreferencesStore
|
||||
import com.tangem.domain.hotwallet.repository.HotWalletRepository
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
internal object HotWalletDataModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideHotWalletRepository(appPreferencesStore: AppPreferencesStore): HotWalletRepository {
|
||||
return DefaultHotWalletRepository(
|
||||
appPreferencesStore = appPreferencesStore,
|
||||
)
|
||||
}
|
||||
}
|
||||
1
domain/hot-wallet/.gitignore
vendored
Normal file
1
domain/hot-wallet/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
17
domain/hot-wallet/build.gradle.kts
Normal file
17
domain/hot-wallet/build.gradle.kts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
plugins {
|
||||
alias(deps.plugins.android.library)
|
||||
alias(deps.plugins.kotlin.android)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tangem.domain.hotwallet"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.domain.core)
|
||||
implementation(projects.domain.models)
|
||||
implementation(projects.domain.wallets.models)
|
||||
|
||||
implementation(deps.kotlin.coroutines)
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.tangem.domain.hotwallet
|
||||
|
||||
import com.tangem.domain.hotwallet.repository.HotWalletRepository
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
|
||||
class GetAccessCodeSkippedUseCase(
|
||||
private val hotWalletRepository: HotWalletRepository,
|
||||
) {
|
||||
operator fun invoke(userWalletId: UserWalletId): Flow<Boolean> = hotWalletRepository
|
||||
.accessCodeSkipped(userWalletId)
|
||||
.distinctUntilChanged()
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.tangem.domain.hotwallet
|
||||
|
||||
import arrow.core.Either
|
||||
import com.tangem.domain.hotwallet.repository.HotWalletRepository
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
|
||||
class SetAccessCodeSkippedUseCase(
|
||||
private val hotWalletRepository: HotWalletRepository,
|
||||
) {
|
||||
suspend operator fun invoke(userWalletId: UserWalletId, skipped: Boolean): Either<Throwable, Unit> = Either.catch {
|
||||
hotWalletRepository.setAccessCodeSkipped(userWalletId, skipped)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.tangem.domain.hotwallet.repository
|
||||
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface HotWalletRepository {
|
||||
|
||||
fun accessCodeSkipped(userWalletId: UserWalletId): Flow<Boolean>
|
||||
|
||||
suspend fun setAccessCodeSkipped(userWalletId: UserWalletId, skipped: Boolean)
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ interface WalletActivationComponent : ComposableContentComponent {
|
|||
|
||||
data class Params(
|
||||
val userWalletId: UserWalletId,
|
||||
val isBackupExists: Boolean,
|
||||
)
|
||||
|
||||
interface Factory : ComponentFactory<Params, WalletActivationComponent>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ dependencies {
|
|||
implementation(projects.domain.settings)
|
||||
implementation(projects.domain.feedback)
|
||||
implementation(projects.domain.feedback.models)
|
||||
implementation(projects.domain.hotWallet)
|
||||
|
||||
/** Common */
|
||||
implementation(projects.common.ui)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.tangem.core.ui.message.DialogMessage
|
|||
import com.tangem.core.ui.message.EventMessageAction
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.settings.ShouldAskPermissionUseCase
|
||||
import com.tangem.domain.hotwallet.SetAccessCodeSkippedUseCase
|
||||
import com.tangem.features.hotwallet.addexistingwallet.entry.routing.AddExistingWalletRoute
|
||||
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
|
||||
import com.tangem.features.hotwallet.manualbackup.completed.ManualBackupCompletedComponent
|
||||
|
|
@ -34,6 +35,7 @@ internal class AddExistingWalletModel @Inject constructor(
|
|||
private val shouldAskPermissionUseCase: ShouldAskPermissionUseCase,
|
||||
@GlobalUiMessageSender private val uiMessageSender: UiMessageSender,
|
||||
private val trackingContextProxy: TrackingContextProxy,
|
||||
private val setAccessCodeSkippedUseCase: SetAccessCodeSkippedUseCase,
|
||||
) : Model() {
|
||||
|
||||
val hotWalletStepperComponentModelCallback = HotWalletStepperComponentModelCallback()
|
||||
|
|
@ -83,6 +85,12 @@ internal class AddExistingWalletModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun showSkipAccessCodeWarningDialog() {
|
||||
val userWalletId = when (val route = currentRoute.value) {
|
||||
is AddExistingWalletRoute.SetAccessCode -> route.userWalletId
|
||||
is AddExistingWalletRoute.ConfirmAccessCode -> route.userWalletId
|
||||
else -> null
|
||||
}
|
||||
|
||||
uiMessageSender.send(
|
||||
DialogMessage(
|
||||
message = resourceReference(R.string.access_code_alert_skip_description),
|
||||
|
|
@ -93,7 +101,14 @@ internal class AddExistingWalletModel @Inject constructor(
|
|||
),
|
||||
secondAction = EventMessageAction(
|
||||
title = resourceReference(R.string.access_code_alert_skip_ok),
|
||||
onClick = { navigateToPushNotificationsOrNext() },
|
||||
onClick = {
|
||||
if (userWalletId != null) {
|
||||
modelScope.launch {
|
||||
setAccessCodeSkippedUseCase(userWalletId, true)
|
||||
}
|
||||
}
|
||||
navigateToPushNotificationsOrNext()
|
||||
},
|
||||
),
|
||||
shouldDismissOnFirstAction = true,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.tangem.core.ui.message.DialogMessage
|
|||
import com.tangem.core.ui.message.EventMessageAction
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.settings.ShouldAskPermissionUseCase
|
||||
import com.tangem.domain.hotwallet.SetAccessCodeSkippedUseCase
|
||||
import com.tangem.features.hotwallet.manualbackup.check.ManualBackupCheckComponent
|
||||
import com.tangem.features.hotwallet.manualbackup.completed.ManualBackupCompletedComponent
|
||||
import com.tangem.features.hotwallet.manualbackup.phrase.ManualBackupPhraseComponent
|
||||
|
|
@ -33,6 +34,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
@ModelScoped
|
||||
internal class WalletActivationModel @Inject constructor(
|
||||
paramsContainer: ParamsContainer,
|
||||
|
|
@ -41,6 +43,7 @@ internal class WalletActivationModel @Inject constructor(
|
|||
private val shouldAskPermissionUseCase: ShouldAskPermissionUseCase,
|
||||
@GlobalUiMessageSender private val uiMessageSender: UiMessageSender,
|
||||
private val trackingContextProxy: TrackingContextProxy,
|
||||
private val setAccessCodeSkippedUseCase: SetAccessCodeSkippedUseCase,
|
||||
) : Model() {
|
||||
|
||||
val params = paramsContainer.require<WalletActivationComponent.Params>()
|
||||
|
|
@ -54,8 +57,13 @@ internal class WalletActivationModel @Inject constructor(
|
|||
val pushNotificationsCallbacks = PushNotificationsCallbacks()
|
||||
val mobileWalletSetupFinishedModelCallbacks = MobileWalletSetupFinishedModelCallbacks()
|
||||
|
||||
val isStartingWithAccessCode = params.isBackupExists
|
||||
val stackNavigation = StackNavigation<WalletActivationRoute>()
|
||||
val startRoute = WalletActivationRoute.ManualBackupStart
|
||||
val startRoute = if (isStartingWithAccessCode) {
|
||||
WalletActivationRoute.SetAccessCode
|
||||
} else {
|
||||
WalletActivationRoute.ManualBackupStart
|
||||
}
|
||||
val currentRoute: MutableStateFlow<WalletActivationRoute> = MutableStateFlow(startRoute)
|
||||
|
||||
init {
|
||||
|
|
@ -73,7 +81,9 @@ internal class WalletActivationModel @Inject constructor(
|
|||
is WalletActivationRoute.ManualBackupPhrase -> stackNavigation.pop()
|
||||
is WalletActivationRoute.ManualBackupCheck -> stackNavigation.pop()
|
||||
is WalletActivationRoute.ManualBackupCompleted -> Unit
|
||||
is WalletActivationRoute.SetAccessCode -> Unit
|
||||
is WalletActivationRoute.SetAccessCode -> if (isStartingWithAccessCode) {
|
||||
router.pop()
|
||||
}
|
||||
is WalletActivationRoute.ConfirmAccessCode -> stackNavigation.pop()
|
||||
is WalletActivationRoute.PushNotifications -> Unit
|
||||
is WalletActivationRoute.SetupFinished -> Unit
|
||||
|
|
@ -96,6 +106,8 @@ internal class WalletActivationModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun showSkipAccessCodeWarningDialog() {
|
||||
val userWalletId = params.userWalletId
|
||||
|
||||
uiMessageSender.send(
|
||||
DialogMessage(
|
||||
message = resourceReference(R.string.access_code_alert_skip_description),
|
||||
|
|
@ -106,7 +118,12 @@ internal class WalletActivationModel @Inject constructor(
|
|||
),
|
||||
secondAction = EventMessageAction(
|
||||
title = resourceReference(R.string.access_code_alert_skip_ok),
|
||||
onClick = { navigateToPushNotificationsOrNext() },
|
||||
onClick = {
|
||||
modelScope.launch {
|
||||
setAccessCodeSkippedUseCase(userWalletId, true)
|
||||
}
|
||||
navigateToPushNotificationsOrNext()
|
||||
},
|
||||
),
|
||||
shouldDismissOnFirstAction = true,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ dependencies {
|
|||
implementation(deps.jodatime)
|
||||
implementation(deps.kotlin.immutable.collections)
|
||||
implementation(deps.reKotlin)
|
||||
implementation(tangemDeps.hot.core)
|
||||
implementation(tangemDeps.card.core)
|
||||
implementation(tangemDeps.blockchain)
|
||||
implementation(deps.timber)
|
||||
|
|
@ -82,6 +83,7 @@ dependencies {
|
|||
implementation(projects.domain.networks)
|
||||
implementation(projects.domain.nft)
|
||||
implementation(projects.domain.nft.models)
|
||||
implementation(projects.domain.hotWallet)
|
||||
implementation(projects.domain.onramp)
|
||||
implementation(projects.domain.onramp.models)
|
||||
implementation(projects.domain.promo)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ internal interface WalletWarningsClickIntents {
|
|||
|
||||
fun onDenyPermissions()
|
||||
|
||||
fun onFinishWalletActivationClick(type: WalletActivationBannerType)
|
||||
fun onFinishWalletActivationClick(bannerType: WalletActivationBannerType, isBackupExists: Boolean)
|
||||
}
|
||||
|
||||
@Suppress("LargeClass", "LongParameterList", "TooManyFunctions")
|
||||
|
|
@ -147,32 +147,6 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
|
|||
private val uiMessageSender: UiMessageSender,
|
||||
) : BaseWalletClickIntents(), WalletWarningsClickIntents {
|
||||
|
||||
private val finalizeWalletSetupAlertBS
|
||||
get() = bottomSheetMessage {
|
||||
infoBlock {
|
||||
icon(R.drawable.img_knight_shield_32) {
|
||||
type = MessageBottomSheetUMV2.Icon.Type.Warning
|
||||
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
|
||||
}
|
||||
title = resourceReference(R.string.hw_activation_need_title)
|
||||
body = resourceReference(R.string.hw_activation_need_description)
|
||||
}
|
||||
secondaryButton {
|
||||
text = resourceReference(R.string.common_later)
|
||||
onClick {
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
primaryButton {
|
||||
text = resourceReference(R.string.hw_activation_need_backup)
|
||||
onClick {
|
||||
val userWallet = getSelectedUserWallet() ?: return@onClick
|
||||
appRouter.push(WalletActivation(userWallet.walletId))
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAddBackupCardClick() {
|
||||
analyticsEventHandler.send(MainScreen.NoticeBackupYourWalletTapped)
|
||||
|
||||
|
|
@ -501,14 +475,38 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onFinishWalletActivationClick(type: WalletActivationBannerType) {
|
||||
when (type) {
|
||||
override fun onFinishWalletActivationClick(bannerType: WalletActivationBannerType, isBackupExists: Boolean) {
|
||||
when (bannerType) {
|
||||
WalletActivationBannerType.Attention -> {
|
||||
val userWallet = getSelectedUserWallet() ?: return
|
||||
appRouter.push(WalletActivation(userWallet.walletId))
|
||||
appRouter.push(WalletActivation(userWallet.walletId, isBackupExists))
|
||||
}
|
||||
WalletActivationBannerType.Warning -> {
|
||||
messageSender.send(finalizeWalletSetupAlertBS)
|
||||
val message = bottomSheetMessage {
|
||||
infoBlock {
|
||||
icon(R.drawable.img_knight_shield_32) {
|
||||
type = MessageBottomSheetUMV2.Icon.Type.Warning
|
||||
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
|
||||
}
|
||||
title = resourceReference(R.string.hw_activation_need_title)
|
||||
body = resourceReference(R.string.hw_activation_need_description)
|
||||
}
|
||||
secondaryButton {
|
||||
text = resourceReference(R.string.common_later)
|
||||
onClick {
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
primaryButton {
|
||||
text = resourceReference(R.string.hw_activation_need_backup)
|
||||
onClick {
|
||||
val userWallet = getSelectedUserWallet() ?: return@onClick
|
||||
appRouter.push(WalletActivation(userWallet.walletId, isBackupExists))
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
}
|
||||
messageSender.send(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,13 @@ import com.tangem.domain.tokens.error.TokenListError
|
|||
import com.tangem.domain.wallets.models.SeedPhraseNotificationsStatus
|
||||
import com.tangem.domain.wallets.usecase.IsNeedToBackupUseCase
|
||||
import com.tangem.domain.wallets.usecase.SeedPhraseNotificationUseCase
|
||||
import com.tangem.domain.hotwallet.GetAccessCodeSkippedUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.WalletActivationBannerType
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
import com.tangem.feature.wallet.presentation.account.AccountDependencies
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
|
||||
import com.tangem.hot.sdk.model.HotWalletId
|
||||
import com.tangem.lib.crypto.BlockchainUtils.isBitcoin
|
||||
import com.tangem.utils.extensions.addIf
|
||||
import com.tangem.utils.extensions.isPositive
|
||||
|
|
@ -62,6 +64,7 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
private val getOnrampCountryUseCase: GetOnrampCountryUseCase,
|
||||
private val notificationsRepository: NotificationsRepository,
|
||||
private val accountDependencies: AccountDependencies,
|
||||
private val getAccessCodeSkippedUseCase: GetAccessCodeSkippedUseCase,
|
||||
) {
|
||||
|
||||
@Suppress("UNCHECKED_CAST", "MagicNumber")
|
||||
|
|
@ -98,6 +101,7 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
shouldShowPromoWalletUseCase(userWalletId = userWallet.walletId, promoId = PromoId.VisaPresale),
|
||||
shouldShowPromoWalletUseCase(userWalletId = userWallet.walletId, promoId = PromoId.Sepa),
|
||||
notificationsRepository.getShouldShowNotification(NotificationId.EnablePushesReminderNotification.key),
|
||||
getAccessCodeSkippedUseCase(userWallet.walletId),
|
||||
) { array -> array }
|
||||
.combine(tokenListFlow()) { array, any: Any -> arrayOf(any).plus(elements = array) }
|
||||
.map { array ->
|
||||
|
|
@ -110,13 +114,14 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
val shouldShowVisaPromo = array[4] as Boolean
|
||||
val shouldShowSepaBanner = array[5] as Boolean
|
||||
val shouldShowEnablePushesReminderNotification = array[6] as Boolean
|
||||
val accessCodeSkipped = array[7] as Boolean
|
||||
|
||||
buildList {
|
||||
addUsedOutdatedDataNotification(totalFiatBalance)
|
||||
|
||||
addCriticalNotifications(userWallet, seedPhraseIssueStatus, clickIntents)
|
||||
|
||||
addFinishWalletActivationNotification(userWallet, totalFiatBalance, clickIntents)
|
||||
addFinishWalletActivationNotification(userWallet, totalFiatBalance, clickIntents, accessCodeSkipped)
|
||||
|
||||
addVisaPresalePromoNotification(clickIntents, shouldShowVisaPromo)
|
||||
|
||||
|
|
@ -405,10 +410,14 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
userWallet: UserWallet,
|
||||
totalFiatBalance: Lce<TokenListError, TotalFiatBalance>,
|
||||
clickIntents: WalletClickIntents,
|
||||
accessCodeSkipped: Boolean,
|
||||
) {
|
||||
if (userWallet !is UserWallet.Hot) return
|
||||
|
||||
val shouldShowFinishActivation = !userWallet.backedUp
|
||||
val isBackupExists = userWallet.backedUp
|
||||
val isAccessCodeRequired = userWallet.hotWalletId.authType == HotWalletId.AuthType.NoPassword &&
|
||||
!accessCodeSkipped
|
||||
val shouldShowFinishActivation = !isBackupExists || isAccessCodeRequired
|
||||
|
||||
val type = totalFiatBalance.fold(
|
||||
ifLoading = { it.getFinishWalletActivationType() },
|
||||
|
|
@ -427,11 +436,11 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
|
|||
buttonsState = when (type) {
|
||||
WalletActivationBannerType.Warning -> ButtonsState.PrimaryButtonConfig(
|
||||
text = resourceReference(R.string.hw_activation_need_finish),
|
||||
onClick = { clickIntents.onFinishWalletActivationClick(type) },
|
||||
onClick = { clickIntents.onFinishWalletActivationClick(type, isBackupExists) },
|
||||
)
|
||||
else -> ButtonsState.SecondaryButtonConfig(
|
||||
text = resourceReference(R.string.hw_activation_need_finish),
|
||||
onClick = { clickIntents.onFinishWalletActivationClick(type) },
|
||||
onClick = { clickIntents.onFinishWalletActivationClick(type, isBackupExists) },
|
||||
)
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ include(":domain:promo")
|
|||
include(":domain:promo:models")
|
||||
include(":domain:nft")
|
||||
include(":domain:nft:models")
|
||||
include(":domain:hot-wallet")
|
||||
include(":domain:networks")
|
||||
include(":domain:quotes")
|
||||
include(":domain:blockaid")
|
||||
|
|
@ -389,6 +390,7 @@ include(":data:markets")
|
|||
include(":data:manage-tokens")
|
||||
include(":data:networks")
|
||||
include(":data:nft")
|
||||
include(":data:hot-wallet")
|
||||
include(":data:onramp")
|
||||
include(":data:quotes")
|
||||
include(":data:notifications")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue