Updated on 2026-08-14
This commit is contained in:
parent
f529d886b4
commit
90bfea9e4c
14 changed files with 41 additions and 96 deletions
|
|
@ -29,9 +29,6 @@ sealed class GlobalAction : Action {
|
|||
data class ShowErrorNotification(override val error: TapError) : GlobalAction(), ErrorAction
|
||||
data class DebugShowErrorNotification(override val error: TapError) : GlobalAction(), DebugErrorAction
|
||||
|
||||
// android resources
|
||||
data class SetResources(val resources: AndroidResources) : GlobalAction()
|
||||
|
||||
// dialogs
|
||||
data class ShowDialog(val stateDialog: StateDialog) : GlobalAction()
|
||||
object HideDialog : GlobalAction()
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ fun globalReducer(action: Action, state: AppState): GlobalState {
|
|||
val globalState = state.globalState
|
||||
|
||||
return when (action) {
|
||||
is GlobalAction.SetResources -> {
|
||||
globalState.copy(resources = action.resources)
|
||||
}
|
||||
is GlobalAction.Onboarding.Start -> {
|
||||
val usedCardsPrefStorage = preferencesStorage.usedCardsPrefStorage
|
||||
val onboardingManager = OnboardingManager(action.scanResponse, usedCardsPrefStorage)
|
||||
|
|
@ -34,7 +31,7 @@ fun globalReducer(action: Action, state: AppState): GlobalState {
|
|||
is GlobalAction.ScanFailsCounter.Reset -> {
|
||||
globalState.copy(scanCardFailsCounter = 0)
|
||||
}
|
||||
is GlobalAction.SaveScanNoteResponse ->{
|
||||
is GlobalAction.SaveScanNoteResponse -> {
|
||||
domainStore.dispatch(DomainGlobalAction.SaveScanNoteResponse(action.scanResponse))
|
||||
globalState.copy(scanResponse = action.scanResponse)
|
||||
}
|
||||
|
|
@ -51,11 +48,12 @@ fun globalReducer(action: Action, state: AppState): GlobalState {
|
|||
is GlobalAction.UpdateWalletSignedHashes -> {
|
||||
val card = globalState.scanResponse?.card ?: return globalState
|
||||
val wallet = card.wallet(action.walletPublicKey) ?: return globalState
|
||||
|
||||
val newCardInstance = card.updateWallet(wallet.copy(
|
||||
totalSignedHashes = action.walletSignedHashes,
|
||||
remainingSignatures = action.remainingSignatures
|
||||
))
|
||||
val newCardInstance = card.updateWallet(
|
||||
wallet.copy(
|
||||
totalSignedHashes = action.walletSignedHashes,
|
||||
remainingSignatures = action.remainingSignatures,
|
||||
),
|
||||
)
|
||||
globalState.copy(scanResponse = globalState.scanResponse.copy(card = newCardInstance))
|
||||
}
|
||||
is GlobalAction.SetFeedbackManager -> {
|
||||
|
|
@ -72,9 +70,7 @@ fun globalReducer(action: Action, state: AppState): GlobalState {
|
|||
}
|
||||
is GlobalAction.SetIfCardVerifiedOnline ->
|
||||
globalState.copy(cardVerifiedOnline = action.verified)
|
||||
is GlobalAction.FetchUserCountry.Success -> globalState.copy(
|
||||
userCountryCode = action.countryCode
|
||||
)
|
||||
is GlobalAction.FetchUserCountry.Success -> globalState.copy(userCountryCode = action.countryCode)
|
||||
else -> globalState
|
||||
}
|
||||
}
|
||||
|
|
@ -25,18 +25,9 @@ data class GlobalState(
|
|||
val scanCardFailsCounter: Int = 0,
|
||||
val dialog: StateDialog? = null,
|
||||
val exchangeManager: CurrencyExchangeManager = CurrencyExchangeManager.dummy(),
|
||||
val resources: AndroidResources = AndroidResources(),
|
||||
val userCountryCode: String? = null,
|
||||
) : StateType
|
||||
|
||||
data class AndroidResources(
|
||||
val strings: RString = RString(),
|
||||
) {
|
||||
data class RString(
|
||||
val addressWasCopied: Int = -1,
|
||||
val walletIsNotEmpty: Int = -1,
|
||||
)
|
||||
}
|
||||
typealias CryptoCurrencyName = String
|
||||
|
||||
data class OnboardingState(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue