fix(@desktop/keycard): onboarding flow `I'm new to Status` -> `Import a seed phrase` -> `Import a seed phrase into a new Keycard` updated
Onboarding flow updated according to the latest related figma changes.
This commit is contained in:
parent
9be07efec3
commit
eb5ad8c911
|
@ -13,7 +13,8 @@ proc delete*(self: KeycardCreatePinState) =
|
|||
method executeBackCommand*(self: KeycardCreatePinState, controller: Controller) =
|
||||
controller.setPin("")
|
||||
controller.setPinMatch(false)
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method getNextPrimaryState*(self: KeycardCreatePinState, controller: Controller): State =
|
||||
|
|
|
@ -9,7 +9,8 @@ proc delete*(self: KeycardInsertKeycardState) =
|
|||
self.State.delete
|
||||
|
||||
method executeBackCommand*(self: KeycardInsertKeycardState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method resolveKeycardNextState*(self: KeycardInsertKeycardState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
||||
|
|
|
@ -9,7 +9,8 @@ proc delete*(self: KeycardInsertedKeycardState) =
|
|||
self.State.delete
|
||||
|
||||
method executeBackCommand*(self: KeycardInsertedKeycardState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method getNextPrimaryState*(self: KeycardInsertedKeycardState, controller: Controller): State =
|
||||
|
|
|
@ -9,7 +9,8 @@ proc delete*(self: KeycardPluginReaderState) =
|
|||
self.State.delete
|
||||
|
||||
method executeBackCommand*(self: KeycardPluginReaderState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method resolveKeycardNextState*(self: KeycardPluginReaderState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
||||
|
|
|
@ -9,7 +9,8 @@ proc delete*(self: KeycardReadingKeycardState) =
|
|||
self.State.delete
|
||||
|
||||
method executeBackCommand*(self: KeycardReadingKeycardState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method getNextPrimaryState*(self: KeycardReadingKeycardState, controller: Controller): State =
|
||||
|
|
|
@ -9,9 +9,12 @@ proc delete*(self: KeycardRecognizedKeycardState) =
|
|||
self.State.delete
|
||||
|
||||
method executeBackCommand*(self: KeycardRecognizedKeycardState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method getNextPrimaryState*(self: KeycardRecognizedKeycardState, controller: Controller): State =
|
||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||
return createState(StateType.KeycardCreatePin, self.flowType, self.getBackState)
|
||||
if self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
return createState(StateType.UserProfileEnterSeedPhrase, self.flowType, self.getBackState)
|
||||
|
|
|
@ -230,14 +230,21 @@ proc ensureReaderAndCardPresenceAndResolveNextOnboardingState*(state: State, key
|
|||
if keycardFlowType == ResponseTypeValueEnterNewPIN and
|
||||
keycardEvent.error.len > 0 and
|
||||
keycardEvent.error == ErrorRequireInit:
|
||||
if state.stateType == StateType.UserProfileEnterSeedPhrase:
|
||||
return createState(StateType.KeycardCreatePin, state.flowType, state.getBackState)
|
||||
return createState(StateType.KeycardRecognizedKeycard, state.flowType, state.getBackState)
|
||||
if keycardFlowType == ResponseTypeValueEnterPIN and
|
||||
keycardEvent.error.len == 0:
|
||||
return createState(StateType.KeycardNotEmpty, state.flowType, state.getBackState)
|
||||
if keycardFlowType == ResponseTypeValueSwapCard and
|
||||
keycardEvent.error.len > 0 and
|
||||
(keycardEvent.error == ErrorHasKeys or
|
||||
keycardEvent.error == RequestParamPUKRetries):
|
||||
keycardEvent.error.len > 0:
|
||||
if keycardEvent.error == ErrorNotAKeycard:
|
||||
return createState(StateType.KeycardNotKeycard, state.flowType, state.getBackState)
|
||||
if keycardEvent.error == RequestParamFreeSlots:
|
||||
return createState(StateType.KeycardLocked, state.flowType, state.getBackState)
|
||||
if keycardEvent.error == RequestParamPUKRetries:
|
||||
return createState(StateType.KeycardLocked, state.flowType, state.getBackState)
|
||||
if keycardEvent.error == ErrorHasKeys:
|
||||
return createState(StateType.KeycardNotEmpty, state.flowType, state.getBackState)
|
||||
if keycardFlowType == ResponseTypeValueKeycardFlowResult and
|
||||
keycardEvent.keyUid.len > 0:
|
||||
|
|
|
@ -31,7 +31,7 @@ method executePrimaryCommand*(self: UserProfileEnterSeedPhraseState, controller:
|
|||
self.successfulImport = controller.importMnemonic()
|
||||
if self.successfulImport:
|
||||
if self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.runLoadAccountFlow(controller.getSeedPhraseLength(), controller.getSeedPhrase(), puk = "", factoryReset = true)
|
||||
controller.storeSeedPhraseToKeycard(controller.getSeedPhraseLength(), controller.getSeedPhrase())
|
||||
elif self.flowType == FlowType.FirstRunOldUserKeycardImport:
|
||||
controller.runLoadAccountFlow(controller.getSeedPhraseLength(), controller.getSeedPhrase(), puk = "", factoryReset = true)
|
||||
|
||||
|
|
|
@ -8,8 +8,17 @@ proc newUserProfileImportSeedPhraseState*(flowType: FlowType, backState: State):
|
|||
proc delete*(self: UserProfileImportSeedPhraseState) =
|
||||
self.State.delete
|
||||
|
||||
method executeBackCommand*(self: UserProfileImportSeedPhraseState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||
controller.cancelCurrentFlow()
|
||||
|
||||
method getNextPrimaryState*(self: UserProfileImportSeedPhraseState, controller: Controller): State =
|
||||
return createState(StateType.UserProfileEnterSeedPhrase, FlowType.FirstRunNewUserImportSeedPhrase, self)
|
||||
|
||||
method getNextSecondaryState*(self: UserProfileImportSeedPhraseState, controller: Controller): State =
|
||||
return createState(StateType.UserProfileEnterSeedPhrase, FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard, self.getBackState)
|
||||
method executeSecondaryCommand*(self: UserProfileImportSeedPhraseState, controller: Controller) =
|
||||
self.setFlowType(FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard)
|
||||
controller.runLoadAccountFlow()
|
||||
|
||||
method resolveKeycardNextState*(self: UserProfileImportSeedPhraseState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
||||
controller: Controller): State =
|
||||
return ensureReaderAndCardPresenceAndResolveNextOnboardingState(self, keycardFlowType, keycardEvent, controller)
|
|
@ -159,9 +159,7 @@ QtObject:
|
|||
self.threadpool.start(arg)
|
||||
|
||||
proc startLoadAccountFlow*(self: Service, seedPhraseLength: int, seedPhrase: string, puk: string, factoryReset: bool) =
|
||||
var payload = %* {
|
||||
RequestParamOverwrite: true
|
||||
}
|
||||
var payload = %* { }
|
||||
if seedPhrase.len > 0 and seedPhraseLength > 0:
|
||||
payload[RequestParamMnemonic] = %* seedPhrase
|
||||
payload[RequestParamMnemonicLen] = %* seedPhraseLength
|
||||
|
|
|
@ -133,6 +133,7 @@ Item {
|
|||
PropertyChanges {
|
||||
target: info
|
||||
text: qsTr("It is very important that you do not lose this PIN")
|
||||
color: Theme.palette.dangerColor1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: message
|
||||
|
|
Loading…
Reference in New Issue