mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 09:33:49 +02:00
Bugfixes; enable purchase asset from marketplace screen raise
This commit is contained in:
parent
8df5db4239
commit
31f7d747c8
4 changed files with 124 additions and 95 deletions
|
@ -19,6 +19,7 @@ import controlsUit 1.0 as HifiControlsUit
|
|||
import "../../../controls" as HifiControls
|
||||
import "../wallet" as HifiWallet
|
||||
import "../common" as HifiCommerceCommon
|
||||
import "../.." as HifiCommon
|
||||
|
||||
// references XXX from root context
|
||||
|
||||
|
@ -31,6 +32,7 @@ Rectangle {
|
|||
property bool ownershipStatusReceived: false;
|
||||
property bool balanceReceived: false;
|
||||
property bool availableUpdatesReceived: false;
|
||||
property bool itemInfoReceived: false;
|
||||
property string baseItemName: "";
|
||||
property string itemName;
|
||||
property string itemId;
|
||||
|
@ -181,11 +183,14 @@ Rectangle {
|
|||
|
||||
onItemIdChanged: {
|
||||
root.ownershipStatusReceived = false;
|
||||
root.itemInfoReceived = false;
|
||||
Commerce.alreadyOwned(root.itemId);
|
||||
root.availableUpdatesReceived = false;
|
||||
root.currentUpdatesPage = 1;
|
||||
Commerce.getAvailableUpdates(root.itemId);
|
||||
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
||||
|
||||
var MARKETPLACE_API_URL = Account.metaverseServerURL + "/api/v1/marketplace/items/";
|
||||
http.request({uri: MARKETPLACE_API_URL + root.itemId}, updateCheckoutQMLFromHTTP);
|
||||
}
|
||||
|
||||
onItemTypeChanged: {
|
||||
|
@ -279,6 +284,7 @@ Rectangle {
|
|||
ownershipStatusReceived = false;
|
||||
balanceReceived = false;
|
||||
availableUpdatesReceived = false;
|
||||
itemInfoReceived = false;
|
||||
Commerce.getWalletStatus();
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +361,7 @@ Rectangle {
|
|||
Rectangle {
|
||||
id: loading;
|
||||
z: 997;
|
||||
visible: !root.ownershipStatusReceived || !root.balanceReceived || !root.availableUpdatesReceived;
|
||||
visible: !root.ownershipStatusReceived || !root.balanceReceived || !root.availableUpdatesReceived || !root.itemInfoReceived;
|
||||
anchors.fill: parent;
|
||||
color: hifi.colors.white;
|
||||
|
||||
|
@ -1063,10 +1069,27 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HifiCommon.RootHttpRequest {
|
||||
id: http;
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION DEFINITIONS START
|
||||
//
|
||||
|
||||
function updateCheckoutQMLFromHTTP(error, result) {
|
||||
root.itemInfoReceived = true;
|
||||
root.itemName = result.data.title;
|
||||
root.itemPrice = result.data.cost;
|
||||
root.itemHref = Account.metaverseServerURL + result.data.path;
|
||||
root.itemAuthor = result.data.creator;
|
||||
root.itemType = result.data.item_type || "unknown";
|
||||
itemPreviewImage.source = result.data.thumbnail_url;
|
||||
refreshBuyUI();
|
||||
}
|
||||
|
||||
//
|
||||
// Function Name: fromScript()
|
||||
//
|
||||
|
@ -1080,18 +1103,24 @@ Rectangle {
|
|||
// Description:
|
||||
// Called when a message is received from a script.
|
||||
//
|
||||
|
||||
function fromScript(message) {
|
||||
switch (message.method) {
|
||||
case 'updateCheckoutQML':
|
||||
root.itemId = message.params.itemId;
|
||||
root.itemName = message.params.itemName.trim();
|
||||
root.itemPrice = message.params.itemPrice;
|
||||
root.itemHref = message.params.itemHref;
|
||||
root.referrer = message.params.referrer;
|
||||
root.itemAuthor = message.params.itemAuthor;
|
||||
case 'updateCheckoutQMLItemID':
|
||||
if (!message.params.itemId) {
|
||||
console.log("A message with method 'updateCheckoutQMLItemID' was sent without an itemId!");
|
||||
return;
|
||||
}
|
||||
|
||||
// If we end up following the referrer (i.e. in case the wallet "isn't set up" or the user cancels),
|
||||
// we want the user to be placed back on the individual item's page - thus we set the
|
||||
// default of the referrer in this case to "itemPage".
|
||||
root.referrer = message.params.referrer || "itemPage";
|
||||
root.itemEdition = message.params.itemEdition || -1;
|
||||
root.itemType = message.params.itemType || "unknown";
|
||||
refreshBuyUI();
|
||||
root.itemId = message.params.itemId;
|
||||
break;
|
||||
case 'http.response':
|
||||
http.handleHttpResponse(message);
|
||||
break;
|
||||
default:
|
||||
console.log('Checkout.qml: Unrecognized message from marketplaces.js');
|
||||
|
|
|
@ -56,7 +56,7 @@ Item {
|
|||
// Background
|
||||
Rectangle {
|
||||
z: 1;
|
||||
visible: root.assetName !== "" && sendAssetStep.visible;
|
||||
visible: root.assetCertID !== "" && sendAssetStep.referrer !== "payIn" && sendAssetStep.visible;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: root.parentAppTitleBarHeight;
|
||||
anchors.left: parent.left;
|
||||
|
@ -84,7 +84,6 @@ Item {
|
|||
if (sendPubliclyCheckbox.checked && sendAssetStep.referrer === "nearby") {
|
||||
sendSignalToParent({
|
||||
method: 'sendAsset_sendPublicly',
|
||||
assetName: root.assetName,
|
||||
recipient: sendAssetStep.selectedRecipientNodeID,
|
||||
amount: parseInt(amountTextField.text),
|
||||
effectImage: root.sendingPubliclyEffectImage
|
||||
|
@ -155,7 +154,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: userInfoContainer;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "";
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
|
@ -251,7 +250,7 @@ Item {
|
|||
|
||||
LinearGradient {
|
||||
anchors.fill: parent;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "";
|
||||
start: Qt.point(0, 0);
|
||||
end: Qt.point(0, height);
|
||||
gradient: Gradient {
|
||||
|
@ -262,7 +261,7 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: sendAssetText;
|
||||
text: root.assetName === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
||||
text: root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 26;
|
||||
|
@ -441,7 +440,7 @@ Item {
|
|||
HiFiGlyphs {
|
||||
id: closeGlyphButton_connections;
|
||||
text: hifi.glyphs.close;
|
||||
color: root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||
color: root.assetCertID === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||
size: 26;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 10;
|
||||
|
@ -684,7 +683,7 @@ Item {
|
|||
HiFiGlyphs {
|
||||
id: closeGlyphButton_nearby;
|
||||
text: hifi.glyphs.close;
|
||||
color: root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||
color: root.assetCertID === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||
size: 26;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 10;
|
||||
|
@ -760,7 +759,7 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: sendToText;
|
||||
text: root.assetName === "" ? "Send to:" : "Gift to:";
|
||||
text: root.assetCertID === "" ? "Send to:" : "Gift to:";
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 36;
|
||||
|
@ -865,7 +864,8 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: sendAssetText_sendAssetStep;
|
||||
text: root.assetName === "" ? "Send Money" : "Gift \"" + root.assetName + "\"";
|
||||
text: sendAssetStep.referrer === "payIn" && root.assetCertID !== "" ? "Send Item:" :
|
||||
(root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:");
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 26;
|
||||
|
@ -878,7 +878,7 @@ Item {
|
|||
// Text size
|
||||
size: 22;
|
||||
// Style
|
||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
||||
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -893,7 +893,7 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: sendToText_sendAssetStep;
|
||||
text: root.assetName === "" ? "Send to:" : "Gift to:";
|
||||
text: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ? "Send to:" : "Gift to:";
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left;
|
||||
|
@ -902,7 +902,7 @@ Item {
|
|||
// Text size
|
||||
size: 18;
|
||||
// Style
|
||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
||||
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
|
||||
|
@ -912,7 +912,7 @@ Item {
|
|||
anchors.right: changeButton.left;
|
||||
anchors.rightMargin: 12;
|
||||
height: parent.height;
|
||||
textColor: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
||||
textColor: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||
|
||||
displayName: sendAssetStep.selectedRecipientDisplayName;
|
||||
userName: sendAssetStep.selectedRecipientUserName;
|
||||
|
@ -924,7 +924,7 @@ Item {
|
|||
// "CHANGE" button
|
||||
HifiControlsUit.Button {
|
||||
id: changeButton;
|
||||
color: root.assetName === "" ? hifi.buttons.none : hifi.buttons.white;
|
||||
color: root.assetCertID === "" ? hifi.buttons.none : hifi.buttons.white;
|
||||
colorScheme: hifi.colorSchemes.dark;
|
||||
anchors.right: parent.right;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
|
@ -945,7 +945,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: amountContainer;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "";
|
||||
anchors.top: sendToContainer.bottom;
|
||||
anchors.topMargin: 2;
|
||||
anchors.left: parent.left;
|
||||
|
@ -972,8 +972,8 @@ Item {
|
|||
HifiControlsUit.TextField {
|
||||
id: amountTextField;
|
||||
readOnly: sendAssetStep.referrer === "payIn";
|
||||
text: root.assetName === "" ? "" : "1";
|
||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
text: root.assetCertID === "" ? "" : "1";
|
||||
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
inputMethodHints: Qt.ImhDigitsOnly;
|
||||
// Anchors
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
|
@ -1084,12 +1084,13 @@ Item {
|
|||
// Style
|
||||
background: Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: root.assetName === "" ? (optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.black : hifi.colors.baseGrayShadow) :
|
||||
(optionalMessage.activeFocus && !optionalMessage.readOnly ? "#EFEFEF" : "#EEEEEE");
|
||||
color: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ?
|
||||
(optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.black : hifi.colors.baseGrayShadow) :
|
||||
(optionalMessage.activeFocus ? "#EFEFEF" : "#EEEEEE");
|
||||
border.width: optionalMessage.activeFocus && !optionalMessage.readOnly ? 1 : 0;
|
||||
border.color: optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground;
|
||||
}
|
||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
||||
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||
textFormat: TextEdit.PlainText;
|
||||
wrapMode: TextEdit.Wrap;
|
||||
activeFocusOnPress: true;
|
||||
|
@ -1125,7 +1126,8 @@ Item {
|
|||
// Text size
|
||||
size: 16;
|
||||
// Style
|
||||
color: optionalMessage.text.length === optionalMessage.maximumLength ? "#ea89a5" : (root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight);
|
||||
color: optionalMessage.text.length === optionalMessage.maximumLength ? "#ea89a5" :
|
||||
(root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight);
|
||||
verticalAlignment: Text.AlignTop;
|
||||
horizontalAlignment: Text.AlignRight;
|
||||
}
|
||||
|
@ -1170,7 +1172,7 @@ Item {
|
|||
parent.color = hifi.colors.blueAccent;
|
||||
}
|
||||
onClicked: {
|
||||
lightboxPopup.titleText = (root.assetName === "" ? "Send Effect" : "Gift Effect");
|
||||
lightboxPopup.titleText = (root.assetCertID === "" ? "Send Effect" : "Gift Effect");
|
||||
lightboxPopup.bodyImageSource = "sendAsset/images/send-money-effect-sm.jpg"; // Path relative to CommerceLightbox.qml
|
||||
lightboxPopup.bodyText = "Enabling this option will create a particle effect between you and " +
|
||||
"your recipient that is visible to everyone nearby.";
|
||||
|
@ -1199,7 +1201,7 @@ Item {
|
|||
// "CANCEL" button
|
||||
HifiControlsUit.Button {
|
||||
id: cancelButton_sendAssetStep;
|
||||
color: root.assetName === "" ? hifi.buttons.noneBorderlessWhite : hifi.buttons.noneBorderlessGray;
|
||||
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.buttons.noneBorderlessWhite : hifi.buttons.noneBorderlessGray;
|
||||
colorScheme: hifi.colorSchemes.dark;
|
||||
anchors.right: sendButton.left;
|
||||
anchors.rightMargin: 24;
|
||||
|
@ -1221,7 +1223,7 @@ Item {
|
|||
HifiControlsUit.Button {
|
||||
id: sendButton;
|
||||
color: hifi.buttons.blue;
|
||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: 0;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
|
@ -1229,11 +1231,11 @@ Item {
|
|||
width: 100;
|
||||
text: "SUBMIT";
|
||||
onClicked: {
|
||||
if (root.assetName === "" && parseInt(amountTextField.text) > parseInt(balanceText.text)) {
|
||||
if (root.assetCertID === "" && parseInt(amountTextField.text) > parseInt(balanceText.text)) {
|
||||
amountTextField.focus = true;
|
||||
amountTextField.error = true;
|
||||
amountTextFieldError.text = "<i>amount exceeds available funds</i>";
|
||||
} else if (root.assetName === "" && (amountTextField.text === "" || parseInt(amountTextField.text) < 1)) {
|
||||
} else if (root.assetCertID === "" && (amountTextField.text === "" || parseInt(amountTextField.text) < 1)) {
|
||||
amountTextField.focus = true;
|
||||
amountTextField.error = true;
|
||||
amountTextFieldError.text = "<i>invalid amount</i>";
|
||||
|
@ -1324,18 +1326,18 @@ Item {
|
|||
|
||||
Rectangle {
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: root.assetName === "" ? 15 : 125;
|
||||
anchors.topMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 125;
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
||||
anchors.leftMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
||||
anchors.rightMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: root.assetName === "" ? 15 : 125;
|
||||
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 125;
|
||||
color: "#FFFFFF";
|
||||
|
||||
RalewaySemiBold {
|
||||
id: paymentSentText;
|
||||
text: root.assetName === "" ? "Payment Sent" : "Gift Sent";
|
||||
text: root.assetCertID === "" ? "Payment Sent" : (sendAssetStep.referrer === "payIn" ? "Item Sent" : "Gift Sent");
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 26;
|
||||
|
@ -1353,7 +1355,7 @@ Item {
|
|||
|
||||
HiFiGlyphs {
|
||||
id: closeGlyphButton_paymentSuccess;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "" && sendAssetStep.referrer !== "payIn";
|
||||
text: hifi.glyphs.close;
|
||||
color: hifi.colors.lightGrayText;
|
||||
size: 26;
|
||||
|
@ -1427,7 +1429,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: giftContainer_paymentSuccess;
|
||||
visible: root.assetName !== "";
|
||||
visible: root.assetCertID !== "" && sendAssetStep.referrer !== "payIn";
|
||||
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||
anchors.topMargin: 8;
|
||||
anchors.left: parent.left;
|
||||
|
@ -1469,7 +1471,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: amountContainer_paymentSuccess;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "";
|
||||
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||
anchors.topMargin: 16;
|
||||
anchors.left: parent.left;
|
||||
|
@ -1524,7 +1526,7 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: optionalMessage_paymentSuccess;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||
text: optionalMessage.text;
|
||||
// Anchors
|
||||
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
||||
|
@ -1546,18 +1548,22 @@ Item {
|
|||
HifiControlsUit.Button {
|
||||
id: closeButton;
|
||||
color: hifi.buttons.blue;
|
||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
||||
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||
height: 50;
|
||||
width: 120;
|
||||
text: "Close";
|
||||
onClicked: {
|
||||
root.nextActiveView = "sendAssetHome";
|
||||
resetSendAssetData();
|
||||
if (root.assetName !== "") {
|
||||
sendSignalToParent({method: "closeSendAsset"});
|
||||
if (sendAssetStep.referrer === "payIn") {
|
||||
sendToScript({method: "closeSendAsset"});
|
||||
} else {
|
||||
root.nextActiveView = "sendAssetHome";
|
||||
resetSendAssetData();
|
||||
if (root.assetName !== "") {
|
||||
sendSignalToParent({method: "closeSendAsset"});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1585,18 +1591,18 @@ Item {
|
|||
|
||||
Rectangle {
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: root.assetName === "" ? 15 : 150;
|
||||
anchors.topMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 150;
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
||||
anchors.leftMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
||||
anchors.rightMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: root.assetName === "" ? 15 : 300;
|
||||
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 300;
|
||||
color: "#FFFFFF";
|
||||
|
||||
RalewaySemiBold {
|
||||
id: paymentFailureText;
|
||||
text: root.assetName === "" ? "Payment Failed" : "Failed";
|
||||
text: root.assetCertID === "" && sendAssetStep.referrer !== "payIn" ? "Payment Failed" : "Failed";
|
||||
// Anchors
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 26;
|
||||
|
@ -1614,7 +1620,7 @@ Item {
|
|||
|
||||
HiFiGlyphs {
|
||||
id: closeGlyphButton_paymentFailure;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "" && sendAssetStep.referrer !== "payIn";
|
||||
text: hifi.glyphs.close;
|
||||
color: hifi.colors.lightGrayText;
|
||||
size: 26;
|
||||
|
@ -1643,7 +1649,8 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: paymentFailureDetailText;
|
||||
text: "The recipient you specified was unable to receive your " + (root.assetName === "" ? "payment." : "gift.");
|
||||
text: "The recipient you specified was unable to receive your " +
|
||||
(root.assetCertID === "" ? "payment." : (sendAssetStep.referrer === "payIn" ? "item." : "gift."));
|
||||
anchors.top: paymentFailureText.bottom;
|
||||
anchors.topMargin: 20;
|
||||
anchors.left: parent.left;
|
||||
|
@ -1661,7 +1668,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: sendToContainer_paymentFailure;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||
anchors.top: paymentFailureDetailText.bottom;
|
||||
anchors.topMargin: 8;
|
||||
anchors.left: parent.left;
|
||||
|
@ -1702,7 +1709,7 @@ Item {
|
|||
|
||||
Item {
|
||||
id: amountContainer_paymentFailure;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "";
|
||||
anchors.top: sendToContainer_paymentFailure.bottom;
|
||||
anchors.topMargin: 16;
|
||||
anchors.left: parent.left;
|
||||
|
@ -1757,7 +1764,7 @@ Item {
|
|||
|
||||
RalewaySemiBold {
|
||||
id: optionalMessage_paymentFailure;
|
||||
visible: root.assetName === "";
|
||||
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||
text: optionalMessage.text;
|
||||
// Anchors
|
||||
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
||||
|
@ -1779,19 +1786,23 @@ Item {
|
|||
HifiControlsUit.Button {
|
||||
id: closeButton_paymentFailure;
|
||||
color: hifi.buttons.noneBorderless;
|
||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
anchors.right: retryButton_paymentFailure.left;
|
||||
anchors.rightMargin: 12;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
||||
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||
height: 50;
|
||||
width: 120;
|
||||
text: "Cancel";
|
||||
onClicked: {
|
||||
root.nextActiveView = "sendAssetHome";
|
||||
resetSendAssetData();
|
||||
if (root.assetName !== "") {
|
||||
sendSignalToParent({method: "closeSendAsset"});
|
||||
if (sendAssetStep.referrer === "payIn") {
|
||||
sendToScript({method: "closeSendAsset"});
|
||||
} else {
|
||||
root.nextActiveView = "sendAssetHome";
|
||||
resetSendAssetData();
|
||||
if (root.assetName !== "") {
|
||||
sendSignalToParent({method: "closeSendAsset"});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1800,17 +1811,17 @@ Item {
|
|||
HifiControlsUit.Button {
|
||||
id: retryButton_paymentFailure;
|
||||
color: hifi.buttons.blue;
|
||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: 12;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
||||
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||
height: 50;
|
||||
width: 120;
|
||||
text: "Retry";
|
||||
onClicked: {
|
||||
root.isCurrentlySendingAsset = true;
|
||||
if (sendAssetStep.referrer === "connections") {
|
||||
if (sendAssetStep.referrer === "connections" || sendAssetStep.referrer === "payIn") {
|
||||
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
||||
root.assetCertID,
|
||||
parseInt(amountTextField.text),
|
||||
|
@ -1878,9 +1889,13 @@ Item {
|
|||
sendAssetStep.selectedRecipientUserName = message.userName;
|
||||
break;
|
||||
case 'updateSendAssetQML':
|
||||
root.assetName = message.assetName || "";
|
||||
root.assetName = "";
|
||||
root.assetCertID = message.assetCertID || "";
|
||||
amountTextField.text = message.amount || 1;
|
||||
if (root.assetCertID === "") {
|
||||
amountTextField.text = message.amount || 1;
|
||||
} else {
|
||||
amountTextField.text = "";
|
||||
}
|
||||
sendAssetStep.referrer = "payIn";
|
||||
sendAssetStep.selectedRecipientNodeID = "";
|
||||
sendAssetStep.selectedRecipientDisplayName = 'Secure Payment';
|
||||
|
|
|
@ -219,17 +219,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
function buyButtonClicked(id, name, author, price, href, referrer, edition, type) {
|
||||
function buyButtonClicked(id, referrer, edition) {
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: "CHECKOUT",
|
||||
itemId: id,
|
||||
itemName: name,
|
||||
itemPrice: price ? parseInt(price, 10) : 0,
|
||||
itemHref: href,
|
||||
referrer: referrer,
|
||||
itemAuthor: author,
|
||||
itemEdition: edition,
|
||||
itemType: type.trim()
|
||||
itemEdition: edition
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -313,13 +308,8 @@
|
|||
return false;
|
||||
}
|
||||
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),
|
||||
$(this).closest('.grid-item').find('.item-title').text(),
|
||||
$(this).closest('.grid-item').find('.creator').find('.value').text(),
|
||||
$(this).closest('.grid-item').find('.item-cost').text(),
|
||||
$(this).attr('data-href'),
|
||||
"mainPage",
|
||||
-1,
|
||||
$(this).closest('.grid-item').find('.item-type').text());
|
||||
-1);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -427,13 +417,8 @@
|
|||
purchaseButton.on('click', function () {
|
||||
if ('available' === availability || isUpdating) {
|
||||
buyButtonClicked(window.location.pathname.split("/")[3],
|
||||
$('#top-center').find('h1').text(),
|
||||
$('#creator').find('.value').text(),
|
||||
cost,
|
||||
href,
|
||||
"itemPage",
|
||||
urlParams.get('edition'),
|
||||
type);
|
||||
urlParams.get('edition'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -471,7 +471,7 @@ function onWebEventReceived(message) {
|
|||
wireQmlEventBridge(true);
|
||||
ui.open(MARKETPLACE_CHECKOUT_QML_PATH);
|
||||
ui.tablet.sendToQml({
|
||||
method: 'updateCheckoutQML',
|
||||
method: 'updateCheckoutQMLItemID',
|
||||
params: message
|
||||
});
|
||||
} else if (message.type === "REQUEST_SETTING") {
|
||||
|
@ -649,8 +649,8 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
|
|||
case 'purchases_openGoTo':
|
||||
case 'purchases_itemInfoClicked':
|
||||
case 'purchases_itemCertificateClicked':
|
||||
case 'clearShouldShowDotHistory':
|
||||
case 'giftAsset':
|
||||
case 'clearShouldShowDotHistory':
|
||||
case 'giftAsset':
|
||||
break;
|
||||
default:
|
||||
print('marketplaces.js: Unrecognized message from Checkout.qml');
|
||||
|
|
Loading…
Reference in a new issue