mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:43:45 +02:00
Merge pull request #14360 from zfox23/MS19743_updateCheckoutBug
Fix MS19743: Fix case where user couldn't update certain items
This commit is contained in:
commit
3cbaec818d
6 changed files with 18 additions and 8 deletions
|
@ -55,6 +55,7 @@ Rectangle {
|
||||||
property bool isInstalled;
|
property bool isInstalled;
|
||||||
property bool isUpdating;
|
property bool isUpdating;
|
||||||
property string baseAppURL;
|
property string baseAppURL;
|
||||||
|
property int currentUpdatesPage: 1;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -156,8 +157,14 @@ Rectangle {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.availableUpdatesReceived = true;
|
|
||||||
refreshBuyUI();
|
if (result.data.updates.length === 0 || root.isUpdating) {
|
||||||
|
root.availableUpdatesReceived = true;
|
||||||
|
refreshBuyUI();
|
||||||
|
} else {
|
||||||
|
root.currentUpdatesPage++;
|
||||||
|
Commerce.getAvailableUpdates(root.itemId, currentUpdatesPage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +183,7 @@ Rectangle {
|
||||||
root.ownershipStatusReceived = false;
|
root.ownershipStatusReceived = false;
|
||||||
Commerce.alreadyOwned(root.itemId);
|
Commerce.alreadyOwned(root.itemId);
|
||||||
root.availableUpdatesReceived = false;
|
root.availableUpdatesReceived = false;
|
||||||
|
root.currentUpdatesPage = 1;
|
||||||
Commerce.getAvailableUpdates(root.itemId);
|
Commerce.getAvailableUpdates(root.itemId);
|
||||||
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
||||||
}
|
}
|
||||||
|
@ -1181,6 +1189,7 @@ Rectangle {
|
||||||
root.ownershipStatusReceived = false;
|
root.ownershipStatusReceived = false;
|
||||||
Commerce.alreadyOwned(root.itemId);
|
Commerce.alreadyOwned(root.itemId);
|
||||||
root.availableUpdatesReceived = false;
|
root.availableUpdatesReceived = false;
|
||||||
|
root.currentUpdatesPage = 1;
|
||||||
Commerce.getAvailableUpdates(root.itemId);
|
Commerce.getAvailableUpdates(root.itemId);
|
||||||
root.balanceReceived = false;
|
root.balanceReceived = false;
|
||||||
Commerce.balance();
|
Commerce.balance();
|
||||||
|
|
|
@ -29,7 +29,6 @@ Item {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
Commerce.balance();
|
Commerce.balance();
|
||||||
transactionHistoryModel.getFirstPage();
|
transactionHistoryModel.getFirstPage();
|
||||||
Commerce.getAvailableUpdates();
|
|
||||||
} else {
|
} else {
|
||||||
refreshTimer.stop();
|
refreshTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,7 +454,7 @@ void Ledger::alreadyOwned(const QString& marketplaceId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ledger::getAvailableUpdates(const QString& itemId) {
|
void Ledger::getAvailableUpdates(const QString& itemId, const int& pageNumber, const int& itemsPerPage) {
|
||||||
auto wallet = DependencyManager::get<Wallet>();
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
QString endpoint = "available_updates";
|
QString endpoint = "available_updates";
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
|
@ -462,6 +462,8 @@ void Ledger::getAvailableUpdates(const QString& itemId) {
|
||||||
if (!itemId.isEmpty()) {
|
if (!itemId.isEmpty()) {
|
||||||
request["marketplace_item_id"] = itemId;
|
request["marketplace_item_id"] = itemId;
|
||||||
}
|
}
|
||||||
|
request["per_page"] = itemsPerPage;
|
||||||
|
request["page"] = pageNumber;
|
||||||
send(endpoint, "availableUpdatesSuccess", "availableUpdatesFailure", QNetworkAccessManager::PutOperation, AccountManagerAuth::Required, request);
|
send(endpoint, "availableUpdatesSuccess", "availableUpdatesFailure", QNetworkAccessManager::PutOperation, AccountManagerAuth::Required, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
void transferAssetToNode(const QString& hfc_key, const QString& nodeID, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
void transferAssetToNode(const QString& hfc_key, const QString& nodeID, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
||||||
void transferAssetToUsername(const QString& hfc_key, const QString& username, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
void transferAssetToUsername(const QString& hfc_key, const QString& username, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
||||||
void alreadyOwned(const QString& marketplaceId);
|
void alreadyOwned(const QString& marketplaceId);
|
||||||
void getAvailableUpdates(const QString& itemId = "");
|
void getAvailableUpdates(const QString& itemId = "", const int& pageNumber = 1, const int& itemsPerPage = 10);
|
||||||
void updateItem(const QString& hfc_key, const QString& certificate_id);
|
void updateItem(const QString& hfc_key, const QString& certificate_id);
|
||||||
|
|
||||||
enum CertificateStatus {
|
enum CertificateStatus {
|
||||||
|
|
|
@ -441,9 +441,9 @@ bool QmlCommerce::openApp(const QString& itemHref) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCommerce::getAvailableUpdates(const QString& itemId) {
|
void QmlCommerce::getAvailableUpdates(const QString& itemId, const int& pageNumber, const int& itemsPerPage) {
|
||||||
auto ledger = DependencyManager::get<Ledger>();
|
auto ledger = DependencyManager::get<Ledger>();
|
||||||
ledger->getAvailableUpdates(itemId);
|
ledger->getAvailableUpdates(itemId, pageNumber, itemsPerPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCommerce::updateItem(const QString& certificateId) {
|
void QmlCommerce::updateItem(const QString& certificateId) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ protected:
|
||||||
Q_INVOKABLE bool uninstallApp(const QString& appHref);
|
Q_INVOKABLE bool uninstallApp(const QString& appHref);
|
||||||
Q_INVOKABLE bool openApp(const QString& appHref);
|
Q_INVOKABLE bool openApp(const QString& appHref);
|
||||||
|
|
||||||
Q_INVOKABLE void getAvailableUpdates(const QString& itemId = "");
|
Q_INVOKABLE void getAvailableUpdates(const QString& itemId = "", const int& pageNumber = 1, const int& itemsPerPage = 10);
|
||||||
Q_INVOKABLE void updateItem(const QString& certificateId);
|
Q_INVOKABLE void updateItem(const QString& certificateId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue