@capgo/capacitor-updater 5.7.0 → 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +13 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +3 -0
- package/ios/Plugin/CapacitorUpdater.swift +5 -0
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -298,6 +298,7 @@ public class CapacitorUpdater {
|
|
|
298
298
|
String version = bundle.getString(DownloadService.VERSION);
|
|
299
299
|
String sessionKey = bundle.getString(DownloadService.SESSIONKEY);
|
|
300
300
|
String checksum = bundle.getString(DownloadService.CHECKSUM);
|
|
301
|
+
String error = bundle.getString(DownloadService.ERROR);
|
|
301
302
|
Log.i(
|
|
302
303
|
CapacitorUpdater.TAG,
|
|
303
304
|
"res " +
|
|
@@ -309,7 +310,9 @@ public class CapacitorUpdater {
|
|
|
309
310
|
" " +
|
|
310
311
|
sessionKey +
|
|
311
312
|
" " +
|
|
312
|
-
checksum
|
|
313
|
+
checksum +
|
|
314
|
+
" " +
|
|
315
|
+
error
|
|
313
316
|
);
|
|
314
317
|
if (dest == null) {
|
|
315
318
|
final JSObject ret = new JSObject();
|
|
@@ -317,8 +320,12 @@ public class CapacitorUpdater {
|
|
|
317
320
|
"version",
|
|
318
321
|
CapacitorUpdater.this.getCurrentBundle().getVersionName()
|
|
319
322
|
);
|
|
323
|
+
if ("low_mem_fail".equals(error)) {
|
|
324
|
+
CapacitorUpdater.this.sendStats("low_mem_fail", version);
|
|
325
|
+
}
|
|
326
|
+
ret.put("error", "download_fail");
|
|
327
|
+
CapacitorUpdater.this.sendStats("download_fail", version);
|
|
320
328
|
CapacitorUpdater.this.notifyListeners("downloadFailed", ret);
|
|
321
|
-
CapacitorUpdater.this.sendStats("download_fail");
|
|
322
329
|
return;
|
|
323
330
|
}
|
|
324
331
|
CapacitorUpdater.this.finishDownload(
|
|
@@ -465,6 +472,10 @@ public class CapacitorUpdater {
|
|
|
465
472
|
}
|
|
466
473
|
bytesRead += length;
|
|
467
474
|
}
|
|
475
|
+
} catch (OutOfMemoryError e) {
|
|
476
|
+
Log.e(TAG, "OutOfMemoryError while downloading file", e);
|
|
477
|
+
this.sendStats("low_mem_fail");
|
|
478
|
+
throw new IOException("OutOfMemoryError while downloading file");
|
|
468
479
|
}
|
|
469
480
|
return target;
|
|
470
481
|
}
|
|
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
55
55
|
private static final String channelUrlDefault =
|
|
56
56
|
"https://api.capgo.app/channel_self";
|
|
57
57
|
|
|
58
|
-
private final String PLUGIN_VERSION = "5.7.
|
|
58
|
+
private final String PLUGIN_VERSION = "5.7.1";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -84,6 +84,9 @@ public class DownloadService extends IntentService {
|
|
|
84
84
|
publishResults(dest, id, version, checksum, sessionKey, "");
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
} catch (OutOfMemoryError e) {
|
|
88
|
+
e.printStackTrace();
|
|
89
|
+
publishResults("", id, version, checksum, sessionKey, "low_mem_fail");
|
|
87
90
|
} catch (Exception e) {
|
|
88
91
|
e.printStackTrace();
|
|
89
92
|
publishResults(
|
|
@@ -527,6 +527,11 @@ extension CustomError: LocalizedError {
|
|
|
527
527
|
}
|
|
528
528
|
case let .failure(error):
|
|
529
529
|
print("\(self.TAG) download error", response.value ?? "", error)
|
|
530
|
+
if let afError = error as? AFError,
|
|
531
|
+
case .sessionTaskFailed(let urlError as URLError) = afError,
|
|
532
|
+
urlError.code == .cannotWriteToFile {
|
|
533
|
+
self.sendStats(action: "low_mem_fail", versionName: version)
|
|
534
|
+
}
|
|
530
535
|
mainError = error as NSError
|
|
531
536
|
}
|
|
532
537
|
}
|
|
@@ -15,7 +15,7 @@ import Version
|
|
|
15
15
|
@objc(CapacitorUpdaterPlugin)
|
|
16
16
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
17
17
|
public var implementation = CapacitorUpdater()
|
|
18
|
-
private let PLUGIN_VERSION: String = "5.7.
|
|
18
|
+
private let PLUGIN_VERSION: String = "5.7.1"
|
|
19
19
|
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
20
20
|
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
21
21
|
static let channelUrlDefault = "https://api.capgo.app/channel_self"
|