mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 12:01:15 -04:00
Remove backward compatibility with FxOS 1.0, to simplify the use of DeviceStorage API. Fixes #79
This commit is contained in:
parent
e138844a99
commit
8bff5cd843
@ -224,23 +224,13 @@ define(function(require) {
|
||||
evopediaArchive.LocalArchive.scanForArchives(storages, populateDropDownListOfArchives);
|
||||
}
|
||||
|
||||
if ($.isFunction(navigator.getDeviceStorage)) {
|
||||
if ($.isFunction(navigator.getDeviceStorages)) {
|
||||
// The method getDeviceStorages is available (FxOS>=1.1)
|
||||
// We have to scan all the DeviceStorages, because getDeviceStorage
|
||||
// only returns the default Device Storage.
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=885753
|
||||
storages = $.map(navigator.getDeviceStorages("sdcard"), function(s) {
|
||||
return new osabstraction.StorageFirefoxOS(s);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// The method getDeviceStorages is not available (FxOS 1.0)
|
||||
// The fallback is to use getDeviceStorage
|
||||
storages[0] = new osabstraction.StorageFirefoxOS(
|
||||
navigator.getDeviceStorage("sdcard"));
|
||||
}
|
||||
} else if ($.isFunction(window.requestFileSystem)) { // cordova
|
||||
if ($.isFunction(navigator.getDeviceStorages)) {
|
||||
// The method getDeviceStorages is available (FxOS>=1.1)
|
||||
storages = $.map(navigator.getDeviceStorages("sdcard"), function(s) {
|
||||
return new osabstraction.StorageFirefoxOS(s);
|
||||
});
|
||||
} else if ($.isFunction(window.requestFileSystem)) {
|
||||
// The requestFileSystem is available (Cordova)
|
||||
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
|
||||
storages[0] = new osabstraction.StoragePhoneGap(fs);
|
||||
searchForArchivesInPreferencesOrStorage();
|
||||
|
@ -264,9 +264,9 @@ define(function(require) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This happens with FxOS 1.0
|
||||
// In this case, we use the first storage of the list
|
||||
// (there should be only one)
|
||||
// This happens when the archiveDirectory is not prefixed by the name of the storage
|
||||
// (in the Simulator, or with FxOs 1.0, or probably on devices that only have one device storage)
|
||||
// In this case, we use the first storage of the list (there should be only one)
|
||||
if (storages.length === 1) {
|
||||
selectedStorage = storages[0];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user