Move launch handler to app.js to support permission prompt

Former-commit-id: c150e9eb0e142c43072ea12a30289cb9b4d02d0f [formerly 9fa3ef316cdc9df1f00dc4f344e1590d012f1742 [formerly 4b2a00cdb6a4ccf6415673efccf64536576a6f63]]
Former-commit-id: bcb0e2d2dd0d8f6cf544ab49a75fdd11cbd37bd6
Former-commit-id: 7a1540db0317453045227d8631d3913fbbbb55fa
This commit is contained in:
Jaifroid 2021-07-08 12:19:53 +01:00
parent f01c90b2ff
commit 2ef13e7de7
4 changed files with 14 additions and 11 deletions

View File

@ -4,7 +4,7 @@
// App version number - ENSURE IT MATCHES VALUE IN init.js
// DEV: Changing this will cause the browser to recognize that the Service Worker has changed, and it will download and
// install a new copy
const appVersion = '1.4.3-rc1';
const appVersion = '1.4.3-rc2';
// Kiwix ZIM Archive Download Server in regex form
// DEV: The server URL is defined in init.js, but is not available to us in SW

View File

@ -47,15 +47,7 @@
<script type="text/javascript">
// This script is needed to retrieve launch arguments when the app is started by double-clicking on a file
var launchArguments = null;
if ('launchQueue' in window) {
launchQueue.setConsumer(function (launchParams) {
// Nothing to do when the queue is empty.
if (!launchParams.files.length) {
return;
}
launchArguments = launchParams;
});
} else if (typeof Windows !== 'undefined' && Windows.UI && Windows.UI.WebUI && Windows.UI.WebUI.WebUIApplication) {
if (typeof Windows !== 'undefined' && Windows.UI && Windows.UI.WebUI && Windows.UI.WebUI.WebUIApplication) {
Windows.UI.WebUI.WebUIApplication.addEventListener('activated', function (eventArgs) {
if (eventArgs.kind === Windows.ApplicationModel.Activation.ActivationKind.file) {
console.log("App was activated with a file: " + eventArgs.files[0].name);

View File

@ -1895,6 +1895,17 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
}
}
if ('launchQueue' in window) {
launchQueue.setConsumer(function (launchParams) {
// Nothing to do when the queue is empty.
if (!launchParams.files.length) {
return;
}
// User launched app by double-clicking on file
processNativeFileHandle(launchParams.files[0]);
});
}
// @STORAGE AUTOLOAD STARTS HERE
if ($.isFunction(navigator.getDeviceStorages)) {
// The method getDeviceStorages is available (FxOS>=1.1)

View File

@ -49,7 +49,7 @@ var params = {};
*/
var appstate = {};
/******** UPDATE VERSION IN pwabuilder-sw.js TO MATCH VERSION AND CHECK PWASERVER BELOW!!!!!!! *******/
params['version'] = "1.4.3-rc1"; //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['version'] = "1.4.3-rc2"; //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
/******* UPDATE THIS ^^^^^^ IN service worker AND PWA-SERVER BELOW !! ********************/
params['packagedFile'] = getSetting('packagedFile') || "wikipedia_en_100_maxi_2021-05.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)