2022-07-20 12:34:44 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
|
2023-01-26 11:52:01 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2022-03-03 22:50:53 +00:00
|
|
|
import utils 1.0
|
2022-08-05 13:50:54 +00:00
|
|
|
import shared.popups.keycard 1.0
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
import "controls"
|
2022-03-03 22:50:53 +00:00
|
|
|
import "views"
|
|
|
|
import "stores"
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
OnboardingBasePage {
|
2022-03-03 22:50:53 +00:00
|
|
|
id: root
|
2022-03-07 22:59:38 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
property var startupStore: StartupStore {}
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-12-13 10:45:26 +00:00
|
|
|
backButtonVisible: root.startupStore.currentStartupState ? root.startupStore.currentStartupState.displayBackButton
|
|
|
|
: false
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
onBackClicked: {
|
|
|
|
root.startupStore.backAction()
|
|
|
|
}
|
2022-05-20 17:14:39 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
function unload() {
|
|
|
|
loader.sourceComponent = undefined
|
|
|
|
}
|
2022-05-20 17:14:39 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
anchors.fill: parent
|
|
|
|
sourceComponent: {
|
2022-11-30 09:25:47 +00:00
|
|
|
switch (root.startupStore.currentStartupState.stateType) {
|
|
|
|
case Constants.startupState.allowNotifications:
|
2022-07-20 12:34:44 +00:00
|
|
|
return allowNotificationsViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.welcome:
|
2022-07-20 12:34:44 +00:00
|
|
|
return welcomeViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.welcomeNewStatusUser:
|
|
|
|
case Constants.startupState.welcomeOldStatusUser:
|
2023-01-16 09:45:33 +00:00
|
|
|
case Constants.startupState.recoverOldUser:
|
2022-11-30 09:25:47 +00:00
|
|
|
case Constants.startupState.userProfileImportSeedPhrase:
|
|
|
|
case Constants.startupState.profileFetchingAnnouncement:
|
|
|
|
case Constants.startupState.userProfileCreateSameChatKey:
|
2023-01-18 11:53:38 +00:00
|
|
|
case Constants.startupState.lostKeycardOptions:
|
2022-07-20 12:34:44 +00:00
|
|
|
return keysMainViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileCreate:
|
|
|
|
case Constants.startupState.userProfileChatKey:
|
2022-07-20 12:34:44 +00:00
|
|
|
return insertDetailsViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileCreatePassword:
|
2022-07-20 12:34:44 +00:00
|
|
|
return createPasswordViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileConfirmPassword:
|
2022-07-20 12:34:44 +00:00
|
|
|
return confirmPasswordViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.biometrics:
|
2022-07-20 12:34:44 +00:00
|
|
|
return touchIdAuthViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.userProfileEnterSeedPhrase:
|
2022-07-20 12:34:44 +00:00
|
|
|
return seedPhraseInputViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.login:
|
|
|
|
case Constants.startupState.loginPlugin:
|
|
|
|
case Constants.startupState.loginKeycardInsertKeycard:
|
|
|
|
case Constants.startupState.loginKeycardInsertedKeycard:
|
|
|
|
case Constants.startupState.loginKeycardReadingKeycard:
|
|
|
|
case Constants.startupState.loginKeycardRecognizedKeycard:
|
|
|
|
case Constants.startupState.loginKeycardEnterPin:
|
|
|
|
case Constants.startupState.loginKeycardEnterPassword:
|
|
|
|
case Constants.startupState.loginKeycardPinVerified:
|
|
|
|
case Constants.startupState.loginKeycardWrongKeycard:
|
|
|
|
case Constants.startupState.loginKeycardWrongPin:
|
|
|
|
case Constants.startupState.loginKeycardMaxPinRetriesReached:
|
|
|
|
case Constants.startupState.loginKeycardMaxPukRetriesReached:
|
|
|
|
case Constants.startupState.loginKeycardMaxPairingSlotsReached:
|
|
|
|
case Constants.startupState.loginKeycardEmpty:
|
|
|
|
case Constants.startupState.loginNotKeycard:
|
2023-01-26 11:52:01 +00:00
|
|
|
case Constants.startupState.loginKeycardConvertedToRegularAccount:
|
2022-07-20 12:34:44 +00:00
|
|
|
return loginViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardPluginReader:
|
|
|
|
case Constants.startupState.keycardInsertKeycard:
|
|
|
|
case Constants.startupState.keycardInsertedKeycard:
|
|
|
|
case Constants.startupState.keycardReadingKeycard:
|
|
|
|
case Constants.startupState.keycardRecognizedKeycard:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardInitViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardCreatePin:
|
|
|
|
case Constants.startupState.keycardRepeatPin:
|
|
|
|
case Constants.startupState.keycardPinSet:
|
|
|
|
case Constants.startupState.keycardEnterPin:
|
|
|
|
case Constants.startupState.keycardWrongPin:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardPinViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardDisplaySeedPhrase:
|
2022-07-21 11:29:18 +00:00
|
|
|
return seedphraseViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardEnterSeedPhraseWords:
|
2022-07-21 11:29:18 +00:00
|
|
|
return seedphraseWordsInputViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardNotEmpty:
|
|
|
|
case Constants.startupState.keycardNotKeycard:
|
|
|
|
case Constants.startupState.keycardEmpty:
|
|
|
|
case Constants.startupState.keycardWrongKeycard:
|
|
|
|
case Constants.startupState.keycardLocked:
|
|
|
|
case Constants.startupState.keycardRecover:
|
|
|
|
case Constants.startupState.keycardMaxPairingSlotsReached:
|
|
|
|
case Constants.startupState.keycardMaxPinRetriesReached:
|
|
|
|
case Constants.startupState.keycardMaxPukRetriesReached:
|
2023-01-26 11:52:01 +00:00
|
|
|
case Constants.startupState.userProfileWrongSeedPhrase:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardStateViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardEnterPuk:
|
|
|
|
case Constants.startupState.keycardWrongPuk:
|
2022-07-21 11:29:18 +00:00
|
|
|
return keycardPukViewComponent
|
2022-11-30 09:25:47 +00:00
|
|
|
|
|
|
|
case Constants.startupState.keycardWrongPuk:
|
|
|
|
return keycardPukViewComponent
|
|
|
|
|
|
|
|
case Constants.startupState.keycardWrongPuk:
|
|
|
|
return keycardPukViewComponent
|
|
|
|
|
|
|
|
case Constants.startupState.profileFetching:
|
|
|
|
case Constants.startupState.profileFetchingSuccess:
|
|
|
|
case Constants.startupState.profileFetchingTimeout:
|
|
|
|
return fetchingDataViewComponent
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
return undefined
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
2022-07-20 12:34:44 +00:00
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Connections {
|
|
|
|
target: root.startupStore.startupModuleInst
|
2023-01-26 11:52:01 +00:00
|
|
|
onStartupError: {
|
|
|
|
msgDialog.errType = errType
|
|
|
|
if (errType === Constants.startupErrorType.setupAccError) {
|
|
|
|
if (error === Constants.existingAccountError) {
|
|
|
|
msgDialog.title = qsTr("Keys for this account already exist")
|
|
|
|
msgDialog.text = qsTr("Keys for this account already exist and can't be added again. If you've lost\
|
|
|
|
your password, passcode or Keycard, uninstall the app, reinstall and access your keys by entering your seed phrase.")
|
|
|
|
} else {
|
|
|
|
msgDialog.title = qsTr("Login failed")
|
|
|
|
msgDialog.text = qsTr("Login failed. Please re-enter your password and try again.")
|
|
|
|
}
|
2022-07-20 12:34:44 +00:00
|
|
|
}
|
2023-01-26 11:52:01 +00:00
|
|
|
else if (errType === Constants.startupErrorType.importAccError) {
|
|
|
|
if (error === Constants.existingAccountError) {
|
|
|
|
msgDialog.title = qsTr("Keys for this account already exist")
|
|
|
|
msgDialog.text = qsTr("Keys for this account already exist and can't be added again. If you've lost\
|
|
|
|
your password, passcode or Keycard, uninstall the app, reinstall and access your keys by entering your seed phrase. In\
|
2022-07-21 11:29:18 +00:00
|
|
|
case of Keycard try recovering using PUK or reinstall the app and try login with the Keycard option.")
|
2023-01-26 11:52:01 +00:00
|
|
|
} else {
|
|
|
|
msgDialog.title = qsTr("Error importing seed")
|
|
|
|
msgDialog.text = error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (errType === Constants.startupErrorType.convertToRegularAccError) {
|
|
|
|
msgDialog.title = qsTr("Converting account")
|
|
|
|
msgDialog.text = qsTr("Really sorry about this inconvenience.\n\
|
|
|
|
Most likely that your account is damaged while converting to a regular Status account.\n\
|
|
|
|
First try to login after app restart, if that doesn't work, you can alway recover your accout\n\
|
|
|
|
following the \"Add existing Status user\" flow, using your seed phrase.")
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
2023-01-26 11:52:01 +00:00
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
msgDialog.open()
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
2023-01-26 11:52:01 +00:00
|
|
|
|
2022-09-02 11:03:40 +00:00
|
|
|
onDisplayKeycardSharedModuleFlow: {
|
2022-08-05 13:50:54 +00:00
|
|
|
keycardPopup.active = true
|
|
|
|
}
|
|
|
|
onDestroyKeycardSharedModuleFlow: {
|
|
|
|
keycardPopup.active = false
|
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
|
2023-01-26 11:52:01 +00:00
|
|
|
StatusDialog {
|
2022-07-20 12:34:44 +00:00
|
|
|
id: msgDialog
|
|
|
|
title: qsTr("Login failed")
|
2023-01-26 11:52:01 +00:00
|
|
|
|
|
|
|
property int errType: Constants.startupErrorType.unknownType
|
|
|
|
property string text: qsTr("Login failed. Please re-enter your password and try again.")
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.fill: parent
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
text: msgDialog.text
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
|
|
|
standardButtons: Dialog.Ok
|
2022-07-20 12:34:44 +00:00
|
|
|
onAccepted: {
|
2023-01-26 11:52:01 +00:00
|
|
|
if (msgDialog.errType == Constants.startupErrorType.convertToRegularAccError) {
|
|
|
|
Qt.quit();
|
|
|
|
}
|
2022-07-20 12:34:44 +00:00
|
|
|
console.log("TODO: restart flow...")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: allowNotificationsViewComponent
|
2022-05-20 17:14:39 +00:00
|
|
|
AllowNotificationsView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-05-20 17:14:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: welcomeViewComponent
|
2022-03-04 23:31:31 +00:00
|
|
|
WelcomeView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-03-04 23:31:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: keysMainViewComponent
|
2022-03-03 22:50:53 +00:00
|
|
|
KeysMainView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: insertDetailsViewComponent
|
|
|
|
InsertDetailsView {
|
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: createPasswordViewComponent
|
|
|
|
CreatePasswordView {
|
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: confirmPasswordViewComponent
|
|
|
|
ConfirmPasswordView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: touchIdAuthViewComponent
|
|
|
|
TouchIDAuthView {
|
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
Component {
|
|
|
|
id: seedPhraseInputViewComponent
|
|
|
|
SeedPhraseInputView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loginViewComponent
|
2022-03-03 22:50:53 +00:00
|
|
|
LoginView {
|
2022-07-20 12:34:44 +00:00
|
|
|
startupStore: root.startupStore
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardInitViewComponent
|
|
|
|
KeycardInitView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardPinViewComponent
|
|
|
|
KeycardPinView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardPukViewComponent
|
|
|
|
KeycardPukView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: seedphraseViewComponent
|
|
|
|
SeedPhraseView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: seedphraseWordsInputViewComponent
|
|
|
|
SeedPhraseWordsInputView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardStateViewComponent
|
|
|
|
KeycardStateView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
2022-08-05 13:50:54 +00:00
|
|
|
|
2022-11-30 09:25:47 +00:00
|
|
|
Component {
|
|
|
|
id: fetchingDataViewComponent
|
|
|
|
ProfileFetchingView {
|
|
|
|
startupStore: root.startupStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-05 13:50:54 +00:00
|
|
|
Loader {
|
|
|
|
id: keycardPopup
|
|
|
|
active: false
|
|
|
|
sourceComponent: KeycardPopup {
|
2022-12-16 09:37:08 +00:00
|
|
|
anchors.centerIn: parent
|
2022-08-05 13:50:54 +00:00
|
|
|
sharedKeycardModule: root.startupStore.startupModuleInst.keycardSharedModule
|
|
|
|
}
|
|
|
|
|
|
|
|
onLoaded: {
|
|
|
|
keycardPopup.item.open()
|
|
|
|
}
|
|
|
|
}
|
2022-03-03 22:50:53 +00:00
|
|
|
}
|