mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-20 22:00:15 +02:00
Fix MS16615: Don't early-remove .app.json we JUST installed
This commit is contained in:
parent
54d2f42fa4
commit
bf4954d667
5 changed files with 24 additions and 10 deletions
|
@ -129,7 +129,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppInstalled: {
|
onAppInstalled: {
|
||||||
if (appHref === root.itemHref) {
|
if (appID === root.itemId) {
|
||||||
root.isInstalled = true;
|
root.isInstalled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,13 +67,13 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppInstalled: {
|
onAppInstalled: {
|
||||||
if (appHref === root.itemHref) {
|
if (appID === root.itemId) {
|
||||||
root.isInstalled = true;
|
root.isInstalled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppUninstalled: {
|
onAppUninstalled: {
|
||||||
if (appHref === root.itemHref) {
|
if (appID === root.itemId) {
|
||||||
root.isInstalled = false;
|
root.isInstalled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppInstalled: {
|
onAppInstalled: {
|
||||||
root.installedApps = Commerce.getInstalledApps();
|
root.installedApps = Commerce.getInstalledApps(appID);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppUninstalled: {
|
onAppUninstalled: {
|
||||||
|
|
|
@ -208,7 +208,7 @@ void QmlCommerce::alreadyOwned(const QString& marketplaceId) {
|
||||||
ledger->alreadyOwned(marketplaceId);
|
ledger->alreadyOwned(marketplaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlCommerce::getInstalledApps() {
|
QString QmlCommerce::getInstalledApps(const QString& justInstalledAppID) {
|
||||||
QString installedAppsFromMarketplace;
|
QString installedAppsFromMarketplace;
|
||||||
QStringList runningScripts = DependencyManager::get<ScriptEngines>()->getRunningScripts();
|
QStringList runningScripts = DependencyManager::get<ScriptEngines>()->getRunningScripts();
|
||||||
|
|
||||||
|
@ -217,6 +217,18 @@ QString QmlCommerce::getInstalledApps() {
|
||||||
foreach(QString appFileName, apps) {
|
foreach(QString appFileName, apps) {
|
||||||
installedAppsFromMarketplace += appFileName;
|
installedAppsFromMarketplace += appFileName;
|
||||||
installedAppsFromMarketplace += ",";
|
installedAppsFromMarketplace += ",";
|
||||||
|
|
||||||
|
// If we were supplied a "justInstalledAppID" argument, that means we're entering this function
|
||||||
|
// to get the new list of installed apps immediately after installing an app.
|
||||||
|
// In that case, the app we installed may not yet have its associated script running -
|
||||||
|
// that task is asynchronous and takes a nonzero amount of time. This is especially true
|
||||||
|
// for apps that are not in Interface's script cache.
|
||||||
|
// Thus, we protect against deleting the .app.json from the user's disk (below)
|
||||||
|
// by skipping that check for the app we just installed.
|
||||||
|
if ((justInstalledAppID != "") && ((justInstalledAppID + ".app.json") == appFileName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QFile appFile(_appsPath + appFileName);
|
QFile appFile(_appsPath + appFileName);
|
||||||
if (appFile.open(QIODevice::ReadOnly)) {
|
if (appFile.open(QIODevice::ReadOnly)) {
|
||||||
QJsonDocument appFileJsonDocument = QJsonDocument::fromJson(appFile.readAll());
|
QJsonDocument appFileJsonDocument = QJsonDocument::fromJson(appFile.readAll());
|
||||||
|
@ -291,7 +303,8 @@ bool QmlCommerce::installApp(const QString& itemHref) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit appInstalled(itemHref);
|
QFileInfo appFileInfo(appFile);
|
||||||
|
emit appInstalled(appFileInfo.baseName());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
request->send();
|
request->send();
|
||||||
|
@ -321,7 +334,8 @@ bool QmlCommerce::uninstallApp(const QString& itemHref) {
|
||||||
qCWarning(commerce) << "Couldn't delete local .app.json file during app uninstall. Continuing anyway. App filename is:" << appHref.fileName();
|
qCWarning(commerce) << "Couldn't delete local .app.json file during app uninstall. Continuing anyway. App filename is:" << appHref.fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit appUninstalled(itemHref);
|
QFileInfo appFileInfo(appFile);
|
||||||
|
emit appUninstalled(appFileInfo.baseName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ signals:
|
||||||
|
|
||||||
void contentSetChanged(const QString& contentSetHref);
|
void contentSetChanged(const QString& contentSetHref);
|
||||||
|
|
||||||
void appInstalled(const QString& appHref);
|
void appInstalled(const QString& appID);
|
||||||
void appUninstalled(const QString& appHref);
|
void appUninstalled(const QString& appID);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Q_INVOKABLE void getWalletStatus();
|
Q_INVOKABLE void getWalletStatus();
|
||||||
|
@ -86,7 +86,7 @@ protected:
|
||||||
|
|
||||||
Q_INVOKABLE void replaceContentSet(const QString& itemHref, const QString& certificateID);
|
Q_INVOKABLE void replaceContentSet(const QString& itemHref, const QString& certificateID);
|
||||||
|
|
||||||
Q_INVOKABLE QString getInstalledApps();
|
Q_INVOKABLE QString getInstalledApps(const QString& justInstalledAppID = "");
|
||||||
Q_INVOKABLE bool installApp(const QString& appHref);
|
Q_INVOKABLE bool installApp(const QString& appHref);
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue