@capgo/capacitor-updater 4.0.0-alpha.29 → 4.0.0-alpha.32
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 +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +11 -4
- package/ios/Plugin/CapacitorUpdater.swift +1 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ public class CapacitorUpdater {
|
|
|
46
46
|
private static final String bundleDirectory = "versions";
|
|
47
47
|
|
|
48
48
|
public static final String TAG = "Capacitor-updater";
|
|
49
|
-
public static final String pluginVersion = "4.0.0-alpha.
|
|
49
|
+
public static final String pluginVersion = "4.0.0-alpha.32";
|
|
50
50
|
|
|
51
51
|
public SharedPreferences.Editor editor;
|
|
52
52
|
public SharedPreferences prefs;
|
|
@@ -180,9 +180,14 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
180
180
|
public void download(final PluginCall call) {
|
|
181
181
|
final String url = call.getString("url");
|
|
182
182
|
final String version = call.getString("version");
|
|
183
|
-
if (url == null
|
|
184
|
-
Log.e(CapacitorUpdater.TAG, "
|
|
185
|
-
call.reject("
|
|
183
|
+
if (url == null) {
|
|
184
|
+
Log.e(CapacitorUpdater.TAG, "Download called without url");
|
|
185
|
+
call.reject("Download called without url");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (version == null) {
|
|
189
|
+
Log.e(CapacitorUpdater.TAG, "Download called without version");
|
|
190
|
+
call.reject("Download called without version");
|
|
186
191
|
return;
|
|
187
192
|
}
|
|
188
193
|
try {
|
|
@@ -561,7 +566,9 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
561
566
|
|
|
562
567
|
final String url = (String) res.get("url");
|
|
563
568
|
final BundleInfo next = CapacitorUpdaterPlugin.this.implementation.download(url, latestVersionName);
|
|
564
|
-
|
|
569
|
+
final JSObject ret = new JSObject();
|
|
570
|
+
ret.put("bundle", next.toJSON());
|
|
571
|
+
this.notifyListeners("updateAvailable", ret);
|
|
565
572
|
CapacitorUpdaterPlugin.this.implementation.setNextBundle(next.getId());
|
|
566
573
|
} catch (final Exception e) {
|
|
567
574
|
Log.e(CapacitorUpdater.TAG, "error downloading file", e);
|
|
@@ -148,7 +148,7 @@ extension CustomError: LocalizedError {
|
|
|
148
148
|
|
|
149
149
|
public let TAG = "✨ Capacitor-updater:";
|
|
150
150
|
public let CAP_SERVER_PATH = "serverBasePath"
|
|
151
|
-
public let pluginVersion = "4.0.0-alpha.
|
|
151
|
+
public let pluginVersion = "4.0.0-alpha.32"
|
|
152
152
|
public var statsUrl = ""
|
|
153
153
|
public var appId = ""
|
|
154
154
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
@@ -380,7 +380,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
380
380
|
do {
|
|
381
381
|
print("\(self.implementation.TAG) New bundle: \(latestVersionName!) found. Current is: \(current.getVersionName()). Update will occur next time app moves to background.")
|
|
382
382
|
let next = try self.implementation.download(url: downloadUrl, version: latestVersionName!)
|
|
383
|
-
|
|
383
|
+
self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
|
|
384
384
|
let _ = self.implementation.setNextBundle(next: next.getId())
|
|
385
385
|
} catch {
|
|
386
386
|
print("\(self.implementation.TAG) Error downloading file", error.localizedDescription)
|