Merge branch 'master' of https://github.com/highfidelity/hifi into light

This commit is contained in:
Sam Gateau 2017-12-04 19:11:42 -08:00
commit 987246afb8
6 changed files with 26 additions and 16 deletions

View file

@ -12,9 +12,9 @@
var MAX_WARNINGS = 3; var MAX_WARNINGS = 3;
var numWarnings = 0; var numWarnings = 0;
var isWindowFocused = true; var isWindowFocused = true;
var isKeyboardRaised = false; window.isKeyboardRaised = false;
var isNumericKeyboard = false; window.isNumericKeyboard = false;
var isPasswordField = false; window.isPasswordField = false;
function shouldSetPasswordField() { function shouldSetPasswordField() {
var nodeType = document.activeElement.type; var nodeType = document.activeElement.type;
@ -62,7 +62,7 @@
var passwordField = shouldSetPasswordField(); var passwordField = shouldSetPasswordField();
if (isWindowFocused && if (isWindowFocused &&
(keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard || passwordField !== isPasswordField)) { (keyboardRaised !== window.isKeyboardRaised || numericKeyboard !== window.isNumericKeyboard || passwordField !== window.isPasswordField)) {
if (typeof EventBridge !== "undefined" && EventBridge !== null) { if (typeof EventBridge !== "undefined" && EventBridge !== null) {
EventBridge.emitWebEvent( EventBridge.emitWebEvent(
@ -75,20 +75,20 @@
} }
} }
if (!isKeyboardRaised) { if (!window.isKeyboardRaised) {
scheduleBringToView(250); // Allow time for keyboard to be raised in QML. scheduleBringToView(250); // Allow time for keyboard to be raised in QML.
// 2DO: should it be rather done from 'client area height changed' event? // 2DO: should it be rather done from 'client area height changed' event?
} }
isKeyboardRaised = keyboardRaised; window.isKeyboardRaised = keyboardRaised;
isNumericKeyboard = numericKeyboard; window.isNumericKeyboard = numericKeyboard;
isPasswordField = passwordField; window.isPasswordField = passwordField;
} }
}, POLL_FREQUENCY); }, POLL_FREQUENCY);
window.addEventListener("click", function () { window.addEventListener("click", function () {
var keyboardRaised = shouldRaiseKeyboard(); var keyboardRaised = shouldRaiseKeyboard();
if(keyboardRaised && isKeyboardRaised) { if (keyboardRaised && window.isKeyboardRaised) {
scheduleBringToView(150); scheduleBringToView(150);
} }
}); });
@ -99,7 +99,7 @@
window.addEventListener("blur", function () { window.addEventListener("blur", function () {
isWindowFocused = false; isWindowFocused = false;
isKeyboardRaised = false; window.isKeyboardRaised = false;
isNumericKeyboard = false; window.isNumericKeyboard = false;
}); });
})(); })();

View file

@ -47,6 +47,7 @@ Rectangle {
} else if (walletStatus === 1) { } else if (walletStatus === 1) {
if (root.activeView !== "walletSetup") { if (root.activeView !== "walletSetup") {
root.activeView = "walletSetup"; root.activeView = "walletSetup";
commerce.resetLocalWalletOnly();
} }
} else if (walletStatus === 2) { } else if (walletStatus === 2) {
if (root.activeView !== "passphraseModal") { if (root.activeView !== "passphraseModal") {

View file

@ -371,7 +371,7 @@ Item {
Item { Item {
id: securityImageTip; id: securityImageTip;
visible: false; visible: !root.hasShownSecurityImageTip && root.activeView === "step_3";
z: 999; z: 999;
anchors.fill: root; anchors.fill: root;
@ -421,7 +421,6 @@ Item {
text: "Got It"; text: "Got It";
onClicked: { onClicked: {
root.hasShownSecurityImageTip = true; root.hasShownSecurityImageTip = true;
securityImageTip.visible = false;
passphraseSelection.focusFirstTextField(); passphraseSelection.focusFirstTextField();
} }
} }
@ -439,9 +438,6 @@ Item {
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
commerce.getWalletAuthenticatedStatus(); commerce.getWalletAuthenticatedStatus();
if (!root.hasShownSecurityImageTip) {
securityImageTip.visible = true;
}
} }
} }
@ -732,6 +728,7 @@ Item {
text: "Finish"; text: "Finish";
onClicked: { onClicked: {
root.visible = false; root.visible = false;
root.hasShownSecurityImageTip = false;
sendSignalToWallet({method: 'walletSetup_finished', referrer: root.referrer ? root.referrer : ""}); sendSignalToWallet({method: 'walletSetup_finished', referrer: root.referrer ? root.referrer : ""});
} }
} }

View file

@ -128,6 +128,11 @@ void QmlCommerce::reset() {
wallet->reset(); wallet->reset();
} }
void QmlCommerce::resetLocalWalletOnly() {
auto wallet = DependencyManager::get<Wallet>();
wallet->reset();
}
void QmlCommerce::account() { void QmlCommerce::account() {
auto ledger = DependencyManager::get<Ledger>(); auto ledger = DependencyManager::get<Ledger>();
ledger->account(); ledger->account();

View file

@ -65,6 +65,7 @@ protected:
Q_INVOKABLE void history(); Q_INVOKABLE void history();
Q_INVOKABLE void generateKeyPair(); Q_INVOKABLE void generateKeyPair();
Q_INVOKABLE void reset(); Q_INVOKABLE void reset();
Q_INVOKABLE void resetLocalWalletOnly();
Q_INVOKABLE void account(); Q_INVOKABLE void account();
Q_INVOKABLE void certificateInfo(const QString& certificateId); Q_INVOKABLE void certificateInfo(const QString& certificateId);

View file

@ -15,6 +15,9 @@ function setUpKeyboardControl() {
var KEYBOARD_HEIGHT = 200; var KEYBOARD_HEIGHT = 200;
function raiseKeyboard() { function raiseKeyboard() {
window.isKeyboardRaised = true;
window.isNumericKeyboard = this.type === "number";
if (lowerTimer !== null) { if (lowerTimer !== null) {
clearTimeout(lowerTimer); clearTimeout(lowerTimer);
lowerTimer = null; lowerTimer = null;
@ -35,6 +38,9 @@ function setUpKeyboardControl() {
} }
function doLowerKeyboard() { function doLowerKeyboard() {
window.isKeyboardRaised = false;
window.isNumericKeyboard = false;
EventBridge.emitWebEvent("_LOWER_KEYBOARD"); EventBridge.emitWebEvent("_LOWER_KEYBOARD");
lowerTimer = null; lowerTimer = null;
isRaised = false; isRaised = false;