From 009d3a18a390c46b957e03d552b3fdc94b21fe9d Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 30 Nov 2017 15:40:20 -0800 Subject: [PATCH 1/3] Call reset() on Ledger and Wallet before creating new wallet --- interface/resources/qml/hifi/commerce/wallet/Wallet.qml | 1 + .../resources/qml/hifi/commerce/wallet/WalletSetup.qml | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index 759d7a37eb..6af6a484b9 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -47,6 +47,7 @@ Rectangle { } else if (walletStatus === 1) { if (root.activeView !== "walletSetup") { root.activeView = "walletSetup"; + commerce.reset(); } } else if (walletStatus === 2) { if (root.activeView !== "passphraseModal") { diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml index 1a62fe6f0d..369f8c1f95 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml @@ -225,6 +225,7 @@ Item { height: 50; text: "Set Up Wallet"; onClicked: { + commerce.account(); root.activeView = "step_2"; } } @@ -371,7 +372,7 @@ Item { Item { id: securityImageTip; - visible: false; + visible: !root.hasShownSecurityImageTip && root.activeView === "step_3"; z: 999; anchors.fill: root; @@ -421,7 +422,6 @@ Item { text: "Got It"; onClicked: { root.hasShownSecurityImageTip = true; - securityImageTip.visible = false; passphraseSelection.focusFirstTextField(); } } @@ -439,9 +439,6 @@ Item { onVisibleChanged: { if (visible) { commerce.getWalletAuthenticatedStatus(); - if (!root.hasShownSecurityImageTip) { - securityImageTip.visible = true; - } } } @@ -732,6 +729,7 @@ Item { text: "Finish"; onClicked: { root.visible = false; + root.hasShownSecurityImageTip = false; sendSignalToWallet({method: 'walletSetup_finished', referrer: root.referrer ? root.referrer : ""}); } } From 24e5994f20d7403c1028396cd0809f62dd15f388 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 30 Nov 2017 15:48:57 -0800 Subject: [PATCH 2/3] The nuclear option is a bad option. --- interface/resources/qml/hifi/commerce/wallet/Wallet.qml | 2 +- interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml | 1 - interface/src/commerce/QmlCommerce.cpp | 5 +++++ interface/src/commerce/QmlCommerce.h | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml index 6af6a484b9..0424dd1edd 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml @@ -47,7 +47,7 @@ Rectangle { } else if (walletStatus === 1) { if (root.activeView !== "walletSetup") { root.activeView = "walletSetup"; - commerce.reset(); + commerce.resetLocalWalletOnly(); } } else if (walletStatus === 2) { if (root.activeView !== "passphraseModal") { diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml index 369f8c1f95..8de831ef75 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml @@ -225,7 +225,6 @@ Item { height: 50; text: "Set Up Wallet"; onClicked: { - commerce.account(); root.activeView = "step_2"; } } diff --git a/interface/src/commerce/QmlCommerce.cpp b/interface/src/commerce/QmlCommerce.cpp index f29e46d843..435d15d161 100644 --- a/interface/src/commerce/QmlCommerce.cpp +++ b/interface/src/commerce/QmlCommerce.cpp @@ -128,6 +128,11 @@ void QmlCommerce::reset() { wallet->reset(); } +void QmlCommerce::resetLocalWalletOnly() { + auto wallet = DependencyManager::get(); + wallet->reset(); +} + void QmlCommerce::account() { auto ledger = DependencyManager::get(); ledger->account(); diff --git a/interface/src/commerce/QmlCommerce.h b/interface/src/commerce/QmlCommerce.h index d4f4aa35d2..fd8dd0d395 100644 --- a/interface/src/commerce/QmlCommerce.h +++ b/interface/src/commerce/QmlCommerce.h @@ -65,6 +65,7 @@ protected: Q_INVOKABLE void history(); Q_INVOKABLE void generateKeyPair(); Q_INVOKABLE void reset(); + Q_INVOKABLE void resetLocalWalletOnly(); Q_INVOKABLE void account(); Q_INVOKABLE void certificateInfo(const QString& certificateId); From 48b50e33dda8d0e7dde9b03991dbd1f2ee33b730 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 1 Dec 2017 19:41:11 +0300 Subject: [PATCH 3/3] 9461 Keyboard for create appear then disappears immediately (HMD) --- .../resources/html/raiseAndLowerKeyboard.js | 22 +++++++++---------- scripts/system/html/js/keyboardControl.js | 6 +++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/interface/resources/html/raiseAndLowerKeyboard.js b/interface/resources/html/raiseAndLowerKeyboard.js index 23f3a7e9a8..a0aa1eb7fe 100644 --- a/interface/resources/html/raiseAndLowerKeyboard.js +++ b/interface/resources/html/raiseAndLowerKeyboard.js @@ -12,9 +12,9 @@ var MAX_WARNINGS = 3; var numWarnings = 0; var isWindowFocused = true; - var isKeyboardRaised = false; - var isNumericKeyboard = false; - var isPasswordField = false; + window.isKeyboardRaised = false; + window.isNumericKeyboard = false; + window.isPasswordField = false; function shouldSetPasswordField() { var nodeType = document.activeElement.type; @@ -62,7 +62,7 @@ var passwordField = shouldSetPasswordField(); if (isWindowFocused && - (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard || passwordField !== isPasswordField)) { + (keyboardRaised !== window.isKeyboardRaised || numericKeyboard !== window.isNumericKeyboard || passwordField !== window.isPasswordField)) { if (typeof EventBridge !== "undefined" && EventBridge !== null) { EventBridge.emitWebEvent( @@ -75,20 +75,20 @@ } } - if (!isKeyboardRaised) { + if (!window.isKeyboardRaised) { scheduleBringToView(250); // Allow time for keyboard to be raised in QML. // 2DO: should it be rather done from 'client area height changed' event? } - isKeyboardRaised = keyboardRaised; - isNumericKeyboard = numericKeyboard; - isPasswordField = passwordField; + window.isKeyboardRaised = keyboardRaised; + window.isNumericKeyboard = numericKeyboard; + window.isPasswordField = passwordField; } }, POLL_FREQUENCY); window.addEventListener("click", function () { var keyboardRaised = shouldRaiseKeyboard(); - if(keyboardRaised && isKeyboardRaised) { + if (keyboardRaised && window.isKeyboardRaised) { scheduleBringToView(150); } }); @@ -99,7 +99,7 @@ window.addEventListener("blur", function () { isWindowFocused = false; - isKeyboardRaised = false; - isNumericKeyboard = false; + window.isKeyboardRaised = false; + window.isNumericKeyboard = false; }); })(); diff --git a/scripts/system/html/js/keyboardControl.js b/scripts/system/html/js/keyboardControl.js index f2937bc63a..7a8a314c62 100644 --- a/scripts/system/html/js/keyboardControl.js +++ b/scripts/system/html/js/keyboardControl.js @@ -15,6 +15,9 @@ function setUpKeyboardControl() { var KEYBOARD_HEIGHT = 200; function raiseKeyboard() { + window.isKeyboardRaised = true; + window.isNumericKeyboard = this.type === "number"; + if (lowerTimer !== null) { clearTimeout(lowerTimer); lowerTimer = null; @@ -35,6 +38,9 @@ function setUpKeyboardControl() { } function doLowerKeyboard() { + window.isKeyboardRaised = false; + window.isNumericKeyboard = false; + EventBridge.emitWebEvent("_LOWER_KEYBOARD"); lowerTimer = null; isRaised = false;