@capgo/capacitor-updater 4.17.26 → 4.17.30
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.
|
@@ -198,7 +198,7 @@ public class CapacitorUpdater {
|
|
|
198
198
|
);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
final int newPercent = (int) ((lengthRead
|
|
201
|
+
final int newPercent = (int) ((lengthRead / (float) lengthTotal) * 100);
|
|
202
202
|
if (lengthTotal > 1 && newPercent != percent) {
|
|
203
203
|
percent = newPercent;
|
|
204
204
|
this.notifyDownload(id, this.calcTotalPercent(percent, 75, 90));
|
|
@@ -424,7 +424,7 @@ public class CapacitorUpdater {
|
|
|
424
424
|
this.notifyDownload(id, 10);
|
|
425
425
|
while ((length = dis.read(buffer)) > 0) {
|
|
426
426
|
fos.write(buffer, 0, length);
|
|
427
|
-
final int newPercent = (int) ((bytesRead
|
|
427
|
+
final int newPercent = (int) ((bytesRead / (float) totalLength) * 100);
|
|
428
428
|
if (totalLength > 1 && newPercent != percent) {
|
|
429
429
|
percent = newPercent;
|
|
430
430
|
this.notifyDownload(id, this.calcTotalPercent(percent, 10, 70));
|
|
@@ -47,7 +47,7 @@ public class CapacitorUpdaterPlugin
|
|
|
47
47
|
private static final String channelUrlDefault =
|
|
48
48
|
"https://api.capgo.app/channel_self";
|
|
49
49
|
|
|
50
|
-
private final String PLUGIN_VERSION = "4.17.
|
|
50
|
+
private final String PLUGIN_VERSION = "4.17.30";
|
|
51
51
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
52
52
|
|
|
53
53
|
private SharedPreferences.Editor editor;
|
|
@@ -9,7 +9,7 @@ import Version
|
|
|
9
9
|
@objc(CapacitorUpdaterPlugin)
|
|
10
10
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
11
11
|
private var implementation = CapacitorUpdater()
|
|
12
|
-
private let PLUGIN_VERSION: String = "4.17.
|
|
12
|
+
private let PLUGIN_VERSION: String = "4.17.30"
|
|
13
13
|
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
14
14
|
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
15
15
|
static let channelUrlDefault = "https://api.capgo.app/channel_self"
|
|
@@ -270,31 +270,34 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
270
270
|
@objc func _reset(toLastSuccessful: Bool) -> Bool {
|
|
271
271
|
guard let bridge = self.bridge else { return false }
|
|
272
272
|
|
|
273
|
-
if
|
|
273
|
+
if (bridge.viewController as? CAPBridgeViewController) != nil {
|
|
274
274
|
let fallback: BundleInfo = self.implementation.getFallbackBundle()
|
|
275
|
+
|
|
276
|
+
// If developer wants to reset to the last successful bundle, and that bundle is not
|
|
277
|
+
// the built-in bundle, set it as the bundle to use and reload.
|
|
275
278
|
if toLastSuccessful && !fallback.isBuiltin() {
|
|
276
279
|
print("\(self.implementation.TAG) Resetting to: \(fallback.toString())")
|
|
277
280
|
return self.implementation.set(bundle: fallback) && self._reload()
|
|
278
281
|
}
|
|
282
|
+
|
|
283
|
+
print("\(self.implementation.TAG) Resetting to builtin version")
|
|
284
|
+
|
|
285
|
+
// Otherwise, reset back to the built-in bundle and reload.
|
|
279
286
|
self.implementation.reset()
|
|
280
|
-
|
|
281
|
-
DispatchQueue.main.async {
|
|
282
|
-
vc.loadView()
|
|
283
|
-
vc.viewDidLoad()
|
|
284
|
-
print("\(self.implementation.TAG) Reset to builtin version")
|
|
285
|
-
}
|
|
286
|
-
return true
|
|
287
|
+
return self._reload()
|
|
287
288
|
}
|
|
289
|
+
|
|
288
290
|
return false
|
|
289
291
|
}
|
|
290
292
|
|
|
291
293
|
@objc func reset(_ call: CAPPluginCall) {
|
|
292
294
|
let toLastSuccessful = call.getBool("toLastSuccessful") ?? false
|
|
293
295
|
if self._reset(toLastSuccessful: toLastSuccessful) {
|
|
294
|
-
|
|
296
|
+
call.resolve()
|
|
297
|
+
} else {
|
|
298
|
+
print("\(self.implementation.TAG) Reset failed")
|
|
299
|
+
call.reject("\(self.implementation.TAG) Reset failed")
|
|
295
300
|
}
|
|
296
|
-
print("\(self.implementation.TAG) Reset failed")
|
|
297
|
-
call.reject("\(self.implementation.TAG) Reset failed")
|
|
298
301
|
}
|
|
299
302
|
|
|
300
303
|
@objc func current(_ call: CAPPluginCall) {
|