wip simplified keycard api

This commit is contained in:
Jonathan Rainville 2024-12-16 14:38:09 -05:00
parent 8460c22240
commit 91513acea2
8 changed files with 51 additions and 2 deletions

View File

@ -529,6 +529,12 @@ proc getKeyUidForSeedPhrase*(self: Controller, seedPhrase: string): string =
proc getCurrentKeycardServiceFlow*(self: Controller): keycard_service.KCSFlowType =
return self.keycardService.getCurrentFlow()
proc getAppInfoFlow*(self: Controller) =
self.keycardService.getAppInfoFlow()
proc getMetadataFlow*(self: Controller) =
self.keycardService.getMetadataFlow()
proc getLastReceivedKeycardData*(self: Controller): tuple[flowType: string, flowEvent: KeycardEvent] =
return self.keycardService.getLastReceivedKeycardData()

View File

@ -41,6 +41,12 @@ method moveToLoadingAppState*(self: AccessInterface) {.base.} =
method moveToAppState*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method getAppInfoFlow*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method getMetadataFlow*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method moveToStartupState*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -491,6 +491,12 @@ method checkRepeatedKeycardPinWhileTyping*[T](self: Module[T], pin: string): boo
method getSeedPhrase*[T](self: Module[T]): string =
return self.controller.getSeedPhrase()
method getAppInfoFlow*[T](self: Module[T]) =
self.controller.getAppInfoFlow()
method getMetadataFlow*[T](self: Module[T]) =
self.controller.getMetadataFlow()
method getKeycardData*[T](self: Module[T]): string =
return self.view.getKeycardData()

View File

@ -107,6 +107,12 @@ QtObject:
proc onQuaternaryActionClicked*(self: View) {.slot.} =
self.delegate.onQuaternaryActionClicked()
proc getAppInfoFlow*(self: View) {.slot.} =
self.delegate.getAppInfoFlow()
proc getMetadataFlow*(self: View) {.slot.} =
self.delegate.getMetadataFlow()
proc onQuinaryActionClicked*(self: View) {.slot.} =
self.delegate.onQuinaryActionClicked()

View File

@ -107,6 +107,7 @@ QtObject:
debug "initialization response: ", initResp
proc processSignal(self: Service, signal: string) =
echo "--- GOT A SIGNAL ", signal
var jsonSignal: JsonNode
try:
jsonSignal = signal.parseJson
@ -167,6 +168,16 @@ QtObject:
if self.doLogging:
debug "keycardStartFlow", kcServiceCurrFlow=($self.currentFlow), payload=payload, response=response
proc getAppInfoFlow*(self: Service) =
let response = keycard_go.getAppInfoFlow()
debug "getAppInfoFlow", response=response
proc getMetadataFlow*(self: Service) =
let response = keycard_go.getMetadataFlow()
debug "getMetadataFlow", response=response
proc resumeFlow(self: Service, payload: JsonNode) =
self.busy = true
self.updateLocalPayloadForCurrentFlow(payload)

View File

@ -198,6 +198,20 @@ Item {
font.pixelSize: Constants.onboarding.titleFontSize
color: Theme.palette.directColor1
}
StatusButton {
text: qsTr("Get keycard status")
onClicked: {
console.log('Cal getAppInfoFlowl')
startupStore.startupModuleInst.getAppInfoFlow()
}
}
StatusButton {
text: qsTr("Get metadata")
onClicked: {
console.log('Call getMetadataFlow')
startupStore.startupModuleInst.getMetadataFlow()
}
}
Item { Layout.fillHeight: d.isRegularLogin }
Item {
id: userInfo

@ -1 +1 @@
Subproject commit aa05fe490b57023028e242567f52bd124ed87d30
Subproject commit 9e01fb0cefdd43305d938f6add30b1f3b789ea33

@ -1 +1 @@
Subproject commit 96be8e02d7013bb6518f236424cfd2962e636398
Subproject commit dc66298e27f4dbc9ca8b497374f934577ab2ce51