Updated on 2026-08-14

This commit is contained in:
Tangem 2024-09-04 17:59:02 +05:00
parent 324f207300
commit 5c4f10f90e
4 changed files with 13 additions and 3 deletions

View file

@ -10,4 +10,6 @@ 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()
}

View file

@ -41,4 +41,9 @@ internal class StakingEventFactory(
)
stateController.updateEvent(alert)
}
fun createShareDialog(txUrl: String) {
val event = StakingEvent.ShowShareDialog(txUrl)
stateController.updateEvent(event)
}
}

View file

@ -11,11 +11,13 @@ 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.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) }
@ -38,6 +40,9 @@ internal fun StakingEventEffect(event: StateEvent<StakingEvent>, snackbarHostSta
is StakingEvent.ShowAlert -> {
alertConfig = value.alert
}
is StakingEvent.ShowShareDialog -> {
context.shareText(value.txUrl)
}
}
},
)

View file

@ -15,7 +15,6 @@ import com.tangem.common.routing.bundle.unbundle
import com.tangem.common.ui.amountScreen.converters.AmountReduceByTransformer
import com.tangem.common.ui.amountScreen.models.AmountState
import com.tangem.common.ui.notifications.NotificationUM
import com.tangem.core.ui.clipboard.ClipboardManager
import com.tangem.core.ui.haptic.TangemHapticEffect
import com.tangem.core.ui.haptic.VibratorHapticManager
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
@ -96,7 +95,6 @@ internal class StakingViewModel @Inject constructor(
private val getAllowanceUseCase: GetAllowanceUseCase,
private val getFeeUseCase: GetFeeUseCase,
private val isApproveNeededUseCase: IsApproveNeededUseCase,
private val clipboardManager: ClipboardManager,
private val vibratorHapticManager: VibratorHapticManager,
private val feedbackManager: FeedbackManager,
private val getCardInfoUseCase: GetCardInfoUseCase,
@ -643,7 +641,7 @@ internal class StakingViewModel @Inject constructor(
if (txUrl != null) {
vibratorHapticManager.performOneTime(TangemHapticEffect.OneTime.Click)
clipboardManager.setText(text = txUrl)
stakingEventFactory.createShareDialog(txUrl = txUrl)
}
// TODO staking [REDACTED_TASK_KEY]