Updated on 2026-08-14
This commit is contained in:
parent
20eba62956
commit
e92074bbb0
21 changed files with 36 additions and 75 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)
|
||||
}
|
||||
}
|
||||
|
|
@ -10,14 +10,12 @@ 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)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -757,7 +759,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