Merge branch 'oculus-store-commerce' of github.com:howard-stearns/hifi into oculus-store-commerce

This commit is contained in:
Zach Fox 2018-10-31 13:24:06 -07:00
commit efcda129b7
2 changed files with 64 additions and 43 deletions

View file

@ -260,38 +260,50 @@ Item {
interactive: false; interactive: false;
anchors.fill: parent; anchors.fill: parent;
model: filterBarModel; model: filterBarModel;
delegate: Rectangle { delegate: Item {
id: dropDownButton;
color: hifi.colors.white;
width: parent.width; width: parent.width;
height: 50; height: 50;
Rectangle {
id: dropDownButton;
color: hifi.colors.white;
width: parent.width;
height: 50;
visible: true;
RalewaySemiBold { RalewaySemiBold {
id: dropDownButtonText; id: dropDownButtonText;
text: model.displayName; text: model.displayName;
anchors.fill: parent; anchors.fill: parent;
anchors.leftMargin: 12; anchors.topMargin: 2;
color: hifi.colors.baseGray; anchors.leftMargin: 12;
horizontalAlignment: Text.AlignLeft; color: hifi.colors.baseGray;
verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignLeft;
size: 18; verticalAlignment: Text.AlignVCenter;
size: 18;
}
MouseArea {
anchors.fill: parent;
hoverEnabled: true;
propagateComposedEvents: false;
onEntered: {
dropDownButton.color = hifi.colors.blueHighlight;
}
onExited: {
dropDownButton.color = hifi.colors.white;
}
onClicked: {
textField.forceActiveFocus();
root.primaryFilter_index = index;
dropdownContainer.visible = false;
}
}
} }
Rectangle {
MouseArea { height: 2;
anchors.fill: parent; width: parent.width;
hoverEnabled: true; color: hifi.colors.lightGray;
propagateComposedEvents: false; visible: model.separator
onEntered: {
dropDownButton.color = hifi.colors.blueHighlight;
}
onExited: {
dropDownButton.color = hifi.colors.white;
}
onClicked: {
textField.forceActiveFocus();
root.primaryFilter_index = index;
dropdownContainer.visible = false;
}
} }
} }
} }

View file

