mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
support artist's stocking to inventory
This commit is contained in:
parent
d505485d6a
commit
52a43ca4cd
1 changed files with 34 additions and 21 deletions
|
@ -33,15 +33,19 @@ Rectangle {
|
||||||
property bool balanceReceived: false;
|
property bool balanceReceived: false;
|
||||||
property bool availableUpdatesReceived: false;
|
property bool availableUpdatesReceived: false;
|
||||||
property bool itemInfoReceived: false;
|
property bool itemInfoReceived: false;
|
||||||
|
property bool dataReady: itemInfoReceived && ownershipStatusReceived && balanceReceived && availableUpdatesReceived;
|
||||||
property string baseItemName: "";
|
property string baseItemName: "";
|
||||||
property string itemName;
|
property string itemName;
|
||||||
property string itemId;
|
property string itemId;
|
||||||
property string itemHref;
|
property string itemHref;
|
||||||
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 isTradingIn: isUpdating && hasSomethingToTradeIn;
|
||||||
|
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;
|
property bool alreadyOwned: false; // Including proofs
|
||||||
property int itemPrice: -1;
|
property int itemPrice: -1;
|
||||||
property bool isCertified;
|
property bool isCertified;
|
||||||
property string itemType: "unknown";
|
property string itemType: "unknown";
|
||||||
|
@ -56,6 +60,8 @@ Rectangle {
|
||||||
property string referrer;
|
property string referrer;
|
||||||
property bool isInstalled;
|
property bool isInstalled;
|
||||||
property bool isUpdating;
|
property bool isUpdating;
|
||||||
|
property string availability: "available";
|
||||||
|
property string creator: "";
|
||||||
property string baseAppURL;
|
property string baseAppURL;
|
||||||
property int currentUpdatesPage: 1;
|
property int currentUpdatesPage: 1;
|
||||||
// Style
|
// Style
|
||||||
|
@ -454,10 +460,10 @@ Rectangle {
|
||||||
height: 30;
|
height: 30;
|
||||||
width: itemPriceTextLabel.width + itemPriceText.width + 20;
|
width: itemPriceTextLabel.width + itemPriceText.width + 20;
|
||||||
|
|
||||||
// "HFC" balance label
|
// "HFC" label
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: itemPriceTextLabel;
|
id: itemPriceTextLabel;
|
||||||
visible: !(root.isUpdating && root.itemEdition > 0) && (root.itemPrice > 0);
|
visible: !isTradingIn && (root.itemPrice > 0);
|
||||||
text: hifi.glyphs.hfc;
|
text: hifi.glyphs.hfc;
|
||||||
// Size
|
// Size
|
||||||
size: 30;
|
size: 30;
|
||||||
|
@ -473,9 +479,11 @@ Rectangle {
|
||||||
}
|
}
|
||||||
FiraSansSemiBold {
|
FiraSansSemiBold {
|
||||||
id: itemPriceText;
|
id: itemPriceText;
|
||||||
text: (root.isUpdating && root.itemEdition > 0) ? "FREE\nUPDATE" : ((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE"));
|
text: isTradingIn ? "FREE\nUPDATE" :
|
||||||
|
(isStocking ? "Free for creator" :
|
||||||
|
((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE")));
|
||||||
// Text size
|
// Text size
|
||||||
size: (root.isUpdating && root.itemEdition > 0) ? 20 : 26;
|
size: isTradingIn ? 20 : 26;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
@ -571,7 +579,7 @@ Rectangle {
|
||||||
// "View in Inventory" button
|
// "View in Inventory" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: viewInMyPurchasesButton;
|
id: viewInMyPurchasesButton;
|
||||||
visible: false;
|
visible: isCertified && dataReady && (isUpdating ? !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;
|
||||||
|
@ -592,8 +600,8 @@ Rectangle {
|
||||||
// "Buy" button
|
// "Buy" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: buyButton;
|
id: buyButton;
|
||||||
visible: !((root.itemType === "avatar" || root.itemType === "app") && viewInMyPurchasesButton.visible)
|
visible: isTradingIn || !alreadyOwned || isStocking || !(root.itemType === "avatar" || root.itemType === "app");
|
||||||
enabled: (root.balanceAfterPurchase >= 0 && ownershipStatusReceived && balanceReceived && availableUpdatesReceived) || (!root.isCertified) || root.isUpdating;
|
enabled: (root.balanceAfterPurchase >= 0 && dataReady) || (!root.isCertified) || root.isUpdating;
|
||||||
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 :
|
||||||
|
@ -602,10 +610,15 @@ Rectangle {
|
||||||
height: 50;
|
height: 50;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
text: (root.isUpdating && root.itemEdition > 0) ? "CONFIRM UPDATE" : (((root.isCertified) ? ((ownershipStatusReceived && balanceReceived && availableUpdatesReceived) ?
|
text: isTradingIn ?
|
||||||
((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") : "--") : "Get Item"));
|
"CONFIRM UPDATE" :
|
||||||
|
(((root.isCertified) ?
|
||||||
|
(dataReady ?
|
||||||
|
((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") :
|
||||||
|
"--") :
|
||||||
|
"Get Item"));
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.isUpdating && root.itemEdition > 0) {
|
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.
|
||||||
// This call will fail/return `false` if the app isn't installed, but that's OK.
|
// This call will fail/return `false` if the app isn't installed, but that's OK.
|
||||||
if (root.itemType === "app") {
|
if (root.itemType === "app") {
|
||||||
|
@ -1063,7 +1076,11 @@ Rectangle {
|
||||||
buyButton.color = hifi.buttons.red;
|
buyButton.color = hifi.buttons.red;
|
||||||
root.shouldBuyWithControlledFailure = true;
|
root.shouldBuyWithControlledFailure = true;
|
||||||
} else {
|
} else {
|
||||||
buyButton.text = (root.isCertified ? ((ownershipStatusReceived && balanceReceived && availableUpdatesReceived) ? (root.alreadyOwned ? "Buy Another" : "Buy"): "--") : "Get Item");
|
buyButton.text = (root.isCertified ?
|
||||||
|
(dataReady ?
|
||||||
|
(root.alreadyOwned ? "Buy Another" : "Buy") :
|
||||||
|
"--") :
|
||||||
|
"Get Item");
|
||||||
buyButton.color = hifi.buttons.blue;
|
buyButton.color = hifi.buttons.blue;
|
||||||
root.shouldBuyWithControlledFailure = false;
|
root.shouldBuyWithControlledFailure = false;
|
||||||
}
|
}
|
||||||
|
@ -1091,6 +1108,8 @@ Rectangle {
|
||||||
root.itemPrice = result.data.cost;
|
root.itemPrice = result.data.cost;
|
||||||
root.itemAuthor = result.data.creator;
|
root.itemAuthor = result.data.creator;
|
||||||
root.itemType = result.data.item_type || "unknown";
|
root.itemType = result.data.item_type || "unknown";
|
||||||
|
root.availability = result.data.availability;
|
||||||
|
root.creator = result.data.creator;
|
||||||
if (root.itemType === "unknown") {
|
if (root.itemType === "unknown") {
|
||||||
root.itemHref = result.data.review_url;
|
root.itemHref = result.data.review_url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1139,7 +1158,7 @@ Rectangle {
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
function canBuyAgain() {
|
function canBuyAgain() {
|
||||||
return (root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet" || root.itemType === "unknown");
|
return root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet" || root.itemType === "unknown" || isStocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleContentSets() {
|
function handleContentSets() {
|
||||||
|
@ -1185,29 +1204,23 @@ Rectangle {
|
||||||
|
|
||||||
function refreshBuyUI() {
|
function refreshBuyUI() {
|
||||||
if (root.isCertified) {
|
if (root.isCertified) {
|
||||||
if (root.ownershipStatusReceived && root.balanceReceived && root.availableUpdatesReceived) {
|
if (dataReady) {
|
||||||
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.isUpdating) {
|
||||||
// If the user HAS already selected a specific edition to update...
|
// If the user HAS already selected a specific edition to update...
|
||||||
if (root.itemEdition > 0) {
|
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.";
|
||||||
buyTextContainer.color = "#FFFFFF";
|
buyTextContainer.color = "#FFFFFF";
|
||||||
buyTextContainer.border.color = "#FFFFFF";
|
buyTextContainer.border.color = "#FFFFFF";
|
||||||
// Else if the user HAS NOT selected a specific edition to update...
|
// Else if the user HAS NOT selected a specific edition to update...
|
||||||
} else {
|
} else {
|
||||||
viewInMyPurchasesButton.visible = true;
|
|
||||||
|
|
||||||
handleBuyAgainLogic();
|
handleBuyAgainLogic();
|
||||||
}
|
}
|
||||||
// If the user IS NOT on the checkout page for the updated verison of an owned item...
|
// If the user IS NOT on the checkout page for the updated verison of an owned item...
|
||||||
// (i.e. they are checking out an item "normally")
|
// (i.e. they are checking out an item "normally")
|
||||||
} else {
|
} else {
|
||||||
if (root.alreadyOwned) {
|
|
||||||
viewInMyPurchasesButton.visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleBuyAgainLogic();
|
handleBuyAgainLogic();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue