mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-12 21:02:11 +02:00
Upgrade specific edition
This commit is contained in:
parent
f42255f46b
commit
7b6b08fd26
2 changed files with 13 additions and 4 deletions
|
@ -35,6 +35,7 @@ Rectangle {
|
||||||
property string itemId;
|
property string itemId;
|
||||||
property string itemHref;
|
property string itemHref;
|
||||||
property string itemAuthor;
|
property string itemAuthor;
|
||||||
|
property int itemEdition: -1;
|
||||||
property string certificateId;
|
property string certificateId;
|
||||||
property double balanceAfterPurchase;
|
property double balanceAfterPurchase;
|
||||||
property bool alreadyOwned: false;
|
property bool alreadyOwned: false;
|
||||||
|
@ -143,6 +144,9 @@ Rectangle {
|
||||||
// OR the ID of an "updated" item, we're updating.
|
// OR the ID of an "updated" item, we're updating.
|
||||||
if (root.itemId === result.data.updates[i].item_id ||
|
if (root.itemId === result.data.updates[i].item_id ||
|
||||||
root.itemId === result.data.updates[i].updated_item_id) {
|
root.itemId === result.data.updates[i].updated_item_id) {
|
||||||
|
if (root.itemEdition !== -1 && root.itemEdition !== result.data.updates[i].edition_number) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
root.isUpdating = true;
|
root.isUpdating = true;
|
||||||
// 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;
|
||||||
|
@ -1059,6 +1063,7 @@ Rectangle {
|
||||||
root.itemHref = message.params.itemHref;
|
root.itemHref = message.params.itemHref;
|
||||||
root.referrer = message.params.referrer;
|
root.referrer = message.params.referrer;
|
||||||
root.itemAuthor = message.params.itemAuthor;
|
root.itemAuthor = message.params.itemAuthor;
|
||||||
|
root.itemEdition = message.params.itemEdition;
|
||||||
refreshBuyUI();
|
refreshBuyUI();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -243,7 +243,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buyButtonClicked(id, name, author, price, href, referrer) {
|
function buyButtonClicked(id, name, author, price, href, referrer, edition) {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "CHECKOUT",
|
type: "CHECKOUT",
|
||||||
itemId: id,
|
itemId: id,
|
||||||
|
@ -251,7 +251,8 @@
|
||||||
itemPrice: price ? parseInt(price, 10) : 0,
|
itemPrice: price ? parseInt(price, 10) : 0,
|
||||||
itemHref: href,
|
itemHref: href,
|
||||||
referrer: referrer,
|
referrer: referrer,
|
||||||
itemAuthor: author
|
itemAuthor: author,
|
||||||
|
itemEdition: edition
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +320,8 @@
|
||||||
$(this).closest('.grid-item').find('.creator').find('.value').text(),
|
$(this).closest('.grid-item').find('.creator').find('.value').text(),
|
||||||
$(this).closest('.grid-item').find('.item-cost').text(),
|
$(this).closest('.grid-item').find('.item-cost').text(),
|
||||||
$(this).attr('data-href'),
|
$(this).attr('data-href'),
|
||||||
"mainPage");
|
"mainPage",
|
||||||
|
-1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,6 +413,7 @@
|
||||||
|
|
||||||
var cost = $('.item-cost').text();
|
var cost = $('.item-cost').text();
|
||||||
var isUpdating = window.location.href.indexOf('edition=') > -1;
|
var isUpdating = window.location.href.indexOf('edition=') > -1;
|
||||||
|
var urlParams = new URLSearchParams(window.location.search);
|
||||||
if (isUpdating) {
|
if (isUpdating) {
|
||||||
purchaseButton.html('UPDATE FOR FREE');
|
purchaseButton.html('UPDATE FOR FREE');
|
||||||
} else if (availability !== 'available') {
|
} else if (availability !== 'available') {
|
||||||
|
@ -427,7 +430,8 @@
|
||||||
$('#creator').find('.value').text(),
|
$('#creator').find('.value').text(),
|
||||||
cost,
|
cost,
|
||||||
href,
|
href,
|
||||||
"itemPage");
|
"itemPage",
|
||||||
|
urlParams.get('edition'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
maybeAddPurchasesButton();
|
maybeAddPurchasesButton();
|
||||||
|
|
Loading…
Reference in a new issue