cordova-app-loader
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "cordova-app-loadaer", | ||
"main": "www/lib/CordovaAppLoader.js", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/markmarijnissen/cordova-file-cache", | ||
@@ -6,0 +6,0 @@ "authors": [ |
35
index.js
@@ -54,16 +54,21 @@ var CordovaFileCache = require('cordova-file-cache'); | ||
self._toBeDeleted = Object.keys(manifest.files) | ||
.concat(self._toBeDownloaded) | ||
.filter(function(file){ | ||
return !newManifest.files[file] && self.cache.isCached(file); | ||
}); | ||
if(self._toBeDeleted.length > 0 || self._toBeDownloaded.length > 0){ | ||
// Save the new Manifest | ||
self.newManifest = newManifest; | ||
self.newManifest.root = self.cache.toInternalURL('/') + (self.newManifest.root || ''); | ||
resolve(true); | ||
} else { | ||
resolve(false); | ||
} | ||
self.cache.list().then(function(files){ | ||
self._toBeDeleted = files | ||
.map(function(file){ | ||
return file.substr(self.cache._localRoot.length); | ||
}) | ||
.filter(function(file){ | ||
return !newManifest.files[file]; | ||
}) | ||
.concat(self._toBeDownloaded); | ||
if(self._toBeDeleted.length > 0 || self._toBeDownloaded.length > 0){ | ||
// Save the new Manifest | ||
self.newManifest = newManifest; | ||
self.newManifest.root = self.cache.toInternalURL('/') + (self.newManifest.root || ''); | ||
resolve(true); | ||
} else { | ||
resolve(false); | ||
} | ||
},reject); | ||
},reject); | ||
@@ -80,3 +85,3 @@ } | ||
AppLoader.prototype.canDownload = function(){ | ||
return !!this.newManifest; | ||
return !!this.newManifest && !this._updateReady; | ||
}; | ||
@@ -83,0 +88,0 @@ |
{ | ||
"name": "cordova-app-loader", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Cordova App Loader - remote update your cordova app", | ||
@@ -23,4 +23,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"cordova-file-cache": "^0.2.2" | ||
"cordova-file-cache": "^0.3.0" | ||
} | ||
} |
@@ -10,3 +10,4 @@ | ||
serverRoot: SERVER, | ||
mode: 'mirror' | ||
mode: 'mirror', | ||
cacheBuster: true | ||
}); | ||
@@ -40,3 +41,4 @@ | ||
setStatus('checking...'); | ||
loader.check(url).then(setStatus,setStatus); | ||
var cacheBuster = "?"+Math.random(); | ||
loader.check(url+cacheBuster).then(setStatus,setStatus); | ||
}); | ||
@@ -43,0 +45,0 @@ |
@@ -16,9 +16,9 @@ { | ||
"lib/CordovaAppLoader.js": { | ||
"version": "d84dbc532913cbb0a5b576b31ac33c98e57efcbb" | ||
"version": "addb258103efc624f5c21a6a9f68a06feaa47db5" | ||
}, | ||
"template.html": { | ||
"version": "67a0f801a50ac6366a24f638f9a61f522058749a" | ||
"version": "3e70f2873de3d9c91e31271c1a59b32e8002ac23" | ||
}, | ||
"app.js": { | ||
"version": "7acb6658f3bbf00da7a43585695c1f394af1f93d" | ||
"version": "dc24c37d42663c7d7b156eb7debd166c50eac542" | ||
}, | ||
@@ -25,0 +25,0 @@ "broken-app/style.css": { |
@@ -16,9 +16,9 @@ { | ||
"lib/CordovaAppLoader.js": { | ||
"version": "d84dbc532913cbb0a5b576b31ac33c98e57efcbb" | ||
"version": "addb258103efc624f5c21a6a9f68a06feaa47db5" | ||
}, | ||
"template.html": { | ||
"version": "67a0f801a50ac6366a24f638f9a61f522058749a" | ||
"version": "3e70f2873de3d9c91e31271c1a59b32e8002ac23" | ||
}, | ||
"app.js": { | ||
"version": "7acb6658f3bbf00da7a43585695c1f394af1f93d" | ||
"version": "dc24c37d42663c7d7b156eb7debd166c50eac542" | ||
}, | ||
@@ -25,0 +25,0 @@ "broken-url/this-file-does-not-exist.jpg": { |
@@ -101,16 +101,21 @@ var CordovaAppLoader = | ||
self._toBeDeleted = Object.keys(manifest.files) | ||
.concat(self._toBeDownloaded) | ||
.filter(function(file){ | ||
return !newManifest.files[file] && self.cache.isCached(file); | ||
}); | ||
if(self._toBeDeleted.length > 0 || self._toBeDownloaded.length > 0){ | ||
// Save the new Manifest | ||
self.newManifest = newManifest; | ||
self.newManifest.root = self.cache.toInternalURL('/') + (self.newManifest.root || ''); | ||
resolve(true); | ||
} else { | ||
resolve(false); | ||
} | ||
self.cache.list().then(function(files){ | ||
self._toBeDeleted = files | ||
.map(function(file){ | ||
return file.substr(self.cache._localRoot.length); | ||
}) | ||
.filter(function(file){ | ||
return !newManifest.files[file]; | ||
}) | ||
.concat(self._toBeDownloaded); | ||
if(self._toBeDeleted.length > 0 || self._toBeDownloaded.length > 0){ | ||
// Save the new Manifest | ||
self.newManifest = newManifest; | ||
self.newManifest.root = self.cache.toInternalURL('/') + (self.newManifest.root || ''); | ||
resolve(true); | ||
} else { | ||
resolve(false); | ||
} | ||
},reject); | ||
},reject); | ||
@@ -127,3 +132,3 @@ } | ||
AppLoader.prototype.canDownload = function(){ | ||
return !!this.newManifest; | ||
return !!this.newManifest && !this._updateReady; | ||
}; | ||
@@ -204,2 +209,3 @@ | ||
this._retry = options.retry || [500,1500,8000]; | ||
this._cacheBuster = !!options.cacheBuster; | ||
@@ -352,3 +358,4 @@ // normalize path | ||
}; | ||
var downloadUrl = url; | ||
if(self._cacheBuster) downloadUrl += "?"+Date.now(); | ||
var download = fs.download(url,path,{retry:self._retry},onSingleDownloadProgress); | ||
@@ -355,0 +362,0 @@ download.then(onDone,onDone); |
@@ -16,9 +16,9 @@ { | ||
"lib/CordovaAppLoader.js": { | ||
"version": "d84dbc532913cbb0a5b576b31ac33c98e57efcbb" | ||
"version": "addb258103efc624f5c21a6a9f68a06feaa47db5" | ||
}, | ||
"template.html": { | ||
"version": "67a0f801a50ac6366a24f638f9a61f522058749a" | ||
"version": "3e70f2873de3d9c91e31271c1a59b32e8002ac23" | ||
}, | ||
"app.js": { | ||
"version": "7acb6658f3bbf00da7a43585695c1f394af1f93d" | ||
"version": "dc24c37d42663c7d7b156eb7debd166c50eac542" | ||
}, | ||
@@ -25,0 +25,0 @@ "style.css": { |
@@ -16,9 +16,9 @@ { | ||
"lib/CordovaAppLoader.js": { | ||
"version": "d84dbc532913cbb0a5b576b31ac33c98e57efcbb" | ||
"version": "addb258103efc624f5c21a6a9f68a06feaa47db5" | ||
}, | ||
"template.html": { | ||
"version": "67a0f801a50ac6366a24f638f9a61f522058749a" | ||
"version": "3e70f2873de3d9c91e31271c1a59b32e8002ac23" | ||
}, | ||
"app.js": { | ||
"version": "7acb6658f3bbf00da7a43585695c1f394af1f93d" | ||
"version": "dc24c37d42663c7d7b156eb7debd166c50eac542" | ||
}, | ||
@@ -25,0 +25,0 @@ "slow-download/style.css": { |
@@ -1,3 +0,5 @@ | ||
$(function(){ | ||
$('#msg').text('Update'); | ||
$.get(Manifest.root + 'update/time.php').then(function(time){ | ||
time = time * 1000.0; | ||
time = new Date(time); | ||
$('#msg').text(time); | ||
}); |
@@ -16,10 +16,13 @@ { | ||
"lib/CordovaAppLoader.js": { | ||
"version": "d84dbc532913cbb0a5b576b31ac33c98e57efcbb" | ||
"version": "addb258103efc624f5c21a6a9f68a06feaa47db5" | ||
}, | ||
"template.html": { | ||
"version": "67a0f801a50ac6366a24f638f9a61f522058749a" | ||
"version": "3e70f2873de3d9c91e31271c1a59b32e8002ac23" | ||
}, | ||
"app.js": { | ||
"version": "7acb6658f3bbf00da7a43585695c1f394af1f93d" | ||
"version": "dc24c37d42663c7d7b156eb7debd166c50eac542" | ||
}, | ||
"update/time.php": { | ||
"version": "86a6fef9a4e2957e434343a7b65c683dda2a82c4" | ||
}, | ||
"update/style.css": { | ||
@@ -29,3 +32,3 @@ "version": "092dff7bb63e9e6bcd5b1ef382695d315538db6a" | ||
"update/index.js": { | ||
"version": "41381015957e82e7712e4843ec6881ac06646a71" | ||
"version": "8390932657cb2ca317469a92d69a38408ad9115a" | ||
} | ||
@@ -32,0 +35,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
440630
33
6686
+ Addedcordova-file-cache@0.3.0(transitive)
- Removedcordova-file-cache@0.2.2(transitive)
Updatedcordova-file-cache@^0.3.0