From 2b2b279e13d7dbece0b397f64f22c3d72e7500fa Mon Sep 17 00:00:00 2001 From: foxster-mp4 Date: Tue, 18 Jul 2023 11:40:58 -0700 Subject: [PATCH] Show latest version if the app has multiple versions --- js/app.js | 10 ++++++++++ js/apps.js | 2 +- js/index.js | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 40b7a76..fb2dccc 100644 --- a/js/app.js +++ b/js/app.js @@ -38,6 +38,16 @@ main((json) => { const app = getAppWithBundleId(bundleId); if (!app) exit(); + // If has multiple versions, show the latest one + if (app.versions) { + const latestVersion = app.versions[0]; + app.version = latestVersion.version; + app.versionDate = latestVersion.date; + app.versionDescription = latestVersion.localizedDescription; + app.downloadURL = latestVersion.downloadURL; + app.size = latestVersion.size; + } + // Set tab title document.title = `${app.name} - ${json.name}`; diff --git a/js/apps.js b/js/apps.js index f579778..14f1f16 100644 --- a/js/apps.js +++ b/js/apps.js @@ -17,7 +17,7 @@ main((json) => { document.title = `Apps - ${json.name}`; // Sort apps in decending order of version date (newest first) - json.apps.sort((a, b) => (new Date(b.versionDate)).valueOf() - (new Date(a.versionDate)).valueOf()); + // json.apps.sort((a, b) => (new Date(b.versionDate)).valueOf() - (new Date(a.versionDate)).valueOf()); // Create & insert app items json.apps.forEach(app => { diff --git a/js/index.js b/js/index.js index 337caad..a075544 100644 --- a/js/index.js +++ b/js/index.js @@ -37,7 +37,7 @@ main((json) => { } else document.getElementById("news").remove(); // Sort apps in descending order of version date - json.apps.sort((a, b) => (new Date(b.versionDate)).valueOf() - (new Date(a.versionDate)).valueOf()); + // json.apps.sort((a, b) => (new Date(b.versionDate)).valueOf() - (new Date(a.versionDate)).valueOf()); // // Featured apps