From 95a967522048604bb443c90056d03c3bf1767702 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 13 Oct 2017 10:52:28 -0700 Subject: [PATCH 1/9] Final help QA - minus link to blockchain docs --- interface/resources/qml/hifi/commerce/wallet/Help.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/Help.qml b/interface/resources/qml/hifi/commerce/wallet/Help.qml index 65c06994f8..7cada5e914 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Help.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Help.qml @@ -90,17 +90,22 @@ Item { ListElement { isExpanded: false; question: "What are private keys?" - answer: qsTr("A private key is a secret piece of text that is used to decrypt code.

In High Fidelity, your private keys are used to decrypt the contents of your Wallet and Purchases."); + answer: qsTr("A private key is a secret piece of text that is used to prove ownership, unlock confidential information, and sign transactions.

In High Fidelity, your private keys are used to securely access the contents of your Wallet and Purchases."); } ListElement { isExpanded: false; question: "Where are my private keys stored?" - answer: qsTr('Your private keys are only stored on your hard drive in High Fidelity Interface\'s AppData directory.

Tap here to open the file path of your hifikey in your file explorer.

You may backup this file by copying it to a USB flash drive, or to a service like Dropbox or Google Drive. Restore your backup by replacing the file in Interface\'s AppData directory with your backed-up copy.'); + answer: qsTr('By default, your private keys are only stored on your hard drive in High Fidelity Interface\'s AppData directory.

Tap here to open the file path of your hifikey in your file explorer.'); + } + ListElement { + isExpanded: false; + question: "How can I backup my private keys?" + answer: qsTr('You may backup the file containing your private keys by copying it to a USB flash drive, or to a service like Dropbox or Google Drive.

Restore your backup by replacing the file in Interface\'s AppData directory with your backed-up copy.

Tap here to open the file path of your hifikey in your file explorer.'); } ListElement { isExpanded: false; question: "What happens if I lose my passphrase?" - answer: qsTr("If you lose your passphrase, you will no longer have access to the contents of your Wallet or My Purchases.

Nobody can help you recover your passphrase, including High Fidelity. Please write it down and store it securely."); + answer: qsTr("Your passphrase is used to encrypt your private keys. If you lose your passphrase, you will no longer be able to decrypt your private key file. You will also no longer have access to the contents of your Wallet or My Purchases.

Nobody can help you recover your passphrase, including High Fidelity. Please write it down and store it securely."); } ListElement { isExpanded: false; From 051019a57a863644e4c1af46ff066e3c4d8be498 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 13 Oct 2017 12:10:37 -0700 Subject: [PATCH 2/9] Fix certificate username text eliding too early --- .../inspectionCertificate/InspectionCertificate.qml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml index fe1f049e5e..aa1372494f 100644 --- a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml +++ b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml @@ -200,12 +200,6 @@ Rectangle { // Style color: hifi.colors.lightGray; } - FontLoader { id: ralewayRegular; source: "../../../../fonts/Raleway-Regular.ttf"; } - TextMetrics { - id: textMetrics; - font.family: ralewayRegular.name - text: root.itemOwner; - } RalewayRegular { id: ownedBy; text: root.itemOwner; @@ -215,8 +209,7 @@ Rectangle { anchors.top: ownedByHeader.bottom; anchors.topMargin: 8; anchors.left: ownedByHeader.left; - height: textMetrics.height; - width: root.isMyCert ? textMetrics.width + 25 : ownedByHeader.width; + height: paintedHeight; // Style color: hifi.colors.darkGray; elide: Text.ElideRight; @@ -231,7 +224,7 @@ Rectangle { anchors.topMargin: 4; anchors.bottom: ownedBy.bottom; anchors.left: ownedBy.right; - anchors.leftMargin: 4; + anchors.leftMargin: 6; anchors.right: ownedByHeader.right; // Style color: hifi.colors.lightGray; From 17a0dd2a76ea7bc55adde2ec1b0d2c27ee2ca46f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 13 Oct 2017 13:32:55 -0700 Subject: [PATCH 3/9] Elide long usernames in injected code --- scripts/system/html/js/marketplacesInject.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index fc16eae8bf..0f4fe58586 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -193,6 +193,11 @@ var navbarBrandElement = document.getElementsByClassName('navbar-brand')[0]; var purchasesElement = document.createElement('a'); var dropDownElement = document.getElementById('user-dropdown'); + + $('#user-dropdown').find('.username')[0].style = "max-width:80px;white-space:nowrap;overflow:hidden;" + + "text-overflow:ellipsis;display:inline-block;position:relative;top:4px;"; + $('#user-dropdown').find('.caret')[0].style = "position:relative;top:-3px;"; + purchasesElement.id = "purchasesButton"; purchasesElement.setAttribute('href', "#"); purchasesElement.innerHTML = "My Purchases"; From 6b7c997a4c2e63e2ed6ad098e08ec0eb8b6d495a Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 13 Oct 2017 13:37:11 -0700 Subject: [PATCH 4/9] Minor text tweak --- interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml index 0075e86bdc..99fe933bd6 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml @@ -679,7 +679,7 @@ Item { anchors.right: parent.right; anchors.rightMargin: 30; height: 40; - text: "Open Instructions for Later"; + text: "Open Backup Instructions for Later"; onClicked: { instructions01Container.visible = false; instructions02Container.visible = true; From 5be9f2022e60864b4c161d9922a1f93468f6231c Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 13 Oct 2017 14:33:36 -0700 Subject: [PATCH 5/9] Fix writing backup instructions when restoring wallet backup --- interface/src/commerce/Wallet.cpp | 22 ++++++++++++---------- interface/src/commerce/Wallet.h | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index d7227a58f7..faa95b2a40 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -105,19 +105,19 @@ RSA* readKeys(const char* filename) { return key; } -bool writeBackupInstructions() { +bool Wallet::writeBackupInstructions() { QString inputFilename(PathUtils::resourcesPath() + "html/commerce/backup_instructions.html"); - QString filename = PathUtils::getAppDataFilePath(INSTRUCTIONS_FILE); - QFile outputFile(filename); + QString outputFilename = PathUtils::getAppDataFilePath(INSTRUCTIONS_FILE); + QFile outputFile(outputFilename); bool retval = false; - if (QFile::exists(filename)) + if (QFile::exists(outputFilename) || getKeyFilePath() == "") { - QFile::remove(filename); + return false; } - QFile::copy(inputFilename, filename); + QFile::copy(inputFilename, outputFilename); - if (QFile::exists(filename) && outputFile.open(QIODevice::ReadWrite)) { + if (QFile::exists(outputFilename) && outputFile.open(QIODevice::ReadWrite)) { QByteArray fileData = outputFile.readAll(); QString text(fileData); @@ -132,7 +132,7 @@ bool writeBackupInstructions() { retval = true; qCDebug(commerce) << "wrote html file successfully"; } else { - qCDebug(commerce) << "failed to open output html file" << filename; + qCDebug(commerce) << "failed to open output html file" << outputFilename; } return retval; } @@ -154,8 +154,6 @@ bool writeKeys(const char* filename, RSA* keys) { QFile(QString(filename)).remove(); return retval; } - - writeBackupInstructions(); retval = true; qCDebug(commerce) << "wrote keys successfully"; @@ -359,6 +357,8 @@ bool Wallet::setPassphrase(const QString& passphrase) { _publicKeys.clear(); + writeBackupInstructions(); + return true; } @@ -526,6 +526,8 @@ bool Wallet::generateKeyPair() { qCInfo(commerce) << "Generating keypair."; auto keyPair = generateRSAKeypair(); + writeBackupInstructions(); + // TODO: redo this soon -- need error checking and so on writeSecurityImage(_securityImage, keyFilePath()); QString oldKey = _publicKeys.count() == 0 ? "" : _publicKeys.last(); diff --git a/interface/src/commerce/Wallet.h b/interface/src/commerce/Wallet.h index 38c5299810..31df2df918 100644 --- a/interface/src/commerce/Wallet.h +++ b/interface/src/commerce/Wallet.h @@ -80,6 +80,7 @@ private: void updateImageProvider(); bool writeSecurityImage(const QPixmap* pixmap, const QString& outputFilePath); bool readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferLen); + bool writeBackupInstructions(); bool verifyOwnerChallenge(const QByteArray& encryptedText, const QString& publicKey, QString& decryptedText); From a852d5040d5cfddb7127268d0879370fdea7d7a7 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 13 Oct 2017 16:04:48 -0700 Subject: [PATCH 6/9] FIxing the zone entity not stacked properly when created --- .../src/EntityTreeRenderer.cpp | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 9e700b0efe..85916baf60 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -237,19 +237,7 @@ void EntityTreeRenderer::update(bool simulate) { EntityTreePointer tree = std::static_pointer_cast(_tree); tree->update(simulate); - if (simulate) { - // Handle enter/leave entity logic - checkEnterLeaveEntities(); - - // Even if we're not moving the mouse, if we started clicking on an entity and we have - // not yet released the hold then this is still considered a holdingClickOnEntity event - // and we want to simulate this message here as well as in mouse move - if (_lastPointerEventValid && !_currentClickingOnEntityID.isInvalidID()) { - emit holdingClickOnEntity(_currentClickingOnEntityID, _lastPointerEvent); - _entitiesScriptEngine->callEntityScriptMethod(_currentClickingOnEntityID, "holdingClickOnEntity", _lastPointerEvent); - } - } - + // Update the rendereable entities as needed { PerformanceTimer sceneTimer("scene"); auto scene = _viewState->getMain3DScene(); @@ -269,6 +257,20 @@ void EntityTreeRenderer::update(bool simulate) { } } } + + if (simulate) { + // Handle enter/leave entity logic + checkEnterLeaveEntities(); + + // Even if we're not moving the mouse, if we started clicking on an entity and we have + // not yet released the hold then this is still considered a holdingClickOnEntity event + // and we want to simulate this message here as well as in mouse move + if (_lastPointerEventValid && !_currentClickingOnEntityID.isInvalidID()) { + emit holdingClickOnEntity(_currentClickingOnEntityID, _lastPointerEvent); + _entitiesScriptEngine->callEntityScriptMethod(_currentClickingOnEntityID, "holdingClickOnEntity", _lastPointerEvent); + } + } + } } From 1cf816a261b87a85620ed91266798bf72b5fb1a6 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 16 Oct 2017 11:15:09 -0700 Subject: [PATCH 7/9] Fix Wallet notification appearing when taking screenshots --- scripts/system/notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index ef2c674a41..b6ddd9d33e 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -576,7 +576,7 @@ createNotification("Processing GIF snapshot...", NotificationType.SNAPSHOT); } - function processingGif() { + function walletNotSetup() { createNotification("Your wallet isn't set up. Open the WALLET app.", NotificationType.WALLET); } From fa7892e5c68d756231058b60845f4dfca87fab5e Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 13 Oct 2017 19:51:30 +0300 Subject: [PATCH 8/9] 8217 Search in tablet doesn't update --- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 43 ++++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 01026ae5ff..62ef25f47e 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -1018,17 +1018,8 @@ void OffscreenQmlSurface::synthesizeKeyPress(QString key, QObject* targetOverrid } } -static void forEachKeyboard(QQuickItem* item, std::function function) { - QObject* itemObject = item; - while (itemObject) { - if (itemObject->parent()) { - itemObject = itemObject->parent(); - } else { - break; - } - } - - auto keyboards = itemObject->findChildren("keyboard"); +static void forEachKeyboard(QQuickItem* parent, std::function function) { + auto keyboards = parent->findChildren("keyboard"); for (auto keyboardObject : keyboards) { auto keyboard = qobject_cast(keyboardObject); @@ -1044,6 +1035,19 @@ static void forEachKeyboard(QQuickItem* item, std::function f static const int TEXTINPUT_PASSWORD = 2; +static QQuickItem* getTopmostParent(QQuickItem* item) { + QObject* itemObject = item; + while (itemObject) { + if (itemObject->parent()) { + itemObject = itemObject->parent(); + } else { + break; + } + } + + return qobject_cast (itemObject); +} + void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool numeric) { #if Q_OS_ANDROID return; @@ -1066,10 +1070,14 @@ void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool n // we need to somehow pass 'isPasswordField' to visible keyboard so it will change its 'mirror text' to asterixes // the issue in some cases there might be more than one keyboard in object tree and it is hard to understand which one is being used at the moment // unfortunately attempts to check for visibility failed becuase visibility is not updated yet. So... I don't see other way than just update properties for all the keyboards - forEachKeyboard(item, [&](QQuickItem* keyboard) { - keyboard->setProperty("mirroredText", QVariant::fromValue(QString(""))); - keyboard->setProperty("password", isPasswordField); - }); + + auto topmostParent = getTopmostParent(item); + if (topmostParent) { + forEachKeyboard(topmostParent, [&](QQuickItem* keyboard) { + keyboard->setProperty("mirroredText", QVariant::fromValue(QString(""))); + keyboard->setProperty("password", isPasswordField); + }); + } // for future probably makes sense to consider one of the following: // 1. make keyboard a singleton, which will be dynamically re-parented before showing @@ -1081,6 +1089,11 @@ void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool n numeric = numeric || QString(item->metaObject()->className()).left(7) == "SpinBox"; if (item->property("keyboardRaised").isValid()) { + forEachKeyboard(item, [&](QQuickItem* keyboard) { + keyboard->setProperty("mirroredText", QVariant::fromValue(QString(""))); + keyboard->setProperty("password", isPasswordField); + }); + // FIXME - HMD only: Possibly set value of "keyboardEnabled" per isHMDMode() for use in WebView.qml. if (item->property("punctuationMode").isValid()) { item->setProperty("punctuationMode", QVariant(numeric)); From e8589d53dd32e19644a4e257d707349ea84bbda5 Mon Sep 17 00:00:00 2001 From: beholder Date: Wed, 18 Oct 2017 03:45:50 +0300 Subject: [PATCH 9/9] updated code based on code review --- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 62ef25f47e..eb42c95c66 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -1019,15 +1019,15 @@ void OffscreenQmlSurface::synthesizeKeyPress(QString key, QObject* targetOverrid } static void forEachKeyboard(QQuickItem* parent, std::function function) { + if (!function) { + return; + } + auto keyboards = parent->findChildren("keyboard"); for (auto keyboardObject : keyboards) { auto keyboard = qobject_cast(keyboardObject); - if (keyboard == nullptr) { - continue; - } - - if (function) { + if (keyboard) { function(keyboard); } }