diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEvent.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEvent.kt index 7e7700595e..a1b9cce6d9 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEvent.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEvent.kt @@ -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() } \ No newline at end of file diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEventFactory.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEventFactory.kt index 173975c66c..5c29cbbf5b 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEventFactory.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/events/StakingEventFactory.kt @@ -41,4 +41,9 @@ internal class StakingEventFactory( ) stateController.updateEvent(alert) } + + fun createShareDialog(txUrl: String) { + val event = StakingEvent.ShowShareDialog(txUrl) + stateController.updateEvent(event) + } } \ No newline at end of file diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingEventEffect.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingEventEffect.kt index 80ba0d9029..b134e9d549 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingEventEffect.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/ui/StakingEventEffect.kt @@ -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, snackbarHostState: SnackbarHostState) { + val context = LocalContext.current val resources = LocalContext.current.resources var alertConfig by remember { mutableStateOf(value = null) } @@ -38,6 +40,9 @@ internal fun StakingEventEffect(event: StateEvent, snackbarHostSta is StakingEvent.ShowAlert -> { alertConfig = value.alert } + is StakingEvent.ShowShareDialog -> { + context.shareText(value.txUrl) + } } }, ) diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt index dd305ad949..1f1afe7e27 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt @@ -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]