Updated on 2026-08-14
This commit is contained in:
commit
1f6cbc7ed0
537 changed files with 6377 additions and 12897 deletions
|
|
@ -77,7 +77,7 @@ internal object WalletPreviewData {
|
|||
showCustomBadge = false,
|
||||
),
|
||||
titleState = TokenItemState.TitleState.Content(text = "Polygon"),
|
||||
cryptoAmountState = TokenItemState.CryptoAmountState.Content(text = "3 172,14 $"),
|
||||
subtitle2State = TokenItemState.Subtitle2State.TextContent(text = "3 172,14 $"),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ internal object WalletScreenPreviewData {
|
|||
iconState = CurrencyIconState.Locked,
|
||||
titleState = TokenItemState.TitleState.Content(text = "Bitcoin"),
|
||||
fiatAmountState = TokenItemState.FiatAmountState.Content(text = "12 368,14 \$"),
|
||||
cryptoAmountState = TokenItemState.CryptoAmountState.Content(text = "0,35853044 BTC"),
|
||||
subtitle2State = TokenItemState.Subtitle2State.TextContent(text = "0,35853044 BTC"),
|
||||
subtitleState = TokenItemState.SubtitleState.CryptoPriceContent(
|
||||
price = "34 496,75 \$",
|
||||
priceChangePercent = "0,43 %",
|
||||
|
|
@ -30,7 +30,7 @@ internal object WalletScreenPreviewData {
|
|||
onItemLongClick = {},
|
||||
)
|
||||
|
||||
private val contentTokensState = WalletTokensListState.ContentState.Content(
|
||||
private val textContentTokensState = WalletTokensListState.ContentState.Content(
|
||||
items = persistentListOf(
|
||||
WalletTokensListState.TokensListItemState.NetworkGroupTitle(
|
||||
id = 1,
|
||||
|
|
@ -46,7 +46,7 @@ internal object WalletScreenPreviewData {
|
|||
id = "2",
|
||||
titleState = TokenItemState.TitleState.Content(text = "Ethereum"),
|
||||
fiatAmountState = TokenItemState.FiatAmountState.Content(text = "3 340,79 \$"),
|
||||
cryptoAmountState = TokenItemState.CryptoAmountState.Content(text = "1,856660295 ETH"),
|
||||
subtitle2State = TokenItemState.Subtitle2State.TextContent(text = "1,856660295 ETH"),
|
||||
subtitleState = TokenItemState.SubtitleState.CryptoPriceContent(
|
||||
price = "1 799,41 \$",
|
||||
priceChangePercent = "5,16 %",
|
||||
|
|
@ -68,7 +68,7 @@ internal object WalletScreenPreviewData {
|
|||
id = "4",
|
||||
titleState = TokenItemState.TitleState.Content(text = "Shiba Inu"),
|
||||
fiatAmountState = TokenItemState.FiatAmountState.Content(text = "48,64 \$"),
|
||||
cryptoAmountState = TokenItemState.CryptoAmountState.Content(text = "6 200 220,00 SHIB"),
|
||||
subtitle2State = TokenItemState.Subtitle2State.TextContent(text = "6 200 220,00 SHIB"),
|
||||
subtitleState = TokenItemState.SubtitleState.CryptoPriceContent(
|
||||
price = "0.01 \$",
|
||||
priceChangePercent = "1,34 %",
|
||||
|
|
@ -122,8 +122,7 @@ internal object WalletScreenPreviewData {
|
|||
WalletNotification.Warning.SomeNetworksUnreachable,
|
||||
),
|
||||
bottomSheetConfig = null,
|
||||
tokensListState = contentTokensState,
|
||||
manageTokensButtonConfig = ManageTokensButtonConfig(onClick = {}),
|
||||
tokensListState = textContentTokensState,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ internal class CryptoCurrencyToDraggableItemConverter(
|
|||
id = getTokenItemId(currency.id),
|
||||
iconState = iconStateConverter.convert(currencyStatus),
|
||||
titleState = TokenItemState.TitleState.Content(text = currency.name),
|
||||
cryptoAmountState = if (currencyStatus.value.isError) {
|
||||
TokenItemState.CryptoAmountState.Unreachable
|
||||
subtitle2State = if (currencyStatus.value.isError) {
|
||||
TokenItemState.Subtitle2State.Unreachable
|
||||
} else {
|
||||
TokenItemState.CryptoAmountState.Content(text = getFormattedFiatAmount(currencyStatus, appCurrency))
|
||||
TokenItemState.Subtitle2State.TextContent(text = getFormattedFiatAmount(currencyStatus, appCurrency))
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.model
|
||||
|
||||
internal data class ManageTokensButtonConfig(val onClick: () -> Unit)
|
||||
|
|
@ -20,7 +20,6 @@ internal sealed interface WalletState : WalletStateHolder {
|
|||
sealed class MultiCurrency : WalletState {
|
||||
|
||||
abstract val tokensListState: WalletTokensListState
|
||||
abstract val manageTokensButtonConfig: ManageTokensButtonConfig?
|
||||
|
||||
data class Content(
|
||||
override val pullToRefreshConfig: PullToRefreshConfig,
|
||||
|
|
@ -28,7 +27,6 @@ internal sealed interface WalletState : WalletStateHolder {
|
|||
override val warnings: ImmutableList<WalletNotification>,
|
||||
override val bottomSheetConfig: TangemBottomSheetConfig?,
|
||||
override val tokensListState: WalletTokensListState,
|
||||
override val manageTokensButtonConfig: ManageTokensButtonConfig?,
|
||||
) : MultiCurrency()
|
||||
|
||||
data class Locked(
|
||||
|
|
@ -43,7 +41,6 @@ internal sealed interface WalletState : WalletStateHolder {
|
|||
) {
|
||||
|
||||
override val tokensListState = WalletTokensListState.ContentState.Locked
|
||||
override val manageTokensButtonConfig = null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.transformers
|
||||
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.common.util.cardTypesResolver
|
||||
import com.tangem.domain.tokens.model.TokenList
|
||||
import com.tangem.domain.wallets.models.UserWallet
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.ManageTokensButtonConfig
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTokensListState
|
||||
|
|
@ -26,7 +24,6 @@ internal class SetTokenListTransformer(
|
|||
prevState.copy(
|
||||
walletCardState = prevState.walletCardState.toLoadedState(),
|
||||
tokensListState = prevState.tokensListState.toLoadedState(),
|
||||
manageTokensButtonConfig = createManageTokensButtonConfig(),
|
||||
)
|
||||
}
|
||||
is WalletState.MultiCurrency.Locked -> {
|
||||
|
|
@ -58,12 +55,4 @@ internal class SetTokenListTransformer(
|
|||
clickIntents = clickIntents,
|
||||
).convert(value = this)
|
||||
}
|
||||
|
||||
private fun createManageTokensButtonConfig(): ManageTokensButtonConfig? {
|
||||
return if (userWallet.scanResponse.cardTypesResolver.isSingleWalletWithToken()) {
|
||||
null
|
||||
} else {
|
||||
ManageTokensButtonConfig(clickIntents::onManageTokensClick)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,6 @@ internal class WalletLoadingStateFactory(
|
|||
warnings = persistentListOf(),
|
||||
bottomSheetConfig = null,
|
||||
tokensListState = WalletTokensListState.ContentState.Loading,
|
||||
manageTokensButtonConfig = ManageTokensButtonConfig(clickIntents::onManageTokensClick),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import com.tangem.core.ui.components.BottomFade
|
||||
import com.tangem.core.ui.components.PrimaryButton
|
||||
import com.tangem.core.ui.components.atoms.Hand
|
||||
import com.tangem.core.ui.components.atoms.handComposableComponentHeight
|
||||
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
|
||||
|
|
@ -294,25 +293,6 @@ private fun BaseScaffold(
|
|||
modifier = Modifier.padding(bottom = TangemTheme.dimens.spacing16),
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
val manageTokensButtonConfig by rememberUpdatedState(
|
||||
newValue = (state.wallets[state.selectedWalletIndex] as? WalletState.MultiCurrency)
|
||||
?.manageTokensButtonConfig,
|
||||
)
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = manageTokensButtonConfig != null,
|
||||
enter = fadeIn(),
|
||||
exit = fadeOut(),
|
||||
) {
|
||||
val config = manageTokensButtonConfig ?: return@AnimatedVisibility
|
||||
|
||||
ManageTokensButton(
|
||||
modifier = Modifier.navigationBarsPadding(),
|
||||
onClick = config.onClick,
|
||||
)
|
||||
}
|
||||
},
|
||||
floatingActionButtonPosition = FabPosition.Center,
|
||||
containerColor = TangemTheme.colors.background.secondary,
|
||||
content = {
|
||||
|
|
@ -759,17 +739,6 @@ private fun WalletSnackbarHost(
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ManageTokensButton(onClick: () -> Unit, modifier: Modifier = Modifier) {
|
||||
PrimaryButton(
|
||||
text = stringResource(id = R.string.main_manage_tokens),
|
||||
onClick = onClick,
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
)
|
||||
}
|
||||
|
||||
internal fun LazyListScope.organizeTokens(state: WalletState, itemModifier: Modifier) {
|
||||
(state as? WalletState.MultiCurrency)?.let {
|
||||
(state.tokensListState as? WalletTokensListState.ContentState)?.let {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSend
|
|||
import com.tangem.feature.wallet.presentation.wallet.utils.ScreenLifecycleProvider
|
||||
import com.tangem.feature.wallet.presentation.wallet.viewmodels.intents.WalletClickIntents
|
||||
import com.tangem.features.markets.MarketsFeatureToggles
|
||||
import com.tangem.features.pushnotifications.api.featuretoggles.PushNotificationsFeatureToggles
|
||||
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
|
||||
import com.tangem.features.pushnotifications.api.utils.getPushPermissionOrNull
|
||||
import com.tangem.utils.Provider
|
||||
|
|
@ -68,7 +67,6 @@ internal class WalletViewModel @Inject constructor(
|
|||
private val walletNameMigrationUseCase: WalletNameMigrationUseCase,
|
||||
private val refreshMultiCurrencyWalletQuotesUseCase: RefreshMultiCurrencyWalletQuotesUseCase,
|
||||
private val shouldAskPermissionUseCase: ShouldAskPermissionUseCase,
|
||||
private val pushNotificationsFeatureToggles: PushNotificationsFeatureToggles,
|
||||
private val marketsFeatureToggles: MarketsFeatureToggles,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
analyticsEventsHandler: AnalyticsEventHandler,
|
||||
|
|
@ -168,10 +166,9 @@ internal class WalletViewModel @Inject constructor(
|
|||
|
||||
private fun subscribeOnPushNotificationsPermission() {
|
||||
viewModelScope.launch {
|
||||
val isPushToggled = pushNotificationsFeatureToggles.isPushNotificationsEnabled
|
||||
val shouldRequestPush = shouldAskPermissionUseCase(PUSH_PERMISSION)
|
||||
val isPushPermissionAvailable = getPushPermissionOrNull() != null
|
||||
if (!isPushToggled || !shouldRequestPush || !isPushPermissionAvailable) return@launch
|
||||
if (!shouldRequestPush || !isPushPermissionAvailable) return@launch
|
||||
|
||||
delay(timeMillis = 1_800)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import com.tangem.core.analytics.models.AnalyticsParam
|
|||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.domain.card.DerivePublicKeysUseCase
|
||||
import com.tangem.domain.card.SetCardWasScannedUseCase
|
||||
import com.tangem.domain.feedback.GetCardInfoUseCase
|
||||
import com.tangem.domain.feedback.SendFeedbackEmailUseCase
|
||||
import com.tangem.domain.feedback.models.FeedbackEmailType
|
||||
import com.tangem.domain.redux.LegacyAction
|
||||
import com.tangem.domain.redux.ReduxStateHolder
|
||||
import com.tangem.domain.settings.*
|
||||
|
|
@ -84,6 +87,8 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
|
|||
private val shouldShowSwapPromoWalletUseCase: ShouldShowSwapPromoWalletUseCase,
|
||||
private val shouldShowRingPromoUseCase: ShouldShowRingPromoUseCase,
|
||||
private val shouldShowTravalaPromoWalletUseCase: ShouldShowTravalaPromoWalletUseCase,
|
||||
private val getCardInfoUseCase: GetCardInfoUseCase,
|
||||
private val sendFeedbackEmailUseCase: SendFeedbackEmailUseCase,
|
||||
) : BaseWalletClickIntents(), WalletWarningsClickIntents {
|
||||
|
||||
override fun onAddBackupCardClick() {
|
||||
|
|
@ -209,12 +214,10 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
|
|||
viewModelScope.launch(dispatchers.main) {
|
||||
neverToSuggestRateAppUseCase()
|
||||
|
||||
reduxStateHolder.dispatch(
|
||||
LegacyAction.SendEmailRateCanBeBetter(
|
||||
scanResponse = getSelectedUserWallet()?.scanResponse
|
||||
?: error("ScanResponse must be not null"),
|
||||
),
|
||||
)
|
||||
val scanResponse = getSelectedUserWallet()?.scanResponse ?: return@launch
|
||||
val cardInfo = getCardInfoUseCase(scanResponse).getOrNull() ?: return@launch
|
||||
|
||||
sendFeedbackEmailUseCase(type = FeedbackEmailType.RateCanBeBetter(cardInfo = cardInfo))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,12 +285,12 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onSupportClick() {
|
||||
reduxStateHolder.dispatch(
|
||||
LegacyAction.SendEmailSupport(
|
||||
scanResponse = getSelectedUserWallet()?.scanResponse
|
||||
?: error("ScanResponse must be not null"),
|
||||
),
|
||||
)
|
||||
val scanResponse = getSelectedUserWallet()?.scanResponse ?: return
|
||||
val cardInfo = getCardInfoUseCase(scanResponse).getOrNull() ?: return
|
||||
|
||||
viewModelScope.launch {
|
||||
sendFeedbackEmailUseCase(type = FeedbackEmailType.DirectUserRequest(cardInfo = cardInfo))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSelectedUserWallet(): UserWallet? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue