@capgo/capacitor-updater 7.28.0 → 7.29.0

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 = "7.28.0";
74
+ private final String pluginVersion = "7.29.0";
75
75
  private static final String DELAY_CONDITION_PREFERENCES = "";
76
76
 
77
77
  private SharedPreferences.Editor editor;
@@ -1235,18 +1235,32 @@ public class CapgoUpdater {
1235
1235
  return;
1236
1236
  }
1237
1237
 
1238
- // Auto-detect values
1239
- String appId = this.appId;
1240
- String platform = "android";
1241
- boolean isEmulator = this.isEmulator();
1242
- boolean isProd = this.isProd();
1238
+ JSONObject json;
1239
+ try {
1240
+ json = this.createInfoObject();
1241
+ } catch (JSONException e) {
1242
+ logger.error("Error creating info object: " + e.getMessage());
1243
+ final Map<String, Object> retError = new HashMap<>();
1244
+ retError.put("message", "Cannot get info: " + e);
1245
+ retError.put("error", "json_error");
1246
+ callback.callback(retError);
1247
+ return;
1248
+ }
1243
1249
 
1244
- // Build URL with query parameters
1250
+ // Build URL with query parameters from JSON
1245
1251
  HttpUrl.Builder urlBuilder = HttpUrl.parse(channelUrl).newBuilder();
1246
- urlBuilder.addQueryParameter("app_id", appId);
1247
- urlBuilder.addQueryParameter("platform", platform);
1248
- urlBuilder.addQueryParameter("is_emulator", String.valueOf(isEmulator));
1249
- urlBuilder.addQueryParameter("is_prod", String.valueOf(isProd));
1252
+ try {
1253
+ Iterator<String> keys = json.keys();
1254
+ while (keys.hasNext()) {
1255
+ String key = keys.next();
1256
+ Object value = json.get(key);
1257
+ if (value != null) {
1258
+ urlBuilder.addQueryParameter(key, value.toString());
1259
+ }
1260
+ }
1261
+ } catch (JSONException e) {
1262
+ logger.error("Error adding query parameters: " + e.getMessage());
1263
+ }
1250
1264
 
1251
1265
  Request request = new Request.Builder().url(urlBuilder.build()).get().build();
1252
1266
 
@@ -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 = "7.28.0"
57
+ private let pluginVersion: String = "7.29.0"
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"
@@ -1278,20 +1278,28 @@ import UIKit
1278
1278
 
1279
1279
  let semaphore: DispatchSemaphore = DispatchSemaphore(value: 0)
1280
1280
 
1281
- // Auto-detect values
1282
- let appId = self.appId
1283
- let platform = "ios"
1284
- let isEmulator = self.isEmulator()
1285
- let isProd = self.isProd()
1281
+ // Create info object and convert to query parameters
1282
+ let infoObject = self.createInfoObject()
1286
1283
 
1287
- // Create query parameters
1284
+ // Create query parameters from InfoObject
1288
1285
  var urlComponents = URLComponents(string: self.channelUrl)
1289
- urlComponents?.queryItems = [
1290
- URLQueryItem(name: "app_id", value: appId),
1291
- URLQueryItem(name: "platform", value: platform),
1292
- URLQueryItem(name: "is_emulator", value: String(isEmulator)),
1293
- URLQueryItem(name: "is_prod", value: String(isProd))
1294
- ]
1286
+ var queryItems: [URLQueryItem] = []
1287
+
1288
+ // Convert InfoObject to dictionary using Mirror
1289
+ let mirror = Mirror(reflecting: infoObject)
1290
+ for child in mirror.children {
1291
+ if let key = child.label, let value = child.value as? CustomStringConvertible {
1292
+ queryItems.append(URLQueryItem(name: key, value: String(describing: value)))
1293
+ } else if let key = child.label {
1294
+ // Handle optional values
1295
+ let mirror = Mirror(reflecting: child.value)
1296
+ if let value = mirror.children.first?.value {
1297
+ queryItems.append(URLQueryItem(name: key, value: String(describing: value)))
1298
+ }
1299
+ }
1300
+ }
1301
+
1302
+ urlComponents?.queryItems = queryItems
1295
1303
 
1296
1304
  guard let url = urlComponents?.url else {
1297
1305
  logger.error("Invalid channel URL")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "7.28.0",
3
+ "version": "7.29.0",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",