@capgo/capacitor-updater 4.0.0-alpha.22 → 4.0.0-alpha.25
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 +5 -12
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +3 -2
- package/ios/Plugin/CapacitorUpdater.swift +6 -14
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +3 -2
- 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.25";
|
|
50
50
|
|
|
51
51
|
public SharedPreferences.Editor editor;
|
|
52
52
|
public SharedPreferences prefs;
|
|
@@ -502,15 +502,12 @@ public class CapacitorUpdater {
|
|
|
502
502
|
? BundleInfo.ID_BUILTIN
|
|
503
503
|
: fallback.getId()
|
|
504
504
|
);
|
|
505
|
+
this.editor.commit();
|
|
505
506
|
}
|
|
506
507
|
|
|
507
508
|
public BundleInfo getNextBundle() {
|
|
508
|
-
final String id = this.prefs.getString(NEXT_VERSION,
|
|
509
|
-
|
|
510
|
-
return this.getBundleInfo(id);
|
|
511
|
-
} else {
|
|
512
|
-
return null;
|
|
513
|
-
}
|
|
509
|
+
final String id = this.prefs.getString(NEXT_VERSION, BundleInfo.ID_BUILTIN);
|
|
510
|
+
return this.getBundleInfo(id);
|
|
514
511
|
}
|
|
515
512
|
|
|
516
513
|
public boolean setNextBundle(final String next) {
|
|
@@ -518,11 +515,7 @@ public class CapacitorUpdater {
|
|
|
518
515
|
this.editor.remove(NEXT_VERSION);
|
|
519
516
|
} else {
|
|
520
517
|
final BundleInfo newBundle = this.getBundleInfo(next);
|
|
521
|
-
if(newBundle.isBuiltin()) {
|
|
522
|
-
this.reset();
|
|
523
|
-
return true;
|
|
524
|
-
}
|
|
525
|
-
if (!this.bundleExists(next)) {
|
|
518
|
+
if (!newBundle.isBuiltin() && !this.bundleExists(next)) {
|
|
526
519
|
return false;
|
|
527
520
|
}
|
|
528
521
|
this.editor.putString(NEXT_VERSION, next);
|
|
@@ -35,8 +35,8 @@ import java.util.List;
|
|
|
35
35
|
|
|
36
36
|
@CapacitorPlugin(name = "CapacitorUpdater")
|
|
37
37
|
public class CapacitorUpdaterPlugin extends Plugin implements Application.ActivityLifecycleCallbacks {
|
|
38
|
-
private static final String updateUrlDefault = "https://
|
|
39
|
-
private static final String statsUrlDefault = "https://
|
|
38
|
+
private static final String updateUrlDefault = "https://api.capgo.app/updates";
|
|
39
|
+
private static final String statsUrlDefault = "https://api.capgo.app/stats";
|
|
40
40
|
private static final String DELAY_UPDATE = "delayUpdate";
|
|
41
41
|
private static final String DELAY_UPDATE_VAL = "delayUpdateVal";
|
|
42
42
|
|
|
@@ -88,6 +88,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
88
88
|
this.implementation.editor = this.editor;
|
|
89
89
|
this.implementation.versionOs = Build.VERSION.RELEASE;
|
|
90
90
|
this.implementation.deviceID = Settings.Secure.getString(this.getContext().getContentResolver(), Settings.Secure.ANDROID_ID);
|
|
91
|
+
Log.e(CapacitorUpdater.TAG, "init for device", this.implementation.deviceID);
|
|
91
92
|
|
|
92
93
|
this.autoDeleteFailed = this.getConfig().getBoolean("autoDeleteFailed", true);
|
|
93
94
|
this.autoDeletePrevious = this.getConfig().getBoolean("autoDeletePrevious", true);
|
|
@@ -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.25"
|
|
152
152
|
public var statsUrl = ""
|
|
153
153
|
public var appId = ""
|
|
154
154
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
@@ -526,12 +526,8 @@ extension CustomError: LocalizedError {
|
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
public func getNextBundle() -> BundleInfo? {
|
|
529
|
-
let id: String = UserDefaults.standard.string(forKey: self.NEXT_VERSION) ??
|
|
530
|
-
|
|
531
|
-
return self.getBundleInfo(id: id)
|
|
532
|
-
} else {
|
|
533
|
-
return nil
|
|
534
|
-
}
|
|
529
|
+
let id: String = UserDefaults.standard.string(forKey: self.NEXT_VERSION) ?? BundleInfo.ID_BUILTIN
|
|
530
|
+
return self.getBundleInfo(id: id)
|
|
535
531
|
}
|
|
536
532
|
|
|
537
533
|
public func setNextBundle(next: String?) -> Bool {
|
|
@@ -541,17 +537,13 @@ extension CustomError: LocalizedError {
|
|
|
541
537
|
return false
|
|
542
538
|
}
|
|
543
539
|
let newBundle: BundleInfo = self.getBundleInfo(id: nextId)
|
|
544
|
-
if(newBundle.isBuiltin()) {
|
|
545
|
-
self.reset()
|
|
546
|
-
return true
|
|
547
|
-
}
|
|
548
540
|
let bundle: URL = self.getBundleDirectory(id: nextId)
|
|
549
|
-
if (!bundle.exist) {
|
|
541
|
+
if (!newBundle.isBuiltin() && !bundle.exist) {
|
|
550
542
|
return false
|
|
551
543
|
}
|
|
552
|
-
UserDefaults.standard.set(
|
|
544
|
+
UserDefaults.standard.set(nextId, forKey: self.NEXT_VERSION)
|
|
553
545
|
UserDefaults.standard.synchronize()
|
|
554
|
-
self.setBundleStatus(id:
|
|
546
|
+
self.setBundleStatus(id: nextId, status: BundleStatus.PENDING)
|
|
555
547
|
return true
|
|
556
548
|
}
|
|
557
549
|
}
|
|
@@ -9,8 +9,8 @@ import Version
|
|
|
9
9
|
@objc(CapacitorUpdaterPlugin)
|
|
10
10
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
11
11
|
private var implementation = CapacitorUpdater()
|
|
12
|
-
static let updateUrlDefault = "https://
|
|
13
|
-
static let statsUrlDefault = "https://
|
|
12
|
+
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
13
|
+
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
14
14
|
let DELAY_UPDATE = "delayUpdate"
|
|
15
15
|
let DELAY_UPDATE_VAL = "delayUpdateVal"
|
|
16
16
|
private var updateUrl = ""
|
|
@@ -24,6 +24,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
24
24
|
private var autoDeletePrevious = false
|
|
25
25
|
|
|
26
26
|
override public func load() {
|
|
27
|
+
print("\(self.implementation.TAG) init for device \(self.implementation.deviceID)")
|
|
27
28
|
do {
|
|
28
29
|
currentVersionNative = try Version(Bundle.main.buildVersionNumber ?? "0.0.0")
|
|
29
30
|
} catch {
|