cordova-plugin-ionic
Advanced tools
Comparing version 5.0.8 to 5.0.9
@@ -50,3 +50,3 @@ "use strict"; | ||
this.SNAPSHOT_CACHE = 'ionic_built_snapshots'; | ||
this.PLUGIN_VERSION = '5.0.7'; | ||
this.PLUGIN_VERSION = '5.0.8'; | ||
this.appInfo = appInfo; | ||
@@ -653,18 +653,17 @@ this._savedPreferences = preferences; | ||
fileEntry.createWriter((fileWriter) => { | ||
const status = { done: 0 }; | ||
let chunks = 1; | ||
let offset = Math.floor(dataBlob.size / chunks); | ||
// Maximum chunk size 512kb | ||
while (offset > (1024 * 512)) { | ||
chunks *= 2; | ||
offset = Math.floor(dataBlob.size / chunks); | ||
} | ||
const maxWriteSize = 1024 * 512; | ||
const chunks = Math.ceil(dataBlob.size / maxWriteSize); | ||
const status = { currentChunk: 0 }; | ||
fileWriter.onwriteend = (file) => { | ||
status.done += 1; | ||
if (status.done === chunks) { | ||
status.currentChunk += 1; | ||
if (status.currentChunk >= chunks) { | ||
resolve(); | ||
} | ||
else { | ||
const start = status.currentChunk * maxWriteSize; | ||
// The last chunk might not be the max write size | ||
const writeSize = status.currentChunk === (chunks - 1) ? (dataBlob.size - fileWriter.length) : maxWriteSize; | ||
fileWriter.seek(fileWriter.length); | ||
fileWriter.write(dataBlob.slice(status.done * offset, (status.done * offset) + offset)); | ||
fileWriter.write(dataBlob.slice(start, start + writeSize)); | ||
} | ||
@@ -675,3 +674,4 @@ }; | ||
}; | ||
fileWriter.write(dataBlob.slice(0, offset)); | ||
const writeSize = chunks === 1 ? dataBlob.size : maxWriteSize; | ||
fileWriter.write(dataBlob.slice(0, writeSize)); | ||
}); | ||
@@ -678,0 +678,0 @@ }); |
{ | ||
"name": "cordova-plugin-ionic", | ||
"version": "5.0.8", | ||
"version": "5.0.9", | ||
"cordova": { | ||
@@ -5,0 +5,0 @@ "id": "cordova-plugin-ionic", |
@@ -61,3 +61,3 @@ /// <reference path="../types/IonicCordova.d.ts" /> | ||
public SNAPSHOT_CACHE = 'ionic_built_snapshots'; | ||
public PLUGIN_VERSION = '5.0.8'; | ||
public PLUGIN_VERSION = '5.0.9'; | ||
@@ -711,19 +711,17 @@ constructor(appInfo: IAppInfo, preferences: ISavedPreferences) { | ||
const status = {done: 0}; | ||
let chunks = 1; | ||
let offset = Math.floor(dataBlob.size / chunks); | ||
// Maximum chunk size 512kb | ||
while (offset > (1024 * 512)) { | ||
chunks *= 2; | ||
offset = Math.floor(dataBlob.size / chunks); | ||
} | ||
const maxWriteSize = 1024 * 512; | ||
const chunks = Math.ceil(dataBlob.size / maxWriteSize); | ||
const status = {currentChunk: 0}; | ||
fileWriter.onwriteend = (file) => { | ||
status.done += 1; | ||
if (status.done === chunks) { | ||
status.currentChunk += 1; | ||
if (status.currentChunk >= chunks) { | ||
resolve(); | ||
} else { | ||
const start = status.currentChunk * maxWriteSize; | ||
// The last chunk might not be the max write size | ||
const writeSize = status.currentChunk === (chunks - 1) ? (dataBlob.size - fileWriter.length) : maxWriteSize; | ||
fileWriter.seek(fileWriter.length); | ||
fileWriter.write(dataBlob.slice(status.done * offset, (status.done * offset) + offset)); | ||
fileWriter.write(dataBlob.slice(start, start + writeSize)); | ||
} | ||
@@ -736,3 +734,4 @@ }; | ||
fileWriter.write(dataBlob.slice(0, offset)); | ||
const writeSize = chunks === 1 ? dataBlob.size : maxWriteSize; | ||
fileWriter.write(dataBlob.slice(0, writeSize)); | ||
}); | ||
@@ -739,0 +738,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
436062