@capgo/capacitor-updater 6.27.10 → 6.27.11

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.
@@ -71,7 +71,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
71
71
  private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
72
72
  private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
73
73
 
74
- private final String pluginVersion = "6.27.10";
74
+ private final String pluginVersion = "6.27.11";
75
75
  private static final String DELAY_CONDITION_PREFERENCES = "";
76
76
 
77
77
  private SharedPreferences.Editor editor;
@@ -1242,18 +1242,32 @@ public class CapgoUpdater {
1242
1242
  return;
1243
1243
  }
1244
1244
 
1245
- // Auto-detect values
1246
- String appId = this.appId;
1247
- String platform = "android";
1248
- boolean isEmulator = this.isEmulator();
1249
- boolean isProd = this.isProd();
1245
+ JSONObject json;
1246
+ try {
1247
+ json = this.createInfoObject();
1248
+ } catch (JSONException e) {
1249
+ logger.error("Error creating info object: " + e.getMessage());
1250
+ final Map<String, Object> retError = new HashMap<>();
1251
+ retError.put("message", "Cannot get info: " + e);
1252
+ retError.put("error", "json_error");
1253
+ callback.callback(retError);
1254
+ return;
1255
+ }
1250
1256
 
1251
- // Build URL with query parameters
1257
+ // Build URL with query parameters from JSON
1252
1258
  HttpUrl.Builder urlBuilder = HttpUrl.parse(channelUrl).newBuilder();
1253
- urlBuilder.addQueryParameter("app_id", appId);
1254
- urlBuilder.addQueryParameter("platform", platform);
1255
- urlBuilder.addQueryParameter("is_emulator", String.valueOf(isEmulator));
1256
- urlBuilder.addQueryParameter("is_prod", String.valueOf(isProd));
1259
+ try {
1260
+ Iterator<String> keys = json.keys();
1261
+ while (keys.hasNext()) {
1262
+ String key = keys.next();
1263
+ Object value = json.get(key);
1264
+ if (value != null) {
1265
+ urlBuilder.addQueryParameter(key, value.toString());
1266
+ }
1267
+ }
1268
+ } catch (JSONException e) {
1269
+ logger.error("Error adding query parameters: " + e.getMessage());
1270
+ }
1257
1271
 
1258
1272
  Request request = new Request.Builder().url(urlBuilder.build()).get().build();
1259
1273
 
@@ -54,7 +54,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
54
54
  CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
55
55
  ]
56
56
  public var implementation = CapgoUpdater()
57
- private let pluginVersion: String = "6.27.10"
57
+ private let pluginVersion: String = "6.27.11"
58
58
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
59
59
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
60
60
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
@@ -1301,20 +1301,28 @@ import UIKit
1301
1301
 
1302
1302
  let semaphore: DispatchSemaphore = DispatchSemaphore(value: 0)
1303
1303
 
1304
- // Auto-detect values
1305
- let appId = self.appId
1306
- let platform = "ios"
1307
- let isEmulator = self.isEmulator()
1308
- let isProd = self.isProd()
1304
+ // Create info object and convert to query parameters
1305
+ let infoObject = self.createInfoObject()
1309
1306
 
1310
- // Create query parameters
1307
+ // Create query parameters from InfoObject
1311
1308
  var urlComponents = URLComponents(string: self.channelUrl)
1312
- urlComponents?.queryItems = [
1313
- URLQueryItem(name: "app_id", value: appId),
1314
- URLQueryItem(name: "platform", value: platform),
1315
- URLQueryItem(name: "is_emulator", value: String(isEmulator)),
1316
- URLQueryItem(name: "is_prod", value: String(isProd))
1317
- ]
1309
+ var queryItems: [URLQueryItem] = []
1310
+
1311
+ // Convert InfoObject to dictionary using Mirror
1312
+ let mirror = Mirror(reflecting: infoObject)
1313
+ for child in mirror.children {
1314
+ if let key = child.label, let value = child.value as? CustomStringConvertible {
1315
+ queryItems.append(URLQueryItem(name: key, value: String(describing: value)))
1316
+ } else if let key = child.label {
1317
+ // Handle optional values
1318
+ let mirror = Mirror(reflecting: child.value)
1319
+ if let value = mirror.children.first?.value {
1320
+ queryItems.append(URLQueryItem(name: key, value: String(describing: value)))
1321
+ }
1322
+ }
1323
+ }
1324
+
1325
+ urlComponents?.queryItems = queryItems
1318
1326
 
1319
1327
  guard let url = urlComponents?.url else {
1320
1328
  logger.error("Invalid channel URL")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "6.27.10",
3
+ "version": "6.27.11",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",