@ -33,7 +33,6 @@ Rectangle {
property bool securityImageResultReceived: false; property bool securityImageResultReceived: false;
property bool purchasesReceived: false; property bool purchasesReceived: false;
property bool punctuationMode: false; property bool punctuationMode: false;
property bool isShowingMyItems: false;
property bool isDebuggingFirstUseTutorial: false; property bool isDebuggingFirstUseTutorial: false;
property string installedApps; property string installedApps;
property bool keyboardRaised: false; property bool keyboardRaised: false;
@ -104,10 +103,6 @@ Rectangle {
} }
} }
onIsShowingMyItemsChanged: {
getPurchases();
}
Timer { Timer {
id: notSetUpTimer; id: notSetUpTimer;
interval: 200; interval: 200;
@ -456,7 +451,7 @@ Rectangle {
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: 16; anchors.leftMargin: 16;
width: paintedWidth; width: paintedWidth;
text: isShowingMyItems ? "My Items" : "Inventory"; text: "Inventory";
color: hifi.colors.black; color: hifi.colors.black;
size: 22; size: 22;
} }
@ -498,8 +493,13 @@ Rectangle {
"filterName": "wearable" "filterName": "wearable"
}, },
{ {
"separator" : true,
"displayName": "Updatable", "displayName": "Updatable",
"filterName": "updated" "filterName": "updated"
},
{
"displayName": "Proofs",
"filterName": "proofs"
} }
] ]
filterBar.primaryFilterChoices.clear(); filterBar.primaryFilterChoices.clear();
@ -514,6 +514,7 @@ Rectangle {
onTextChanged: { onTextChanged: {
purchasesModel.searchFilter = filterBar.text; purchasesModel.searchFilter = filterBar.text;
filterBar.previousText = filterBar.text; filterBar.previousText = filterBar.text;
} }
} }
} }
@ -537,10 +538,18 @@ Rectangle {
listModelName: 'purchases'; listModelName: 'purchases';
listView: purchasesContentsList; listView: purchasesContentsList;
getPage: function () { getPage: function () {
console.debug('getPage', purchasesModel.listModelName, root.isShowingMyItems, filterBar.primaryFilter_filterName, purchasesModel.currentPageToRetrieve, purchasesModel.itemsPerPage); console.debug('getPage', purchasesModel.listModelName, filterBar.primaryFilter_filterName, purchasesModel.currentPageToRetrieve, purchasesModel.itemsPerPage);
var editionFilter = "";
var primaryFilter = "";
if (filterBar.primaryFilter_filterName === "proofs") {
editionFilter = "proofs";
} else {
primaryFilter = filterBar.primaryFilter_filterName;
}
Commerce.inventory( Commerce.inventory(
root.isShowingMyItems ? "proofs" : "purchased", editionFilter,
filterBar.primaryFilter_filterName, primaryFilter,
filterBar.text, filterBar.text,
purchasesModel.currentPageToRetrieve, purchasesModel.currentPageToRetrieve,
purchasesModel.itemsPerPage purchasesModel.itemsPerPage
@ -590,7 +599,6 @@ Rectangle {
upgradeUrl: model.upgrade_url; upgradeUrl: model.upgrade_url;
upgradeTitle: model.upgrade_title; upgradeTitle: model.upgrade_title;
itemType: model.item_type; itemType: model.item_type;
isShowingMyItems: root.isShowingMyItems;
valid: model.valid; valid: model.valid;
anchors.topMargin: 10; anchors.topMargin: 10;
anchors.bottomMargin: 10; anchors.bottomMargin: 10;
@ -801,7 +809,8 @@ Rectangle {
Rectangle { Rectangle {
id: updatesAvailableBanner; id: updatesAvailableBanner;
visible: root.numUpdatesAvailable > 0 && !root.isShowingMyItems; visible: root.numUpdatesAvailable > 0 &&
filterBar.primaryFilter_filterName !== "proofs";
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
@ -862,9 +871,8 @@ Rectangle {
id: noItemsAlertContainer; id: noItemsAlertContainer;
visible: !purchasesContentsList.visible && visible: !purchasesContentsList.visible &&
root.purchasesReceived && root.purchasesReceived &&
root.isShowingMyItems &&
filterBar.text === "" && filterBar.text === "" &&
filterBar.primaryFilter_displayName === ""; filterBar.primaryFilter_filterName === "proofs";
anchors.top: filterBarContainer.bottom; anchors.top: filterBarContainer.bottom;
anchors.topMargin: 12; anchors.topMargin: 12;
anchors.left: parent.left; anchors.left: parent.left;
@ -912,7 +920,6 @@ Rectangle {
id: noPurchasesAlertContainer; id: noPurchasesAlertContainer;
visible: !purchasesContentsList.visible && visible: !purchasesContentsList.visible &&
root.purchasesReceived && root.purchasesReceived &&
!root.isShowingMyItems &&
filterBar.text === "" && filterBar.text === "" &&
filterBar.primaryFilter_displayName === ""; filterBar.primaryFilter_displayName === "";
anchors.top: filterBarContainer.bottom; anchors.top: filterBarContainer.bottom;
@ -1045,7 +1052,9 @@ Rectangle {
filterBar.text = message.filterText ? message.filterText : ""; filterBar.text = message.filterText ? message.filterText : "";
break; break;
case 'purchases_showMyItems': case 'purchases_showMyItems':
root.isShowingMyItems = true; filterBar.primaryFilter_filterName = "proofs";
filterBar.primaryFilter_displayName = "Proofs";
filterBar.primaryFilter_index = 6;
break; break;
case 'updateConnections': case 'updateConnections':
sendAsset.updateConnections(message.connections); sendAsset.updateConnections(message.connections);