diff --git a/core/ui/src/main/res/drawable/ic_passcode_lock_32.xml b/core/ui/src/main/res/drawable/ic_passcode_lock_32.xml
new file mode 100644
index 0000000000..b610863fbc
--- /dev/null
+++ b/core/ui/src/main/res/drawable/ic_passcode_lock_32.xml
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/core/ui/src/main/res/drawable/ic_passcode_lock_56.xml b/core/ui/src/main/res/drawable/ic_passcode_lock_56.xml
new file mode 100644
index 0000000000..ecf6f9754c
--- /dev/null
+++ b/core/ui/src/main/res/drawable/ic_passcode_lock_56.xml
@@ -0,0 +1,20 @@
+
+
+
+
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/entity/AddExistingWalletImportUM.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/entity/AddExistingWalletImportUM.kt
index 667d538a14..efd6c04702 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/entity/AddExistingWalletImportUM.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/entity/AddExistingWalletImportUM.kt
@@ -1,7 +1,6 @@
package com.tangem.features.hotwallet.addexistingwallet.im.port.entity
import androidx.compose.ui.text.input.TextFieldValue
-import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
@@ -18,6 +17,5 @@ internal data class AddExistingWalletImportUM(
val importWalletClick: () -> Unit,
val suggestionsList: ImmutableList,
val onSuggestionClick: (String) -> Unit,
- val infoBottomSheetConfig: TangemBottomSheetConfig,
val readyToImport: Boolean,
)
\ No newline at end of file
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt
index f11d60b7bc..29196737e8 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/AddExistingWalletImportModel.kt
@@ -1,8 +1,18 @@
package com.tangem.features.hotwallet.addexistingwallet.im.port.model
+import com.tangem.core.decompose.di.GlobalUiMessageSender
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
import com.tangem.core.decompose.model.ParamsContainer
+import com.tangem.core.decompose.ui.UiMessageSender
+import com.tangem.core.ui.R
+import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
+import com.tangem.core.ui.components.bottomsheets.message.icon
+import com.tangem.core.ui.components.bottomsheets.message.infoBlock
+import com.tangem.core.ui.components.bottomsheets.message.onClick
+import com.tangem.core.ui.components.bottomsheets.message.secondaryButton
+import com.tangem.core.ui.extensions.resourceReference
+import com.tangem.core.ui.message.bottomSheetMessage
import com.tangem.crypto.bip39.Mnemonic
import com.tangem.domain.wallets.builder.HotUserWalletBuilder
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
@@ -19,6 +29,7 @@ import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject
+@Suppress("LongParameterList")
@ModelScoped
internal class AddExistingWalletImportModel @Inject constructor(
paramsContainer: ParamsContainer,
@@ -27,12 +38,29 @@ internal class AddExistingWalletImportModel @Inject constructor(
private val tangemHotSdk: TangemHotSdk,
private val hotUserWalletBuilderFactory: HotUserWalletBuilder.Factory,
private val saveUserWalletUseCase: SaveWalletUseCase,
+ @GlobalUiMessageSender private val uiMessageSender: UiMessageSender,
) : Model() {
private val params: AddExistingWalletImportComponent.Params = paramsContainer.require()
private val importSeedPhraseUiStateBuilder: ImportSeedPhraseUiStateBuilder
+ private val passphraseInfoAlertBS
+ get() = bottomSheetMessage {
+ infoBlock {
+ icon(R.drawable.ic_passcode_lock_56) {
+ type = MessageBottomSheetUMV2.Icon.Type.Accent
+ backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
+ }
+ title = resourceReference(R.string.common_passphrase)
+ body = resourceReference(R.string.onboarding_bottom_sheet_passphrase_description)
+ }
+ secondaryButton {
+ text = resourceReference(R.string.common_got_it)
+ onClick { closeBs() }
+ }
+ }
+
init {
importSeedPhraseUiStateBuilder = ImportSeedPhraseUiStateBuilder(
modelScope = modelScope,
@@ -45,6 +73,7 @@ internal class AddExistingWalletImportModel @Inject constructor(
passphrase = passphrase,
)
},
+ onPassphraseInfoClick = ::onPassphraseInfoClick,
)
}
@@ -73,4 +102,8 @@ internal class AddExistingWalletImportModel @Inject constructor(
}
}
}
+
+ private fun onPassphraseInfoClick() {
+ uiMessageSender.send(passphraseInfoAlertBS)
+ }
}
\ No newline at end of file
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/ImportSeedPhraseUiStateBuilder.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/ImportSeedPhraseUiStateBuilder.kt
index b09bdd3265..7f89025442 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/ImportSeedPhraseUiStateBuilder.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/model/ImportSeedPhraseUiStateBuilder.kt
@@ -4,7 +4,6 @@ import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue
import com.tangem.common.core.TangemSdkError
import com.tangem.core.ui.R
-import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.crypto.bip39.Mnemonic
import com.tangem.crypto.bip39.MnemonicErrorResult
@@ -24,6 +23,7 @@ internal class ImportSeedPhraseUiStateBuilder(
private val readyToImport: (Boolean) -> Unit,
private val updateUiState: ((AddExistingWalletImportUM) -> AddExistingWalletImportUM) -> Unit,
private val importWallet: (mnemonic: Mnemonic, passphrase: String?) -> Unit,
+ private val onPassphraseInfoClick: () -> Unit,
) {
private val wordsCheckJobHolder = JobHolder()
private var importedMnemonic: Mnemonic? = null
@@ -49,11 +49,10 @@ internal class ImportSeedPhraseUiStateBuilder(
passphrase = it.text
updateUiState { state -> state.copy(passPhrase = it) }
},
- onPassphraseInfoClick = ::showInfoBS,
+ onPassphraseInfoClick = onPassphraseInfoClick,
importWalletClick = ::onCreateWallet,
onSuggestionClick = { word -> addSuggestedWord(word) },
readyToImport = false,
- infoBottomSheetConfig = TangemBottomSheetConfig.Empty,
)
}
@@ -168,19 +167,6 @@ internal class ImportSeedPhraseUiStateBuilder(
}
}
- private fun showInfoBS() {
- updateUiState { state ->
- state.copy(
- infoBottomSheetConfig = TangemBottomSheetConfig.Companion.Empty.copy(
- isShown = true,
- onDismissRequest = {
- updateUiState { it.copy(infoBottomSheetConfig = TangemBottomSheetConfig.Companion.Empty) }
- },
- ),
- )
- }
- }
-
companion object {
private const val MINIMUM_WORD_LENGTH = 2
private const val WORDS_INTERCEPT_DELAY_MS = 500L
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/AddExistingWalletImportContent.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/AddExistingWalletImportContent.kt
index 9d1d73601c..d7bb9338b0 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/AddExistingWalletImportContent.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/AddExistingWalletImportContent.kt
@@ -37,7 +37,6 @@ import com.tangem.core.ui.components.Notifier
import com.tangem.core.ui.components.OutlineTextFieldWithIcon
import com.tangem.core.ui.components.PrimaryButton
import com.tangem.core.ui.components.TangemTextFieldsDefault
-import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.keyboardAsState
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.features.hotwallet.addexistingwallet.im.port.ui.utils.InvalidWordsColorTransformation
@@ -113,8 +112,6 @@ internal fun AddExistingWalletImportContent(state: AddExistingWalletImportUM, mo
)
}
}
-
- PassphraseInfoBottomSheet(state.infoBottomSheetConfig)
}
@Composable
@@ -233,7 +230,6 @@ private fun PreviewAddExistingWalletImportContent() {
importWalletClick = {},
suggestionsList = persistentListOf(),
onSuggestionClick = {},
- infoBottomSheetConfig = TangemBottomSheetConfig.Empty,
readyToImport = false,
),
)
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/PassphraseInfoBottomSheet.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/PassphraseInfoBottomSheet.kt
deleted file mode 100644
index 76521aab7a..0000000000
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/im/port/ui/PassphraseInfoBottomSheet.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.tangem.features.hotwallet.addexistingwallet.im.port.ui
-
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.size
-import androidx.compose.material3.Icon
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.res.painterResource
-import androidx.compose.ui.text.style.TextAlign
-import androidx.compose.ui.tooling.preview.Preview
-import com.tangem.core.ui.R
-import com.tangem.core.ui.components.PrimaryButton
-import com.tangem.core.ui.components.bottomsheets.sheet.TangemBottomSheet
-import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
-import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
-import com.tangem.core.ui.extensions.stringResourceSafe
-import com.tangem.core.ui.res.TangemTheme
-import com.tangem.core.ui.res.TangemThemePreview
-
-@Composable
-fun PassphraseInfoBottomSheet(config: TangemBottomSheetConfig) {
- TangemBottomSheet(
- config = config,
- containerColor = TangemTheme.colors.background.primary,
- ) { _: TangemBottomSheetConfigContent.Empty ->
- PassphraseInfoBottomSheetContent(config.onDismissRequest)
- }
-}
-
-@Composable
-fun PassphraseInfoBottomSheetContent(onDismiss: () -> Unit) {
- Column(
- modifier = Modifier
- .background(color = TangemTheme.colors.background.primary)
- .fillMaxWidth(),
- ) {
- Icon(
- modifier = Modifier
- .align(Alignment.CenterHorizontally)
- .padding(top = TangemTheme.dimens.size40)
- .size(TangemTheme.dimens.size48),
- painter = painterResource(id = R.drawable.ic_information_24),
- tint = TangemTheme.colors.icon.accent,
- contentDescription = null,
- )
-
- Text(
- text = stringResourceSafe(id = R.string.common_passphrase),
- modifier = Modifier
- .padding(top = TangemTheme.dimens.size40)
- .align(Alignment.CenterHorizontally),
- color = TangemTheme.colors.text.primary1,
- style = TangemTheme.typography.h2,
- )
-
- Text(
- text = stringResourceSafe(id = R.string.onboarding_bottom_sheet_passphrase_description),
- modifier = Modifier
- .padding(top = TangemTheme.dimens.size16)
- .padding(horizontal = TangemTheme.dimens.size24)
- .align(Alignment.CenterHorizontally),
- color = TangemTheme.colors.text.secondary,
- style = TangemTheme.typography.body2,
- textAlign = TextAlign.Center,
- )
-
- PrimaryButton(
- modifier = Modifier
- .padding(horizontal = TangemTheme.dimens.size16)
- .padding(top = TangemTheme.dimens.size40)
- .padding(bottom = TangemTheme.dimens.size32)
- .fillMaxWidth(),
- text = stringResourceSafe(id = R.string.common_ok),
- onClick = onDismiss,
- )
- }
-}
-
-@Preview
-@Composable
-private fun PassphraseInfoBottomSheetContentPreview() {
- TangemThemePreview {
- PassphraseInfoBottomSheetContent({ })
- }
-}
\ No newline at end of file
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/entity/WalletBackupUM.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/entity/WalletBackupUM.kt
index 5df45d62a0..f3f17cd9d3 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/entity/WalletBackupUM.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/entity/WalletBackupUM.kt
@@ -8,6 +8,7 @@ internal data class WalletBackupUM(
val googleDriveStatus: LabelUM?,
val onRecoveryPhraseClick: () -> Unit,
val onGoogleDriveClick: () -> Unit,
+ val backedUp: Boolean,
)
internal sealed class BackupStatus {
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt
index 18e601c406..37c2dd7948 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/model/WalletBackupModel.kt
@@ -1,13 +1,21 @@
package com.tangem.features.hotwallet.walletbackup.model
+import com.tangem.core.decompose.di.GlobalUiMessageSender
import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.model.Model
import com.tangem.core.decompose.model.ParamsContainer
import com.tangem.core.decompose.navigation.Router
+import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.ui.R
+import com.tangem.core.ui.components.bottomsheets.message.MessageBottomSheetUMV2
+import com.tangem.core.ui.components.bottomsheets.message.icon
+import com.tangem.core.ui.components.bottomsheets.message.infoBlock
+import com.tangem.core.ui.components.bottomsheets.message.onClick
+import com.tangem.core.ui.components.bottomsheets.message.secondaryButton
import com.tangem.core.ui.components.label.entity.LabelStyle
import com.tangem.core.ui.components.label.entity.LabelUM
import com.tangem.core.ui.extensions.resourceReference
+import com.tangem.core.ui.message.bottomSheetMessage
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.features.hotwallet.WalletBackupComponent
@@ -22,6 +30,7 @@ internal class WalletBackupModel @Inject constructor(
getWalletUseCase: GetUserWalletUseCase,
private val router: Router,
override val dispatchers: CoroutineDispatcherProvider,
+ @GlobalUiMessageSender private val uiMessageSender: UiMessageSender,
) : Model() {
private val params: WalletBackupComponent.Params = paramsContainer.require()
@@ -38,11 +47,31 @@ internal class WalletBackupModel @Inject constructor(
text = resourceReference(R.string.common_coming_soon),
style = LabelStyle.REGULAR,
),
- onRecoveryPhraseClick = { },
+ onRecoveryPhraseClick = ::onRecoveryPhraseClick,
onGoogleDriveClick = { },
+ backedUp = false,
),
)
+ private val makeBackupAtFirstAlertBS
+ get() = bottomSheetMessage {
+ infoBlock {
+ icon(R.drawable.ic_passcode_lock_32) {
+ type = MessageBottomSheetUMV2.Icon.Type.Accent
+ backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
+ }
+ title = resourceReference(R.string.hw_backup_need_title)
+ body = resourceReference(R.string.hw_backup_need_description)
+ }
+ secondaryButton {
+ text = resourceReference(R.string.hw_backup_need_action)
+ onClick {
+ closeBs()
+ // TODO [REDACTED_TASK_KEY]
+ }
+ }
+ }
+
init {
getWalletUseCase.invokeFlow(params.userWalletId)
.map { it.getOrNull() }
@@ -80,5 +109,14 @@ internal class WalletBackupModel @Inject constructor(
text = resourceReference(R.string.common_coming_soon),
style = LabelStyle.REGULAR,
),
+ backedUp = userWallet.backedUp,
)
+
+ private fun onRecoveryPhraseClick() {
+ if (uiState.value.backedUp) {
+ // TODO [REDACTED_TASK_KEY]
+ } else {
+ uiMessageSender.send(makeBackupAtFirstAlertBS)
+ }
+ }
}
\ No newline at end of file
diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/ui/WalletBackupContent.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/ui/WalletBackupContent.kt
index 66e0c92d43..f5d25b7280 100644
--- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/ui/WalletBackupContent.kt
+++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletbackup/ui/WalletBackupContent.kt
@@ -96,6 +96,7 @@ private class WalletBackupUMProvider : CollectionPreviewParameterProvider