mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 19:57:46 -04:00
Hand over launchArguments for selected file
Former-commit-id: 7e1002bbee6f809f5743ca0f824886c4857ba8fc [formerly 4e486dc37e78679f322bad4ae454ebfe93aad623] [formerly 592c0f0c67b464d29cd289a0f431e0bac9fc5c92] [formerly 1f0ccfc8b586eda0895ee4e787a14e89937f82e3 [formerly 1461a5d32e75ce94fc76ff6b2bdc5b0311b9450b [formerly f8dc8661601f1349f32f97248a5c673615d16e5c]]] Former-commit-id: 4bfea93b6d3b7f7ae796cdc3410e5abdf838c1b8 [formerly dfc826d8b5252bb1c1f5c3c1cb3fb2be681e5b5b [formerly b7cafdbb82d13be352643ce43c48cfc7470a64d5]] Former-commit-id: 5cad7160657c40854643ec271d7ee85c031c177e [formerly f21972f85276ee714280e8029f99fc8cadf815d7] Former-commit-id: dbe0bf1056f31d998ff86122c522f043d38ddb9a
This commit is contained in:
parent
0f57374928
commit
d04ddd9c26
@ -164,6 +164,13 @@ if (!/^http/i.test(window.location.protocol) && params.localUWPSettings &&
|
||||
uriParams += params.fileVersion ? '&fileVersion=' + encodeURIComponent(params.fileVersion) : '';
|
||||
// Signal failure of PWA until it has successfully launched (in init.js it will be changed to 'success')
|
||||
params.localUWPSettings.PWA_launch = 'fail';
|
||||
if (launchArguments && typeof Windows.Storage !== 'undefined') {
|
||||
// We have to ensure the PWA will have access to the file with which the app was launched
|
||||
var futureAccessList = Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList;
|
||||
futureAccessList.addOrReplace(params.falFileToken, launchArguments.files[0]);
|
||||
if (futureAccessList.containsItem(params.falFolderToken)) futureAccessList.remove(params.falFolderToken);
|
||||
uriParams += '&lastSelectedArchive=' + encodeURIComponent(launchArguments.files[0].name);
|
||||
}
|
||||
window.location.href = params.PWAServer + 'www/index.html' + uriParams;
|
||||
// This will trigger the error catching above, cleanly dematerialize this script and transport us swiftly to PWA land
|
||||
throw 'Beam me up, Scotty!';
|
||||
|
Loading…
x
Reference in New Issue
Block a user