chore(@desktop/keycard): tertiary action for shared keycard popup module renamed to cancel action

Since tertiary action for the keycard popup module is always used to cancel/invalidate
the current flow, it's renamed now to cancel action (avoids confusion this way and it
seems more intuitive. It doesn't set any state. It should be defined if it's possible to cancel
the flow from the current state.
This commit is contained in:
Sale Djenic 2022-11-10 10:06:42 +01:00 committed by saledjenic
parent 21eeefa42e
commit 662a11a57b
62 changed files with 94 additions and 109 deletions

View File

@ -16,7 +16,7 @@ method getNextSecondaryState*(self: BiometricsPasswordFailedState, controller: C
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
return createState(StateType.EnterPassword, self.flowType, nil) return createState(StateType.EnterPassword, self.flowType, nil)
method executePreTertiaryStateCommand*(self: BiometricsPasswordFailedState, controller: Controller) = method executeCancelCommand*(self: BiometricsPasswordFailedState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -20,7 +20,7 @@ method getNextSecondaryState*(self: BiometricsPinFailedState, controller: Contro
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
return createState(StateType.EnterPin, self.flowType, nil) return createState(StateType.EnterPin, self.flowType, nil)
method executePreTertiaryStateCommand*(self: BiometricsPinFailedState, controller: Controller) = method executeCancelCommand*(self: BiometricsPinFailedState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.setPin("") controller.setPin("")

View File

@ -21,7 +21,7 @@ method getNextSecondaryState*(self: BiometricsPinInvalidState, controller: Contr
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
return createState(StateType.EnterPin, self.flowType, nil) return createState(StateType.EnterPin, self.flowType, nil)
method executePreTertiaryStateCommand*(self: BiometricsPinInvalidState, controller: Controller) = method executeCancelCommand*(self: BiometricsPinInvalidState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.setPin("") controller.setPin("")

View File

@ -20,7 +20,7 @@ method getNextSecondaryState*(self: BiometricsReadyToSignState, controller: Cont
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
return createState(StateType.EnterPin, self.flowType, nil) return createState(StateType.EnterPin, self.flowType, nil)
method executePreTertiaryStateCommand*(self: BiometricsReadyToSignState, controller: Controller) = method executeCancelCommand*(self: BiometricsReadyToSignState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.setPin("") controller.setPin("")

View File

@ -14,6 +14,6 @@ method getNextPrimaryState*(self: CreatePairingCodeState, controller: Controller
return createState(StateType.ChangingKeycardPairingCode, self.flowType, nil) return createState(StateType.ChangingKeycardPairingCode, self.flowType, nil)
return createState(StateType.ChangingKeycardPairingCodeFailure, self.flowType, nil) return createState(StateType.ChangingKeycardPairingCodeFailure, self.flowType, nil)
method executePreTertiaryStateCommand*(self: CreatePairingCodeState, controller: Controller) = method executeCancelCommand*(self: CreatePairingCodeState, controller: Controller) =
if self.flowType == FlowType.ChangePairingCode: if self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -15,7 +15,7 @@ method executePreBackStateCommand*(self: CreatePinState, controller: Controller)
if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair:
controller.cancelCurrentFlow() controller.cancelCurrentFlow()
method executePreTertiaryStateCommand*(self: CreatePinState, controller: Controller) = method executeCancelCommand*(self: CreatePinState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard or if self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.UnlockKeycard or
self.flowType == FlowType.ChangeKeycardPin: self.flowType == FlowType.ChangeKeycardPin:

View File

@ -8,7 +8,7 @@ proc newCreatePukState*(flowType: FlowType, backState: State): CreatePukState =
proc delete*(self: CreatePukState) = proc delete*(self: CreatePukState) =
self.State.delete self.State.delete
method executePreTertiaryStateCommand*(self: CreatePukState, controller: Controller) = method executeCancelCommand*(self: CreatePukState, controller: Controller) =
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -25,7 +25,7 @@ method getNextPrimaryState*(self: EnterBiometricsPasswordState, controller: Cont
if not self.success: if not self.success:
return createState(StateType.WrongBiometricsPassword, self.flowType, nil) return createState(StateType.WrongBiometricsPassword, self.flowType, nil)
method executePreTertiaryStateCommand*(self: EnterBiometricsPasswordState, controller: Controller) = method executeCancelCommand*(self: EnterBiometricsPasswordState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -14,7 +14,7 @@ method getNextPrimaryState*(self: EnterKeycardNameState, controller: Controller)
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
return createState(StateType.RenamingKeycard, self.flowType, nil) return createState(StateType.RenamingKeycard, self.flowType, nil)
method executePreTertiaryStateCommand*(self: EnterKeycardNameState, controller: Controller) = method executeCancelCommand*(self: EnterKeycardNameState, controller: Controller) =
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
controller.setPassword("") controller.setPassword("")
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -28,7 +28,7 @@ method executePreSecondaryStateCommand*(self: EnterPasswordState, controller: Co
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.tryToObtainDataFromKeychain() controller.tryToObtainDataFromKeychain()
method executePreTertiaryStateCommand*(self: EnterPasswordState, controller: Controller) = method executeCancelCommand*(self: EnterPasswordState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -30,7 +30,7 @@ method executePreSecondaryStateCommand*(self: EnterPinState, controller: Control
controller.setUsePinFromBiometrics(false) controller.setUsePinFromBiometrics(false)
controller.tryToObtainDataFromKeychain() controller.tryToObtainDataFromKeychain()
method executePreTertiaryStateCommand*(self: EnterPinState, controller: Controller) = method executeCancelCommand*(self: EnterPinState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -13,7 +13,7 @@ method executePrePrimaryStateCommand*(self: EnterPukState, controller: Controlle
if controller.getPuk().len == PUKLengthForStatusApp: if controller.getPuk().len == PUKLengthForStatusApp:
controller.enterKeycardPuk(controller.getPuk()) controller.enterKeycardPuk(controller.getPuk())
method executePreTertiaryStateCommand*(self: EnterPukState, controller: Controller) = method executeCancelCommand*(self: EnterPukState, controller: Controller) =
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -32,7 +32,7 @@ method getNextPrimaryState*(self: EnterSeedPhraseState, controller: Controller):
if not self.verifiedSeedPhrase: if not self.verifiedSeedPhrase:
return createState(StateType.WrongSeedPhrase, self.flowType, nil) return createState(StateType.WrongSeedPhrase, self.flowType, nil)
method executePreTertiaryStateCommand*(self: EnterSeedPhraseState, controller: Controller) = method executeCancelCommand*(self: EnterSeedPhraseState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard or if self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.UnlockKeycard: self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -15,7 +15,7 @@ method executePrePrimaryStateCommand*(self: FactoryResetConfirmationDisplayMetad
controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true)) controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true))
controller.runGetAppInfoFlow(factoryReset = true) controller.runGetAppInfoFlow(factoryReset = true)
method executePreTertiaryStateCommand*(self: FactoryResetConfirmationDisplayMetadataState, controller: Controller) = method executeCancelCommand*(self: FactoryResetConfirmationDisplayMetadataState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard: self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -15,7 +15,7 @@ method executePrePrimaryStateCommand*(self: FactoryResetConfirmationState, contr
controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true)) controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true))
controller.runGetAppInfoFlow(factoryReset = true) controller.runGetAppInfoFlow(factoryReset = true)
method executePreTertiaryStateCommand*(self: FactoryResetConfirmationState, controller: Controller) = method executeCancelCommand*(self: FactoryResetConfirmationState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard: self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -14,7 +14,7 @@ method executePrePrimaryStateCommand*(self: FactoryResetSuccessState, controller
elif self.flowType == FlowType.SetupNewKeycard: elif self.flowType == FlowType.SetupNewKeycard:
controller.runLoadAccountFlow() controller.runLoadAccountFlow()
method executePreTertiaryStateCommand*(self: FactoryResetSuccessState, controller: Controller) = method executeCancelCommand*(self: FactoryResetSuccessState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -13,7 +13,7 @@ method executePreBackStateCommand*(self: InsertKeycardState, controller: Control
if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair:
controller.cancelCurrentFlow() controller.cancelCurrentFlow()
method executePreTertiaryStateCommand*(self: InsertKeycardState, controller: Controller) = method executeCancelCommand*(self: InsertKeycardState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: KeyPairMigrateFailureState, controll
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: KeyPairMigrateFailureState, controller: Controller) = method executeCancelCommand*(self: KeyPairMigrateFailureState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: KeycardAlreadyUnlockedState, control
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: KeycardAlreadyUnlockedState, controller: Controller) = method executeCancelCommand*(self: KeycardAlreadyUnlockedState, controller: Controller) =
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: ChangingKeycardPairingCodeFailureSta
if self.flowType == FlowType.ChangePairingCode: if self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: ChangingKeycardPairingCodeFailureState, controller: Controller) = method executeCancelCommand*(self: ChangingKeycardPairingCodeFailureState, controller: Controller) =
if self.flowType == FlowType.ChangePairingCode: if self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: ChangingKeycardPairingCodeSuccessSta
if self.flowType == FlowType.ChangePairingCode: if self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: ChangingKeycardPairingCodeSuccessState, controller: Controller) = method executeCancelCommand*(self: ChangingKeycardPairingCodeSuccessState, controller: Controller) =
if self.flowType == FlowType.ChangePairingCode: if self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: ChangingKeycardPinFailureState, cont
if self.flowType == FlowType.ChangeKeycardPin: if self.flowType == FlowType.ChangeKeycardPin:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: ChangingKeycardPinFailureState, controller: Controller) = method executeCancelCommand*(self: ChangingKeycardPinFailureState, controller: Controller) =
if self.flowType == FlowType.ChangeKeycardPin: if self.flowType == FlowType.ChangeKeycardPin:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: ChangingKeycardPinSuccessState, cont
if self.flowType == FlowType.ChangeKeycardPin: if self.flowType == FlowType.ChangeKeycardPin:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: ChangingKeycardPinSuccessState, controller: Controller) = method executeCancelCommand*(self: ChangingKeycardPinSuccessState, controller: Controller) =
if self.flowType == FlowType.ChangeKeycardPin: if self.flowType == FlowType.ChangeKeycardPin:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: ChangingKeycardPukFailureState, cont
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: ChangingKeycardPukFailureState, controller: Controller) = method executeCancelCommand*(self: ChangingKeycardPukFailureState, controller: Controller) =
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: ChangingKeycardPukSuccessState, cont
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: ChangingKeycardPukSuccessState, controller: Controller) = method executeCancelCommand*(self: ChangingKeycardPukSuccessState, controller: Controller) =
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -8,7 +8,7 @@ proc newKeycardEmptyMetadataState*(flowType: FlowType, backState: State): Keycar
proc delete*(self: KeycardEmptyMetadataState) = proc delete*(self: KeycardEmptyMetadataState) =
self.State.delete self.State.delete
method executePreTertiaryStateCommand*(self: KeycardEmptyMetadataState, controller: Controller) = method executeCancelCommand*(self: KeycardEmptyMetadataState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.DisplayKeycardContent or self.flowType == FlowType.DisplayKeycardContent or

View File

@ -19,7 +19,7 @@ method executePrePrimaryStateCommand*(self: KeycardEmptyState, controller: Contr
self.flowType == FlowType.ChangePairingCode: self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)
method executePreTertiaryStateCommand*(self: KeycardEmptyState, controller: Controller) = method executeCancelCommand*(self: KeycardEmptyState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or
self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.UnlockKeycard or

View File

@ -20,7 +20,7 @@ method getNextSecondaryState*(self: KeycardInsertedState, controller: Controller
return createState(StateType.ReadingKeycard, self.flowType, self.getBackState) return createState(StateType.ReadingKeycard, self.flowType, self.getBackState)
return createState(StateType.ReadingKeycard, self.flowType, nil) return createState(StateType.ReadingKeycard, self.flowType, nil)
method executePreTertiaryStateCommand*(self: KeycardInsertedState, controller: Controller) = method executeCancelCommand*(self: KeycardInsertedState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -17,7 +17,7 @@ method getNextPrimaryState*(self: KeycardMetadataDisplayState, controller: Contr
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
return createState(StateType.EnterKeycardName, self.flowType, nil) return createState(StateType.EnterKeycardName, self.flowType, nil)
method executePreTertiaryStateCommand*(self: KeycardMetadataDisplayState, controller: Controller) = method executeCancelCommand*(self: KeycardMetadataDisplayState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.DisplayKeycardContent or self.flowType == FlowType.DisplayKeycardContent or

View File

@ -13,7 +13,7 @@ method executePrePrimaryStateCommand*(self: KeycardNotEmptyState, controller: Co
controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true)) controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true))
controller.runGetMetadataFlow(resolveAddress = true) controller.runGetMetadataFlow(resolveAddress = true)
method executePreTertiaryStateCommand*(self: KeycardNotEmptyState, controller: Controller) = method executeCancelCommand*(self: KeycardNotEmptyState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: KeycardRenameFailureState, controlle
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: KeycardRenameFailureState, controller: Controller) = method executeCancelCommand*(self: KeycardRenameFailureState, controller: Controller) =
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: KeycardRenameSuccessState, controlle
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: KeycardRenameSuccessState, controller: Controller) = method executeCancelCommand*(self: KeycardRenameSuccessState, controller: Controller) =
if self.flowType == FlowType.RenameKeycard: if self.flowType == FlowType.RenameKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -21,7 +21,7 @@ method getNextPrimaryState*(self: MaxPairingSlotsReachedState, controller: Contr
controller.runSharedModuleFlow(FlowType.UnlockKeycard) controller.runSharedModuleFlow(FlowType.UnlockKeycard)
return nil return nil
method executePreTertiaryStateCommand*(self: MaxPairingSlotsReachedState, controller: Controller) = method executeCancelCommand*(self: MaxPairingSlotsReachedState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -26,7 +26,7 @@ method getNextPrimaryState*(self: MaxPinRetriesReachedState, controller: Control
controller.runSharedModuleFlow(FlowType.UnlockKeycard) controller.runSharedModuleFlow(FlowType.UnlockKeycard)
return nil return nil
method executePreTertiaryStateCommand*(self: MaxPinRetriesReachedState, controller: Controller) = method executeCancelCommand*(self: MaxPinRetriesReachedState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or
self.flowType == FlowType.DisplayKeycardContent or self.flowType == FlowType.DisplayKeycardContent or

View File

@ -22,7 +22,7 @@ method getNextPrimaryState*(self: MaxPukRetriesReachedState, controller: Control
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
return createState(StateType.EnterSeedPhrase, self.flowType, self) return createState(StateType.EnterSeedPhrase, self.flowType, self)
method executePreTertiaryStateCommand*(self: MaxPukRetriesReachedState, controller: Controller) = method executeCancelCommand*(self: MaxPukRetriesReachedState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -8,7 +8,7 @@ proc newNotKeycardState*(flowType: FlowType, backState: State): NotKeycardState
proc delete*(self: NotKeycardState) = proc delete*(self: NotKeycardState) =
self.State.delete self.State.delete
method executePreTertiaryStateCommand*(self: NotKeycardState, controller: Controller) = method executeCancelCommand*(self: NotKeycardState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -22,6 +22,6 @@ method getNextPrimaryState*(self: PinSetState, controller: Controller): State =
if controller.getCurrentKeycardServiceFlow() == KCSFlowType.StoreMetadata: if controller.getCurrentKeycardServiceFlow() == KCSFlowType.StoreMetadata:
return createState(StateType.UnlockKeycardSuccess, self.flowType, nil) return createState(StateType.UnlockKeycardSuccess, self.flowType, nil)
method executePreTertiaryStateCommand*(self: PinSetState, controller: Controller) = method executeCancelCommand*(self: PinSetState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -21,7 +21,7 @@ method getNextPrimaryState*(self: PinVerifiedState, controller: Controller): Sta
if self.flowType == FlowType.ChangePairingCode: if self.flowType == FlowType.ChangePairingCode:
return createState(StateType.CreatePairingCode, self.flowType, nil) return createState(StateType.CreatePairingCode, self.flowType, nil)
method executePreTertiaryStateCommand*(self: PinVerifiedState, controller: Controller) = method executeCancelCommand*(self: PinVerifiedState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.DisplayKeycardContent or self.flowType == FlowType.DisplayKeycardContent or

View File

@ -13,7 +13,7 @@ method executePreBackStateCommand*(self: PluginReaderState, controller: Controll
if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair:
controller.cancelCurrentFlow() controller.cancelCurrentFlow()
method executePreTertiaryStateCommand*(self: PluginReaderState, controller: Controller) = method executeCancelCommand*(self: PluginReaderState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -13,7 +13,7 @@ method executePreBackStateCommand*(self: ReadingKeycardState, controller: Contro
if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair:
controller.cancelCurrentFlow() controller.cancelCurrentFlow()
method executePreTertiaryStateCommand*(self: ReadingKeycardState, controller: Controller) = method executeCancelCommand*(self: ReadingKeycardState, controller: Controller) =
error "reading state must not be canceled" error "reading state must not be canceled"
method getNextSecondaryState*(self: ReadingKeycardState, controller: Controller): State = method getNextSecondaryState*(self: ReadingKeycardState, controller: Controller): State =

View File

@ -30,5 +30,5 @@ method getNextSecondaryState*(self: RecognizedKeycardState, controller: Controll
self.flowType == FlowType.ChangePairingCode: self.flowType == FlowType.ChangePairingCode:
return createState(StateType.EnterPin, self.flowType, nil) return createState(StateType.EnterPin, self.flowType, nil)
method executePreTertiaryStateCommand*(self: RecognizedKeycardState, controller: Controller) = method executeCancelCommand*(self: RecognizedKeycardState, controller: Controller) =
error "recognized state must not be canceled" error "recognized state must not be canceled"

View File

@ -26,7 +26,7 @@ method getNextSecondaryState*(self: RepeatPinState, controller: Controller): Sta
if self.flowType == FlowType.ChangeKeycardPin: if self.flowType == FlowType.ChangeKeycardPin:
return createState(StateType.ChangingKeycardPin, self.flowType, nil) return createState(StateType.ChangingKeycardPin, self.flowType, nil)
method executePreTertiaryStateCommand*(self: RepeatPinState, controller: Controller) = method executeCancelCommand*(self: RepeatPinState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard or if self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.UnlockKeycard or
self.flowType == FlowType.ChangeKeycardPin: self.flowType == FlowType.ChangeKeycardPin:

View File

@ -18,6 +18,6 @@ method getNextSecondaryState*(self: RepeatPukState, controller: Controller): Sta
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
return createState(StateType.ChangingKeycardPuk, self.flowType, nil) return createState(StateType.ChangingKeycardPuk, self.flowType, nil)
method executePreTertiaryStateCommand*(self: RepeatPukState, controller: Controller) = method executeCancelCommand*(self: RepeatPukState, controller: Controller) =
if self.flowType == FlowType.ChangeKeycardPuk: if self.flowType == FlowType.ChangeKeycardPuk:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -8,7 +8,7 @@ proc newSeedPhraseDisplayState*(flowType: FlowType, backState: State): SeedPhras
proc delete*(self: SeedPhraseDisplayState) = proc delete*(self: SeedPhraseDisplayState) =
self.State.delete self.State.delete
method executePreTertiaryStateCommand*(self: SeedPhraseDisplayState, controller: Controller) = method executeCancelCommand*(self: SeedPhraseDisplayState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -15,7 +15,7 @@ method executePrePrimaryStateCommand*(self: SeedPhraseEnterWordsState, controlle
controller.setSeedPhrase(mnemonic) controller.setSeedPhrase(mnemonic)
controller.storeSeedPhraseToKeycard(mnemonic.split(" ").len, mnemonic) controller.storeSeedPhraseToKeycard(mnemonic.split(" ").len, mnemonic)
method executePreTertiaryStateCommand*(self: SeedPhraseEnterWordsState, controller: Controller) = method executeCancelCommand*(self: SeedPhraseEnterWordsState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -12,7 +12,7 @@ method executePrePrimaryStateCommand*(self: SelectExistingKeyPairState, controll
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.runLoadAccountFlow() controller.runLoadAccountFlow()
method executePreTertiaryStateCommand*(self: SelectExistingKeyPairState, controller: Controller) = method executeCancelCommand*(self: SelectExistingKeyPairState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard: if self.flowType == FlowType.SetupNewKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -119,9 +119,9 @@ method getNextPrimaryState*(self: State, controller: Controller): State {.inlin
method getNextSecondaryState*(self: State, controller: Controller): State {.inline base.} = method getNextSecondaryState*(self: State, controller: Controller): State {.inline base.} =
return nil return nil
## Returns next state instance if "tertiary" action is triggered ## This method is executed if "cancel" action is triggered (invalidates current flow)
method getNextTertiaryState*(self: State, controller: Controller): State {.inline base.} = method executeCancelCommand*(self: State, controller: Controller) {.inline base.} =
return nil discard
## This method is executed before back state is set, if "back" action is triggered ## This method is executed before back state is set, if "back" action is triggered
method executePreBackStateCommand*(self: State, controller: Controller) {.inline base.} = method executePreBackStateCommand*(self: State, controller: Controller) {.inline base.} =
@ -147,14 +147,6 @@ method executePreSecondaryStateCommand*(self: State, controller: Controller) {.i
method executePostSecondaryStateCommand*(self: State, controller: Controller) {.inline base.} = method executePostSecondaryStateCommand*(self: State, controller: Controller) {.inline base.} =
discard discard
## This method is executed before tertiary state is set, if "tertiary" action is triggered
method executePreTertiaryStateCommand*(self: State, controller: Controller) {.inline base.} =
discard
## This method is executed after tertiary state is set, if "tertiary" action is triggered
method executePostTertiaryStateCommand*(self: State, controller: Controller) {.inline base.} =
discard
## This method is used for handling aync responses for keycard related states ## This method is used for handling aync responses for keycard related states
method resolveKeycardNextState*(self: State, keycardFlowType: string, keycardEvent: KeycardEvent, method resolveKeycardNextState*(self: State, keycardFlowType: string, keycardEvent: KeycardEvent,
controller: Controller): State {.inline base.} = controller: Controller): State {.inline base.} =

View File

@ -46,9 +46,13 @@ QtObject:
notify = stateWrapperChanged notify = stateWrapperChanged
proc backActionClicked*(self: StateWrapper) {.signal.} proc backActionClicked*(self: StateWrapper) {.signal.}
proc backAction*(self: StateWrapper) {.slot.} = proc doBackAction*(self: StateWrapper) {.slot.} =
self.backActionClicked() self.backActionClicked()
proc cancelActionClicked*(self: StateWrapper) {.signal.}
proc doCancelAction*(self: StateWrapper) {.slot.} =
self.cancelActionClicked()
proc primaryActionClicked*(self: StateWrapper) {.signal.} proc primaryActionClicked*(self: StateWrapper) {.signal.}
proc doPrimaryAction*(self: StateWrapper) {.slot.} = proc doPrimaryAction*(self: StateWrapper) {.slot.} =
self.primaryActionClicked() self.primaryActionClicked()
@ -56,7 +60,3 @@ QtObject:
proc secondaryActionClicked*(self: StateWrapper) {.signal.} proc secondaryActionClicked*(self: StateWrapper) {.signal.}
proc doSecondaryAction*(self: StateWrapper) {.slot.} = proc doSecondaryAction*(self: StateWrapper) {.slot.} =
self.secondaryActionClicked() self.secondaryActionClicked()
proc tertiaryActionClicked*(self: StateWrapper) {.signal.}
proc doTertiaryAction*(self: StateWrapper) {.slot.} =
self.tertiaryActionClicked()

View File

@ -16,6 +16,6 @@ method getNextSecondaryState*(self: UnlockKeycardOptionsState, controller: Contr
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
return createState(StateType.EnterPuk, self.flowType, self) return createState(StateType.EnterPuk, self.flowType, self)
method executePreTertiaryStateCommand*(self: UnlockKeycardOptionsState, controller: Controller) = method executeCancelCommand*(self: UnlockKeycardOptionsState, controller: Controller) =
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -12,6 +12,6 @@ method executePrePrimaryStateCommand*(self: UnlockKeycardSuccessState, controlle
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: UnlockKeycardSuccessState, controller: Controller) = method executeCancelCommand*(self: UnlockKeycardSuccessState, controller: Controller) =
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)

View File

@ -21,7 +21,7 @@ method executePrePrimaryStateCommand*(self: WrongBiometricsPasswordState, contro
else: else:
controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongPassword, add = true)) controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongPassword, add = true))
method executePreTertiaryStateCommand*(self: WrongBiometricsPasswordState, controller: Controller) = method executeCancelCommand*(self: WrongBiometricsPasswordState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -16,7 +16,7 @@ method executePrePrimaryStateCommand*(self: WrongKeycardState, controller: Contr
self.flowType == FlowType.ChangePairingCode: self.flowType == FlowType.ChangePairingCode:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
method executePreTertiaryStateCommand*(self: WrongKeycardState, controller: Controller) = method executeCancelCommand*(self: WrongKeycardState, controller: Controller) =
if self.flowType == FlowType.Authentication or if self.flowType == FlowType.Authentication or
self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.UnlockKeycard or
self.flowType == FlowType.RenameKeycard or self.flowType == FlowType.RenameKeycard or

View File

@ -14,7 +14,7 @@ method getNextPrimaryState*(self: WrongKeychainPinState, controller: Controller)
controller.enterKeycardPin(controller.getPin()) controller.enterKeycardPin(controller.getPin())
return nil return nil
method executePreTertiaryStateCommand*(self: WrongKeychainPinState, controller: Controller) = method executeCancelCommand*(self: WrongKeychainPinState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -24,7 +24,7 @@ method executePreSecondaryStateCommand*(self: WrongPasswordState, controller: Co
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.tryToObtainDataFromKeychain() controller.tryToObtainDataFromKeychain()
method executePreTertiaryStateCommand*(self: WrongPasswordState, controller: Controller) = method executeCancelCommand*(self: WrongPasswordState, controller: Controller) =
if self.flowType == FlowType.Authentication: if self.flowType == FlowType.Authentication:
controller.setPassword("") controller.setPassword("")
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -36,7 +36,7 @@ method executePreSecondaryStateCommand*(self: WrongPinState, controller: Control
controller.setUsePinFromBiometrics(false) controller.setUsePinFromBiometrics(false)
controller.tryToObtainDataFromKeychain() controller.tryToObtainDataFromKeychain()
method executePreTertiaryStateCommand*(self: WrongPinState, controller: Controller) = method executeCancelCommand*(self: WrongPinState, controller: Controller) =
if self.flowType == FlowType.FactoryReset or if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.Authentication or self.flowType == FlowType.Authentication or

View File

@ -13,7 +13,7 @@ method executePrePrimaryStateCommand*(self: WrongPukState, controller: Controlle
if controller.getPuk().len == PUKLengthForStatusApp: if controller.getPuk().len == PUKLengthForStatusApp:
controller.enterKeycardPuk(controller.getPuk()) controller.enterKeycardPuk(controller.getPuk())
method executePreTertiaryStateCommand*(self: WrongPukState, controller: Controller) = method executeCancelCommand*(self: WrongPukState, controller: Controller) =
if self.flowType == FlowType.UnlockKeycard: if self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -32,7 +32,7 @@ method executePrePrimaryStateCommand*(self: WrongSeedPhraseState, controller: Co
else: else:
controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongSeedPhrase, add = true)) controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongSeedPhrase, add = true))
method executePreTertiaryStateCommand*(self: WrongSeedPhraseState, controller: Controller) = method executeCancelCommand*(self: WrongSeedPhraseState, controller: Controller) =
if self.flowType == FlowType.SetupNewKeycard or if self.flowType == FlowType.SetupNewKeycard or
self.flowType == FlowType.UnlockKeycard: self.flowType == FlowType.UnlockKeycard:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false)

View File

@ -90,7 +90,7 @@ method onPrimaryActionClicked*(self: AccessInterface) {.base.} =
method onSecondaryActionClicked*(self: AccessInterface) {.base.} = method onSecondaryActionClicked*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method onTertiaryActionClicked*(self: AccessInterface) {.base.} = method onCancelActionClicked*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method onKeycardResponse*(self: AccessInterface, keycardFlowType: string, keycardEvent: KeycardEvent) {.base.} = method onKeycardResponse*(self: AccessInterface, keycardFlowType: string, keycardEvent: KeycardEvent) {.base.} =

View File

@ -174,6 +174,14 @@ method onBackActionClicked*[T](self: Module[T]) =
debug "sm_back_action - set state", setCurrFlow=backState.flowType(), newCurrState=backState.stateType() debug "sm_back_action - set state", setCurrFlow=backState.flowType(), newCurrState=backState.stateType()
currStateObj.delete() currStateObj.delete()
method onCancelActionClicked*[T](self: Module[T]) =
let currStateObj = self.view.currentStateObj()
if currStateObj.isNil:
error "sm_cannot resolve current state"
return
debug "sm_cancel_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType()
currStateObj.executeCancelCommand(self.controller)
method onPrimaryActionClicked*[T](self: Module[T]) = method onPrimaryActionClicked*[T](self: Module[T]) =
let currStateObj = self.view.currentStateObj() let currStateObj = self.view.currentStateObj()
if currStateObj.isNil: if currStateObj.isNil:
@ -204,21 +212,6 @@ method onSecondaryActionClicked*[T](self: Module[T]) =
currStateObj.executePostSecondaryStateCommand(self.controller) currStateObj.executePostSecondaryStateCommand(self.controller)
debug "sm_secondary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType() debug "sm_secondary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType()
method onTertiaryActionClicked*[T](self: Module[T]) =
let currStateObj = self.view.currentStateObj()
if currStateObj.isNil:
error "sm_cannot resolve current state"
return
debug "sm_tertiary_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType()
currStateObj.executePreTertiaryStateCommand(self.controller)
let nextState = currStateObj.getNextTertiaryState(self.controller)
if nextState.isNil:
return
self.preStateActivities(nextState.flowType(), nextState.stateType())
self.view.setCurrentState(nextState)
currStateObj.executePostTertiaryStateCommand(self.controller)
debug "sm_tertiary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType()
method onKeycardResponse*[T](self: Module[T], keycardFlowType: string, keycardEvent: KeycardEvent) = method onKeycardResponse*[T](self: Module[T], keycardFlowType: string, keycardEvent: KeycardEvent) =
if self.derivingAccountDetails.deriveAddressAfterAuthentication and if self.derivingAccountDetails.deriveAddressAfterAuthentication and
self.derivingAccountDetails.addressRequested: self.derivingAccountDetails.addressRequested:

View File

@ -55,9 +55,9 @@ QtObject:
result.currentStateVariant = newQVariant(result.currentState) result.currentStateVariant = newQVariant(result.currentState)
signalConnect(result.currentState, "backActionClicked()", result, "onBackActionClicked()", 2) signalConnect(result.currentState, "backActionClicked()", result, "onBackActionClicked()", 2)
signalConnect(result.currentState, "cancelActionClicked()", result, "onCancelActionClicked()", 2)
signalConnect(result.currentState, "primaryActionClicked()", result, "onPrimaryActionClicked()", 2) signalConnect(result.currentState, "primaryActionClicked()", result, "onPrimaryActionClicked()", 2)
signalConnect(result.currentState, "secondaryActionClicked()", result, "onSecondaryActionClicked()", 2) signalConnect(result.currentState, "secondaryActionClicked()", result, "onSecondaryActionClicked()", 2)
signalConnect(result.currentState, "tertiaryActionClicked()", result, "onTertiaryActionClicked()", 2)
proc currentStateObj*(self: View): State = proc currentStateObj*(self: View): State =
return self.currentState.getStateObj() return self.currentState.getStateObj()
@ -85,15 +85,15 @@ QtObject:
proc onBackActionClicked*(self: View) {.slot.} = proc onBackActionClicked*(self: View) {.slot.} =
self.delegate.onBackActionClicked() self.delegate.onBackActionClicked()
proc onCancelActionClicked*(self: View) {.slot.} =
self.delegate.onCancelActionClicked()
proc onPrimaryActionClicked*(self: View) {.slot.} = proc onPrimaryActionClicked*(self: View) {.slot.} =
self.delegate.onPrimaryActionClicked() self.delegate.onPrimaryActionClicked()
proc onSecondaryActionClicked*(self: View) {.slot.} = proc onSecondaryActionClicked*(self: View) {.slot.} =
self.delegate.onSecondaryActionClicked() self.delegate.onSecondaryActionClicked()
proc onTertiaryActionClicked*(self: View) {.slot.} =
self.delegate.onTertiaryActionClicked()
proc keyPairModel*(self: View): KeyPairModel = proc keyPairModel*(self: View): KeyPairModel =
return self.keyPairModel return self.keyPairModel

View File

@ -50,7 +50,7 @@ StatusModal {
} }
onClosed: { onClosed: {
root.sharedKeycardModule.currentState.doTertiaryAction() root.sharedKeycardModule.currentState.doCancelAction()
} }
contentItem: StatusScrollView { contentItem: StatusScrollView {

View File

@ -36,16 +36,17 @@ QtObject {
height: Constants.keycard.general.footerButtonsHeight height: Constants.keycard.general.footerButtonsHeight
width: height width: height
onClicked: { onClicked: {
root.sharedKeycardModule.currentState.backAction() root.sharedKeycardModule.currentState.doBackAction()
} }
} }
] ]
property list<StatusBaseButton> rightButtons: [ property list<StatusBaseButton> rightButtons: [
StatusButton { StatusButton {
id: tertiaryButton id: cancelButton
height: Constants.keycard.general.footerButtonsHeight height: Constants.keycard.general.footerButtonsHeight
text: { text: qsTr("Cancel")
visible: {
switch (root.sharedKeycardModule.currentState.flowType) { switch (root.sharedKeycardModule.currentState.flowType) {
case Constants.keycardSharedFlow.setupNewKeycard: case Constants.keycardSharedFlow.setupNewKeycard:
@ -64,7 +65,7 @@ QtObject {
case Constants.keycardSharedState.factoryResetSuccess: case Constants.keycardSharedState.factoryResetSuccess:
case Constants.keycardSharedState.pinVerified: case Constants.keycardSharedState.pinVerified:
case Constants.keycardSharedState.keycardMetadataDisplay: case Constants.keycardSharedState.keycardMetadataDisplay:
return qsTr("Cancel") return true
} }
break break
@ -86,7 +87,7 @@ QtObject {
case Constants.keycardSharedState.keycardEmptyMetadata: case Constants.keycardSharedState.keycardEmptyMetadata:
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata: case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
case Constants.keycardSharedState.factoryResetConfirmation: case Constants.keycardSharedState.factoryResetConfirmation:
return qsTr("Cancel") return true
} }
break break
@ -112,7 +113,7 @@ QtObject {
case Constants.keycardSharedState.enterBiometricsPassword: case Constants.keycardSharedState.enterBiometricsPassword:
case Constants.keycardSharedState.wrongBiometricsPassword: case Constants.keycardSharedState.wrongBiometricsPassword:
case Constants.keycardSharedState.enterPin: case Constants.keycardSharedState.enterPin:
return qsTr("Cancel") return true
} }
break break
@ -128,7 +129,7 @@ QtObject {
case Constants.keycardSharedState.notKeycard: case Constants.keycardSharedState.notKeycard:
case Constants.keycardSharedState.unlockKeycardOptions: case Constants.keycardSharedState.unlockKeycardOptions:
case Constants.keycardSharedState.enterSeedPhrase: case Constants.keycardSharedState.enterSeedPhrase:
return qsTr("Cancel") return true
} }
break break
@ -146,7 +147,7 @@ QtObject {
case Constants.keycardSharedState.maxPinRetriesReached: case Constants.keycardSharedState.maxPinRetriesReached:
case Constants.keycardSharedState.maxPukRetriesReached: case Constants.keycardSharedState.maxPukRetriesReached:
case Constants.keycardSharedState.maxPairingSlotsReached: case Constants.keycardSharedState.maxPairingSlotsReached:
return qsTr("Cancel") return true
} }
break break
@ -165,7 +166,7 @@ QtObject {
case Constants.keycardSharedState.maxPinRetriesReached: case Constants.keycardSharedState.maxPinRetriesReached:
case Constants.keycardSharedState.maxPukRetriesReached: case Constants.keycardSharedState.maxPukRetriesReached:
case Constants.keycardSharedState.maxPairingSlotsReached: case Constants.keycardSharedState.maxPairingSlotsReached:
return qsTr("Cancel") return true
} }
break break
@ -185,7 +186,7 @@ QtObject {
case Constants.keycardSharedState.maxPinRetriesReached: case Constants.keycardSharedState.maxPinRetriesReached:
case Constants.keycardSharedState.maxPukRetriesReached: case Constants.keycardSharedState.maxPukRetriesReached:
case Constants.keycardSharedState.maxPairingSlotsReached: case Constants.keycardSharedState.maxPairingSlotsReached:
return qsTr("Cancel") return true
} }
break break
@ -205,7 +206,7 @@ QtObject {
case Constants.keycardSharedState.maxPinRetriesReached: case Constants.keycardSharedState.maxPinRetriesReached:
case Constants.keycardSharedState.maxPukRetriesReached: case Constants.keycardSharedState.maxPukRetriesReached:
case Constants.keycardSharedState.maxPairingSlotsReached: case Constants.keycardSharedState.maxPairingSlotsReached:
return qsTr("Cancel") return true
} }
break break
@ -224,14 +225,13 @@ QtObject {
case Constants.keycardSharedState.maxPinRetriesReached: case Constants.keycardSharedState.maxPinRetriesReached:
case Constants.keycardSharedState.maxPukRetriesReached: case Constants.keycardSharedState.maxPukRetriesReached:
case Constants.keycardSharedState.maxPairingSlotsReached: case Constants.keycardSharedState.maxPairingSlotsReached:
return qsTr("Cancel") return true
} }
break break
} }
return "" return false
} }
visible: text !== ""
enabled: { enabled: {
switch (root.sharedKeycardModule.currentState.stateType) { switch (root.sharedKeycardModule.currentState.stateType) {
@ -250,7 +250,7 @@ QtObject {
} }
onClicked: { onClicked: {
root.sharedKeycardModule.currentState.doTertiaryAction() root.sharedKeycardModule.currentState.doCancelAction()
} }
}, },