diff --git a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_password_failed_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_password_failed_state.nim index 3d8081f176..031a7268cc 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_password_failed_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_password_failed_state.nim @@ -8,7 +8,7 @@ proc newBiometricsPasswordFailedState*(flowType: FlowType, backState: State): Bi proc delete*(self: BiometricsPasswordFailedState) = self.State.delete -method executePrimaryCommand*(self: BiometricsPasswordFailedState, controller: Controller) = +method executePrePrimaryStateCommand*(self: BiometricsPasswordFailedState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.tryToObtainDataFromKeychain() @@ -16,7 +16,7 @@ method getNextSecondaryState*(self: BiometricsPasswordFailedState, controller: C if self.flowType == FlowType.Authentication: return createState(StateType.EnterPassword, self.flowType, nil) -method executeTertiaryCommand*(self: BiometricsPasswordFailedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: BiometricsPasswordFailedState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_failed_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_failed_state.nim index 3a5f501d79..50a1fda3df 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_failed_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_failed_state.nim @@ -8,11 +8,11 @@ proc newBiometricsPinFailedState*(flowType: FlowType, backState: State): Biometr proc delete*(self: BiometricsPinFailedState) = self.State.delete -method executePrimaryCommand*(self: BiometricsPinFailedState, controller: Controller) = +method executePrePrimaryStateCommand*(self: BiometricsPinFailedState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.tryToObtainDataFromKeychain() -method executeSecondaryCommand*(self: BiometricsPinFailedState, controller: Controller) = +method executePreSecondaryStateCommand*(self: BiometricsPinFailedState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setUsePinFromBiometrics(true) @@ -20,7 +20,7 @@ method getNextSecondaryState*(self: BiometricsPinFailedState, controller: Contro if self.flowType == FlowType.Authentication: return createState(StateType.EnterPin, self.flowType, nil) -method executeTertiaryCommand*(self: BiometricsPinFailedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: BiometricsPinFailedState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.setPin("") diff --git a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_invalid_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_invalid_state.nim index d5c548b230..facda51ead 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_invalid_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_pin_invalid_state.nim @@ -8,11 +8,11 @@ proc newBiometricsPinInvalidState*(flowType: FlowType, backState: State): Biomet proc delete*(self: BiometricsPinInvalidState) = self.State.delete -method executePrimaryCommand*(self: BiometricsPinInvalidState, controller: Controller) = +method executePrePrimaryStateCommand*(self: BiometricsPinInvalidState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.tryToObtainDataFromKeychain() -method executeSecondaryCommand*(self: BiometricsPinInvalidState, controller: Controller) = +method executePreSecondaryStateCommand*(self: BiometricsPinInvalidState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setUsePinFromBiometrics(true) controller.setOfferToStoreUpdatedPinToKeychain(true) @@ -21,7 +21,7 @@ method getNextSecondaryState*(self: BiometricsPinInvalidState, controller: Contr if self.flowType == FlowType.Authentication: return createState(StateType.EnterPin, self.flowType, nil) -method executeTertiaryCommand*(self: BiometricsPinInvalidState, controller: Controller) = +method executePreTertiaryStateCommand*(self: BiometricsPinInvalidState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.setPin("") diff --git a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_ready_to_sign_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_ready_to_sign_state.nim index 546b251479..dd758b6250 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/biometrics_ready_to_sign_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/biometrics_ready_to_sign_state.nim @@ -8,11 +8,11 @@ proc newBiometricsReadyToSignState*(flowType: FlowType, backState: State): Biome proc delete*(self: BiometricsReadyToSignState) = self.State.delete -method executePrimaryCommand*(self: BiometricsReadyToSignState, controller: Controller) = +method executePrePrimaryStateCommand*(self: BiometricsReadyToSignState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.tryToObtainDataFromKeychain() -method executeSecondaryCommand*(self: BiometricsReadyToSignState, controller: Controller) = +method executePreSecondaryStateCommand*(self: BiometricsReadyToSignState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setUsePinFromBiometrics(true) @@ -20,7 +20,7 @@ method getNextSecondaryState*(self: BiometricsReadyToSignState, controller: Cont if self.flowType == FlowType.Authentication: return createState(StateType.EnterPin, self.flowType, nil) -method executeTertiaryCommand*(self: BiometricsReadyToSignState, controller: Controller) = +method executePreTertiaryStateCommand*(self: BiometricsReadyToSignState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.setPin("") diff --git a/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pairing_code_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pairing_code_state.nim index 6cd0cc0bc5..7b9c035a1e 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pairing_code_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pairing_code_state.nim @@ -8,7 +8,7 @@ proc newChangingKeycardPairingCodeState*(flowType: FlowType, backState: State): proc delete*(self: ChangingKeycardPairingCodeState) = self.State.delete -method executeSecondaryCommand*(self: ChangingKeycardPairingCodeState, controller: Controller) = +method executePreSecondaryStateCommand*(self: ChangingKeycardPairingCodeState, controller: Controller) = if self.flowType == FlowType.ChangePairingCode: controller.storePairingCodeToKeycard(controller.getPairingCode()) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pin_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pin_state.nim index 64ee3b2043..77cf1873e7 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pin_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_pin_state.nim @@ -8,7 +8,7 @@ proc newChangingKeycardPinState*(flowType: FlowType, backState: State): Changing proc delete*(self: ChangingKeycardPinState) = self.State.delete -method executeSecondaryCommand*(self: ChangingKeycardPinState, controller: Controller) = +method executePreSecondaryStateCommand*(self: ChangingKeycardPinState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPin: controller.storePinToKeycard(controller.getPin(), "") diff --git a/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_puk_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_puk_state.nim index d2b17f6986..1988905916 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_puk_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/changing_keycard_puk_state.nim @@ -8,7 +8,7 @@ proc newChangingKeycardPukState*(flowType: FlowType, backState: State): Changing proc delete*(self: ChangingKeycardPukState) = self.State.delete -method executeSecondaryCommand*(self: ChangingKeycardPukState, controller: Controller) = +method executePreSecondaryStateCommand*(self: ChangingKeycardPukState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.storePukToKeycard(controller.getPuk()) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/create_pairing_code_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/create_pairing_code_state.nim index 0838d854b0..c38565fe53 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/create_pairing_code_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/create_pairing_code_state.nim @@ -14,6 +14,6 @@ method getNextPrimaryState*(self: CreatePairingCodeState, controller: Controller return createState(StateType.ChangingKeycardPairingCode, self.flowType, nil) return createState(StateType.ChangingKeycardPairingCodeFailure, self.flowType, nil) -method executeTertiaryCommand*(self: CreatePairingCodeState, controller: Controller) = +method executePreTertiaryStateCommand*(self: CreatePairingCodeState, controller: Controller) = if self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/create_pin_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/create_pin_state.nim index 2739886afc..3fa26c1efb 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/create_pin_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/create_pin_state.nim @@ -8,14 +8,14 @@ proc newCreatePinState*(flowType: FlowType, backState: State): CreatePinState = proc delete*(self: CreatePinState) = self.State.delete -method executeBackCommand*(self: CreatePinState, controller: Controller) = +method executePreBackStateCommand*(self: CreatePinState, controller: Controller) = controller.setPin("") controller.setPinMatch(false) if self.flowType == FlowType.SetupNewKeycard: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: controller.cancelCurrentFlow() -method executeTertiaryCommand*(self: CreatePinState, controller: Controller) = +method executePreTertiaryStateCommand*(self: CreatePinState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.ChangeKeycardPin: diff --git a/src/app/modules/shared_modules/keycard_popup/internal/create_puk_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/create_puk_state.nim index d24b2afa55..8f618384d4 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/create_puk_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/create_puk_state.nim @@ -8,7 +8,7 @@ proc newCreatePukState*(flowType: FlowType, backState: State): CreatePukState = proc delete*(self: CreatePukState) = self.State.delete -method executeTertiaryCommand*(self: CreatePukState, controller: Controller) = +method executePreTertiaryStateCommand*(self: CreatePukState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/enter_biometrics_password_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/enter_biometrics_password_state.nim index a32a67a921..bdb33c9de3 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/enter_biometrics_password_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/enter_biometrics_password_state.nim @@ -10,7 +10,7 @@ proc newEnterBiometricsPasswordState*(flowType: FlowType, backState: State): Ent proc delete*(self: EnterBiometricsPasswordState) = self.State.delete -method executePrimaryCommand*(self: EnterBiometricsPasswordState, controller: Controller) = +method executePrePrimaryStateCommand*(self: EnterBiometricsPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: let password = controller.getPassword() self.success = controller.verifyPassword(password) @@ -25,7 +25,7 @@ method getNextPrimaryState*(self: EnterBiometricsPasswordState, controller: Cont if not self.success: return createState(StateType.WrongBiometricsPassword, self.flowType, nil) -method executeTertiaryCommand*(self: EnterBiometricsPasswordState, controller: Controller) = +method executePreTertiaryStateCommand*(self: EnterBiometricsPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/enter_keycard_name_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/enter_keycard_name_state.nim index 59960c21fa..0fd2ff21e9 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/enter_keycard_name_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/enter_keycard_name_state.nim @@ -14,7 +14,7 @@ method getNextPrimaryState*(self: EnterKeycardNameState, controller: Controller) if self.flowType == FlowType.RenameKeycard: return createState(StateType.RenamingKeycard, self.flowType, nil) -method executeTertiaryCommand*(self: EnterKeycardNameState, controller: Controller) = +method executePreTertiaryStateCommand*(self: EnterKeycardNameState, controller: Controller) = if self.flowType == FlowType.RenameKeycard: controller.setPassword("") controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/enter_password_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/enter_password_state.nim index 741f47e19b..10b2f1bcc7 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/enter_password_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/enter_password_state.nim @@ -10,7 +10,7 @@ proc newEnterPasswordState*(flowType: FlowType, backState: State): EnterPassword proc delete*(self: EnterPasswordState) = self.State.delete -method executePrimaryCommand*(self: EnterPasswordState, controller: Controller) = +method executePrePrimaryStateCommand*(self: EnterPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: let password = controller.getPassword() self.success = controller.verifyPassword(password) @@ -24,11 +24,11 @@ method getNextPrimaryState*(self: EnterPasswordState, controller: Controller): S if not self.success: return createState(StateType.WrongPassword, self.flowType, nil) -method executeSecondaryCommand*(self: EnterPasswordState, controller: Controller) = +method executePreSecondaryStateCommand*(self: EnterPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.tryToObtainDataFromKeychain() -method executeTertiaryCommand*(self: EnterPasswordState, controller: Controller) = +method executePreTertiaryStateCommand*(self: EnterPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/enter_pin_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/enter_pin_state.nim index 60ea2f219b..9149e8d037 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/enter_pin_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/enter_pin_state.nim @@ -16,7 +16,7 @@ method getNextPrimaryState*(self: EnterPinState, controller: Controller): State if controller.getPin().len == PINLengthForStatusApp: controller.enterKeycardPin(controller.getPin()) -method executeSecondaryCommand*(self: EnterPinState, controller: Controller) = +method executePreSecondaryStateCommand*(self: EnterPinState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.FactoryReset or self.flowType == FlowType.DisplayKeycardContent or @@ -30,7 +30,7 @@ method executeSecondaryCommand*(self: EnterPinState, controller: Controller) = controller.setUsePinFromBiometrics(false) controller.tryToObtainDataFromKeychain() -method executeTertiaryCommand*(self: EnterPinState, controller: Controller) = +method executePreTertiaryStateCommand*(self: EnterPinState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/enter_puk_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/enter_puk_state.nim index 4bfc678c6b..9b7dc9aa8a 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/enter_puk_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/enter_puk_state.nim @@ -8,12 +8,12 @@ proc newEnterPukState*(flowType: FlowType, backState: State): EnterPukState = proc delete*(self: EnterPukState) = self.State.delete -method executePrimaryCommand*(self: EnterPukState, controller: Controller) = +method executePrePrimaryStateCommand*(self: EnterPukState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: if controller.getPuk().len == PUKLengthForStatusApp: controller.enterKeycardPuk(controller.getPuk()) -method executeTertiaryCommand*(self: EnterPukState, controller: Controller) = +method executePreTertiaryStateCommand*(self: EnterPukState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/enter_seed_phrase_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/enter_seed_phrase_state.nim index f474a5138b..fa28c72fab 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/enter_seed_phrase_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/enter_seed_phrase_state.nim @@ -10,7 +10,7 @@ proc newEnterSeedPhraseState*(flowType: FlowType, backState: State): EnterSeedPh proc delete*(self: EnterSeedPhraseState) = self.State.delete -method executePrimaryCommand*(self: EnterSeedPhraseState, controller: Controller) = +method executePrePrimaryStateCommand*(self: EnterSeedPhraseState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: self.verifiedSeedPhrase = controller.validSeedPhrase(controller.getSeedPhrase()) and controller.seedPhraseRefersToSelectedKeyPair(controller.getSeedPhrase()) @@ -32,7 +32,7 @@ method getNextPrimaryState*(self: EnterSeedPhraseState, controller: Controller): if not self.verifiedSeedPhrase: return createState(StateType.WrongSeedPhrase, self.flowType, nil) -method executeTertiaryCommand*(self: EnterSeedPhraseState, controller: Controller) = +method executePreTertiaryStateCommand*(self: EnterSeedPhraseState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_displayed_metadata_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_displayed_metadata_state.nim index bc6753ea40..22553de9d8 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_displayed_metadata_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_displayed_metadata_state.nim @@ -8,14 +8,14 @@ proc newFactoryResetConfirmationDisplayMetadataState*(flowType: FlowType, backSt proc delete*(self: FactoryResetConfirmationDisplayMetadataState) = self.State.delete -method executePrimaryCommand*(self: FactoryResetConfirmationDisplayMetadataState, controller: Controller) = +method executePrePrimaryStateCommand*(self: FactoryResetConfirmationDisplayMetadataState, controller: Controller) = if self.flowType == FlowType.FactoryReset: controller.runGetAppInfoFlow(factoryReset = true) elif self.flowType == FlowType.SetupNewKeycard: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true)) controller.runGetAppInfoFlow(factoryReset = true) -method executeTertiaryCommand*(self: FactoryResetConfirmationDisplayMetadataState, controller: Controller) = +method executePreTertiaryStateCommand*(self: FactoryResetConfirmationDisplayMetadataState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_state.nim index 2c249b5371..d71742bdfc 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_confirmation_state.nim @@ -8,14 +8,14 @@ proc newFactoryResetConfirmationState*(flowType: FlowType, backState: State): Fa proc delete*(self: FactoryResetConfirmationState) = self.State.delete -method executePrimaryCommand*(self: FactoryResetConfirmationState, controller: Controller) = +method executePrePrimaryStateCommand*(self: FactoryResetConfirmationState, controller: Controller) = if self.flowType == FlowType.FactoryReset: controller.runGetAppInfoFlow(factoryReset = true) elif self.flowType == FlowType.SetupNewKeycard: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true)) controller.runGetAppInfoFlow(factoryReset = true) -method executeTertiaryCommand*(self: FactoryResetConfirmationState, controller: Controller) = +method executePreTertiaryStateCommand*(self: FactoryResetConfirmationState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_success_state.nim index 5d3f6304ef..88994df870 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/factory_reset_success_state.nim @@ -8,13 +8,13 @@ proc newFactoryResetSuccessState*(flowType: FlowType, backState: State): Factory proc delete*(self: FactoryResetSuccessState) = self.State.delete -method executePrimaryCommand*(self: FactoryResetSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: FactoryResetSuccessState, controller: Controller) = if self.flowType == FlowType.FactoryReset: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) elif self.flowType == FlowType.SetupNewKeycard: controller.runLoadAccountFlow() -method executeTertiaryCommand*(self: FactoryResetSuccessState, controller: Controller) = +method executePreTertiaryStateCommand*(self: FactoryResetSuccessState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/insert_keycard_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/insert_keycard_state.nim index fe8bc2b929..1404ae9d57 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/insert_keycard_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/insert_keycard_state.nim @@ -8,12 +8,12 @@ proc newInsertKeycardState*(flowType: FlowType, backState: State): InsertKeycard proc delete*(self: InsertKeycardState) = self.State.delete -method executeBackCommand*(self: InsertKeycardState, controller: Controller) = +method executePreBackStateCommand*(self: InsertKeycardState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: controller.cancelCurrentFlow() -method executeTertiaryCommand*(self: InsertKeycardState, controller: Controller) = +method executePreTertiaryStateCommand*(self: InsertKeycardState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_failure_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_failure_state.nim index bd186aa2b8..6b15bdf337 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_failure_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_failure_state.nim @@ -8,10 +8,10 @@ proc newKeyPairMigrateFailureState*(flowType: FlowType, backState: State): KeyPa proc delete*(self: KeyPairMigrateFailureState) = self.State.delete -method executePrimaryCommand*(self: KeyPairMigrateFailureState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeyPairMigrateFailureState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: KeyPairMigrateFailureState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeyPairMigrateFailureState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_success_state.nim index 79f3e1ef82..a1b78956c5 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/key_pair_migrate_success_state.nim @@ -8,7 +8,7 @@ proc newKeyPairMigrateSuccessState*(flowType: FlowType, backState: State): KeyPa proc delete*(self: KeyPairMigrateSuccessState) = self.State.delete -method executePrimaryCommand*(self: KeyPairMigrateSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeyPairMigrateSuccessState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) if controller.getSelectedKeyPairIsProfile(): diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_already_unlocked_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_already_unlocked_state.nim index 8880418ae3..f5a344ebd9 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_already_unlocked_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_already_unlocked_state.nim @@ -8,10 +8,10 @@ proc newKeycardAlreadyUnlockedState*(flowType: FlowType, backState: State): Keyc proc delete*(self: KeycardAlreadyUnlockedState) = self.State.delete -method executePrimaryCommand*(self: KeycardAlreadyUnlockedState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeycardAlreadyUnlockedState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: KeycardAlreadyUnlockedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardAlreadyUnlockedState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_failure_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_failure_state.nim index 0a51d28c94..9724b79d3a 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_failure_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_failure_state.nim @@ -8,10 +8,10 @@ proc newChangingKeycardPairingCodeFailureState*(flowType: FlowType, backState: S proc delete*(self: ChangingKeycardPairingCodeFailureState) = self.State.delete -method executePrimaryCommand*(self: ChangingKeycardPairingCodeFailureState, controller: Controller) = +method executePrePrimaryStateCommand*(self: ChangingKeycardPairingCodeFailureState, controller: Controller) = if self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: ChangingKeycardPairingCodeFailureState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ChangingKeycardPairingCodeFailureState, controller: Controller) = if self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_success_state.nim index 75bf73f405..6613497df8 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pairing_code_success_state.nim @@ -8,10 +8,10 @@ proc newChangingKeycardPairingCodeSuccessState*(flowType: FlowType, backState: S proc delete*(self: ChangingKeycardPairingCodeSuccessState) = self.State.delete -method executePrimaryCommand*(self: ChangingKeycardPairingCodeSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: ChangingKeycardPairingCodeSuccessState, controller: Controller) = if self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: ChangingKeycardPairingCodeSuccessState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ChangingKeycardPairingCodeSuccessState, controller: Controller) = if self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_failure_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_failure_state.nim index 21e463d5a6..927628b35e 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_failure_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_failure_state.nim @@ -8,10 +8,10 @@ proc newChangingKeycardPinFailureState*(flowType: FlowType, backState: State): C proc delete*(self: ChangingKeycardPinFailureState) = self.State.delete -method executePrimaryCommand*(self: ChangingKeycardPinFailureState, controller: Controller) = +method executePrePrimaryStateCommand*(self: ChangingKeycardPinFailureState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPin: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: ChangingKeycardPinFailureState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ChangingKeycardPinFailureState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPin: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_success_state.nim index f019d88e78..ea50cf85ca 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_pin_success_state.nim @@ -8,10 +8,10 @@ proc newChangingKeycardPinSuccessState*(flowType: FlowType, backState: State): C proc delete*(self: ChangingKeycardPinSuccessState) = self.State.delete -method executePrimaryCommand*(self: ChangingKeycardPinSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: ChangingKeycardPinSuccessState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPin: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: ChangingKeycardPinSuccessState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ChangingKeycardPinSuccessState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPin: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_failure_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_failure_state.nim index 402dc7885a..5b68039601 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_failure_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_failure_state.nim @@ -8,10 +8,10 @@ proc newChangingKeycardPukFailureState*(flowType: FlowType, backState: State): C proc delete*(self: ChangingKeycardPukFailureState) = self.State.delete -method executePrimaryCommand*(self: ChangingKeycardPukFailureState, controller: Controller) = +method executePrePrimaryStateCommand*(self: ChangingKeycardPukFailureState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: ChangingKeycardPukFailureState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ChangingKeycardPukFailureState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_success_state.nim index 4f26dca27a..544075aaa0 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_change_puk_success_state.nim @@ -8,10 +8,10 @@ proc newChangingKeycardPukSuccessState*(flowType: FlowType, backState: State): C proc delete*(self: ChangingKeycardPukSuccessState) = self.State.delete -method executePrimaryCommand*(self: ChangingKeycardPukSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: ChangingKeycardPukSuccessState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: ChangingKeycardPukSuccessState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ChangingKeycardPukSuccessState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_metadata_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_metadata_state.nim index 36243ea969..cf17c1ccf2 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_metadata_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_metadata_state.nim @@ -8,14 +8,14 @@ proc newKeycardEmptyMetadataState*(flowType: FlowType, backState: State): Keycar proc delete*(self: KeycardEmptyMetadataState) = self.State.delete -method executeTertiaryCommand*(self: KeycardEmptyMetadataState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardEmptyMetadataState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.DisplayKeycardContent or self.flowType == FlowType.RenameKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) -method executePrimaryCommand*(self: KeycardEmptyMetadataState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeycardEmptyMetadataState, controller: Controller) = if self.flowType == FlowType.DisplayKeycardContent or self.flowType == FlowType.RenameKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_state.nim index 8f711b9f95..7746a69590 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_empty_state.nim @@ -8,7 +8,7 @@ proc newKeycardEmptyState*(flowType: FlowType, backState: State): KeycardEmptySt proc delete*(self: KeycardEmptyState) = self.State.delete -method executePrimaryCommand*(self: KeycardEmptyState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeycardEmptyState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.Authentication or self.flowType == FlowType.UnlockKeycard or @@ -19,7 +19,7 @@ method executePrimaryCommand*(self: KeycardEmptyState, controller: Controller) = self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) -method executeTertiaryCommand*(self: KeycardEmptyState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardEmptyState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.Authentication or self.flowType == FlowType.UnlockKeycard or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_inserted_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_inserted_state.nim index 94691a2b59..cd894e9b66 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_inserted_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_inserted_state.nim @@ -8,7 +8,7 @@ proc newKeycardInsertedState*(flowType: FlowType, backState: State): KeycardInse proc delete*(self: KeycardInsertedState) = self.State.delete -method executeBackCommand*(self: KeycardInsertedState, controller: Controller) = +method executePreBackStateCommand*(self: KeycardInsertedState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: controller.cancelCurrentFlow() @@ -20,7 +20,7 @@ method getNextSecondaryState*(self: KeycardInsertedState, controller: Controller return createState(StateType.ReadingKeycard, self.flowType, self.getBackState) return createState(StateType.ReadingKeycard, self.flowType, nil) -method executeTertiaryCommand*(self: KeycardInsertedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardInsertedState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_metadata_display_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_metadata_display_state.nim index 728f2cfecf..d0f651f217 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_metadata_display_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_metadata_display_state.nim @@ -17,7 +17,7 @@ method getNextPrimaryState*(self: KeycardMetadataDisplayState, controller: Contr if self.flowType == FlowType.RenameKeycard: return createState(StateType.EnterKeycardName, self.flowType, nil) -method executeTertiaryCommand*(self: KeycardMetadataDisplayState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardMetadataDisplayState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.DisplayKeycardContent or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_not_empty_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_not_empty_state.nim index 94b4f0b626..5ae0d47bb6 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_not_empty_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_not_empty_state.nim @@ -8,12 +8,12 @@ proc newKeycardNotEmptyState*(flowType: FlowType, backState: State): KeycardNotE proc delete*(self: KeycardNotEmptyState) = self.State.delete -method executePrimaryCommand*(self: KeycardNotEmptyState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeycardNotEmptyState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.HideKeyPair, add = true)) controller.runGetMetadataFlow(resolveAddress = true) -method executeTertiaryCommand*(self: KeycardNotEmptyState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardNotEmptyState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_failure_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_failure_state.nim index c81902caf0..9e555798de 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_failure_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_failure_state.nim @@ -8,10 +8,10 @@ proc newKeycardRenameFailureState*(flowType: FlowType, backState: State): Keycar proc delete*(self: KeycardRenameFailureState) = self.State.delete -method executePrimaryCommand*(self: KeycardRenameFailureState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeycardRenameFailureState, controller: Controller) = if self.flowType == FlowType.RenameKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: KeycardRenameFailureState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardRenameFailureState, controller: Controller) = if self.flowType == FlowType.RenameKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_success_state.nim index db2024da9f..8200c28e91 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/keycard_rename_success_state.nim @@ -8,10 +8,10 @@ proc newKeycardRenameSuccessState*(flowType: FlowType, backState: State): Keycar proc delete*(self: KeycardRenameSuccessState) = self.State.delete -method executePrimaryCommand*(self: KeycardRenameSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: KeycardRenameSuccessState, controller: Controller) = if self.flowType == FlowType.RenameKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: KeycardRenameSuccessState, controller: Controller) = +method executePreTertiaryStateCommand*(self: KeycardRenameSuccessState, controller: Controller) = if self.flowType == FlowType.RenameKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/max_pairing_slots_reached_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/max_pairing_slots_reached_state.nim index d00370afbb..1fa6d0ddab 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/max_pairing_slots_reached_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/max_pairing_slots_reached_state.nim @@ -21,7 +21,7 @@ method getNextPrimaryState*(self: MaxPairingSlotsReachedState, controller: Contr controller.runSharedModuleFlow(FlowType.UnlockKeycard) return nil -method executeTertiaryCommand*(self: MaxPairingSlotsReachedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: MaxPairingSlotsReachedState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/max_pin_retries_reached_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/max_pin_retries_reached_state.nim index cbea373821..fc2af52b0c 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/max_pin_retries_reached_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/max_pin_retries_reached_state.nim @@ -26,7 +26,7 @@ method getNextPrimaryState*(self: MaxPinRetriesReachedState, controller: Control controller.runSharedModuleFlow(FlowType.UnlockKeycard) return nil -method executeTertiaryCommand*(self: MaxPinRetriesReachedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: MaxPinRetriesReachedState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.Authentication or self.flowType == FlowType.DisplayKeycardContent or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/max_puk_retries_reached_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/max_puk_retries_reached_state.nim index e9192dd6ff..9cbfc4079d 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/max_puk_retries_reached_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/max_puk_retries_reached_state.nim @@ -22,7 +22,7 @@ method getNextPrimaryState*(self: MaxPukRetriesReachedState, controller: Control if self.flowType == FlowType.UnlockKeycard: return createState(StateType.EnterSeedPhrase, self.flowType, self) -method executeTertiaryCommand*(self: MaxPukRetriesReachedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: MaxPukRetriesReachedState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/migrating_key_pair_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/migrating_key_pair_state.nim index 37c5ff2f74..c99fbec1c2 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/migrating_key_pair_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/migrating_key_pair_state.nim @@ -29,14 +29,14 @@ proc doMigration(self: MigratingKeyPairState, controller: Controller) = controller.runStoreMetadataFlow(selectedKeyPairDto.keycardName, controller.getPin(), controller.getSelectedKeyPairWalletPaths()) -method executePrimaryCommand*(self: MigratingKeyPairState, controller: Controller) = +method executePrePrimaryStateCommand*(self: MigratingKeyPairState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: if controller.getSelectedKeyPairIsProfile(): controller.authenticateUser() else: self.doMigration(controller) -method executeSecondaryCommand*(self: MigratingKeyPairState, controller: Controller) = +method executePreSecondaryStateCommand*(self: MigratingKeyPairState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: self.doMigration(controller) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/not_keycard_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/not_keycard_state.nim index a071cf2cbf..ca6b61cfb8 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/not_keycard_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/not_keycard_state.nim @@ -8,7 +8,7 @@ proc newNotKeycardState*(flowType: FlowType, backState: State): NotKeycardState proc delete*(self: NotKeycardState) = self.State.delete -method executeTertiaryCommand*(self: NotKeycardState, controller: Controller) = +method executePreTertiaryStateCommand*(self: NotKeycardState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/pin_set_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/pin_set_state.nim index c21da0e1e2..576b45f116 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/pin_set_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/pin_set_state.nim @@ -22,6 +22,6 @@ method getNextPrimaryState*(self: PinSetState, controller: Controller): State = if controller.getCurrentKeycardServiceFlow() == KCSFlowType.StoreMetadata: return createState(StateType.UnlockKeycardSuccess, self.flowType, nil) -method executeTertiaryCommand*(self: PinSetState, controller: Controller) = +method executePreTertiaryStateCommand*(self: PinSetState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/pin_verified_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/pin_verified_state.nim index ed19efc49d..fc2d85c36d 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/pin_verified_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/pin_verified_state.nim @@ -21,7 +21,7 @@ method getNextPrimaryState*(self: PinVerifiedState, controller: Controller): Sta if self.flowType == FlowType.ChangePairingCode: return createState(StateType.CreatePairingCode, self.flowType, nil) -method executeTertiaryCommand*(self: PinVerifiedState, controller: Controller) = +method executePreTertiaryStateCommand*(self: PinVerifiedState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.DisplayKeycardContent or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/plugin_reader_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/plugin_reader_state.nim index a0a927b3e8..b948dd3e96 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/plugin_reader_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/plugin_reader_state.nim @@ -8,12 +8,12 @@ proc newPluginReaderState*(flowType: FlowType, backState: State): PluginReaderSt proc delete*(self: PluginReaderState) = self.State.delete -method executeBackCommand*(self: PluginReaderState, controller: Controller) = +method executePreBackStateCommand*(self: PluginReaderState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: controller.cancelCurrentFlow() -method executeTertiaryCommand*(self: PluginReaderState, controller: Controller) = +method executePreTertiaryStateCommand*(self: PluginReaderState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/reading_keycard_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/reading_keycard_state.nim index 14403d655c..d1e092b157 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/reading_keycard_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/reading_keycard_state.nim @@ -8,12 +8,12 @@ proc newReadingKeycardState*(flowType: FlowType, backState: State): ReadingKeyca proc delete*(self: ReadingKeycardState) = self.State.delete -method executeBackCommand*(self: ReadingKeycardState, controller: Controller) = +method executePreBackStateCommand*(self: ReadingKeycardState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: controller.cancelCurrentFlow() -method executeTertiaryCommand*(self: ReadingKeycardState, controller: Controller) = +method executePreTertiaryStateCommand*(self: ReadingKeycardState, controller: Controller) = error "reading state must not be canceled" method getNextSecondaryState*(self: ReadingKeycardState, controller: Controller): State = diff --git a/src/app/modules/shared_modules/keycard_popup/internal/recognized_keycard_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/recognized_keycard_state.nim index 6dce660a4e..fa34b58c9d 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/recognized_keycard_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/recognized_keycard_state.nim @@ -8,7 +8,7 @@ proc newRecognizedKeycardState*(flowType: FlowType, backState: State): Recognize proc delete*(self: RecognizedKeycardState) = self.State.delete -method executeBackCommand*(self: RecognizedKeycardState, controller: Controller) = +method executePreBackStateCommand*(self: RecognizedKeycardState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: if not self.getBackState.isNil and self.getBackState.stateType == StateType.SelectExistingKeyPair: controller.cancelCurrentFlow() @@ -30,5 +30,5 @@ method getNextSecondaryState*(self: RecognizedKeycardState, controller: Controll self.flowType == FlowType.ChangePairingCode: return createState(StateType.EnterPin, self.flowType, nil) -method executeTertiaryCommand*(self: RecognizedKeycardState, controller: Controller) = +method executePreTertiaryStateCommand*(self: RecognizedKeycardState, controller: Controller) = error "recognized state must not be canceled" \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/renaming_keycard_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/renaming_keycard_state.nim index 93bb0cb67b..207cbafb7a 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/renaming_keycard_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/renaming_keycard_state.nim @@ -10,7 +10,7 @@ proc newRenamingKeycardState*(flowType: FlowType, backState: State): RenamingKey proc delete*(self: RenamingKeycardState) = self.State.delete -method executePrimaryCommand*(self: RenamingKeycardState, controller: Controller) = +method executePrePrimaryStateCommand*(self: RenamingKeycardState, controller: Controller) = if self.flowType == FlowType.RenameKeycard: let md = controller.getMetadataFromKeycard() let paths = md.walletAccounts.map(a => a.path) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/repeat_pin_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/repeat_pin_state.nim index 00f47404ec..80ccaad6e6 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/repeat_pin_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/repeat_pin_state.nim @@ -8,11 +8,11 @@ proc newRepeatPinState*(flowType: FlowType, backState: State): RepeatPinState = proc delete*(self: RepeatPinState) = self.State.delete -method executeBackCommand*(self: RepeatPinState, controller: Controller) = +method executePreBackStateCommand*(self: RepeatPinState, controller: Controller) = controller.setPin("") controller.setPinMatch(false) -method executeSecondaryCommand*(self: RepeatPinState, controller: Controller) = +method executePreSecondaryStateCommand*(self: RepeatPinState, controller: Controller) = if not controller.getPinMatch(): return if self.flowType == FlowType.SetupNewKeycard: @@ -26,7 +26,7 @@ method getNextSecondaryState*(self: RepeatPinState, controller: Controller): Sta if self.flowType == FlowType.ChangeKeycardPin: return createState(StateType.ChangingKeycardPin, self.flowType, nil) -method executeTertiaryCommand*(self: RepeatPinState, controller: Controller) = +method executePreTertiaryStateCommand*(self: RepeatPinState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.ChangeKeycardPin: diff --git a/src/app/modules/shared_modules/keycard_popup/internal/repeat_puk_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/repeat_puk_state.nim index 7737f7fb98..9e4da6ffa2 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/repeat_puk_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/repeat_puk_state.nim @@ -8,7 +8,7 @@ proc newRepeatPukState*(flowType: FlowType, backState: State): RepeatPukState = proc delete*(self: RepeatPukState) = self.State.delete -method executeBackCommand*(self: RepeatPukState, controller: Controller) = +method executePreBackStateCommand*(self: RepeatPukState, controller: Controller) = controller.setPuk("") controller.setPukMatch(false) @@ -18,6 +18,6 @@ method getNextSecondaryState*(self: RepeatPukState, controller: Controller): Sta if self.flowType == FlowType.ChangeKeycardPuk: return createState(StateType.ChangingKeycardPuk, self.flowType, nil) -method executeTertiaryCommand*(self: RepeatPukState, controller: Controller) = +method executePreTertiaryStateCommand*(self: RepeatPukState, controller: Controller) = if self.flowType == FlowType.ChangeKeycardPuk: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_display_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_display_state.nim index 3ad25089f6..6f2c733e69 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_display_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_display_state.nim @@ -8,7 +8,7 @@ proc newSeedPhraseDisplayState*(flowType: FlowType, backState: State): SeedPhras proc delete*(self: SeedPhraseDisplayState) = self.State.delete -method executeTertiaryCommand*(self: SeedPhraseDisplayState, controller: Controller) = +method executePreTertiaryStateCommand*(self: SeedPhraseDisplayState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_enter_words_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_enter_words_state.nim index c18968e9e8..1d5eda924f 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_enter_words_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/seed_phrase_enter_words_state.nim @@ -10,12 +10,12 @@ proc newSeedPhraseEnterWordsState*(flowType: FlowType, backState: State): SeedPh proc delete*(self: SeedPhraseEnterWordsState) = self.State.delete -method executePrimaryCommand*(self: SeedPhraseEnterWordsState, controller: Controller) = +method executePrePrimaryStateCommand*(self: SeedPhraseEnterWordsState, controller: Controller) = let mnemonic = controller.getMnemonic() controller.setSeedPhrase(mnemonic) controller.storeSeedPhraseToKeycard(mnemonic.split(" ").len, mnemonic) -method executeTertiaryCommand*(self: SeedPhraseEnterWordsState, controller: Controller) = +method executePreTertiaryStateCommand*(self: SeedPhraseEnterWordsState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/select_existing_key_pair_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/select_existing_key_pair_state.nim index 3fd6859011..20c78fd71a 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/select_existing_key_pair_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/select_existing_key_pair_state.nim @@ -8,11 +8,11 @@ proc newSelectExistingKeyPairState*(flowType: FlowType, backState: State): Selec proc delete*(self: SelectExistingKeyPairState) = self.State.delete -method executePrimaryCommand*(self: SelectExistingKeyPairState, controller: Controller) = +method executePrePrimaryStateCommand*(self: SelectExistingKeyPairState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.runLoadAccountFlow() -method executeTertiaryCommand*(self: SelectExistingKeyPairState, controller: Controller) = +method executePreTertiaryStateCommand*(self: SelectExistingKeyPairState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/state.nim b/src/app/modules/shared_modules/keycard_popup/internal/state.nim index d0658dcc7e..4cf7c5bb2a 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/state.nim @@ -111,32 +111,48 @@ method getBackState*(self: State): State {.inline base.} = method displayBackButton*(self: State): bool {.inline base.} = return not self.backState.isNil -## Returns next state instance in case the "primary" action is triggered +## Returns next state instance if "primary" action is triggered method getNextPrimaryState*(self: State, controller: Controller): State {.inline base.} = return nil -## Returns next state instance in case the "secondary" action is triggered +## Returns next state instance if "secondary" action is triggered method getNextSecondaryState*(self: State, controller: Controller): State {.inline base.} = return nil -## Returns next state instance in case the "tertiary" action is triggered +## Returns next state instance if "tertiary" action is triggered method getNextTertiaryState*(self: State, controller: Controller): State {.inline base.} = return nil -## This method is executed in case "back" button is clicked -method executeBackCommand*(self: State, controller: Controller) {.inline base.} = +## This method is executed before back state is set, if "back" action is triggered +method executePreBackStateCommand*(self: State, controller: Controller) {.inline base.} = discard -## This method is executed in case "primary" action is triggered -method executePrimaryCommand*(self: State, controller: Controller) {.inline base.} = +## This method is executed after back state is set, if "back" action is triggered +method executePostBackStateCommand*(self: State, controller: Controller) {.inline base.} = discard -## This method is executed in case "secondary" action is triggered -method executeSecondaryCommand*(self: State, controller: Controller) {.inline base.} = +## This method is executed before primary state is set, if "primary" action is triggered +method executePrePrimaryStateCommand*(self: State, controller: Controller) {.inline base.} = discard -## This method is executed in case "tertiary" action is triggered -method executeTertiaryCommand*(self: State, controller: Controller) {.inline base.} = +## This method is executed after primary state is set, if "primary" action is triggered +method executePostPrimaryStateCommand*(self: State, controller: Controller) {.inline base.} = + discard + +## This method is executed before secondary state is set, if "secondary" action is triggered +method executePreSecondaryStateCommand*(self: State, controller: Controller) {.inline base.} = + discard + +## This method is executed after secondary state is set, if "secondary" action is triggered +method executePostSecondaryStateCommand*(self: State, controller: Controller) {.inline base.} = + 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 diff --git a/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_options_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_options_state.nim index 17d24aaa48..f46974e769 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_options_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_options_state.nim @@ -16,6 +16,6 @@ method getNextSecondaryState*(self: UnlockKeycardOptionsState, controller: Contr if self.flowType == FlowType.UnlockKeycard: return createState(StateType.EnterPuk, self.flowType, self) -method executeTertiaryCommand*(self: UnlockKeycardOptionsState, controller: Controller) = +method executePreTertiaryStateCommand*(self: UnlockKeycardOptionsState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_success_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_success_state.nim index 34d91e7cdf..d641ee51a1 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_success_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/unlock_keycard_success_state.nim @@ -8,10 +8,10 @@ proc newUnlockKeycardSuccessState*(flowType: FlowType, backState: State): Unlock proc delete*(self: UnlockKeycardSuccessState) = self.State.delete -method executePrimaryCommand*(self: UnlockKeycardSuccessState, controller: Controller) = +method executePrePrimaryStateCommand*(self: UnlockKeycardSuccessState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: UnlockKeycardSuccessState, controller: Controller) = +method executePreTertiaryStateCommand*(self: UnlockKeycardSuccessState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_biometrics_password_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_biometrics_password_state.nim index 35805a1592..bf619984f6 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_biometrics_password_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_biometrics_password_state.nim @@ -10,7 +10,7 @@ proc newWrongBiometricsPasswordState*(flowType: FlowType, backState: State): Wro proc delete*(self: WrongBiometricsPasswordState) = self.State.delete -method executePrimaryCommand*(self: WrongBiometricsPasswordState, controller: Controller) = +method executePrePrimaryStateCommand*(self: WrongBiometricsPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongPassword, add = false)) let password = controller.getPassword() @@ -21,7 +21,7 @@ method executePrimaryCommand*(self: WrongBiometricsPasswordState, controller: Co else: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongPassword, add = true)) -method executeTertiaryCommand*(self: WrongBiometricsPasswordState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongBiometricsPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_keycard_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_keycard_state.nim index c5f7760306..0a114b9198 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_keycard_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_keycard_state.nim @@ -8,7 +8,7 @@ proc newWrongKeycardState*(flowType: FlowType, backState: State): WrongKeycardSt proc delete*(self: WrongKeycardState) = self.State.delete -method executePrimaryCommand*(self: WrongKeycardState, controller: Controller) = +method executePrePrimaryStateCommand*(self: WrongKeycardState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.RenameKeycard or self.flowType == FlowType.ChangeKeycardPin or @@ -16,7 +16,7 @@ method executePrimaryCommand*(self: WrongKeycardState, controller: Controller) = self.flowType == FlowType.ChangePairingCode: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true) -method executeTertiaryCommand*(self: WrongKeycardState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongKeycardState, controller: Controller) = if self.flowType == FlowType.Authentication or self.flowType == FlowType.UnlockKeycard or self.flowType == FlowType.RenameKeycard or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_keychain_pin_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_keychain_pin_state.nim index ca73912ce1..6ac8bf130a 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_keychain_pin_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_keychain_pin_state.nim @@ -14,7 +14,7 @@ method getNextPrimaryState*(self: WrongKeychainPinState, controller: Controller) controller.enterKeycardPin(controller.getPin()) return nil -method executeTertiaryCommand*(self: WrongKeychainPinState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongKeychainPinState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_password_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_password_state.nim index 1371724ae9..3dcf02c927 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_password_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_password_state.nim @@ -10,7 +10,7 @@ proc newWrongPasswordState*(flowType: FlowType, backState: State): WrongPassword proc delete*(self: WrongPasswordState) = self.State.delete -method executePrimaryCommand*(self: WrongPasswordState, controller: Controller) = +method executePrePrimaryStateCommand*(self: WrongPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongPassword, add = false)) let password = controller.getPassword() @@ -20,11 +20,11 @@ method executePrimaryCommand*(self: WrongPasswordState, controller: Controller) else: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongPassword, add = true)) -method executeSecondaryCommand*(self: WrongPasswordState, controller: Controller) = +method executePreSecondaryStateCommand*(self: WrongPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.tryToObtainDataFromKeychain() -method executeTertiaryCommand*(self: WrongPasswordState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongPasswordState, controller: Controller) = if self.flowType == FlowType.Authentication: controller.setPassword("") controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) \ No newline at end of file diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_pin_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_pin_state.nim index 31df35b6b2..c29149b324 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_pin_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_pin_state.nim @@ -22,7 +22,7 @@ method getNextPrimaryState*(self: WrongPinState, controller: Controller): State self.flowType == FlowType.ChangePairingCode: controller.runSharedModuleFlow(FlowType.FactoryReset) -method executeSecondaryCommand*(self: WrongPinState, controller: Controller) = +method executePreSecondaryStateCommand*(self: WrongPinState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.DisplayKeycardContent or @@ -36,7 +36,7 @@ method executeSecondaryCommand*(self: WrongPinState, controller: Controller) = controller.setUsePinFromBiometrics(false) controller.tryToObtainDataFromKeychain() -method executeTertiaryCommand*(self: WrongPinState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongPinState, controller: Controller) = if self.flowType == FlowType.FactoryReset or self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.Authentication or diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_puk_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_puk_state.nim index 48662bf493..938cadcf7b 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_puk_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_puk_state.nim @@ -8,12 +8,12 @@ proc newWrongPukState*(flowType: FlowType, backState: State): WrongPukState = proc delete*(self: WrongPukState) = self.State.delete -method executePrimaryCommand*(self: WrongPukState, controller: Controller) = +method executePrePrimaryStateCommand*(self: WrongPukState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: if controller.getPuk().len == PUKLengthForStatusApp: controller.enterKeycardPuk(controller.getPuk()) -method executeTertiaryCommand*(self: WrongPukState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongPukState, controller: Controller) = if self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/internal/wrong_seed_phrase_state.nim b/src/app/modules/shared_modules/keycard_popup/internal/wrong_seed_phrase_state.nim index 18259c5b22..3153886f4c 100644 --- a/src/app/modules/shared_modules/keycard_popup/internal/wrong_seed_phrase_state.nim +++ b/src/app/modules/shared_modules/keycard_popup/internal/wrong_seed_phrase_state.nim @@ -12,7 +12,7 @@ proc newWrongSeedPhraseState*(flowType: FlowType, backState: State): WrongSeedPh proc delete*(self: WrongSeedPhraseState) = self.State.delete -method executePrimaryCommand*(self: WrongSeedPhraseState, controller: Controller) = +method executePrePrimaryStateCommand*(self: WrongSeedPhraseState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongSeedPhrase, add = false)) sleep(500) # just to shortly remove text on the UI side @@ -32,7 +32,7 @@ method executePrimaryCommand*(self: WrongSeedPhraseState, controller: Controller else: controller.setKeycardData(updatePredefinedKeycardData(controller.getKeycardData(), PredefinedKeycardData.WrongSeedPhrase, add = true)) -method executeTertiaryCommand*(self: WrongSeedPhraseState, controller: Controller) = +method executePreTertiaryStateCommand*(self: WrongSeedPhraseState, controller: Controller) = if self.flowType == FlowType.SetupNewKeycard or self.flowType == FlowType.UnlockKeycard: controller.terminateCurrentFlow(lastStepInTheCurrentFlow = false) diff --git a/src/app/modules/shared_modules/keycard_popup/module.nim b/src/app/modules/shared_modules/keycard_popup/module.nim index 56611e8726..7fae9ed4da 100644 --- a/src/app/modules/shared_modules/keycard_popup/module.nim +++ b/src/app/modules/shared_modules/keycard_popup/module.nim @@ -166,10 +166,11 @@ method onBackActionClicked*[T](self: Module[T]) = error "sm_cannot resolve current state" return debug "sm_back_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType() - currStateObj.executeBackCommand(self.controller) + currStateObj.executePreBackStateCommand(self.controller) let backState = currStateObj.getBackState() self.preStateActivities(backState.flowType(), backState.stateType()) self.view.setCurrentState(backState) + currStateObj.executePostBackStateCommand(self.controller) debug "sm_back_action - set state", setCurrFlow=backState.flowType(), newCurrState=backState.stateType() currStateObj.delete() @@ -179,12 +180,13 @@ method onPrimaryActionClicked*[T](self: Module[T]) = error "sm_cannot resolve current state" return debug "sm_primary_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType() - currStateObj.executePrimaryCommand(self.controller) + currStateObj.executePrePrimaryStateCommand(self.controller) let nextState = currStateObj.getNextPrimaryState(self.controller) if nextState.isNil: return self.preStateActivities(nextState.flowType(), nextState.stateType()) self.view.setCurrentState(nextState) + currStateObj.executePostPrimaryStateCommand(self.controller) debug "sm_primary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType() method onSecondaryActionClicked*[T](self: Module[T]) = @@ -193,12 +195,13 @@ method onSecondaryActionClicked*[T](self: Module[T]) = error "sm_cannot resolve current state" return debug "sm_secondary_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType() - currStateObj.executeSecondaryCommand(self.controller) + currStateObj.executePreSecondaryStateCommand(self.controller) let nextState = currStateObj.getNextSecondaryState(self.controller) if nextState.isNil: return self.preStateActivities(nextState.flowType(), nextState.stateType()) self.view.setCurrentState(nextState) + currStateObj.executePostSecondaryStateCommand(self.controller) debug "sm_secondary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType() method onTertiaryActionClicked*[T](self: Module[T]) = @@ -207,12 +210,13 @@ method onTertiaryActionClicked*[T](self: Module[T]) = error "sm_cannot resolve current state" return debug "sm_tertiary_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType() - currStateObj.executeTertiaryCommand(self.controller) + 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) =