diff --git a/app/src/main/java/com/tangem/tap/TapApplication.kt b/app/src/main/java/com/tangem/tap/TapApplication.kt index ad62fdfbba..c67f289238 100644 --- a/app/src/main/java/com/tangem/tap/TapApplication.kt +++ b/app/src/main/java/com/tangem/tap/TapApplication.kt @@ -37,6 +37,8 @@ import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.domain.wallets.legacy.WalletManagersRepository import com.tangem.domain.wallets.repository.WalletsRepository +import com.tangem.features.managetokens.featuretoggles.ManageTokensFeatureToggles +import com.tangem.features.send.api.featuretoggles.SendFeatureToggles import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles import com.tangem.tap.common.analytics.AnalyticsFactory import com.tangem.tap.common.analytics.api.AnalyticsHandlerBuilder diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt index e392f08809..af472b3608 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt @@ -207,7 +207,7 @@ internal class BiometricUserWalletsListManager( } } - private suspend fun unlockWithBiometryInternal(selectedWalletId: UserWalletId? = null): CompletionResult { + private suspend fun unlockWithBiometryInternal(): CompletionResult { return keysRepository.getAll() .map { keys -> state.update { prevState -> @@ -216,7 +216,7 @@ internal class BiometricUserWalletsListManager( ) } } - .flatMap { loadModels(selectedWalletId = selectedWalletId) } + .flatMap { loadModels() } .map { state.update { prevState -> val hasLockedUserWallets = prevState.userWallets.any { it.isLocked } @@ -225,24 +225,6 @@ internal class BiometricUserWalletsListManager( } } - private fun CompletionResult.mapUnlockResult(): CompletionResult { - return this - .mapFailure { error -> - if (error is UserWalletsListError) { - error - } else { - UserWalletsListError.UnableToUnlockUserWallets(cause = error) - } - } - .map { - selectedUserWalletSync.guard { - throw UserWalletsListError.UnableToUnlockUserWallets( - cause = IllegalStateException("No user wallet selected"), - ) - } - } - } - private suspend fun saveEncryptionKeyIfNotNull(userWallet: UserWallet): CompletionResult { val encryptionKey = userWallet.scanResponse.card.encryptionKey ?.let { UserWalletEncryptionKey(userWallet.walletId, it) } @@ -264,7 +246,7 @@ internal class BiometricUserWalletsListManager( } } - private suspend fun loadModels(selectedWalletId: UserWalletId? = null): CompletionResult { + private suspend fun loadModels(): CompletionResult { return getSavedUserWallets() .map { userWallets -> if (userWallets.isNotEmpty()) { @@ -274,7 +256,7 @@ internal class BiometricUserWalletsListManager( prevState.copy( userWallets = wallets, selectedUserWalletId = findOrSetSelectedUserWalletId( - prevSelectedWalletId = selectedWalletId ?: prevState.selectedUserWalletId, + prevSelectedWalletId = prevState.selectedUserWalletId, userWallets = wallets, ), ) diff --git a/app/src/main/java/com/tangem/tap/features/send/ui/SendViewModel.kt b/app/src/main/java/com/tangem/tap/features/send/ui/SendViewModel.kt index 9a6dde559f..fe7c000ae6 100644 --- a/app/src/main/java/com/tangem/tap/features/send/ui/SendViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/send/ui/SendViewModel.kt @@ -9,7 +9,7 @@ import com.tangem.domain.tokens.model.CryptoCurrency import com.tangem.domain.tokens.model.Network import com.tangem.domain.wallets.models.UserWallet import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase -import com.tangem.features.send.navigation.SendRouter +import com.tangem.features.send.api.navigation.SendRouter import com.tangem.tap.di.DelayedWork import com.tangem.tap.features.send.redux.AmountAction import com.tangem.tap.proxy.AppStateHolder diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/Buttons.kt b/core/ui/src/main/java/com/tangem/core/ui/components/Buttons.kt index 85a731b14f..a9eddb52f7 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/Buttons.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/Buttons.kt @@ -173,7 +173,6 @@ fun SecondaryButton( text: String, onClick: () -> Unit, modifier: Modifier = Modifier, - size: TangemButtonSize = TangemButtonSize.Default, showProgress: Boolean = false, enabled: Boolean = true, size: TangemButtonSize = TangemButtonSize.Default, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt index d25157dbea..3e863a35f6 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/Transaction.kt @@ -362,15 +362,6 @@ private class TransactionItemStateProvider : CollectionPreviewParameterProvider< subtitle = TextReference.Str("33BddS...ga2B"), onClick = {}, ), - TransactionState.Approve( - txHash = UUID.randomUUID().toString(), - address = TextReference.Str("33BddS...ga2B"), - amount = "+0.500913 BTC", - timestamp = "8:41", - status = Status.Confirmed, - direction = Direction.OUTGOING, - onClick = {}, - ), TransactionState.Content( txHash = UUID.randomUUID().toString(), amount = "+0.500913 BTC", diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt index 66c1f70869..7211f73a66 100644 --- a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListManager.kt @@ -113,13 +113,6 @@ interface UserWalletsListManager { */ suspend fun unlock(throwIfNotAllWalletsUnlocked: Boolean = false): CompletionResult - /** - * Unlock all [UserWallet]s and select passed [UserWalletId] - * - * @param selectedWalletId [UserWalletId] of [UserWallet] which must be selected - */ - suspend fun unlockAndSelect(selectedWalletId: UserWalletId): CompletionResult - /** Remove [UserWallet]s from [userWallets] and set [isLocked] as true */ fun lock() } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/send/viewmodel/SendViewModel.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/send/viewmodel/SendViewModel.kt index 5bc0189731..46377b3fe4 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/send/viewmodel/SendViewModel.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/send/viewmodel/SendViewModel.kt @@ -81,6 +81,7 @@ internal class SendViewModel @Inject constructor( userWalletId = userWalletId, currencyId = cryptoCurrency.id, derivationPath = cryptoCurrency.network.derivationPath, + contractAddress = (cryptoCurrency as? CryptoCurrency.Token)?.contractAddress, isSingleWalletWithTokens = isSingleWallet, ) .flowWithLifecycle(owner.lifecycle) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt index dbbc78cffa..989aa84d9b 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/components/TokenDetailsNotification.kt @@ -24,7 +24,7 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) { iconResId = iconResId, buttonsState = buttonsState, ), - ) { + ) sealed class Informational( title: TextReference, @@ -108,35 +108,5 @@ internal sealed class TokenDetailsNotification(val config: NotificationConfig) { id = R.string.warning_send_blocked_pending_transactions_message, formatArgs = wrappedList(coinSymbol), ), - ) { - data class RentInfo( - private val rentInfo: CryptoCurrencyWarning.Rent, - private val onCloseClick: () -> Unit, - ) : Informational( - title = TextReference.Res(R.string.warning_rent_fee_title), - subtitle = TextReference.Res( - id = R.string.warning_solana_rent_fee_message, - formatArgs = wrappedList(rentInfo.rent, rentInfo.exemptionAmount), - ), - onCloseClick = onCloseClick, - ) - - data class ExistentialDeposit( - private val existentialInfo: CryptoCurrencyWarning.ExistentialDeposit, - ) : Informational( - title = resourceReference(R.string.warning_existential_deposit_title), - subtitle = TextReference.Res( - id = R.string.warning_existential_deposit_message, - formatArgs = wrappedList(existentialInfo.currencyName, existentialInfo.edStringValueWithSymbol), - ), - ) - - class NetworksNoAccount(val network: String, val symbol: String, val amount: String) : Informational( - title = resourceReference(R.string.warning_no_account_title), - subtitle = resourceReference( - R.string.no_account_generic, - wrappedList(network, amount, symbol), - ), - ) - } + ) } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt index e297f5717d..0710f995f6 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt @@ -41,7 +41,7 @@ internal class TokenDetailsLoadedBalanceConverter( return state.copy( tokenBalanceBlockState = TokenDetailsBalanceBlockState.Error(state.tokenBalanceBlockState.actionButtons), marketPriceBlockState = MarketPriceBlockState.Error(state.marketPriceBlockState.currencySymbol), - notifications = persistentListOf(TokenDetailsNotification.Warning.NetworksUnreachable), + notifications = persistentListOf(TokenDetailsNotification.NetworksUnreachable), ) } diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt index 0e6762124c..d9362571ca 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsNotificationConverter.kt @@ -19,20 +19,20 @@ internal class TokenDetailsNotificationConverter( fun removeRentInfo(currentState: TokenDetailsState): ImmutableList { val newNotifications = currentState.notifications.toMutableList() - newNotifications.removeBy { it is TokenDetailsNotification.Informational.RentInfo } + newNotifications.removeBy { it is TokenDetailsNotification.RentInfo } return newNotifications.toImmutableList() } private fun mapToNotification(warning: CryptoCurrencyWarning): TokenDetailsNotification { return when (warning) { - is CryptoCurrencyWarning.BalanceNotEnoughForFee -> TokenDetailsNotification.Warning.NetworkFee( + is CryptoCurrencyWarning.BalanceNotEnoughForFee -> TokenDetailsNotification.NetworkFee( feeInfo = warning, onBuyClick = { clickIntents.onBuyCoinClick(warning.coinCurrency) }, ) - is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.Informational.ExistentialDeposit( + is CryptoCurrencyWarning.ExistentialDeposit -> TokenDetailsNotification.ExistentialDeposit( existentialInfo = warning, ) - is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.Informational.RentInfo( + is CryptoCurrencyWarning.Rent -> TokenDetailsNotification.RentInfo( rentInfo = warning, onCloseClick = clickIntents::onCloseRentInfoNotification, ) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletNotificationsListFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletNotificationsListFactory.kt index 2e404526c6..6540090c11 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletNotificationsListFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletNotificationsListFactory.kt @@ -159,18 +159,6 @@ internal class WalletNotificationsListFactory( addMissingAddressesNotification(maybeMissedAddressCurrencies) } - private fun MutableList.addInformationalNotifications( - cardTypesResolver: CardTypesResolver, - maybeMissedAddressCurrencies: Either>, - ) { - addIf( - element = WalletNotification.Informational.DemoCard, - condition = isDemoCardUseCase(cardId = cardTypesResolver.getCardId()), - ) - - addMissingAddressesNotification(maybeMissedAddressCurrencies) - } - private fun MutableList.addIf(element: WalletNotification, condition: Boolean) { if (condition) { add(element = element) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt index f1f03ce06a..baf99e30bf 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt @@ -115,7 +115,6 @@ internal class WalletViewModel @Inject constructor( private val shouldShowSaveWalletScreenUseCase: ShouldShowSaveWalletScreenUseCase, private val canUseBiometryUseCase: CanUseBiometryUseCase, private val shouldSaveUserWalletsUseCase: ShouldSaveUserWalletsUseCase, - private val isBalanceHiddenUseCase: IsBalanceHiddenUseCase, private val getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase, private val listenToFlipsUseCase: ListenToFlipsUseCase, private val removeCurrencyUseCase: RemoveCurrencyUseCase,