From 02aa8ac56613c8671355234b1828cc5855bcab56 Mon Sep 17 00:00:00 2001
From: Zach Fox <fox@highfidelity.io>
Date: Mon, 16 Apr 2018 11:53:37 -0700
Subject: [PATCH] Bugfixes per QA

---
 .../commerce/common/sendAsset/SendAsset.qml   |  3 +-
 .../qml/hifi/commerce/purchases/Purchases.qml |  1 +
 scripts/system/marketplaces/marketplaces.js   | 37 +++++++++++++------
 3 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml b/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml
index 8cae586017..8bf3a22338 100644
--- a/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml
+++ b/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml
@@ -1121,7 +1121,7 @@ Item {
             anchors.topMargin: 16;
             anchors.left: parent.left;
             anchors.leftMargin: 20;
-            width: 110;
+            width: 130;
             boxSize: 28;
             onCheckedChanged: {
                 Settings.setValue("sendAssetsNearbyPublicly", checked);
@@ -1133,7 +1133,6 @@ Item {
             text: "[?]";
             // Anchors
             anchors.left: sendPubliclyCheckbox.right;
-            anchors.leftMargin: 8;
             anchors.verticalCenter: sendPubliclyCheckbox.verticalCenter;
             height: 30;
             width: paintedWidth;
diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
index 0316e7d8b4..08e3e7a552 100644
--- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
+++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
@@ -792,6 +792,7 @@ Rectangle {
 
     HifiControlsUit.Keyboard {
         id: keyboard;
+        z: 999;
         raised: HMD.mounted && parent.keyboardRaised;
         numeric: parent.punctuationMode;
         anchors {
diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js
index 7fdefbcab7..64ce73fad6 100644
--- a/scripts/system/marketplaces/marketplaces.js
+++ b/scripts/system/marketplaces/marketplaces.js
@@ -1013,21 +1013,33 @@ var selectionDisplay = null; // for gridTool.js to ignore
                 });
                 break;
             case 'refreshConnections':
-                print('Refreshing Connections...');
-                getConnectionData(false);
+                // Guard to prevent this code from being executed while sending money --
+                // we only want to execute this while sending non-HFC gifts
+                if (!onWalletScreen) {
+                    print('Refreshing Connections...');
+                    getConnectionData(false);
+                }
                 break;
             case 'enable_ChooseRecipientNearbyMode':
-                if (!isUpdateOverlaysWired) {
-                    Script.update.connect(updateOverlays);
-                    isUpdateOverlaysWired = true;
+                // Guard to prevent this code from being executed while sending money --
+                // we only want to execute this while sending non-HFC gifts
+                if (!onWalletScreen) {
+                    if (!isUpdateOverlaysWired) {
+                        Script.update.connect(updateOverlays);
+                        isUpdateOverlaysWired = true;
+                    }
                 }
                 break;
             case 'disable_ChooseRecipientNearbyMode':
-                if (isUpdateOverlaysWired) {
-                    Script.update.disconnect(updateOverlays);
-                    isUpdateOverlaysWired = false;
+                // Guard to prevent this code from being executed while sending money --
+                // we only want to execute this while sending non-HFC gifts
+                if (!onWalletScreen) {
+                    if (isUpdateOverlaysWired) {
+                        Script.update.disconnect(updateOverlays);
+                        isUpdateOverlaysWired = false;
+                    }
+                    removeOverlays();
                 }
-                removeOverlays();
                 break;
             case 'wallet_availableUpdatesReceived':
             case 'purchases_availableUpdatesReceived':
@@ -1191,18 +1203,19 @@ var selectionDisplay = null; // for gridTool.js to ignore
     var isWired = false;
     var isUpdateOverlaysWired = false;
     function off() {
-        if (isWired) { // It is not ok to disconnect these twice, hence guard.
+        if (isWired) {
             Users.usernameFromIDReply.disconnect(usernameFromIDReply);
             Controller.mousePressEvent.disconnect(handleMouseEvent);
             Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent);
+            triggerMapping.disable();
+            triggerPressMapping.disable();
+
             isWired = false;
         }
         if (isUpdateOverlaysWired) {
             Script.update.disconnect(updateOverlays);
             isUpdateOverlaysWired = false;
         }
-        triggerMapping.disable(); // It's ok if we disable twice.
-        triggerPressMapping.disable(); // see above
         removeOverlays();
     }
     function shutdown() {