Updated on 2026-08-14
This commit is contained in:
parent
202aa790c4
commit
2105360004
1 changed files with 1 additions and 58 deletions
|
|
@ -6,12 +6,7 @@ import com.tangem.core.decompose.di.ModelScoped
|
|||
import com.tangem.core.decompose.model.Model
|
||||
import com.tangem.core.decompose.navigation.Router
|
||||
import com.tangem.core.decompose.ui.UiMessageSender
|
||||
import com.tangem.core.navigation.url.UrlOpener
|
||||
import com.tangem.core.ui.components.bottomsheets.BottomSheetOption
|
||||
import com.tangem.core.ui.components.bottomsheets.OptionsBottomSheetContent
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.message.SnackbarMessage
|
||||
import com.tangem.domain.common.wallets.UserWalletsListRepository
|
||||
import com.tangem.domain.common.wallets.error.UnlockWalletError
|
||||
|
|
@ -20,7 +15,6 @@ import com.tangem.domain.models.wallet.UserWalletId
|
|||
import com.tangem.domain.models.wallet.isLocked
|
||||
import com.tangem.domain.settings.CanUseBiometryUseCase
|
||||
import com.tangem.domain.wallets.repository.WalletsRepository
|
||||
import com.tangem.domain.wallets.usecase.GenerateBuyTangemCardLinkUseCase
|
||||
import com.tangem.features.wallet.utils.UserWalletsFetcher
|
||||
import com.tangem.features.welcome.impl.R
|
||||
import com.tangem.features.welcome.impl.ui.state.WelcomeUM
|
||||
|
|
@ -44,8 +38,6 @@ internal class WelcomeModel @Inject constructor(
|
|||
private val userWalletsListRepository: UserWalletsListRepository,
|
||||
private val canUseBiometryUseCase: CanUseBiometryUseCase,
|
||||
private val walletsRepository: WalletsRepository,
|
||||
private val generateBuyTangemCardLinkUseCase: GenerateBuyTangemCardLinkUseCase,
|
||||
private val urlOpener: UrlOpener,
|
||||
userWalletsFetcherFactory: UserWalletsFetcher.Factory,
|
||||
) : Model() {
|
||||
|
||||
|
|
@ -146,50 +138,7 @@ internal class WelcomeModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun addWalletClick() {
|
||||
updateSelectState { currentState ->
|
||||
currentState.copy(
|
||||
addWalletBottomSheet = TangemBottomSheetConfig(
|
||||
isShown = true,
|
||||
content = OptionsBottomSheetContent(
|
||||
options = persistentListOf(
|
||||
BottomSheetOption(
|
||||
key = ADD_WALLET_KEY_CREATE,
|
||||
label = resourceReference(R.string.home_button_create_new_wallet),
|
||||
),
|
||||
BottomSheetOption(
|
||||
key = ADD_WALLET_KEY_ADD,
|
||||
label = resourceReference(R.string.home_button_add_existing_wallet),
|
||||
),
|
||||
BottomSheetOption(
|
||||
key = ADD_WALLET_KEY_BUY,
|
||||
label = resourceReference(R.string.details_buy_wallet),
|
||||
),
|
||||
),
|
||||
onOptionClick = { optionKey ->
|
||||
updateSelectState {
|
||||
it.copy(addWalletBottomSheet = it.addWalletBottomSheet.copy(isShown = false))
|
||||
}
|
||||
onAddWalletOptionClick(optionKey)
|
||||
},
|
||||
),
|
||||
onDismissRequest = {
|
||||
updateSelectState {
|
||||
it.copy(addWalletBottomSheet = it.addWalletBottomSheet.copy(isShown = false))
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onAddWalletOptionClick(optionKey: String) {
|
||||
when (optionKey) {
|
||||
ADD_WALLET_KEY_CREATE -> router.push(AppRoute.CreateWalletSelection)
|
||||
ADD_WALLET_KEY_ADD -> router.push(AppRoute.AddExistingWallet)
|
||||
ADD_WALLET_KEY_BUY -> modelScope.launch {
|
||||
generateBuyTangemCardLinkUseCase.invoke().let { urlOpener.openUrl(it) }
|
||||
}
|
||||
}
|
||||
router.push(AppRoute.CreateWalletSelection)
|
||||
}
|
||||
|
||||
private suspend fun onlyOneHotWalletWithAccessCode(): Boolean {
|
||||
|
|
@ -268,10 +217,4 @@ internal class WelcomeModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ADD_WALLET_KEY_CREATE = "create"
|
||||
private const val ADD_WALLET_KEY_ADD = "add"
|
||||
private const val ADD_WALLET_KEY_BUY = "buy"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue