From 21a5b10fab906d6d6db610def38e28b267a751c8 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Fri, 3 Mar 2023 11:13:48 +0100 Subject: [PATCH] fix(@desktop/keycard): few small fixes applied - missed space added in account already exists popup - disable close button for shared keycard popup flows identified separately - crash if built tokens from some other action (like enabling wallet) are received late while keycard flow is setting up and keypair for processing is not prepared yet - 3 words name was displayed on login for a keycard user --- src/app/modules/shared_modules/keycard_popup/module.nim | 2 ++ src/app_service/service/accounts/service.nim | 4 ++-- ui/app/AppLayouts/Onboarding/OnboardingLayout.qml | 6 +++--- ui/imports/shared/popups/keycard/KeycardPopup.qml | 4 ++-- ui/imports/shared/popups/keycard/KeycardPopupDetails.qml | 8 ++++++++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/app/modules/shared_modules/keycard_popup/module.nim b/src/app/modules/shared_modules/keycard_popup/module.nim index 294965c662..cd46c76417 100644 --- a/src/app/modules/shared_modules/keycard_popup/module.nim +++ b/src/app/modules/shared_modules/keycard_popup/module.nim @@ -639,6 +639,8 @@ proc updateKeyPairItemIfDataAreKnown[T](self: Module[T], address: string, item: return false method onTokensRebuilt*[T](self: Module[T], accountsTokens: OrderedTable[string, seq[WalletTokenDto]]) = + if self.getKeyPairForProcessing().isNil: + return let chainIds = self.controller.getChainIdsOfAllKnownNetworks() let currency = self.controller.getCurrency() for address, tokens in accountsTokens.pairs: diff --git a/src/app_service/service/accounts/service.nim b/src/app_service/service/accounts/service.nim index 80b14f155e..440a1a556e 100644 --- a/src/app_service/service/accounts/service.nim +++ b/src/app_service/service/accounts/service.nim @@ -419,7 +419,7 @@ QtObject: let alias = generateAliasFromPk(whisperPublicKey) var accountDataJson = %* { - "name": alias, + "name": if displayName == "": alias else: displayName, "display-name": displayName, "address": address, "key-uid": keyUid, @@ -442,7 +442,7 @@ QtObject: { "public-key": whisperPublicKey, "address": whisperAddress, - "name": alias, + "name": if displayName == "": alias else: displayName, "path": PATH_WHISPER, "chat": true, "derived-from": "" diff --git a/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml b/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml index 2048b88515..60cdca3880 100644 --- a/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml +++ b/ui/app/AppLayouts/Onboarding/OnboardingLayout.qml @@ -143,7 +143,7 @@ OnboardingBasePage { 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\ + 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") @@ -153,8 +153,8 @@ your password, passcode or Keycard, uninstall the app, reinstall and access your 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\ + 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 \ case of Keycard try recovering using PUK or reinstall the app and try login with the Keycard option.") } else { msgDialog.title = qsTr("Error importing seed") diff --git a/ui/imports/shared/popups/keycard/KeycardPopup.qml b/ui/imports/shared/popups/keycard/KeycardPopup.qml index 74b29248cb..506c78bf88 100644 --- a/ui/imports/shared/popups/keycard/KeycardPopup.qml +++ b/ui/imports/shared/popups/keycard/KeycardPopup.qml @@ -13,8 +13,8 @@ StatusModal { property var emojiPopup width: Constants.keycard.general.popupWidth - closePolicy: d.disableActionPopupButtons? Popup.NoAutoClose : Popup.CloseOnEscape - hasCloseButton: !d.disableActionPopupButtons + closePolicy: d.disableActionPopupButtons || d.disableCloseButton? Popup.NoAutoClose : Popup.CloseOnEscape + hasCloseButton: !d.disableActionPopupButtons && !d.disableCloseButton header.title: { switch (root.sharedKeycardModule.currentState.flowType) { diff --git a/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml b/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml index f962a1f8f3..1198387fc0 100644 --- a/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml +++ b/ui/imports/shared/popups/keycard/KeycardPopupDetails.qml @@ -34,6 +34,14 @@ QtObject { case Constants.keycardSharedState.importingFromKeycard: case Constants.keycardSharedState.copyingKeycard: return true + } + + return false + } + + // disables only close button (upper right "X" button) + readonly property bool disableCloseButton: { + switch (root.sharedKeycardModule.currentState.stateType) { case Constants.keycardSharedState.keyPairMigrateSuccess: return root.sharedKeycardModule.migratingProfileKeyPair()