feat(@desktop/keycard): unlock keycard flow added to the flows which are using it

- factory reset flow updated with unlock keycard flow
- setup new keycard (keycard migrate) flow updated with unlock keycard flow
- authenticate flow updated with unlock keycard flow
This commit is contained in:
Sale Djenic 2022-09-20 16:05:02 +02:00 committed by saledjenic
parent d985e347ce
commit 10c3b66336
8 changed files with 61 additions and 12 deletions

View File

@ -28,6 +28,15 @@ method onSharedKeycarModuleFlowTerminated*(self: AccessInterface, lastStepInTheC
method runSetupKeycardPopup*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method runUnlockKeycardPopup*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method runDisplayKeycardContentPopup*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method runFactoryResetPopup*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
# View Delegate Interface
# Delegate for the view must be declared here due to use of QtObject and multi

View File

@ -95,11 +95,26 @@ method onSharedKeycarModuleFlowTerminated*(self: Module, lastStepInTheCurrentFlo
self.keycardSharedModule.delete
self.keycardSharedModule = nil
method onDisplayKeycardSharedModuleFlow*(self: Module) =
self.view.emitDisplayKeycardSharedModuleFlow()
method runSetupKeycardPopup*(self: Module) =
self.createSharedKeycardModule()
if self.keycardSharedModule.isNil:
return
self.keycardSharedModule.runFlow(keycard_shared_module.FlowType.SetupNewKeycard)
method onDisplayKeycardSharedModuleFlow*(self: Module) =
self.view.emitDisplayKeycardSharedModuleFlow()
method runUnlockKeycardPopup*(self: Module) =
self.createSharedKeycardModule()
if self.keycardSharedModule.isNil:
return
self.keycardSharedModule.runFlow(keycard_shared_module.FlowType.UnlockKeycard)
method runDisplayKeycardContentPopup*(self: Module) =
info "TODO: Run display keycard content..."
method runFactoryResetPopup*(self: Module) =
self.createSharedKeycardModule()
if self.keycardSharedModule.isNil:
return
self.keycardSharedModule.runFlow(keycard_shared_module.FlowType.FactoryReset)

View File

@ -33,3 +33,12 @@ QtObject:
proc runSetupKeycardPopup*(self: View) {.slot.} =
self.delegate.runSetupKeycardPopup()
proc runUnlockKeycardPopup*(self: View) {.slot.} =
self.delegate.runUnlockKeycardPopup()
proc runDisplayKeycardContentPopup*(self: View) {.slot.} =
self.delegate.runDisplayKeycardContentPopup()
proc runFactoryResetPopup*(self: View) {.slot.} =
self.delegate.runFactoryResetPopup()

View File

@ -13,7 +13,7 @@ method getNextPrimaryState*(self: MaxPairingSlotsReachedState, controller: Contr
self.flowType == FlowType.SetupNewKeycard:
return createState(StateType.FactoryResetConfirmation, self.flowType, self)
if self.flowType == FlowType.Authentication:
debug "Run Unlock Keycard flow... (not developed yet)"
controller.runSharedModuleFlow(FlowType.UnlockKeycard)
return nil
method executeTertiaryCommand*(self: MaxPairingSlotsReachedState, controller: Controller) =

View File

@ -9,12 +9,16 @@ proc delete*(self: MaxPinRetriesReachedState) =
self.State.delete
method getNextPrimaryState*(self: MaxPinRetriesReachedState, controller: Controller): State =
if self.flowType == FlowType.FactoryReset or
self.flowType == FlowType.SetupNewKeycard:
debug "Run Unlock Keycard flow... (not developed yet)"
if self.flowType == FlowType.FactoryReset:
controller.runSharedModuleFlow(FlowType.UnlockKeycard)
if self.flowType == FlowType.SetupNewKeycard:
let currValue = extractPredefinedKeycardDataToNumber(controller.getKeycardData())
if (currValue and PredefinedKeycardData.UseUnlockLabelForLockedState.int) > 0:
controller.runSharedModuleFlow(FlowType.UnlockKeycard)
return nil
return createState(StateType.FactoryResetConfirmation, self.flowType, self)
if self.flowType == FlowType.Authentication:
debug "Run Unlock Keycard flow... (not developed yet)"
controller.runSharedModuleFlow(FlowType.UnlockKeycard)
return nil
method executeTertiaryCommand*(self: MaxPinRetriesReachedState, controller: Controller) =

View File

@ -13,7 +13,7 @@ method getNextPrimaryState*(self: MaxPukRetriesReachedState, controller: Control
self.flowType == FlowType.SetupNewKeycard:
return createState(StateType.FactoryResetConfirmation, self.flowType, self)
if self.flowType == FlowType.Authentication:
debug "Run Unlock Keycard flow... (not developed yet)"
controller.runSharedModuleFlow(FlowType.UnlockKeycard)
if self.flowType == FlowType.UnlockKeycard:
return createState(StateType.EnterSeedPhrase, self.flowType, self)

View File

@ -9,4 +9,16 @@ QtObject {
function runSetupKeycardPopup() {
root.keycardModule.runSetupKeycardPopup()
}
function runUnlockKeycardPopup() {
root.keycardModule.runUnlockKeycardPopup()
}
function runDisplayKeycardContentPopup() {
root.keycardModule.runDisplayKeycardContentPopup()
}
function runFactoryResetPopup() {
root.keycardModule.runFactoryResetPopup()
}
}

View File

@ -167,7 +167,7 @@ SettingsContentBase {
}
]
onClicked: {
console.warn("TODO: Check whats on a Keycard...")
root.keycardStore.runDisplayKeycardContentPopup()
}
}
@ -182,7 +182,7 @@ SettingsContentBase {
}
]
onClicked: {
console.warn("TODO: Factory reset a Keycard...")
root.keycardStore.runFactoryResetPopup()
}
}
}