mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 14:04:23 +02:00
work through stocking vs update issues, and cleanup
This commit is contained in:
parent
7585391642
commit
f5afc2033f
5 changed files with 27 additions and 42 deletions
|
@ -41,8 +41,8 @@ Rectangle {
|
||||||
property string itemAuthor;
|
property string itemAuthor;
|
||||||
property int itemEdition: -1;
|
property int itemEdition: -1;
|
||||||
property bool hasSomethingToTradeIn: alreadyOwned && (itemEdition > 0); // i.e., don't trade in your artist's proof
|
property bool hasSomethingToTradeIn: alreadyOwned && (itemEdition > 0); // i.e., don't trade in your artist's proof
|
||||||
property bool isTradingIn: isUpdating && hasSomethingToTradeIn;
|
property bool isTradingIn: canUpdate && hasSomethingToTradeIn;
|
||||||
property bool isStocking: availability === 'not for sale' && creator === Account.username;
|
property bool isStocking: (availability === 'not for sale') && (creator === Account.username) && ;
|
||||||
property string certificateId;
|
property string certificateId;
|
||||||
property double balanceAfterPurchase;
|
property double balanceAfterPurchase;
|
||||||
property bool alreadyOwned: false; // Including proofs
|
property bool alreadyOwned: false; // Including proofs
|
||||||
|
@ -59,7 +59,7 @@ Rectangle {
|
||||||
property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
|
property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
|
||||||
property string referrer;
|
property string referrer;
|
||||||
property bool isInstalled;
|
property bool isInstalled;
|
||||||
property bool isUpdating;
|
property bool canUpdate;
|
||||||
property string availability: "available";
|
property string availability: "available";
|
||||||
property string creator: "";
|
property string creator: "";
|
||||||
property string baseAppURL;
|
property string baseAppURL;
|
||||||
|
@ -144,6 +144,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAvailableUpdatesResult: {
|
onAvailableUpdatesResult: {
|
||||||
|
// Answers the updatable original item cert data still owned by this user that are EITHER instances of this marketplace id, or update to this marketplace id.
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
console.log("Failed to get Available Updates", result.data.message);
|
console.log("Failed to get Available Updates", result.data.message);
|
||||||
} else {
|
} else {
|
||||||
|
@ -155,7 +156,7 @@ Rectangle {
|
||||||
if (root.itemEdition !== -1 && root.itemEdition !== parseInt(result.data.updates[i].edition_number)) {
|
if (root.itemEdition !== -1 && root.itemEdition !== parseInt(result.data.updates[i].edition_number)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
root.isUpdating = true;
|
root.canUpdate = true;
|
||||||
root.baseItemName = result.data.updates[i].base_item_title;
|
root.baseItemName = result.data.updates[i].base_item_title;
|
||||||
// This CertID is the one corresponding to the base item CertID that the user already owns
|
// This CertID is the one corresponding to the base item CertID that the user already owns
|
||||||
root.certificateId = result.data.updates[i].certificate_id;
|
root.certificateId = result.data.updates[i].certificate_id;
|
||||||
|
@ -166,7 +167,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.data.updates.length === 0 || root.isUpdating) {
|
if (result.data.updates.length === 0 || root.canUpdate) {
|
||||||
root.availableUpdatesReceived = true;
|
root.availableUpdatesReceived = true;
|
||||||
refreshBuyUI();
|
refreshBuyUI();
|
||||||
} else {
|
} else {
|
||||||
|
@ -266,13 +267,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
|
||||||
enabled: titleBarContainer.usernameDropdownVisible;
|
|
||||||
anchors.fill: parent;
|
|
||||||
onClicked: {
|
|
||||||
titleBarContainer.usernameDropdownVisible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// TITLE BAR END
|
// TITLE BAR END
|
||||||
//
|
//
|
||||||
|
@ -481,7 +475,7 @@ Rectangle {
|
||||||
FiraSansSemiBold {
|
FiraSansSemiBold {
|
||||||
id: itemPriceText;
|
id: itemPriceText;
|
||||||
text: isTradingIn ? "FREE\nUPDATE" :
|
text: isTradingIn ? "FREE\nUPDATE" :
|
||||||
(isStocking ? "Free for creator" :
|
(isStocking ? "Free for creator" :
|
||||||
((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE")));
|
((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE")));
|
||||||
// Text size
|
// Text size
|
||||||
size: isTradingIn ? 20 : 26;
|
size: isTradingIn ? 20 : 26;
|
||||||
|
@ -580,7 +574,7 @@ Rectangle {
|
||||||
// "View in Inventory" button
|
// "View in Inventory" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: viewInMyPurchasesButton;
|
id: viewInMyPurchasesButton;
|
||||||
visible: isCertified && dataReady && (isUpdating ? !hasSomethingToTradeIn : alreadyOwned);
|
visible: isCertified && dataReady && (isTradingIn ? hasSomethingToTradeIn : alreadyOwned);
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
anchors.top: buyTextContainer.visible ? buyTextContainer.bottom : checkoutActionButtonsContainer.top;
|
anchors.top: buyTextContainer.visible ? buyTextContainer.bottom : checkoutActionButtonsContainer.top;
|
||||||
|
@ -588,9 +582,9 @@ Rectangle {
|
||||||
height: 50;
|
height: 50;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
text: root.isUpdating ? "UPDATE TO THIS ITEM FOR FREE" : "VIEW THIS ITEM IN YOUR INVENTORY";
|
text: (canUpdate && !isTradingIn) ? "UPDATE TO THIS ITEM FOR FREE" : "VIEW THIS ITEM IN YOUR INVENTORY";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.isUpdating) {
|
if (root.canUpdate) {
|
||||||
sendToScript({method: 'checkout_goToPurchases', filterText: root.baseItemName});
|
sendToScript({method: 'checkout_goToPurchases', filterText: root.baseItemName});
|
||||||
} else {
|
} else {
|
||||||
sendToScript({method: 'checkout_goToPurchases', filterText: root.itemName});
|
sendToScript({method: 'checkout_goToPurchases', filterText: root.itemName});
|
||||||
|
@ -602,7 +596,11 @@ Rectangle {
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: buyButton;
|
id: buyButton;
|
||||||
visible: isTradingIn || !alreadyOwned || isStocking || !(root.itemType === "avatar" || root.itemType === "app");
|
visible: isTradingIn || !alreadyOwned || isStocking || !(root.itemType === "avatar" || root.itemType === "app");
|
||||||
enabled: (root.balanceAfterPurchase >= 0 && dataReady) || (!root.isCertified) || root.isUpdating;
|
property bool checkBalance: dataReady && (root.availability === "available")
|
||||||
|
enabled: (checkBalance && (balanceAfterPurchase >= 0)) || !isCertified || isTradingIn || isStocking;
|
||||||
|
text: isTradingIn ? "Confirm Update" :
|
||||||
|
(enabled ? (viewInMyPurchasesButton.visible ? "Get It Again" : (dataReady ? "Get Item" : "--")) :
|
||||||
|
(checkBalance ? "Insufficient Funds" : availability))
|
||||||
color: viewInMyPurchasesButton.visible ? hifi.buttons.white : hifi.buttons.blue;
|
color: viewInMyPurchasesButton.visible ? hifi.buttons.white : hifi.buttons.blue;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
anchors.top: viewInMyPurchasesButton.visible ? viewInMyPurchasesButton.bottom :
|
anchors.top: viewInMyPurchasesButton.visible ? viewInMyPurchasesButton.bottom :
|
||||||
|
@ -611,13 +609,6 @@ Rectangle {
|
||||||
height: 50;
|
height: 50;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
text: isTradingIn ?
|
|
||||||
"CONFIRM UPDATE" :
|
|
||||||
(((root.isCertified) ?
|
|
||||||
(dataReady ?
|
|
||||||
((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") :
|
|
||||||
"--") :
|
|
||||||
"Get Item"));
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (isTradingIn) {
|
if (isTradingIn) {
|
||||||
// If we're updating an app, the existing app needs to be uninstalled.
|
// If we're updating an app, the existing app needs to be uninstalled.
|
||||||
|
@ -1209,7 +1200,7 @@ Rectangle {
|
||||||
buyText.text = "";
|
buyText.text = "";
|
||||||
|
|
||||||
// If the user IS on the checkout page for the updated version of an owned item...
|
// If the user IS on the checkout page for the updated version of an owned item...
|
||||||
if (root.isUpdating) {
|
if (root.canUpdate) {
|
||||||
// If the user HAS already selected a specific edition to update...
|
// If the user HAS already selected a specific edition to update...
|
||||||
if (hasSomethingToTradeIn) {
|
if (hasSomethingToTradeIn) {
|
||||||
buyText.text = "By pressing \"Confirm Update\", you agree to trade in your old item for the updated item that replaces it.";
|
buyText.text = "By pressing \"Confirm Update\", you agree to trade in your old item for the updated item that replaces it.";
|
||||||
|
|
|
@ -112,7 +112,7 @@ Rectangle {
|
||||||
marketplaceItem.image_url = result.data.thumbnail_url;
|
marketplaceItem.image_url = result.data.thumbnail_url;
|
||||||
marketplaceItem.name = result.data.title;
|
marketplaceItem.name = result.data.title;
|
||||||
marketplaceItem.likes = result.data.likes;
|
marketplaceItem.likes = result.data.likes;
|
||||||
if(result.data.has_liked !== undefined) {
|
if (result.data.has_liked !== undefined) {
|
||||||
marketplaceItem.liked = result.data.has_liked;
|
marketplaceItem.liked = result.data.has_liked;
|
||||||
}
|
}
|
||||||
marketplaceItem.creator = result.data.creator;
|
marketplaceItem.creator = result.data.creator;
|
||||||
|
@ -122,6 +122,7 @@ Rectangle {
|
||||||
marketplaceItem.attributions = result.data.attributions;
|
marketplaceItem.attributions = result.data.attributions;
|
||||||
marketplaceItem.license = result.data.license;
|
marketplaceItem.license = result.data.license;
|
||||||
marketplaceItem.availability = result.data.availability;
|
marketplaceItem.availability = result.data.availability;
|
||||||
|
marketplaceItem.updated_item_id = result.updated_item_id;
|
||||||
marketplaceItem.created_at = result.data.created_at;
|
marketplaceItem.created_at = result.data.created_at;
|
||||||
marketplaceItemScrollView.contentHeight = marketplaceItemContent.height;
|
marketplaceItemScrollView.contentHeight = marketplaceItemContent.height;
|
||||||
itemsList.visible = false;
|
itemsList.visible = false;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// MarketplaceListItem.qml
|
// MarketplaceListItem.qml
|
||||||
// qml/hifi/commerce/marketplace
|
// qml/hifi/commerce/marketplace
|
||||||
//
|
//
|
||||||
// MarketplaceListItem
|
// MarketplaceItem
|
||||||
//
|
//
|
||||||
// Created by Roxanne Skelly on 2019-01-22
|
// Created by Roxanne Skelly on 2019-01-22
|
||||||
// Copyright 2019 High Fidelity, Inc.
|
// Copyright 2019 High Fidelity, Inc.
|
||||||
|
@ -34,6 +34,7 @@ Rectangle {
|
||||||
property var categories: []
|
property var categories: []
|
||||||
property int price: 0
|
property int price: 0
|
||||||
property string availability: "unknown"
|
property string availability: "unknown"
|
||||||
|
property string updated_item_id: ""
|
||||||
property var attributions: []
|
property var attributions: []
|
||||||
property string description: ""
|
property string description: ""
|
||||||
property string license: ""
|
property string license: ""
|
||||||
|
@ -43,7 +44,6 @@ Rectangle {
|
||||||
property int edition: -1;
|
property int edition: -1;
|
||||||
property bool supports3DHTML: false;
|
property bool supports3DHTML: false;
|
||||||
|
|
||||||
|
|
||||||
onCategoriesChanged: {
|
onCategoriesChanged: {
|
||||||
categoriesListModel.clear();
|
categoriesListModel.clear();
|
||||||
categories.forEach(function(category) {
|
categories.forEach(function(category) {
|
||||||
|
@ -264,15 +264,12 @@ Rectangle {
|
||||||
}
|
}
|
||||||
height: 50
|
height: 50
|
||||||
|
|
||||||
property bool isNFS: availability === "not for sale" // Note: server will say "sold out" or "invalidated" before it says NFS
|
property bool isUpdate: root.edition >= 0 // Special case of updating from a specific older item
|
||||||
property bool isMine: creator === Account.username
|
property bool isStocking: (creator === Account.username) && (availability === "not for sale") && !updated_item_id // Note: server will say "sold out" or "invalidated" before it says NFS
|
||||||
property bool isUpgrade: root.edition >= 0
|
property bool isFreeSpecial: isStocking || isUpdate
|
||||||
property int costToMe: ((isMine && isNFS) || isUpgrade) ? 0 : price
|
enabled: isFreeSpecial || (availability === 'available')
|
||||||
property bool isAvailable: costToMe >= 0
|
buttonGlyph: (enabled && !isUpdate && (price > 0)) ? hifi.glyphs.hfc : ""
|
||||||
|
text: isUpdate ? "UPDATE FOR FREE" : (isStocking ? "FREE STOCK" : (enabled ? (price || "FREE") : availability))
|
||||||
text: isUpgrade ? "UPGRADE FOR FREE" : (isAvailable ? (costToMe || "FREE") : availability)
|
|
||||||
enabled: isAvailable
|
|
||||||
buttonGlyph: isAvailable ? (costToMe ? hifi.glyphs.hfc : "") : ""
|
|
||||||
color: hifi.buttons.blue
|
color: hifi.buttons.blue
|
||||||
|
|
||||||
onClicked: root.buy();
|
onClicked: root.buy();
|
||||||
|
|
|
@ -380,7 +380,7 @@ Item {
|
||||||
if (updateButton.visible && uninstallButton.visible) {
|
if (updateButton.visible && uninstallButton.visible) {
|
||||||
item.itemButtonText = "";
|
item.itemButtonText = "";
|
||||||
item.glyphSize = 20;
|
item.glyphSize = 20;
|
||||||
} else {
|
} else if (item) {
|
||||||
item.itemButtonText = "Send to Trash";
|
item.itemButtonText = "Send to Trash";
|
||||||
item.glyphSize = 30;
|
item.glyphSize = 30;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,6 @@ Rectangle {
|
||||||
source: "images/wallet-bg.jpg";
|
source: "images/wallet-bg.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
KeyboardScriptingInterface.raised = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Commerce;
|
target: Commerce;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue