From 7f35248c5bb7ab7baa501185e006b3666477cff6 Mon Sep 17 00:00:00 2001 From: mossroy Date: Thu, 10 Apr 2014 22:02:43 +0200 Subject: [PATCH] Make a first access to device storage before looking for archives, in order to ask the user for confirmation only once. This avoids a very annoying behavior on first startup of the application. Fixes #85 --- www/js/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/js/app.js b/www/js/app.js index ef5a7a4d..1701d0bc 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -238,7 +238,10 @@ define(function(require) { } if (storages !== null && storages.length > 0) { - searchForArchivesInPreferencesOrStorage(); + // Make a fake first access to device storage, in order to ask the user for confirmation if necessary. + // This way, it is only done once at this moment, instead of being done several times in callbacks + // After that, we can start looking for archives + storages[0].get("fake-file-to-read").always(searchForArchivesInPreferencesOrStorage); } else { // If DeviceStorage is not available, we display the file select components