Updated on 2026-08-14
This commit is contained in:
parent
16e776a468
commit
1916427e5a
4 changed files with 9 additions and 12 deletions
|
|
@ -17,7 +17,6 @@ import androidx.compose.ui.unit.sp
|
|||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import com.tangem.domain.DomainDialog
|
||||
import com.tangem.domain.DomainStateDialog
|
||||
import com.tangem.domain.redux.domainStore
|
||||
import com.tangem.domain.redux.global.DomainGlobalAction
|
||||
import com.tangem.domain.redux.global.DomainGlobalState
|
||||
|
|
@ -28,7 +27,7 @@ import org.rekotlin.StoreSubscriber
|
|||
|
||||
@Composable
|
||||
fun ComposeDialogManager() {
|
||||
val dialogSate = remember { mutableStateOf<DomainStateDialog?>(null) }
|
||||
val dialogSate = remember { mutableStateOf<DomainDialog?>(null) }
|
||||
val subscriber = remember {
|
||||
object : StoreSubscriber<DomainGlobalState> {
|
||||
override fun newState(state: DomainGlobalState) {
|
||||
|
|
@ -52,7 +51,7 @@ fun ComposeDialogManager() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun ShowTheDialog(dialogState: MutableState<DomainStateDialog?>) {
|
||||
private fun ShowTheDialog(dialogState: MutableState<DomainDialog?>) {
|
||||
if (dialogState.value == null) return
|
||||
|
||||
val context = LocalContext.current
|
||||
|
|
|
|||
|
|
@ -6,16 +6,14 @@ import com.tangem.network.api.tangemTech.Coins
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
interface DomainStateDialog
|
||||
sealed interface DomainDialog {
|
||||
|
||||
sealed class DomainDialog : DomainStateDialog {
|
||||
|
||||
data class DialogError(val error: DomainError) : DomainDialog()
|
||||
data class DialogError(val error: DomainError) : DomainDialog
|
||||
|
||||
data class SelectTokenDialog(
|
||||
val items: List<Coins.CheckAddressResponse.Token.Contract>,
|
||||
val networkIdConverter: (String) -> String,
|
||||
val onSelect: (Coins.CheckAddressResponse.Token.Contract) -> Unit,
|
||||
val onClose: VoidCallback = {}
|
||||
) : DomainDialog()
|
||||
) : DomainDialog
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tangem.domain.redux.global
|
||||
|
||||
import com.tangem.domain.DomainStateDialog
|
||||
import com.tangem.domain.DomainDialog
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import org.rekotlin.Action
|
||||
|
||||
|
|
@ -10,5 +10,5 @@ import org.rekotlin.Action
|
|||
//TODO: refactoring: is alias for the GlobalAction
|
||||
sealed class DomainGlobalAction : Action {
|
||||
data class SetScanResponse(val scanResponse: ScanResponse?) : DomainGlobalAction()
|
||||
data class ShowDialog(val stateDialog: DomainStateDialog?) : DomainGlobalAction()
|
||||
data class ShowDialog(val stateDialog: DomainDialog?) : DomainGlobalAction()
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.tangem.domain.redux.global
|
||||
|
||||
import com.tangem.domain.DomainStateDialog
|
||||
import com.tangem.domain.DomainDialog
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
|
||||
/**
|
||||
|
|
@ -9,5 +9,5 @@ import com.tangem.domain.common.ScanResponse
|
|||
//TODO: refactoring: is alias for the GlobalState
|
||||
data class DomainGlobalState(
|
||||
val scanResponse: ScanResponse? = null,
|
||||
val dialog: DomainStateDialog? = null,
|
||||
val dialog: DomainDialog? = null,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue