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,8 +13,9 @@ proc delete*(self: KeycardCreatePinState) =
|
||||||
method executeBackCommand*(self: KeycardCreatePinState, controller: Controller) =
|
method executeBackCommand*(self: KeycardCreatePinState, controller: Controller) =
|
||||||
controller.setPin("")
|
controller.setPin("")
|
||||||
controller.setPinMatch(false)
|
controller.setPinMatch(false)
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||||
controller.cancelCurrentFlow()
|
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method getNextPrimaryState*(self: KeycardCreatePinState, controller: Controller): State =
|
method getNextPrimaryState*(self: KeycardCreatePinState, controller: Controller): State =
|
||||||
if not self.pinValid:
|
if not self.pinValid:
|
||||||
|
|
|
@ -9,8 +9,9 @@ proc delete*(self: KeycardInsertKeycardState) =
|
||||||
self.State.delete
|
self.State.delete
|
||||||
|
|
||||||
method executeBackCommand*(self: KeycardInsertKeycardState, controller: Controller) =
|
method executeBackCommand*(self: KeycardInsertKeycardState, controller: Controller) =
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||||
controller.cancelCurrentFlow()
|
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method resolveKeycardNextState*(self: KeycardInsertKeycardState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
method resolveKeycardNextState*(self: KeycardInsertKeycardState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
||||||
controller: Controller): State =
|
controller: Controller): State =
|
||||||
|
|
|
@ -9,8 +9,9 @@ proc delete*(self: KeycardInsertedKeycardState) =
|
||||||
self.State.delete
|
self.State.delete
|
||||||
|
|
||||||
method executeBackCommand*(self: KeycardInsertedKeycardState, controller: Controller) =
|
method executeBackCommand*(self: KeycardInsertedKeycardState, controller: Controller) =
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||||
controller.cancelCurrentFlow()
|
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method getNextPrimaryState*(self: KeycardInsertedKeycardState, controller: Controller): State =
|
method getNextPrimaryState*(self: KeycardInsertedKeycardState, controller: Controller): State =
|
||||||
return createState(StateType.KeycardReadingKeycard, self.flowType, self.getBackState)
|
return createState(StateType.KeycardReadingKeycard, self.flowType, self.getBackState)
|
||||||
|
|
|
@ -9,8 +9,9 @@ proc delete*(self: KeycardPluginReaderState) =
|
||||||
self.State.delete
|
self.State.delete
|
||||||
|
|
||||||
method executeBackCommand*(self: KeycardPluginReaderState, controller: Controller) =
|
method executeBackCommand*(self: KeycardPluginReaderState, controller: Controller) =
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||||
controller.cancelCurrentFlow()
|
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method resolveKeycardNextState*(self: KeycardPluginReaderState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
method resolveKeycardNextState*(self: KeycardPluginReaderState, keycardFlowType: string, keycardEvent: KeycardEvent,
|
||||||
controller: Controller): State =
|
controller: Controller): State =
|
||||||
|
|
|
@ -9,8 +9,9 @@ proc delete*(self: KeycardReadingKeycardState) =
|
||||||
self.State.delete
|
self.State.delete
|
||||||
|
|
||||||
method executeBackCommand*(self: KeycardReadingKeycardState, controller: Controller) =
|
method executeBackCommand*(self: KeycardReadingKeycardState, controller: Controller) =
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||||
controller.cancelCurrentFlow()
|
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method getNextPrimaryState*(self: KeycardReadingKeycardState, controller: Controller): State =
|
method getNextPrimaryState*(self: KeycardReadingKeycardState, controller: Controller): State =
|
||||||
let (flowType, flowEvent) = controller.getLastReceivedKeycardData()
|
let (flowType, flowEvent) = controller.getLastReceivedKeycardData()
|
||||||
|
|
|
@ -9,9 +9,12 @@ proc delete*(self: KeycardRecognizedKeycardState) =
|
||||||
self.State.delete
|
self.State.delete
|
||||||
|
|
||||||
method executeBackCommand*(self: KeycardRecognizedKeycardState, controller: Controller) =
|
method executeBackCommand*(self: KeycardRecognizedKeycardState, controller: Controller) =
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys or
|
||||||
controller.cancelCurrentFlow()
|
self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method getNextPrimaryState*(self: KeycardRecognizedKeycardState, controller: Controller): State =
|
method getNextPrimaryState*(self: KeycardRecognizedKeycardState, controller: Controller): State =
|
||||||
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
if self.flowType == FlowType.FirstRunNewUserNewKeycardKeys:
|
||||||
return createState(StateType.KeycardCreatePin, self.flowType, self.getBackState)
|
return createState(StateType.KeycardCreatePin, self.flowType, self.getBackState)
|
||||||
|
if self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
return createState(StateType.UserProfileEnterSeedPhrase, self.flowType, self.getBackState)
|
||||||
|
|
|
@ -230,15 +230,22 @@ proc ensureReaderAndCardPresenceAndResolveNextOnboardingState*(state: State, key
|
||||||
if keycardFlowType == ResponseTypeValueEnterNewPIN and
|
if keycardFlowType == ResponseTypeValueEnterNewPIN and
|
||||||
keycardEvent.error.len > 0 and
|
keycardEvent.error.len > 0 and
|
||||||
keycardEvent.error == ErrorRequireInit:
|
keycardEvent.error == ErrorRequireInit:
|
||||||
return createState(StateType.KeycardCreatePin, state.flowType, state.getBackState)
|
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
|
if keycardFlowType == ResponseTypeValueEnterPIN and
|
||||||
keycardEvent.error.len == 0:
|
keycardEvent.error.len == 0:
|
||||||
return createState(StateType.KeycardNotEmpty, state.flowType, state.getBackState)
|
return createState(StateType.KeycardNotEmpty, state.flowType, state.getBackState)
|
||||||
if keycardFlowType == ResponseTypeValueSwapCard and
|
if keycardFlowType == ResponseTypeValueSwapCard and
|
||||||
keycardEvent.error.len > 0 and
|
keycardEvent.error.len > 0:
|
||||||
(keycardEvent.error == ErrorHasKeys or
|
if keycardEvent.error == ErrorNotAKeycard:
|
||||||
keycardEvent.error == RequestParamPUKRetries):
|
return createState(StateType.KeycardNotKeycard, state.flowType, state.getBackState)
|
||||||
return createState(StateType.KeycardNotEmpty, 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
|
if keycardFlowType == ResponseTypeValueKeycardFlowResult and
|
||||||
keycardEvent.keyUid.len > 0:
|
keycardEvent.keyUid.len > 0:
|
||||||
controller.setKeyUid(keycardEvent.keyUid)
|
controller.setKeyUid(keycardEvent.keyUid)
|
||||||
|
|
|
@ -31,7 +31,7 @@ method executePrimaryCommand*(self: UserProfileEnterSeedPhraseState, controller:
|
||||||
self.successfulImport = controller.importMnemonic()
|
self.successfulImport = controller.importMnemonic()
|
||||||
if self.successfulImport:
|
if self.successfulImport:
|
||||||
if self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
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:
|
elif self.flowType == FlowType.FirstRunOldUserKeycardImport:
|
||||||
controller.runLoadAccountFlow(controller.getSeedPhraseLength(), controller.getSeedPhrase(), puk = "", factoryReset = true)
|
controller.runLoadAccountFlow(controller.getSeedPhraseLength(), controller.getSeedPhrase(), puk = "", factoryReset = true)
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,17 @@ proc newUserProfileImportSeedPhraseState*(flowType: FlowType, backState: State):
|
||||||
proc delete*(self: UserProfileImportSeedPhraseState) =
|
proc delete*(self: UserProfileImportSeedPhraseState) =
|
||||||
self.State.delete
|
self.State.delete
|
||||||
|
|
||||||
|
method executeBackCommand*(self: UserProfileImportSeedPhraseState, controller: Controller) =
|
||||||
|
if self.flowType == FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard:
|
||||||
|
controller.cancelCurrentFlow()
|
||||||
|
|
||||||
method getNextPrimaryState*(self: UserProfileImportSeedPhraseState, controller: Controller): State =
|
method getNextPrimaryState*(self: UserProfileImportSeedPhraseState, controller: Controller): State =
|
||||||
return createState(StateType.UserProfileEnterSeedPhrase, FlowType.FirstRunNewUserImportSeedPhrase, self)
|
return createState(StateType.UserProfileEnterSeedPhrase, FlowType.FirstRunNewUserImportSeedPhrase, self)
|
||||||
|
|
||||||
method getNextSecondaryState*(self: UserProfileImportSeedPhraseState, controller: Controller): State =
|
method executeSecondaryCommand*(self: UserProfileImportSeedPhraseState, controller: Controller) =
|
||||||
return createState(StateType.UserProfileEnterSeedPhrase, FlowType.FirstRunNewUserImportSeedPhraseIntoKeycard, self.getBackState)
|
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)
|
self.threadpool.start(arg)
|
||||||
|
|
||||||
proc startLoadAccountFlow*(self: Service, seedPhraseLength: int, seedPhrase: string, puk: string, factoryReset: bool) =
|
proc startLoadAccountFlow*(self: Service, seedPhraseLength: int, seedPhrase: string, puk: string, factoryReset: bool) =
|
||||||
var payload = %* {
|
var payload = %* { }
|
||||||
RequestParamOverwrite: true
|
|
||||||
}
|
|
||||||
if seedPhrase.len > 0 and seedPhraseLength > 0:
|
if seedPhrase.len > 0 and seedPhraseLength > 0:
|
||||||
payload[RequestParamMnemonic] = %* seedPhrase
|
payload[RequestParamMnemonic] = %* seedPhrase
|
||||||
payload[RequestParamMnemonicLen] = %* seedPhraseLength
|
payload[RequestParamMnemonicLen] = %* seedPhraseLength
|
||||||
|
|
|
@ -133,6 +133,7 @@ Item {
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: info
|
target: info
|
||||||
text: qsTr("It is very important that you do not lose this PIN")
|
text: qsTr("It is very important that you do not lose this PIN")
|
||||||
|
color: Theme.palette.dangerColor1
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: message
|
target: message
|
||||||
|
|
Loading…
Reference in New Issue