@capgo/capacitor-updater 6.51.16 → 6.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 = "6.51.16";
149
+ private final String pluginVersion = "6.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;
@@ -5681,8 +5682,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
5681
5682
  return;
5682
5683
  }
5683
5684
 
5684
- // Save the call for later resolution
5685
- bridge.saveCall(call);
5685
+ if (pendingAppUpdateCall != null) {
5686
+ call.reject("An app update flow is already in progress");
5687
+ return;
5688
+ }
5689
+
5690
+ call.setKeepAlive(true);
5691
+ pendingAppUpdateCall = call;
5686
5692
 
5687
5693
  AppUpdateManager manager = getAppUpdateManager();
5688
5694
  manager.startUpdateFlowForResult(
@@ -5754,8 +5760,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
5754
5760
 
5755
5761
  manager.registerListener(installStateUpdatedListener);
5756
5762
 
5757
- // Save the call for later resolution
5758
- bridge.saveCall(call);
5763
+ if (pendingAppUpdateCall != null) {
5764
+ call.reject("An app update flow is already in progress");
5765
+ return;
5766
+ }
5767
+
5768
+ call.setKeepAlive(true);
5769
+ pendingAppUpdateCall = call;
5759
5770
 
5760
5771
  manager.startUpdateFlowForResult(
5761
5772
  cachedAppUpdateInfo,
@@ -5796,11 +5807,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
5796
5807
  super.handleOnActivityResult(requestCode, resultCode, data);
5797
5808
 
5798
5809
  if (requestCode == APP_UPDATE_REQUEST_CODE) {
5799
- PluginCall savedCall = bridge.getSavedCall("com.getcapacitor.PluginCall");
5810
+ PluginCall savedCall = pendingAppUpdateCall;
5800
5811
  if (savedCall == null) {
5801
- // Try to get any saved call (for backward compatibility)
5802
5812
  return;
5803
5813
  }
5814
+ pendingAppUpdateCall = null;
5804
5815
 
5805
5816
  JSObject result = new JSObject();
5806
5817
  if (resultCode == Activity.RESULT_OK) {
@@ -5810,8 +5821,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
5810
5821
  } else {
5811
5822
  result.put("code", RESULT_FAILED);
5812
5823
  }
5824
+ savedCall.setKeepAlive(false);
5813
5825
  savedCall.resolve(result);
5814
- bridge.releaseCall(savedCall);
5815
5826
  }
5816
5827
  }
5817
5828
 
@@ -96,7 +96,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
96
96
  deinit {
97
97
  implementation.shutdown()
98
98
  }
99
- private let pluginVersion: String = "6.51.16"
99
+ private let pluginVersion: String = "6.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": "6.51.16",
3
+ "version": "6.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",