use the switch

This commit is contained in:
Howard Stearns 2018-10-25 11:29:10 -07:00
parent c85dbb8233
commit 6284c902be
5 changed files with 45 additions and 35 deletions

View file

@ -180,8 +180,8 @@ Rectangle {
HifiCommerceCommon.EmulatedMarketplaceHeader {
id: titleBarContainer;
z: 997;
visible: false; //HRS FIXME !needsLogIn.visible;
height: 100; // HRS FIXME
visible: false;
height: 100; // HRS FIXME: get rid of the header and associated code entirely?
// Size
width: parent.width;
// Anchors
@ -476,7 +476,7 @@ Rectangle {
anchors.left: parent.left;
anchors.leftMargin: 16;
width: paintedWidth;
text: isShowingMyItems ? "My Items" : "Inventory"; //"My Purchases";
text: isShowingMyItems ? "My Items" : "Inventory";
color: hifi.colors.black;
size: 22;
}

View file

@ -30,6 +30,7 @@ Rectangle {
property string activeView: "initialize";
property bool keyboardRaised: false;
property bool isPassword: false;
property bool limitedCommerce: true;
anchors.fill: (typeof parent === undefined) ? undefined : parent;
@ -65,7 +66,7 @@ Rectangle {
}
} else if (walletStatus === 5) {
if (root.activeView !== "walletSetup") {
root.activeView = "walletInventory"; // HRS FIXME "walletHome";
root.activeView = "walletInventory";
Commerce.getSecurityImage();
}
} else {
@ -125,7 +126,7 @@ Rectangle {
// Title Bar text
RalewaySemiBold {
id: titleBarText;
text: "ASSETS"; //"WALLET";
text: "ASSETS";
// Text size
size: hifi.fontSizes.overlayTitle;
// Anchors
@ -370,6 +371,7 @@ Rectangle {
listModelName: "Send Money Connections";
z: 997;
visible: root.activeView === "sendMoney";
keyboardContainer: root;
anchors.fill: parent;
parentAppTitleBarHeight: titleBarContainer.height;
parentAppNavBarHeight: tabButtonsContainer.height;
@ -464,13 +466,13 @@ Rectangle {
visible: !walletSetup.visible;
color: root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
anchors.top: parent.top;
anchors.left: exchangeMoneyButtonContainer.right; // HRS FIXME parent.left;
anchors.left: exchangeMoneyButtonContainer.right;
anchors.bottom: parent.bottom;
width: parent.width / tabButtonsContainer.numTabs;
HiFiGlyphs {
id: homeTabIcon;
text: hifi.glyphs.leftRightArrows; // HRS FIXME hifi.glyphs.home2;
text: hifi.glyphs.leftRightArrows;
// Size
size: 50;
// Anchors
@ -478,11 +480,11 @@ Rectangle {
anchors.top: parent.top;
anchors.topMargin: -2;
// Style
color: hifi.colors.lightGray50; // HRS FIXME root.activeView === "walletHome" || walletHomeTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight;
color: root.limitedCommerce ? hifi.colors.lightGray50 : ((root.activeView === "walletHome" || walletHomeTabMouseArea.containsMouse) ? hifi.colors.white : hifi.colors.blueHighlight);
}
RalewaySemiBold {
text: "RECENT ACTIVITY"; //"WALLET HOME";
text: "RECENT ACTIVITY";
// Text size
size: 16;
// Anchors
@ -493,15 +495,16 @@ Rectangle {
anchors.right: parent.right;
anchors.rightMargin: 4;
// Style
color: hifi.colors.lightGray50; // HRS FIXME root.activeView === "walletHome" || walletHomeTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight;
color: root.limitedCommerce ? hifi.colors.lightGray50 : ((root.activeView === "walletHome" || walletHomeTabMouseArea.containsMouse) ? hifi.colors.white : hifi.colors.blueHighlight);
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignTop;
}
/* HRS FIXME MouseArea {
MouseArea {
id: walletHomeTabMouseArea;
anchors.fill: parent;
enabled: !root.limitedCommerce;
hoverEnabled: enabled;
onClicked: {
root.activeView = "walletHome";
@ -509,22 +512,22 @@ Rectangle {
}
onEntered: parent.color = hifi.colors.blueHighlight;
onExited: parent.color = root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
}*/
}
}
// "EXCHANGE MONEY" tab button
Rectangle {
id: exchangeMoneyButtonContainer;
visible: !walletSetup.visible;
color: root.activeView === "walletInventory" ? hifi.colors.blueAccent : hifi.colors.black; // HRS FIXME hifi.colors.black;
color: root.activeView === "walletInventory" ? hifi.colors.blueAccent : hifi.colors.black;
anchors.top: parent.top;
anchors.left: parent.left; // FIXME walletHomeButtonContainer.right;
anchors.left: parent.left;
anchors.bottom: parent.bottom;
width: parent.width / tabButtonsContainer.numTabs;
HiFiGlyphs {
id: exchangeMoneyTabIcon;
text: hifi.glyphs.home2; // HRS FIXME hifi.glyphs.leftRightArrows;
text: hifi.glyphs.home2;
// Size
size: 50;
// Anchors
@ -532,11 +535,11 @@ Rectangle {
anchors.top: parent.top;
anchors.topMargin: -2;
// Style
color: root.activeView === "walletInventory" || walletHomeTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight; // HRS FIXMEhifi.colors.lightGray50;
color: root.activeView === "walletInventory" || walletHomeTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight;
}
RalewaySemiBold {
text: "INVENTORY"; // HRS FIXME "EXCHANGE MONEY";
text: "INVENTORY";
// Text size
size: 16;
// Anchors
@ -547,7 +550,7 @@ Rectangle {
anchors.right: parent.right;
anchors.rightMargin: 4;
// Style
color: root.activeView === "walletInventory" || walletHomeTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight; // HRS FIXME hifi.colors.lightGray50;
color: root.activeView === "walletInventory" || walletHomeTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight;
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignHCenter;
@ -574,7 +577,7 @@ Rectangle {
visible: !walletSetup.visible;
color: root.activeView === "sendMoney" ? hifi.colors.blueAccent : hifi.colors.black;
anchors.top: parent.top;
anchors.left: walletHomeButtonContainer.right; // HRS FIXME exchangeMoneyButtonContainer.right;
anchors.left: walletHomeButtonContainer.right;
anchors.bottom: parent.bottom;
width: parent.width / tabButtonsContainer.numTabs;
@ -588,7 +591,7 @@ Rectangle {
anchors.top: parent.top;
anchors.topMargin: -2;
// Style
color: hifi.colors.lightGray50; // HRS FIXME root.activeView === "sendMoney" || sendMoneyTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight;
color: root.limitedCommerce ? hifi.colors.lightGray50 : ((root.activeView === "sendMoney" || sendMoneyTabMouseArea.containsMouse) ? hifi.colors.white : hifi.colors.blueHighlight);
}
RalewaySemiBold {
@ -603,16 +606,17 @@ Rectangle {
anchors.right: parent.right;
anchors.rightMargin: 4;
// Style
color: hifi.colors.lightGray50; // HRS FIXME root.activeView === "sendMoney" || sendMoneyTabMouseArea.containsMouse ? hifi.colors.white : hifi.colors.blueHighlight;
color: root.limitedCommerce ? hifi.colors.lightGray50 : ((root.activeView === "sendMoney" || sendMoneyTabMouseArea.containsMouse) ? hifi.colors.white : hifi.colors.blueHighlight);
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignTop;
}
/* HRS FIXME MouseArea {
MouseArea {
id: sendMoneyTabMouseArea;
anchors.fill: parent;
enabled: !root.limitedCommerce;
hoverEnabled: enabled;
onClicked: {
root.activeView = "sendMoney";
@ -620,7 +624,7 @@ Rectangle {
}
onEntered: parent.color = hifi.colors.blueHighlight;
onExited: parent.color = root.activeView === "sendMoney" ? hifi.colors.blueAccent : hifi.colors.black;
} */
}
}
// "SECURITY" tab button
@ -737,7 +741,7 @@ Rectangle {
sendMoneyButtonContainer.color = hifi.colors.black;
securityButtonContainer.color = hifi.colors.black;
helpButtonContainer.color = hifi.colors.black;
exchangeMoneyButtonContainer.color = hifi.colors.black; // HRS FIXME
exchangeMoneyButtonContainer.color = hifi.colors.black;
if (root.activeView === "walletHome") {
walletHomeButtonContainer.color = hifi.colors.blueAccent;
} else if (root.activeView === "sendMoney") {
@ -746,7 +750,7 @@ Rectangle {
securityButtonContainer.color = hifi.colors.blueAccent;
} else if (root.activeView === "help") {
helpButtonContainer.color = hifi.colors.blueAccent;
} else if (root.activeView == "walletInventory") { // HRS FIXME
} else if (root.activeView == "walletInventory") {
exchangeMoneyButtonContainer.color = hifi.colors.blueAccent;
}
}
@ -825,6 +829,9 @@ Rectangle {
case 'avatarDisconnected':
// Because we don't have "channels" for sending messages to a specific QML object, the messages are broadcast to all QML Items. If an Item of yours happens to be visible when some script sends a message with a method you don't expect, you'll get "Unrecognized message..." logs.
break;
case 'setLimitedCommerce':
root.limitedCommerce = message.limitedCommerce;
break;
default:
// HRS FIXME console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
walletInventory.fromScript(message);

View file

@ -490,6 +490,7 @@ function walletOpened() {
triggerPressMapping.enable();
shouldShowDot = false;
ui.messagesWaiting(shouldShowDot);
ui.sendMessage({method: 'setLimitedCommerce', limitedCommerce: Wallet.limitedCommerce}); // HRS FIXME Wallet should be accessible in qml. Why isn't it?
}
function walletClosed() {
@ -582,7 +583,7 @@ function uninstallMarketplaceItemTester() {
}
}
var BUTTON_NAME = "ASSETS"; //HRS FIXME "WALLET";
var BUTTON_NAME = "ASSETS";
var WALLET_QML_SOURCE = "hifi/commerce/wallet/Wallet.qml";
var ui;
function startup() {

View file

@ -27,6 +27,7 @@
var xmlHttpRequest = null;
var isPreparing = false; // Explicitly track download request status.
var limitedCommerce = false;
var commerceMode = false;
var userIsLoggedIn = false;
var walletNeedsSetup = false;
@ -219,7 +220,9 @@
purchasesElement.style = "height:100%;margin-top:18px;font-weight:bold;float:right;margin-right:" + (dropDownElement.offsetWidth + 30) +
"px;position:relative;z-index:999;";
navbarBrandElement.parentNode.insertAdjacentElement('beforeend', purchasesElement);
$('#purchasesButton').css('display', 'none'); // HRS FIXME
if (limitedCommerce) {
$('#purchasesButton').css('display', 'none');
}
$('#purchasesButton').on('click', function () {
EventBridge.emitWebEvent(JSON.stringify({
type: "PURCHASES",
@ -285,7 +288,7 @@
}
cost = $(this).closest('.col-xs-3').find('.item-cost').text();
var costInt = parseInt(cost, 10);
var disable = costInt > 0; // HRS FIXME
var disable = limitedCommerce && (costInt > 0);
$(this).closest('.col-xs-3').prev().attr("class", 'col-xs-6');
$(this).closest('.col-xs-3').attr("class", 'col-xs-6');
@ -303,7 +306,7 @@
if (parseInt(cost) > 0) {
if (disable) {
priceElement.html('N/A'); // In case the following fails
$(this).parent().parent().parent().parent().parent().css({"display": "none"}); // HRS FIXME
$(this).parent().parent().parent().parent().parent().css({"display": "none"}); // HRS FIXME, oh and do I have to set display non-none in the other branch?
} else {
priceElement.css({ "width": "auto" });
priceElement.html('<span class="hifi-glyph hifi-glyph-hfc" style="filter:invert(1);background-size:20px;' +
@ -315,7 +318,6 @@
// change pricing to GET/BUY on button hover
$('body').on('mouseenter', '#price-or-edit .price', function () {
if (disable) { return; }
var $this = $(this);
var buyString = "BUY";
var getString = "GET";
@ -340,14 +342,12 @@
});
$('body').on('mouseleave', '#price-or-edit .price', function () {
if (disable) { return; }
var $this = $(this);
$this.html($this.data('initialHtml'));
});
$('.grid-item').find('#price-or-edit').find('a').on('click', function () {
if (disable) { return false; }
if ($(this).closest('.grid-item').find('.price').text() === 'invalidated') {
return false;
}
@ -433,8 +433,8 @@
var cost = $('.item-cost').text();
var costInt = parseInt(cost, 10);
var availability = $.trim($('.item-availability').text());
if (costInt > 0) {
availability = ''; // HRS FIXME
if (limitedCommerce && (costInt > 0)) {
availability = '';
}
if (availability === 'available') {
purchaseButton.css({
@ -757,6 +757,7 @@
cancelClaraDownload();
} else if (message.type === "marketplaces") {
if (message.action === "commerceSetting") {
limitedCommerce = !!message.data.limitedCommerce;
commerceMode = !!message.data.commerceMode;
userIsLoggedIn = !!message.data.userIsLoggedIn;
walletNeedsSetup = !!message.data.walletNeedsSetup;

View file

@ -230,7 +230,8 @@ function sendCommerceSettings() {
userIsLoggedIn: Account.loggedIn,
walletNeedsSetup: walletNeedsSetup(),
metaverseServerURL: Account.metaverseServerURL,
messagesWaiting: shouldShowDot
messagesWaiting: shouldShowDot,
limitedCommerce: Wallet.limitedCommerce
}
});
}