mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 21:13:31 +02:00
Merge pull request #15113 from howard-stearns/stock-to-master
Stock to master
This commit is contained in:
commit
ab8f6273ad
5 changed files with 33 additions and 47 deletions
interface/resources/qml/hifi/commerce
checkout
marketplace
purchases
wallet
|
@ -40,9 +40,9 @@ Rectangle {
|
|||
property string itemHref;
|
||||
property string itemAuthor;
|
||||
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 bool hasSomethingToTradeIn: itemEdition > 0; // i.e., don't trade in your artist's proof
|
||||
property bool isTradingIn: canUpdate && hasSomethingToTradeIn;
|
||||
property bool isStocking: (availability === 'not for sale') && (creator === Account.username) && !updated_item_id;
|
||||
property string certificateId;
|
||||
property double balanceAfterPurchase;
|
||||
property bool alreadyOwned: false; // Including proofs
|
||||
|
@ -59,8 +59,9 @@ Rectangle {
|
|||
property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
|
||||
property string referrer;
|
||||
property bool isInstalled;
|
||||
property bool isUpdating;
|
||||
property bool canUpdate;
|
||||
property string availability: "available";
|
||||
property string updated_item_id: "";
|
||||
property string creator: "";
|
||||
property string baseAppURL;
|
||||
property int currentUpdatesPage: 1;
|
||||
|
@ -144,6 +145,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
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') {
|
||||
console.log("Failed to get Available Updates", result.data.message);
|
||||
} else {
|
||||
|
@ -155,7 +157,7 @@ Rectangle {
|
|||
if (root.itemEdition !== -1 && root.itemEdition !== parseInt(result.data.updates[i].edition_number)) {
|
||||
continue;
|
||||
}
|
||||
root.isUpdating = true;
|
||||
root.canUpdate = true;
|
||||
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
|
||||
root.certificateId = result.data.updates[i].certificate_id;
|
||||
|
@ -166,7 +168,7 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
if (result.data.updates.length === 0 || root.isUpdating) {
|
||||
if (result.data.updates.length === 0 || root.canUpdate) {
|
||||
root.availableUpdatesReceived = true;
|
||||
refreshBuyUI();
|
||||
} else {
|
||||
|
@ -178,7 +180,7 @@ Rectangle {
|
|||
|
||||
onUpdateItemResult: {
|
||||
if (result.status !== 'success') {
|
||||
failureErrorText.text = result.message;
|
||||
failureErrorText.text = result.data ? (result.data.message || "Unknown Error") : JSON.stringify(result);
|
||||
root.activeView = "checkoutFailure";
|
||||
} else {
|
||||
root.itemHref = result.data.download_url;
|
||||
|
@ -266,13 +268,6 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
enabled: titleBarContainer.usernameDropdownVisible;
|
||||
anchors.fill: parent;
|
||||
onClicked: {
|
||||
titleBarContainer.usernameDropdownVisible = false;
|
||||
}
|
||||
}
|
||||
//
|
||||
// TITLE BAR END
|
||||
//
|
||||
|
@ -481,7 +476,7 @@ Rectangle {
|
|||
FiraSansSemiBold {
|
||||
id: itemPriceText;
|
||||
text: isTradingIn ? "FREE\nUPDATE" :
|
||||
(isStocking ? "Free for creator" :
|
||||
(isStocking ? "Free for creator" :
|
||||
((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE")));
|
||||
// Text size
|
||||
size: isTradingIn ? 20 : 26;
|
||||
|
@ -580,7 +575,7 @@ Rectangle {
|
|||
// "View in Inventory" button
|
||||
HifiControlsUit.Button {
|
||||
id: viewInMyPurchasesButton;
|
||||
visible: isCertified && dataReady && (isUpdating ? !hasSomethingToTradeIn : alreadyOwned);
|
||||
visible: isCertified && dataReady && (isTradingIn ? hasSomethingToTradeIn : alreadyOwned);
|
||||
color: hifi.buttons.blue;
|
||||
colorScheme: hifi.colorSchemes.light;
|
||||
anchors.top: buyTextContainer.visible ? buyTextContainer.bottom : checkoutActionButtonsContainer.top;
|
||||
|
@ -588,9 +583,9 @@ Rectangle {
|
|||
height: 50;
|
||||
anchors.left: parent.left;
|
||||
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: {
|
||||
if (root.isUpdating) {
|
||||
if (root.canUpdate) {
|
||||
sendToScript({method: 'checkout_goToPurchases', filterText: root.baseItemName});
|
||||
} else {
|
||||
sendToScript({method: 'checkout_goToPurchases', filterText: root.itemName});
|
||||
|
@ -602,7 +597,11 @@ Rectangle {
|
|||
HifiControlsUit.Button {
|
||||
id: buyButton;
|
||||
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;
|
||||
colorScheme: hifi.colorSchemes.light;
|
||||
anchors.top: viewInMyPurchasesButton.visible ? viewInMyPurchasesButton.bottom :
|
||||
|
@ -611,13 +610,6 @@ Rectangle {
|
|||
height: 50;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
text: isTradingIn ?
|
||||
"CONFIRM UPDATE" :
|
||||
(((root.isCertified) ?
|
||||
(dataReady ?
|
||||
((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") :
|
||||
"--") :
|
||||
"Get Item"));
|
||||
onClicked: {
|
||||
if (isTradingIn) {
|
||||
// If we're updating an app, the existing app needs to be uninstalled.
|
||||
|
@ -1110,6 +1102,7 @@ Rectangle {
|
|||
root.itemAuthor = result.data.creator;
|
||||
root.itemType = result.data.item_type || "unknown";
|
||||
root.availability = result.data.availability;
|
||||
root.updated_item_id = result.data.updated_item_id || ""
|
||||
root.creator = result.data.creator;
|
||||
if (root.itemType === "unknown") {
|
||||
root.itemHref = result.data.review_url;
|
||||
|
@ -1209,7 +1202,7 @@ Rectangle {
|
|||
buyText.text = "";
|
||||
|
||||
// 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 (hasSomethingToTradeIn) {
|
||||
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.name = result.data.title;
|
||||
marketplaceItem.likes = result.data.likes;
|
||||
if(result.data.has_liked !== undefined) {
|
||||
if (result.data.has_liked !== undefined) {
|
||||
marketplaceItem.liked = result.data.has_liked;
|
||||
}
|
||||
marketplaceItem.creator = result.data.creator;
|
||||
|
@ -122,6 +122,7 @@ Rectangle {
|
|||
marketplaceItem.attributions = result.data.attributions;
|
||||
marketplaceItem.license = result.data.license;
|
||||
marketplaceItem.availability = result.data.availability;
|
||||
marketplaceItem.updated_item_id = result.data.updated_item_id || "";
|
||||
marketplaceItem.created_at = result.data.created_at;
|
||||
marketplaceItemScrollView.contentHeight = marketplaceItemContent.height;
|
||||
itemsList.visible = false;
|
||||
|
@ -979,7 +980,6 @@ Rectangle {
|
|||
xhr.open("GET", url);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == XMLHttpRequest.DONE) {
|
||||
console.log(xhr.responseText);
|
||||
licenseText.text = xhr.responseText;
|
||||
licenseInfo.visible = true;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// MarketplaceListItem.qml
|
||||
// qml/hifi/commerce/marketplace
|
||||
//
|
||||
// MarketplaceListItem
|
||||
// MarketplaceItem
|
||||
//
|
||||
// Created by Roxanne Skelly on 2019-01-22
|
||||
// Copyright 2019 High Fidelity, Inc.
|
||||
|
@ -34,6 +34,7 @@ Rectangle {
|
|||
property var categories: []
|
||||
property int price: 0
|
||||
property string availability: "unknown"
|
||||
property string updated_item_id: ""
|
||||
property var attributions: []
|
||||
property string description: ""
|
||||
property string license: ""
|
||||
|
@ -42,7 +43,6 @@ Rectangle {
|
|||
property bool isLoggedIn: false;
|
||||
property int edition: -1;
|
||||
property bool supports3DHTML: false;
|
||||
|
||||
|
||||
onCategoriesChanged: {
|
||||
categoriesListModel.clear();
|
||||
|
@ -52,7 +52,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
onDescriptionChanged: {
|
||||
|
||||
|
||||
if(root.supports3DHTML) {
|
||||
descriptionTextModel.clear();
|
||||
descriptionTextModel.append({text: description});
|
||||
|
@ -264,17 +264,14 @@ Rectangle {
|
|||
}
|
||||
height: 50
|
||||
|
||||
property bool isNFS: availability === "not for sale" // Note: server will say "sold out" or "invalidated" before it says NFS
|
||||
property bool isMine: creator === Account.username
|
||||
property bool isUpgrade: root.edition >= 0
|
||||
property int costToMe: ((isMine && isNFS) || isUpgrade) ? 0 : price
|
||||
property bool isAvailable: costToMe >= 0
|
||||
|
||||
text: isUpgrade ? "UPGRADE FOR FREE" : (isAvailable ? (costToMe || "FREE") : availability)
|
||||
enabled: isAvailable
|
||||
buttonGlyph: isAvailable ? (costToMe ? hifi.glyphs.hfc : "") : ""
|
||||
property bool isUpdate: root.edition >= 0 // Special case of updating from a specific older item
|
||||
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 isFreeSpecial: isStocking || isUpdate
|
||||
enabled: isFreeSpecial || (availability === 'available')
|
||||
buttonGlyph: (enabled && !isUpdate && (price > 0)) ? hifi.glyphs.hfc : ""
|
||||
text: isUpdate ? "UPDATE FOR FREE" : (isStocking ? "FREE STOCK" : (enabled ? (price || "FREE") : availability))
|
||||
color: hifi.buttons.blue
|
||||
|
||||
|
||||
onClicked: root.buy();
|
||||
}
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ Item {
|
|||
if (updateButton.visible && uninstallButton.visible) {
|
||||
item.itemButtonText = "";
|
||||
item.glyphSize = 20;
|
||||
} else {
|
||||
} else if (item) {
|
||||
item.itemButtonText = "Send to Trash";
|
||||
item.glyphSize = 30;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,6 @@ Rectangle {
|
|||
source: "images/wallet-bg.jpg";
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
KeyboardScriptingInterface.raised = false;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Commerce;
|
||||
|
||||
|
|
Loading…
Reference in a new issue