Updated on 2026-08-14
This commit is contained in:
commit
8e42589a00
456 changed files with 6580 additions and 3738 deletions
|
|
@ -10,6 +10,4 @@ internal sealed class StakingEvent {
|
|||
data class ShowSnackBar(val text: TextReference) : StakingEvent()
|
||||
|
||||
data class ShowAlert(val alert: AlertUM) : StakingEvent()
|
||||
|
||||
data class ShowShareDialog(val txUrl: String) : StakingEvent()
|
||||
}
|
||||
|
|
@ -41,9 +41,4 @@ internal class StakingEventFactory(
|
|||
)
|
||||
stateController.updateEvent(alert)
|
||||
}
|
||||
|
||||
fun createShareDialog(txUrl: String) {
|
||||
val event = StakingEvent.ShowShareDialog(txUrl)
|
||||
stateController.updateEvent(event)
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ internal class ShowActionSelectorBottomSheetTransformer(
|
|||
override fun transform(prevState: StakingUiState): StakingUiState {
|
||||
return prevState.copy(
|
||||
bottomSheetConfig = TangemBottomSheetConfig(
|
||||
isShow = true,
|
||||
isShown = true,
|
||||
content = StakingActionSelectionBottomSheetConfig(
|
||||
title = resourceReference(R.string.common_choose_action),
|
||||
actions = pendingActions,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ internal class ShowInfoBottomSheetStateTransformer(
|
|||
return prevState.copy(
|
||||
bottomSheetConfig = TangemBottomSheetConfig(
|
||||
onDismissRequest = onDismiss,
|
||||
isShow = true,
|
||||
isShown = true,
|
||||
content = when (infoType) {
|
||||
InfoType.ANNUAL_PERCENTAGE_RATE -> StakingInfoBottomSheetConfig(
|
||||
title = resourceReference(R.string.staking_details_annual_percentage_rate),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ internal class SetApprovalBottomSheetInProgressTransformer(
|
|||
return prevState.copy(
|
||||
bottomSheetConfig = prevState.bottomSheetConfig?.copy(
|
||||
onDismissRequest = onDismiss,
|
||||
isShow = true,
|
||||
isShown = true,
|
||||
content = approvalBottomSheetConfig?.let { config ->
|
||||
config.copy(
|
||||
data = config.data.copy(
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ internal class ShowApprovalBottomSheetTransformer(
|
|||
)
|
||||
return prevState.copy(
|
||||
bottomSheetConfig = TangemBottomSheetConfig(
|
||||
isShow = true,
|
||||
isShown = true,
|
||||
onDismissRequest = onDismiss,
|
||||
content = GiveTxPermissionBottomSheetConfig(
|
||||
data = GiveTxPermissionState.ReadyForRequest(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.features.staking.impl.presentation.state.transformers.notifications
|
||||
|
||||
import com.tangem.blockchain.common.transaction.Fee
|
||||
import com.tangem.common.ui.amountScreen.models.AmountState
|
||||
import com.tangem.common.ui.notifications.NotificationUM
|
||||
import com.tangem.common.ui.notifications.NotificationsFactory.addDustWarningNotification
|
||||
|
|
@ -197,7 +198,7 @@ internal class AddStakingNotificationsTransformer(
|
|||
addExistentialWarningNotification(
|
||||
existentialDeposit = currencyCheck.existentialDeposit,
|
||||
feeAmount = feeState?.fee?.amount?.value.orZero(),
|
||||
receivedAmount = sendingAmount,
|
||||
sendingAmount = sendingAmount,
|
||||
cryptoCurrencyStatus = cryptoCurrencyStatus,
|
||||
onReduceClick = prevState.clickIntents::onAmountReduceByClick,
|
||||
)
|
||||
|
|
@ -212,7 +213,7 @@ internal class AddStakingNotificationsTransformer(
|
|||
// blockchain specific
|
||||
addValidateTransactionNotifications(
|
||||
dustValue = currencyCheck.dustValue.orZero(),
|
||||
fee = feeState?.fee,
|
||||
minAdaValue = (feeState?.fee as? Fee.CardanoToken)?.minAdaValue,
|
||||
validationError = validatorError,
|
||||
cryptoCurrency = cryptoCurrency,
|
||||
onReduceClick = prevState.clickIntents::onAmountReduceToClick,
|
||||
|
|
|
|||
|
|
@ -4,20 +4,18 @@ import androidx.compose.material3.SnackbarHostState
|
|||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.tangem.common.ui.alerts.models.AlertUM
|
||||
import com.tangem.core.ui.components.BasicDialog
|
||||
import com.tangem.core.ui.components.DialogButtonUM
|
||||
import com.tangem.core.ui.event.EventEffect
|
||||
import com.tangem.core.ui.event.StateEvent
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.extensions.shareText
|
||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.features.staking.impl.R
|
||||
import com.tangem.features.staking.impl.presentation.state.events.StakingEvent
|
||||
|
||||
@Composable
|
||||
internal fun StakingEventEffect(event: StateEvent<StakingEvent>, snackbarHostState: SnackbarHostState) {
|
||||
val context = LocalContext.current
|
||||
val resources = LocalContext.current.resources
|
||||
var alertConfig by remember { mutableStateOf<AlertUM?>(value = null) }
|
||||
|
||||
|
|
@ -40,9 +38,6 @@ internal fun StakingEventEffect(event: StateEvent<StakingEvent>, snackbarHostSta
|
|||
is StakingEvent.ShowAlert -> {
|
||||
alertConfig = value.alert
|
||||
}
|
||||
is StakingEvent.ShowShareDialog -> {
|
||||
context.shareText(value.txUrl)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
@ -64,7 +59,7 @@ internal fun StakingAlert(state: AlertUM, onDismiss: () -> Unit) {
|
|||
)
|
||||
|
||||
dismissButton = DialogButtonUM(
|
||||
title = stringResource(id = R.string.common_cancel),
|
||||
title = stringResourceSafe(id = R.string.common_cancel),
|
||||
onClick = onDismiss,
|
||||
)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import androidx.compose.ui.graphics.Brush
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.withStyle
|
||||
|
|
@ -144,7 +143,7 @@ private fun LazyListScope.activeStakingBlock(
|
|||
if (innerYieldBalanceState.balances.isNotEmpty()) {
|
||||
item(ACTIVE_STAKING_BLOCK_KEY) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.staking_your_stakes),
|
||||
text = stringResourceSafe(id = R.string.staking_your_stakes),
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
modifier = Modifier
|
||||
|
|
@ -214,7 +213,7 @@ private fun BannerBlock(onClick: () -> Unit) {
|
|||
.padding(TangemTheme.dimens.spacing16),
|
||||
text = buildAnnotatedString {
|
||||
withStyle(SpanStyle(Brush.linearGradient(textGradientColors))) {
|
||||
append(stringResource(R.string.staking_details_banner_text))
|
||||
append(stringResourceSafe(R.string.staking_details_banner_text))
|
||||
}
|
||||
},
|
||||
style = TangemTheme.typography.h2,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package com.tangem.features.staking.impl.presentation.ui
|
|||
|
||||
import androidx.compose.foundation.text.ClickableText
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import com.tangem.core.ui.extensions.appendColored
|
||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.features.staking.impl.R
|
||||
|
||||
|
|
@ -17,9 +17,9 @@ private const val PRIVACY_POLICY_URL = "https://docs.stakek.it/docs/privacy-poli
|
|||
|
||||
@Composable
|
||||
internal fun StakingTosText(onTextClick: (String) -> Unit) {
|
||||
val termsOfUse = stringResource(R.string.common_terms_of_use)
|
||||
val privacyPolicy = stringResource(R.string.common_privacy_policy)
|
||||
val tosText = stringResource(R.string.staking_legal, termsOfUse, privacyPolicy)
|
||||
val termsOfUse = stringResourceSafe(R.string.common_terms_of_use)
|
||||
val privacyPolicy = stringResourceSafe(R.string.common_privacy_policy)
|
||||
val tosText = stringResourceSafe(R.string.staking_legal, termsOfUse, privacyPolicy)
|
||||
|
||||
val clickableAnnotation = buildAnnotatedString {
|
||||
append(tosText.substringBefore(termsOfUse))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
|
|
@ -113,7 +112,7 @@ internal fun StakingValidatorListContent(
|
|||
private fun RowScope.ValidatorLabel(isStrategicPartner: Boolean) {
|
||||
if (isStrategicPartner) {
|
||||
Text(
|
||||
text = stringResource(R.string.staking_validators_label),
|
||||
text = stringResourceSafe(R.string.staking_validators_label),
|
||||
style = TangemTheme.typography.caption1,
|
||||
color = TangemTheme.colors.icon.constant,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
|
|
@ -21,6 +20,7 @@ import com.tangem.common.ui.amountScreen.utils.getFiatReference
|
|||
import com.tangem.core.ui.components.RectangleShimmer
|
||||
import com.tangem.core.ui.components.rows.SelectorRowItem
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.format.bigdecimal.crypto
|
||||
import com.tangem.core.ui.format.bigdecimal.fee
|
||||
import com.tangem.core.ui.format.bigdecimal.format
|
||||
|
|
@ -46,7 +46,7 @@ internal fun StakingFeeBlock(feeState: FeeState, isTransactionSent: Boolean) {
|
|||
.padding(TangemTheme.dimens.spacing12),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.common_network_fee_title),
|
||||
text = stringResourceSafe(R.string.common_network_fee_title),
|
||||
style = TangemTheme.typography.subtitle2,
|
||||
color = TangemTheme.colors.text.tertiary,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ private fun Preview_StakingActionSelectorBottomSheet() {
|
|||
TangemThemePreview {
|
||||
StakingActionSelectorBottomSheet(
|
||||
config = TangemBottomSheetConfig(
|
||||
isShow = true,
|
||||
isShown = true,
|
||||
onDismissRequest = {},
|
||||
content = StakingActionSelectionBottomSheetConfig(
|
||||
title = resourceReference(R.string.common_select_action),
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ private fun Preview_StakingInfoBottomSheet() {
|
|||
TangemThemePreview {
|
||||
StakingInfoBottomSheet(
|
||||
config = TangemBottomSheetConfig(
|
||||
isShow = true,
|
||||
isShown = true,
|
||||
onDismissRequest = {},
|
||||
content = StakingInfoBottomSheetConfig(
|
||||
title = stringReference("Title"),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.tangem.common.ui.bottomsheet.permission.state.GiveTxPermissionBottomS
|
|||
import com.tangem.common.ui.notifications.NotificationUM
|
||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.core.analytics.api.ParamsInterceptorHolder
|
||||
import com.tangem.core.navigation.share.ShareManager
|
||||
import com.tangem.core.ui.haptic.TangemHapticEffect
|
||||
import com.tangem.core.ui.haptic.VibratorHapticManager
|
||||
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
|
||||
|
|
@ -119,6 +120,7 @@ internal class StakingViewModel @Inject constructor(
|
|||
private val sendFeedbackEmailUseCase: SendFeedbackEmailUseCase,
|
||||
private val getActionsUseCase: GetActionsUseCase,
|
||||
private val paramsInterceptorHolder: ParamsInterceptorHolder,
|
||||
private val shareManager: ShareManager,
|
||||
@DelayedWork private val coroutineScope: CoroutineScope,
|
||||
savedStateHandle: SavedStateHandle,
|
||||
) : ViewModel(), DefaultLifecycleObserver, StakingClickIntents {
|
||||
|
|
@ -765,7 +767,7 @@ internal class StakingViewModel @Inject constructor(
|
|||
analyticsEventHandler.send(StakingAnalyticsEvent.ButtonShare)
|
||||
if (txUrl != null) {
|
||||
vibratorHapticManager.performOneTime(TangemHapticEffect.OneTime.Click)
|
||||
stakingEventFactory.createShareDialog(txUrl = txUrl)
|
||||
shareManager.shareText(txUrl)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue