From d24becca145d07bc66c26ea1b54d490af309f23c Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Fri, 6 Oct 2023 11:28:52 +0100 Subject: [PATCH] Prevent interference between launchQueue and OPFS --- www/js/app.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/www/js/app.js b/www/js/app.js index 3f60c801..dbcae589 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1562,12 +1562,7 @@ function setOPFSUI () { btnExportOPFSEntry.style.display = 'none'; } } -// Set the OPFS UI no app launch -setOPFSUI(); -// If user had previously set the app to use the OPFS directory, attempt to launch any ZIM in it -// if (params.useOPFS) { -// loadOPFSDirectory(); -// } + document.getElementById('btnExportOPFSEntry').addEventListener('click', function () { params.exportOPFSEntry = !params.exportOPFSEntry; var determinedTheme = params.cssUITheme == 'auto' ? cssUIThemeGetOrSet('auto', true) : params.cssUITheme; @@ -3029,15 +3024,18 @@ if ('launchQueue' in window && 'files' in LaunchParams.prototype) { console.debug('Processing NativeFileHandle for ' + launchParams); // Turn off OPFS if it is on, because we are using the File Handling API instead if (params.useOPFS) { - document.getElementById('useOPFSCheck').click(); - params.pickedFolder = ''; - params.storedFile = ''; + params.useOPFS = false; } + params.pickedFolder = ''; + params.storedFile = ''; processNativeFileHandle(launchParams.files[0]); } }); } +// Set the OPFS UI on app launch (this needs to run after the launchQueue above, as it may turn off OPFS) +setOPFSUI(); + // @STORAGE AUTOLOAD STARTS HERE if ($.isFunction(navigator.getDeviceStorages)) { // The method getDeviceStorages is available (FxOS>=1.1)