chore(@desktop/keycard): `quaternary` and `quinary` actions introduced

This commit is contained in:
Sale Djenic 2022-09-30 21:15:12 +02:00 committed by saledjenic
parent 095578b517
commit 2a019f330a
6 changed files with 73 additions and 1 deletions

View File

@ -120,6 +120,14 @@ method getNextSecondaryState*(self: State, controller: Controller): State {.inli
method getNextTertiaryState*(self: State, controller: Controller): State {.inline base.} = method getNextTertiaryState*(self: State, controller: Controller): State {.inline base.} =
return nil return nil
## Returns next state instance in case the "quaternary" action is triggered
method getNextQuaternaryState*(self: State, controller: Controller): State {.inline base.} =
return nil
## Returns next state instance in case the "quinary" action is triggered
method getNextQuinaryState*(self: State, controller: Controller): State {.inline base.} =
return nil
## This method is executed in case "back" button is clicked ## This method is executed in case "back" button is clicked
method executeBackCommand*(self: State, controller: Controller) {.inline base.} = method executeBackCommand*(self: State, controller: Controller) {.inline base.} =
discard discard
@ -136,6 +144,14 @@ method executeSecondaryCommand*(self: State, controller: Controller) {.inline ba
method executeTertiaryCommand*(self: State, controller: Controller) {.inline base.} = method executeTertiaryCommand*(self: State, controller: Controller) {.inline base.} =
discard discard
## This method is executed in case "quaternary" action is triggered
method executeQuaternaryCommand*(self: State, controller: Controller) {.inline base.} =
discard
## This method is executed in case "quinary" action is triggered
method executeQuinaryCommand*(self: State, controller: Controller) {.inline base.} =
discard
## This method is used for handling aync responses for keycard related states ## This method is used for handling aync responses for keycard related states
method resolveKeycardNextState*(self: State, keycardFlowType: string, keycardEvent: KeycardEvent, method resolveKeycardNextState*(self: State, keycardFlowType: string, keycardEvent: KeycardEvent,
controller: Controller): State {.inline base.} = controller: Controller): State {.inline base.} =

View File

@ -59,4 +59,12 @@ QtObject:
proc tertiaryActionClicked*(self: StateWrapper) {.signal.} proc tertiaryActionClicked*(self: StateWrapper) {.signal.}
proc doTertiaryAction*(self: StateWrapper) {.slot.} = proc doTertiaryAction*(self: StateWrapper) {.slot.} =
self.tertiaryActionClicked() self.tertiaryActionClicked()
proc quaternaryActionClicked*(self: StateWrapper) {.signal.}
proc doQuaternaryAction*(self: StateWrapper) {.slot.} =
self.quaternaryActionClicked()
proc quinaryActionClicked*(self: StateWrapper) {.signal.}
proc doQuinaryAction*(self: StateWrapper) {.slot.} =
self.quinaryActionClicked()

View File

@ -40,6 +40,12 @@ method onSecondaryActionClicked*(self: AccessInterface) {.base.} =
method onTertiaryActionClicked*(self: AccessInterface) {.base.} = method onTertiaryActionClicked*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method onQuaternaryActionClicked*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method onQuinaryActionClicked*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method startUpUIRaised*(self: AccessInterface) {.base.} = method startUpUIRaised*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -176,6 +176,32 @@ method onTertiaryActionClicked*[T](self: Module[T]) =
self.view.setCurrentStartupState(nextState) self.view.setCurrentStartupState(nextState)
debug "tertiary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType() debug "tertiary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType()
method onQuaternaryActionClicked*[T](self: Module[T]) =
let currStateObj = self.view.currentStartupStateObj()
if currStateObj.isNil:
error "cannot resolve current state"
return
debug "quaternary_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType()
currStateObj.executeQuaternaryCommand(self.controller)
let nextState = currStateObj.getNextQuaternaryState(self.controller)
if nextState.isNil:
return
self.view.setCurrentStartupState(nextState)
debug "quaternary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType()
method onQuinaryActionClicked*[T](self: Module[T]) =
let currStateObj = self.view.currentStartupStateObj()
if currStateObj.isNil:
error "cannot resolve current state"
return
debug "quinary_action", currFlow=currStateObj.flowType(), currState=currStateObj.stateType()
currStateObj.executeQuinaryCommand(self.controller)
let nextState = currStateObj.getNextQuinaryState(self.controller)
if nextState.isNil:
return
self.view.setCurrentStartupState(nextState)
debug "quinary_action - set state", setCurrFlow=nextState.flowType(), setCurrState=nextState.stateType()
method getImportedAccount*[T](self: Module[T]): GeneratedAccountDto = method getImportedAccount*[T](self: Module[T]): GeneratedAccountDto =
return self.controller.getImportedAccount() return self.controller.getImportedAccount()

View File

@ -59,6 +59,8 @@ QtObject:
signalConnect(result.currentStartupState, "primaryActionClicked()", result, "onPrimaryActionClicked()", 2) signalConnect(result.currentStartupState, "primaryActionClicked()", result, "onPrimaryActionClicked()", 2)
signalConnect(result.currentStartupState, "secondaryActionClicked()", result, "onSecondaryActionClicked()", 2) signalConnect(result.currentStartupState, "secondaryActionClicked()", result, "onSecondaryActionClicked()", 2)
signalConnect(result.currentStartupState, "tertiaryActionClicked()", result, "onTertiaryActionClicked()", 2) signalConnect(result.currentStartupState, "tertiaryActionClicked()", result, "onTertiaryActionClicked()", 2)
signalConnect(result.currentStartupState, "quaternaryActionClicked()", result, "onQuaternaryActionClicked()", 2)
signalConnect(result.currentStartupState, "quinaryActionClicked()", result, "onQuinaryActionClicked()", 2)
proc currentStartupStateObj*(self: View): State = proc currentStartupStateObj*(self: View): State =
return self.currentStartupState.getStateObj() return self.currentStartupState.getStateObj()
@ -87,6 +89,12 @@ QtObject:
proc onTertiaryActionClicked*(self: View) {.slot.} = proc onTertiaryActionClicked*(self: View) {.slot.} =
self.delegate.onTertiaryActionClicked() self.delegate.onTertiaryActionClicked()
proc onQuaternaryActionClicked*(self: View) {.slot.} =
self.delegate.onQuaternaryActionClicked()
proc onQuinaryActionClicked*(self: View) {.slot.} =
self.delegate.onQuinaryActionClicked()
proc startUpUIRaised*(self: View) {.signal.} proc startUpUIRaised*(self: View) {.signal.}
proc showBeforeGetStartedPopup*(self: View): bool {.slot.} = proc showBeforeGetStartedPopup*(self: View): bool {.slot.} =

View File

@ -23,6 +23,14 @@ QtObject {
root.currentStartupState.doTertiaryAction() root.currentStartupState.doTertiaryAction()
} }
function doQuaternaryAction() {
root.currentStartupState.doQuaternaryAction()
}
function doQuinaryAction() {
root.currentStartupState.doQuinaryAction()
}
function showBeforeGetStartedPopup() { function showBeforeGetStartedPopup() {
return root.startupModuleInst.showBeforeGetStartedPopup() return root.startupModuleInst.showBeforeGetStartedPopup()
} }