@capgo/capacitor-updater 7.7.9 → 7.8.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.
|
@@ -60,7 +60,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
60
60
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
61
61
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
62
62
|
|
|
63
|
-
private final String PLUGIN_VERSION = "7.
|
|
63
|
+
private final String PLUGIN_VERSION = "7.8.1";
|
|
64
64
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
65
65
|
|
|
66
66
|
private SharedPreferences.Editor editor;
|
|
@@ -324,6 +324,30 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
private void showSplashscreen() {
|
|
328
|
+
try {
|
|
329
|
+
// Use JavaScript evaluation to show the splashscreen - simpler and more reliable
|
|
330
|
+
getBridge()
|
|
331
|
+
.getWebView()
|
|
332
|
+
.post(() -> {
|
|
333
|
+
getBridge()
|
|
334
|
+
.eval(
|
|
335
|
+
"""
|
|
336
|
+
(function() {
|
|
337
|
+
if (window.Capacitor && window.Capacitor.Plugins && window.Capacitor.Plugins.SplashScreen) {
|
|
338
|
+
window.Capacitor.Plugins.SplashScreen.show();
|
|
339
|
+
}
|
|
340
|
+
})()
|
|
341
|
+
""",
|
|
342
|
+
null
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
logger.info("Splashscreen shown automatically via JavaScript");
|
|
346
|
+
} catch (Exception e) {
|
|
347
|
+
logger.error("Error showing splashscreen: " + e.getMessage());
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
327
351
|
private boolean checkIfRecentlyInstalledOrUpdated() {
|
|
328
352
|
String currentVersion = this.currentVersionNative.getOriginalString();
|
|
329
353
|
String lastKnownVersion = this.prefs.getString("LatestVersionNative", "");
|
|
@@ -1148,6 +1172,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1148
1172
|
|
|
1149
1173
|
private Thread backgroundDownload() {
|
|
1150
1174
|
boolean shouldDirectUpdate = this.shouldUseDirectUpdate();
|
|
1175
|
+
this.implementation.directUpdate = shouldDirectUpdate;
|
|
1151
1176
|
String messageUpdate = shouldDirectUpdate ? "Update will occur now." : "Update will occur next time app moves to background.";
|
|
1152
1177
|
return startNewThread(() -> {
|
|
1153
1178
|
logger.info("Check for update via: " + CapacitorUpdaterPlugin.this.updateUrl);
|
|
@@ -1443,6 +1468,12 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1443
1468
|
final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
1444
1469
|
CapacitorUpdaterPlugin.this.implementation.sendStats("app_moved_to_background", current.getVersionName());
|
|
1445
1470
|
logger.info("Checking for pending update");
|
|
1471
|
+
|
|
1472
|
+
// Show splashscreen if autoSplashscreen is enabled
|
|
1473
|
+
if (this.autoSplashscreen) {
|
|
1474
|
+
this.showSplashscreen();
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1446
1477
|
try {
|
|
1447
1478
|
// We need to set "backgrounded time"
|
|
1448
1479
|
this.delayUpdateUtils.setBackgroundTimestamp(System.currentTimeMillis());
|
|
@@ -50,7 +50,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
50
50
|
CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
|
|
51
51
|
]
|
|
52
52
|
public var implementation = CapgoUpdater()
|
|
53
|
-
private let PLUGIN_VERSION: String = "7.
|
|
53
|
+
private let PLUGIN_VERSION: String = "7.8.1"
|
|
54
54
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
55
55
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
56
56
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
@@ -809,6 +809,36 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
+
private func showSplashscreen() {
|
|
813
|
+
DispatchQueue.main.async {
|
|
814
|
+
guard let bridge = self.bridge else {
|
|
815
|
+
self.logger.warn("Bridge not available for showing splashscreen")
|
|
816
|
+
return
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// Create a plugin call for the show method
|
|
820
|
+
let call = CAPPluginCall(callbackId: "autoShowSplashscreen", options: [:], success: { (_, _) in
|
|
821
|
+
self.logger.info("Splashscreen shown automatically")
|
|
822
|
+
}, error: { (_) in
|
|
823
|
+
self.logger.error("Failed to auto-show splashscreen")
|
|
824
|
+
})
|
|
825
|
+
|
|
826
|
+
// Try to call the SplashScreen show method directly through the bridge
|
|
827
|
+
if let splashScreenPlugin = bridge.plugin(withName: "SplashScreen") {
|
|
828
|
+
// Use runtime method invocation to call show method
|
|
829
|
+
let selector = NSSelectorFromString("show:")
|
|
830
|
+
if splashScreenPlugin.responds(to: selector) {
|
|
831
|
+
_ = splashScreenPlugin.perform(selector, with: call)
|
|
832
|
+
self.logger.info("Called SplashScreen show method")
|
|
833
|
+
} else {
|
|
834
|
+
self.logger.warn("SplashScreen plugin does not respond to show: method")
|
|
835
|
+
}
|
|
836
|
+
} else {
|
|
837
|
+
self.logger.warn("SplashScreen plugin not found")
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
|
|
812
842
|
private func checkIfRecentlyInstalledOrUpdated() -> Bool {
|
|
813
843
|
let userDefaults = UserDefaults.standard
|
|
814
844
|
let currentVersion = self.currentVersionNative.description
|
|
@@ -1068,6 +1098,11 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1068
1098
|
self.implementation.sendStats(action: "app_moved_to_background", versionName: current.getVersionName())
|
|
1069
1099
|
logger.info("Check for pending update")
|
|
1070
1100
|
|
|
1101
|
+
// Show splashscreen if autoSplashscreen is enabled
|
|
1102
|
+
if self.autoSplashscreen {
|
|
1103
|
+
self.showSplashscreen()
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1071
1106
|
// Set background timestamp
|
|
1072
1107
|
let backgroundTimestamp = Int64(Date().timeIntervalSince1970 * 1000) // Convert to milliseconds
|
|
1073
1108
|
self.delayUpdateUtils.setBackgroundTimestamp(backgroundTimestamp)
|