Updated on 2026-08-14
This commit is contained in:
parent
324f207300
commit
5c4f10f90e
4 changed files with 13 additions and 3 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
@ -41,4 +41,9 @@ internal class StakingEventFactory(
|
|||
)
|
||||
stateController.updateEvent(alert)
|
||||
}
|
||||
|
||||
fun createShareDialog(txUrl: String) {
|
||||
val event = StakingEvent.ShowShareDialog(txUrl)
|
||||
stateController.updateEvent(event)
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue