@capgo/capacitor-updater 8.42.5 → 8.42.6

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.
package/Package.swift CHANGED
@@ -10,7 +10,7 @@ let package = Package(
10
10
  targets: ["CapacitorUpdaterPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.1"),
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
14
  .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.11.0")),
15
15
  .package(url: "https://github.com/weichsel/ZIPFoundation.git", from: "0.9.20"),
16
16
  .package(url: "https://github.com/mrackwitz/Version.git", exact: "0.8.0"),
@@ -84,7 +84,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
84
84
  private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
85
85
  private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
86
86
 
87
- private final String pluginVersion = "8.42.5";
87
+ private final String pluginVersion = "8.42.6";
88
88
  private static final String DELAY_CONDITION_PREFERENCES = "";
89
89
 
90
90
  private SharedPreferences.Editor editor;
@@ -1243,6 +1243,13 @@ public class CapgoUpdater {
1243
1243
  makeJsonRequest(channelUrl, json, (res) -> {
1244
1244
  if (res.containsKey("error")) {
1245
1245
  callback.callback(res);
1246
+ } else if (Boolean.TRUE.equals(res.get("unset"))) {
1247
+ // Server requested to unset channel (public channel was requested)
1248
+ // Clear persisted defaultChannel and revert to config value
1249
+ editor.remove(defaultChannelKey);
1250
+ editor.apply();
1251
+ logger.info("Public channel requested, channel override removed");
1252
+ callback.callback(res);
1246
1253
  } else {
1247
1254
  // Success - persist defaultChannel
1248
1255
  this.defaultChannel = channel;
@@ -71,7 +71,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
71
71
  CAPPluginMethod(name: "completeFlexibleUpdate", returnType: CAPPluginReturnPromise)
72
72
  ]
73
73
  public var implementation = CapgoUpdater()
74
- private let pluginVersion: String = "8.42.5"
74
+ private let pluginVersion: String = "8.42.6"
75
75
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
76
76
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
77
77
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
@@ -1549,6 +1549,15 @@ import UIKit
1549
1549
  if let responseValue = response.value {
1550
1550
  if let error = responseValue.error {
1551
1551
  setChannel.error = error
1552
+ } else if responseValue.unset == true {
1553
+ // Server requested to unset channel (public channel was requested)
1554
+ // Clear persisted defaultChannel and revert to config value
1555
+ UserDefaults.standard.removeObject(forKey: defaultChannelKey)
1556
+ UserDefaults.standard.synchronize()
1557
+ self.logger.info("Public channel requested, channel override removed")
1558
+
1559
+ setChannel.status = responseValue.status ?? "ok"
1560
+ setChannel.message = responseValue.message ?? "Public channel requested, channel override removed. Device will use public channel automatically."
1552
1561
  } else {
1553
1562
  // Success - persist defaultChannel
1554
1563
  self.defaultChannel = channel
@@ -23,6 +23,7 @@ struct SetChannelDec: Decodable {
23
23
  let status: String?
24
24
  let error: String?
25
25
  let message: String?
26
+ let unset: Bool?
26
27
  }
27
28
  public class SetChannel: NSObject {
28
29
  var status: String = ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "8.42.5",
3
+ "version": "8.42.6",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",