mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-15 07:19:11 -04:00
Change version to appVersion
Former-commit-id: 0defe6b4783463d69e2a687d6bcb220e49c5142c [formerly dd4bda98acc4be75c7446ed5e6c9ae80da5db77f] [formerly df8c384d3c4af7265cc300d0ec8f7262cbc38f34] [formerly 3fd784e9b00221058324c286f725ba7251291005 [formerly b7bcbb23e938a2eff3d55f73c7c215d656328653 [formerly bd23e8bb7ceac497e5f563d5735c84a5843b864b]]] Former-commit-id: 471c26475377b513298caf63481d44fc763151f0 [formerly 73fb1271f0208e580e03e5e30370021bbedd051e [formerly 535e48b4c2ac5a62680c4763f42d6289a5cdb840]] Former-commit-id: 68dfa7dd25277af6be9e7555956b0fd6d3330091 [formerly 45dcd56abc50e30b468ba3c36b02622b7f945cfb] Former-commit-id: 75c067902b6824934cfef467be0283a76204bd68
This commit is contained in:
parent
081b8e9de8
commit
2fb88ee0dd
@ -760,7 +760,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
||||
// Populate version info
|
||||
var versionSpans = document.getElementsByClassName('version');
|
||||
for (var i = 0; i < versionSpans.length; i++) {
|
||||
versionSpans[i].innerHTML = i ? params.version : params.version.replace(/\s+.*$/, "");
|
||||
versionSpans[i].innerHTML = i ? params.appVersion : params.appVersion.replace(/\s+.*$/, "");
|
||||
}
|
||||
if (params.fileVersion && /UWP|Electron/.test(params.appType)) {
|
||||
var packagedInfoParas = document.getElementsByClassName('packagedInfo');
|
||||
@ -815,7 +815,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
||||
caches.keys().then(function (keyList) {
|
||||
if (keyList.length < 2) document.getElementById('alertBoxPersistent').innerHTML = '';
|
||||
keyList.forEach(function(key) {
|
||||
if (key === 'kiwix-precache-' + params.version) return;
|
||||
if (key === 'kiwix-precache-' + params.appVersion) return;
|
||||
// If we get here, then there is a cache key that does not match our version, i.e. a PWA-in-waiting
|
||||
params.upgradeNeeded = true;
|
||||
document.getElementById('alertBoxPersistent').innerHTML =
|
||||
@ -1563,7 +1563,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
||||
}
|
||||
if (this.checked && /UWP/.test(params.appType) && params.windowOpener && params.cssSource !== 'desktop') {
|
||||
if (message) message += '\n\n';
|
||||
message += 'Please note that hidden elements will not be displayed in any NEW windows or tabs that you open in this UWP app. If you want to see hidden elements in new windows in <b>Wikimedia</b> ZIMs, please switch to Desktop style (above), where they are shown by default.';
|
||||
message += 'Please note that hidden elements will not be displayed in any NEW windows or tabs that you open in this UWP app. If you want to see hidden elements in new windows in *Wikimedia* ZIMs, please switch to Desktop style (above), where they are shown by default.';
|
||||
}
|
||||
if (!this.checked && params.manipulateImages) {
|
||||
message += 'We are turning off the image manipulation option because it is no longer needed to display hidden elements. You may turn it back on if you need it for another reason.';
|
||||
@ -1691,7 +1691,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
||||
}
|
||||
}
|
||||
//Code below triggers display of modal info box if app is run for the first time, or it has been upgraded to new version
|
||||
if (settingsStore.getItem('version') !== params.version) {
|
||||
if (settingsStore.getItem('appVersion') !== params.appVersion) {
|
||||
firstRun = true;
|
||||
|
||||
// If we have an update and the last selected archive is the packaged file, it is best not to preserve last read article
|
||||
@ -1703,7 +1703,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
||||
|
||||
// Update the installed version
|
||||
if (settingsStore.getItem('PWAInstalled')) {
|
||||
params.PWAInstalled = params.version;
|
||||
params.PWAInstalled = params.appVersion;
|
||||
settingsStore.setItem('PWAInstalled', params.PWAInstalled);
|
||||
}
|
||||
// One-time cleanup of idxDB files to delete deprecated databases if possible
|
||||
@ -1716,7 +1716,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
|
||||
$('#myModal').modal({
|
||||
backdrop: "static"
|
||||
});
|
||||
settingsStore.setItem('version', params.version, Infinity);
|
||||
settingsStore.setItem('appVersion', params.appVersion, Infinity);
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ var params = {};
|
||||
*/
|
||||
var appstate = {};
|
||||
/******** UPDATE VERSION IN pwabuilder-sw.js TO MATCH VERSION AND CHECK PWASERVER BELOW!!!!!!! *******/
|
||||
params['version'] = "1.7.7"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "version" in order to show first-time info, and the cookie is updated in app.js
|
||||
params['appVersion'] = "1.7.7"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "appVersion" in order to show first-time info, and the cookie is updated in app.js
|
||||
/******* UPDATE THIS ^^^^^^ IN service worker AND PWA-SERVER BELOW !! ********************/
|
||||
params['packagedFile'] = getSetting('packagedFile') || "wikipedia_en_100_nopic_2021-10.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
|
||||
params['archivePath'] = "archives"; //The directory containing the packaged archive(s) (relative to app's root directory)
|
||||
@ -267,7 +267,7 @@ function getAppType() {
|
||||
// Set up storage types
|
||||
// First check that we have not simply upgraded the app and the packaged file
|
||||
params.packagedFileStub = params.packagedFile ? params.packagedFile.replace(/(?:-app_maxi)?_[\d-]+\.zim\w?\w?$/, ''): null;
|
||||
if (params.packagedFileStub && params.version !== getSetting('version') && ~params.storedFile.indexOf(params.packagedFileStub)) {
|
||||
if (params.packagedFileStub && params.appVersion !== getSetting('appVersion') && ~params.storedFile.indexOf(params.packagedFileStub)) {
|
||||
console.log('The packaged archive has been upgraded: resetting file pointers to point to ' + params.packagedFile);
|
||||
params.lastPageVisit = '';
|
||||
params.storedFile = params.packagedFile;
|
||||
@ -366,7 +366,7 @@ function installApp(e) {
|
||||
}
|
||||
|
||||
window.addEventListener('appinstalled', function(e) {
|
||||
params.PWAInstalled = params.version;
|
||||
params.PWAInstalled = params.appVersion;
|
||||
if (params.storeType === 'cookie') {
|
||||
document.cookie = 'PWAInstalled=' + encodeURIComponent(params.PWAInstalled) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
|
||||
} else if (params.storeType === 'local_storage') {
|
||||
|
@ -23,7 +23,7 @@
|
||||
'use strict';
|
||||
define(['settingsStore', 'uiUtil'], function(settingsStore, uiUtil) {
|
||||
|
||||
const CACHEAPI = 'kiwix-precache-' + params.version; // Set the database or cache name here
|
||||
const CACHEAPI = 'kiwix-precache-' + params.appVersion; // Set the database or cache name here
|
||||
const CACHEIDB = 'kiwix-assetsCache'; // For idxDB we don't want the name to change
|
||||
var objStore = 'kiwix-assets'; // Name of the object store
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user