2022-11-07 11:43:34 +00:00
|
|
|
|
import QtQuick 2.14
|
|
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
2022-12-16 09:37:08 +00:00
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-11-07 11:43:34 +00:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
|
|
|
|
|
|
|
|
|
property bool primaryButtonEnabled: false
|
2022-11-09 10:22:08 +00:00
|
|
|
|
readonly property bool disablePopupClose: {
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.renamingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPin:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPuk:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCode:
|
|
|
|
|
case Constants.keycardSharedState.migratingKeyPair:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhrase:
|
2022-11-18 08:16:02 +00:00
|
|
|
|
case Constants.keycardSharedState.copyingKeycard:
|
2022-11-09 10:22:08 +00:00
|
|
|
|
return true
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keyPairMigrateSuccess:
|
|
|
|
|
return root.sharedKeycardModule.migratingProfileKeyPair()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
|
|
|
|
|
property list<Item> leftButtons: [
|
|
|
|
|
StatusBackButton {
|
|
|
|
|
id: backButton
|
|
|
|
|
visible: root.sharedKeycardModule.currentState.displayBackButton
|
|
|
|
|
height: Constants.keycard.general.footerButtonsHeight
|
|
|
|
|
width: height
|
|
|
|
|
onClicked: {
|
2022-11-10 09:06:42 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doBackAction()
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
property list<StatusBaseButton> rightButtons: [
|
|
|
|
|
StatusButton {
|
2022-11-10 09:06:42 +00:00
|
|
|
|
id: cancelButton
|
2022-11-07 11:43:34 +00:00
|
|
|
|
height: Constants.keycard.general.footerButtonsHeight
|
2022-12-16 09:37:08 +00:00
|
|
|
|
borderColor: Theme.palette.baseColor2
|
|
|
|
|
normalColor: "transparent"
|
2022-11-10 09:06:42 +00:00
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
|
visible: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.selectExistingKeyPair:
|
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.factoryReset:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeychainPin:
|
|
|
|
|
case Constants.keycardSharedState.biometricsReadyToSign:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongPassword:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPasswordFailed:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinFailed:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinInvalid:
|
|
|
|
|
case Constants.keycardSharedState.enterBiometricsPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongBiometricsPassword:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPuk:
|
|
|
|
|
case Constants.keycardSharedState.wrongPuk:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.unlockKeycardOptions:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
// we're sure that we cannot unlock it from here using seed phrase and also in this point max num of puk retries is reached
|
|
|
|
|
// the only option to unlock a keycard is to run unlock flow from details view of the locked keycard
|
|
|
|
|
return root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.displayKeycardContent:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.renameKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPin:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPuk:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.createPuk:
|
|
|
|
|
case Constants.keycardSharedState.repeatPuk:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changePairingCode:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.createPairingCode:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return true
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-18 08:16:02 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.createCopyOfAKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
case Constants.keycardSharedState.removeKeycard:
|
|
|
|
|
case Constants.keycardSharedState.sameKeycard:
|
|
|
|
|
case Constants.keycardSharedState.copyToKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
|
case Constants.keycardSharedState.wrongSeedPhrase:
|
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
let copyFromAKeycardPartDone = root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.copyFromAKeycardPartDone
|
|
|
|
|
if (copyFromAKeycardPartDone) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-10 09:06:42 +00:00
|
|
|
|
return false
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
enabled: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.migratingKeyPair:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhrase:
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedState.renamingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPin:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPuk:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCode:
|
2022-11-18 08:16:02 +00:00
|
|
|
|
case Constants.keycardSharedState.copyingKeycard:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (root.disablePopupClose) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
2022-11-10 09:06:42 +00:00
|
|
|
|
root.sharedKeycardModule.currentState.doCancelAction()
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
|
id: secondaryButton
|
|
|
|
|
height: Constants.keycard.general.footerButtonsHeight
|
2022-12-16 09:37:08 +00:00
|
|
|
|
borderColor: Theme.palette.baseColor2
|
|
|
|
|
normalColor: "transparent"
|
2022-11-07 11:43:34 +00:00
|
|
|
|
text: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (userProfile.usingBiometricLogin) {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongPassword:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Use biometrics instead")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.biometricsPasswordFailed:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Use password instead")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Use biometrics")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.biometricsReadyToSign:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinFailed:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Use PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinInvalid:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Update PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.unlockKeycardOptions:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
if (root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock &&
|
|
|
|
|
!(root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.offerPukForUnlock)) {
|
|
|
|
|
// In case max puk retries or free pairing slots is reached and user is running unlock flow from a flow
|
|
|
|
|
// where we cannot determine key pair, than we should should display only "Close" button and inform him
|
|
|
|
|
// to run unlock flow directly.
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock using PUK")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
2022-12-16 09:37:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.manageKeycardAccounts:
|
|
|
|
|
return qsTr("Add another account")
|
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
visible: text !== ""
|
|
|
|
|
enabled: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.migratingKeyPair:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhrase:
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedState.renamingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPin:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPuk:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCode:
|
2022-11-18 08:16:02 +00:00
|
|
|
|
case Constants.keycardSharedState.copyingKeycard:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (root.disablePopupClose) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
|
|
|
|
if (userProfile.usingBiometricLogin) {
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.unlockKeycardOptions:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.offerPukForUnlock
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
2022-12-16 09:37:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.manageKeycardAccounts:
|
|
|
|
|
return root.primaryButtonEnabled
|
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.sharedKeycardModule.currentState.doSecondaryAction()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
|
id: primaryButton
|
|
|
|
|
objectName: "PrimaryButton"
|
|
|
|
|
height: Constants.keycard.general.footerButtonsHeight
|
|
|
|
|
text: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
|
case Constants.keycardSharedState.pinSet:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Input seed phrase")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseEnterWords:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Yes, migrate key pair to this Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Yes, migrate key pair to Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongSeedPhrase:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Try entering seed phrase again")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Check what is stored on this Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Factory reset this Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.selectExistingKeyPair:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseDisplay:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
if (root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock)
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.migratingKeyPair:
|
|
|
|
|
case Constants.keycardSharedState.keyPairMigrateFailure:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keyPairMigrateSuccess:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (root.sharedKeycardModule.migratingProfileKeyPair())
|
|
|
|
|
return qsTr("Restart app & sign in using your new Keycard")
|
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
|
|
|
|
return qsTr("Check what is stored on this Keycard")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
return qsTr("I don’t know the PIN")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
return qsTr("Factory reset this Keycard")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseDisplay:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseEnterWords:
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.pinSet:
|
|
|
|
|
case Constants.keycardSharedState.enterKeycardName:
|
|
|
|
|
return qsTr("Next")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
if (root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock)
|
|
|
|
|
return qsTr("Unlock Keycard")
|
|
|
|
|
return qsTr("Next")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhrase:
|
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhraseSuccess:
|
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhraseFailure:
|
|
|
|
|
return qsTr("Done")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.manageKeycardAccounts:
|
|
|
|
|
return qsTr("Finalise Keycard")
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.factoryReset:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Factory reset this Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.biometricsReadyToSign:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongPassword:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Authenticate")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterBiometricsPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongBiometricsPassword:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Update password & authenticate")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongKeychainPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Update PIN & authenticate")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.biometricsPasswordFailed:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinFailed:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinInvalid:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Try biometrics again")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
|
|
|
|
case Constants.keycardSharedState.keycardAlreadyUnlocked:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.unlockKeycardSuccess:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.unlockKeycardOptions:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
if (root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock &&
|
|
|
|
|
!(root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.offerPukForUnlock)) {
|
|
|
|
|
// In case max puk retries or free pairing slots is reached and user is running unlock flow from a flow
|
|
|
|
|
// where we cannot determine key pair, than we should should display only "Close" button and inform him
|
|
|
|
|
// to run unlock flow directly.
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock using seed phrase")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
|
case Constants.keycardSharedState.pinSet:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
|
case Constants.keycardSharedState.enterPuk:
|
|
|
|
|
case Constants.keycardSharedState.wrongPuk:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongSeedPhrase:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Try entering seed phrase again")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
if (root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.displayKeycardContent:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.renameKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
case Constants.keycardSharedState.keycardRenameSuccess:
|
|
|
|
|
case Constants.keycardSharedState.keycardRenameFailure:
|
|
|
|
|
case Constants.keycardSharedState.renamingKeycard:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterKeycardName:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Rename this Keycard")
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPin:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPin:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPinSuccess:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPinFailure:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changeKeycardPuk:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPuk:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPukSuccess:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPukFailure:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changePairingCode:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCode:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCodeSuccess:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCodeFailure:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Done")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("I don’t know the PIN")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Next")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Unlock Keycard")
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPairingCode:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return qsTr("Set paring code")
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
2022-11-18 08:16:02 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.createCopyOfAKeycard:
|
|
|
|
|
let copyFromAKeycardPartDone = root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.copyFromAKeycardPartDone
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
if (copyFromAKeycardPartDone) {
|
|
|
|
|
return qsTr("I don’t know the PIN")
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
|
|
|
|
case Constants.keycardSharedState.copyingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.copyingKeycardSuccess:
|
|
|
|
|
case Constants.keycardSharedState.copyingKeycardFailure:
|
|
|
|
|
return qsTr("Done")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
|
case Constants.keycardSharedState.removeKeycard:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
|
|
|
|
case Constants.keycardSharedState.copyToKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
|
return qsTr("Next")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
|
if (copyFromAKeycardPartDone) {
|
|
|
|
|
return qsTr("Next")
|
|
|
|
|
}
|
|
|
|
|
return qsTr("Done")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.wrongSeedPhrase:
|
|
|
|
|
return qsTr("Try entering seed phrase again")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
|
return qsTr("Unlock Keycard")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.sameKeycard:
|
|
|
|
|
return qsTr("Try inserting a different Keycard")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
if (copyFromAKeycardPartDone) {
|
|
|
|
|
return qsTr("Try inserting a different Keycard")
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
|
|
|
|
return qsTr("Check what is stored on this Keycard")
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
return qsTr("Factory reset this Keycard")
|
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
visible: text !== ""
|
|
|
|
|
enabled: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.migratingKeyPair:
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhrase:
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedState.renamingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPin:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPuk:
|
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCode:
|
2022-11-18 08:16:02 +00:00
|
|
|
|
case Constants.keycardSharedState.copyingKeycard:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (root.disablePopupClose) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.selectExistingKeyPair:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseDisplay:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseEnterWords:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.primaryButtonEnabled
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return false
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
2022-12-16 09:37:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycardNewSeedPhrase:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseDisplay:
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseEnterWords:
|
|
|
|
|
case Constants.keycardSharedState.enterKeycardName:
|
|
|
|
|
case Constants.keycardSharedState.manageKeycardAccounts:
|
|
|
|
|
return root.primaryButtonEnabled
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
2022-11-09 10:22:08 +00:00
|
|
|
|
case Constants.keycardSharedFlow.factoryReset:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.primaryButtonEnabled
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeychainPin:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
|
case Constants.keycardSharedState.enterPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongPassword:
|
|
|
|
|
case Constants.keycardSharedState.enterBiometricsPassword:
|
|
|
|
|
case Constants.keycardSharedState.wrongBiometricsPassword:
|
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.primaryButtonEnabled
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.unlockKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
|
case Constants.keycardSharedState.enterPuk:
|
|
|
|
|
case Constants.keycardSharedState.wrongPuk:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.primaryButtonEnabled
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return false
|
2022-12-16 09:37:08 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.unlockKeycardOptions:
|
|
|
|
|
return !(root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.disableSeedPhraseForUnlock)
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.renameKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterKeycardName:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.primaryButtonEnabled
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.changePairingCode:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPairingCode:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return root.primaryButtonEnabled
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-18 08:16:02 +00:00
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.createCopyOfAKeycard:
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
|
return root.primaryButtonEnabled
|
|
|
|
|
}
|
|
|
|
|
break
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return true
|
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
icon.name: {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.flowType) {
|
|
|
|
|
case Constants.keycardSharedFlow.setupNewKeycard:
|
|
|
|
|
if (root.sharedKeycardModule.migratingProfileKeyPair()) {
|
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseEnterWords:
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
|
if (userProfile.usingBiometricLogin)
|
|
|
|
|
return "touch-id"
|
|
|
|
|
if (userProfile.isKeycardUser)
|
|
|
|
|
return "keycard"
|
|
|
|
|
return "password"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedFlow.authentication:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
if (userProfile.usingBiometricLogin) {
|
2022-11-09 10:22:08 +00:00
|
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
|
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPasswordFailed:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinFailed:
|
|
|
|
|
case Constants.keycardSharedState.biometricsPinInvalid:
|
|
|
|
|
case Constants.keycardSharedState.biometricsReadyToSign:
|
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return "touch-id"
|
2022-11-09 10:22:08 +00:00
|
|
|
|
}
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
break
|
2022-11-07 11:43:34 +00:00
|
|
|
|
}
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.sharedKeycardModule.currentState.doPrimaryAction()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|