@capgo/capacitor-updater 8.51.16 → 8.51.17

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.
@@ -146,7 +146,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
146
146
  static final int APPLICATION_EXIT_REASON_USER_REQUESTED = 10;
147
147
  static final int APPLICATION_EXIT_REASON_DEPENDENCY_DIED = 12;
148
148
 
149
- private final String pluginVersion = "8.51.16";
149
+ private final String pluginVersion = "8.51.17";
150
150
  private static final String DELAY_CONDITION_PREFERENCES = "";
151
151
 
152
152
  private SharedPreferences.Editor editor;
@@ -290,6 +290,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
290
290
 
291
291
  // Play Store In-App Updates
292
292
  private AppUpdateManager appUpdateManager;
293
+ private PluginCall pendingAppUpdateCall;
293
294
  private AppUpdateInfo cachedAppUpdateInfo;
294
295
  private static final int APP_UPDATE_REQUEST_CODE = 9001;
295
296
  private InstallStateUpdatedListener installStateUpdatedListener;
@@ -5679,8 +5680,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
5679
5680
  return;
5680
5681
  }
5681
5682
 
5682
- // Save the call for later resolution
5683
- bridge.saveCall(call);
5683
+ if (pendingAppUpdateCall != null) {
5684
+ call.reject("An app update flow is already in progress");
5685
+ return;
5686
+ }
5687
+
5688
+ call.setKeepAlive(true);
5689
+ pendingAppUpdateCall = call;
5684
5690
 
5685
5691
  AppUpdateManager manager = getAppUpdateManager();
5686
5692
  manager.startUpdateFlowForResult(
@@ -5752,8 +5758,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
5752
5758
 
5753
5759
  manager.registerListener(installStateUpdatedListener);
5754
5760
 
5755
- // Save the call for later resolution
5756
- bridge.saveCall(call);
5761
+ if (pendingAppUpdateCall != null) {
5762
+ call.reject("An app update flow is already in progress");
5763
+ return;
5764
+ }
5765
+
5766
+ call.setKeepAlive(true);
5767
+ pendingAppUpdateCall = call;
5757
5768
 
5758
5769
  manager.startUpdateFlowForResult(
5759
5770
  cachedAppUpdateInfo,
@@ -5794,11 +5805,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
5794
5805
  super.handleOnActivityResult(requestCode, resultCode, data);
5795
5806
 
5796
5807
  if (requestCode == APP_UPDATE_REQUEST_CODE) {
5797
- PluginCall savedCall = bridge.getSavedCall("com.getcapacitor.PluginCall");
5808
+ PluginCall savedCall = pendingAppUpdateCall;
5798
5809
  if (savedCall == null) {
5799
- // Try to get any saved call (for backward compatibility)
5800
5810
  return;
5801
5811
  }
5812
+ pendingAppUpdateCall = null;
5802
5813
 
5803
5814
  JSObject result = new JSObject();
5804
5815
  if (resultCode == Activity.RESULT_OK) {
@@ -5808,8 +5819,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
5808
5819
  } else {
5809
5820
  result.put("code", RESULT_FAILED);
5810
5821
  }
5822
+ savedCall.setKeepAlive(false);
5811
5823
  savedCall.resolve(result);
5812
- bridge.releaseCall(savedCall);
5813
5824
  }
5814
5825
  }
5815
5826
 
@@ -96,7 +96,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
96
96
  deinit {
97
97
  implementation.shutdown()
98
98
  }
99
- private let pluginVersion: String = "8.51.16"
99
+ private let pluginVersion: String = "8.51.17"
100
100
  private let launchStartedAtMs = Int64(Date().timeIntervalSince1970 * 1000)
101
101
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
102
102
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
@@ -1194,6 +1194,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1194
1194
  let resolve = {
1195
1195
  let savedCall = self.bridge?.savedCall(withID: call.callbackId)
1196
1196
  let targetCall = savedCall ?? call
1197
+ targetCall.keepAlive = false
1197
1198
 
1198
1199
  if let data {
1199
1200
  targetCall.resolve(data)
@@ -1219,6 +1220,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1219
1220
  let reject = {
1220
1221
  let savedCall = self.bridge?.savedCall(withID: call.callbackId)
1221
1222
  let targetCall = savedCall ?? call
1223
+ targetCall.keepAlive = false
1222
1224
 
1223
1225
  targetCall.reject(message, code, error, data)
1224
1226
 
@@ -1237,7 +1239,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1237
1239
  }
1238
1240
 
1239
1241
  private func saveCallForAsyncHandling(_ call: CAPPluginCall) {
1240
- bridge?.saveCall(call)
1242
+ call.keepAlive = true
1241
1243
  }
1242
1244
 
1243
1245
  private func notifyListenersOnMain(_ eventName: String, data: JSObject) {
@@ -138,17 +138,17 @@ public class Logger {
138
138
  self.tag = tag
139
139
  if let config = config {
140
140
  // The logger plugin's name is LoggerBridge, we want to look at the config
141
- // named "Logger", so we can't use plugin.getConfigValue().
142
- if let configLevel = getConfigValue("level", from: config) as? String,
141
+ // named "Logger", so we can't use the Capacitor plugin config helper.
142
+ if let configLevel = instanceConfigValue("level", from: config) as? String,
143
143
  let logLevel = LogLevel[configLevel] {
144
144
  level = logLevel
145
145
  }
146
146
 
147
- if let configLabels = getConfigValue("labels", from: config) as? [String: String] {
147
+ if let configLabels = instanceConfigValue("labels", from: config) as? [String: String] {
148
148
  labels = configLabels
149
149
  }
150
150
 
151
- if let configSyslog = getConfigValue("useSyslog", from: config) as? Bool {
151
+ if let configSyslog = instanceConfigValue("useSyslog", from: config) as? Bool {
152
152
  useSyslog = configSyslog
153
153
  }
154
154
  }
@@ -160,7 +160,7 @@ public class Logger {
160
160
  }
161
161
  }
162
162
 
163
- private func getConfigValue(_ configKey: String, from config: InstanceConfiguration) -> Any? {
163
+ private func instanceConfigValue(_ configKey: String, from config: InstanceConfiguration) -> Any? {
164
164
  if let config = config.pluginConfigurations as? JSObject {
165
165
  return config[keyPath: KeyPath(stringLiteral: "Logger.\(configKey)")]
166
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "8.51.16",
3
+ "version": "8.51.17",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",
@@ -72,6 +72,7 @@
72
72
  "watch": "tsc --watch",
73
73
  "prepublishOnly": "bun run build",
74
74
  "check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs",
75
+ "check:cap9-deprecated": "bun scripts/check-cap9-deprecated.mjs",
75
76
  "changelog:ai": "node scripts/generate-ai-changelog.mjs",
76
77
  "example:install": "cd example-app && bun install --frozen-lockfile",
77
78
  "example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build",