@capgo/capacitor-updater 7.19.1 → 7.19.2

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.
@@ -65,7 +65,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
65
65
  private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
66
66
  private static final String CUSTOM_ID_PREF_KEY = "CapacitorUpdater.customId";
67
67
 
68
- private final String PLUGIN_VERSION = "7.19.1";
68
+ private final String PLUGIN_VERSION = "7.19.2";
69
69
  private static final String DELAY_CONDITION_PREFERENCES = "";
70
70
 
71
71
  private SharedPreferences.Editor editor;
@@ -185,13 +185,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
185
185
  }
186
186
  this.currentVersionNative = new Version(this.getConfig().getString("version", pInfo.versionName));
187
187
  this.currentBuildVersion = Integer.toString(pInfo.versionCode);
188
- this.delayUpdateUtils = new DelayUpdateUtils(
189
- this.prefs,
190
- this.editor,
191
- this.currentVersionNative,
192
- CapacitorUpdaterPlugin.this::installNext,
193
- logger
194
- );
188
+ this.delayUpdateUtils = new DelayUpdateUtils(this.prefs, this.editor, this.currentVersionNative, logger);
195
189
  } catch (final PackageManager.NameNotFoundException e) {
196
190
  logger.error("Error instantiating implementation " + e.getMessage());
197
191
  return;
@@ -19,19 +19,11 @@ public class DelayUpdateUtils {
19
19
  private final SharedPreferences prefs;
20
20
  private final SharedPreferences.Editor editor;
21
21
  private final Version currentVersionNative;
22
- private final Runnable installNext;
23
22
 
24
- public DelayUpdateUtils(
25
- SharedPreferences prefs,
26
- SharedPreferences.Editor editor,
27
- Version currentVersionNative,
28
- Runnable installNext,
29
- Logger logger
30
- ) {
23
+ public DelayUpdateUtils(SharedPreferences prefs, SharedPreferences.Editor editor, Version currentVersionNative, Logger logger) {
31
24
  this.prefs = prefs;
32
25
  this.editor = editor;
33
26
  this.currentVersionNative = currentVersionNative;
34
- this.installNext = installNext;
35
27
  this.logger = logger;
36
28
  }
37
29
 
@@ -96,7 +88,7 @@ public class DelayUpdateUtils {
96
88
  break;
97
89
  case DelayUntilNext.kill:
98
90
  if (source == CancelDelaySource.KILLED) {
99
- this.installNext.run();
91
+ logger.info("Kill delay (value: " + value + ") condition removed at index " + index + " after app kill");
100
92
  } else {
101
93
  delayConditionListToKeep.add(condition);
102
94
  logger.info(
@@ -160,7 +152,9 @@ public class DelayUpdateUtils {
160
152
  index++;
161
153
  }
162
154
 
163
- if (!delayConditionListToKeep.isEmpty()) {
155
+ if (delayConditionListToKeep.isEmpty()) {
156
+ this.cancelDelay("checkCancelDelay");
157
+ } else {
164
158
  this.setMultiDelay(convertDelayConditionsToJson(delayConditionListToKeep));
165
159
  }
166
160
  }
@@ -51,7 +51,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
51
51
  CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
52
52
  ]
53
53
  public var implementation = CapgoUpdater()
54
- private let PLUGIN_VERSION: String = "7.19.1"
54
+ private let PLUGIN_VERSION: String = "7.19.2"
55
55
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
56
56
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
57
57
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
@@ -173,9 +173,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
173
173
  CryptoCipher.setLogger(logger)
174
174
 
175
175
  // Initialize DelayUpdateUtils
176
- self.delayUpdateUtils = DelayUpdateUtils(currentVersionNative: currentVersionNative, installNext: { [weak self] in
177
- self?.installNext()
178
- }, logger: logger)
176
+ self.delayUpdateUtils = DelayUpdateUtils(currentVersionNative: currentVersionNative, logger: logger)
179
177
  let config = (self.bridge?.viewController as? CAPBridgeViewController)?.instanceDescriptor().legacyConfig
180
178
  implementation.appId = Bundle.main.infoDictionary?["CFBundleIdentifier"] as? String ?? ""
181
179
  implementation.appId = config?["appId"] as? String ?? implementation.appId
@@ -318,6 +316,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
318
316
  return
319
317
  }
320
318
  self.statsUrl = url
319
+ self.implementation.statsUrl = url
321
320
  call.resolve()
322
321
  }
323
322
 
@@ -22,7 +22,6 @@ public class DelayUpdateUtils {
22
22
  private let logger: Logger
23
23
 
24
24
  private let currentVersionNative: Version
25
- private let installNext: () -> Void
26
25
 
27
26
  public enum CancelDelaySource {
28
27
  case killed
@@ -38,9 +37,8 @@ public class DelayUpdateUtils {
38
37
  }
39
38
  }
40
39
 
41
- public init(currentVersionNative: Version, installNext: @escaping () -> Void, logger: Logger) {
40
+ public init(currentVersionNative: Version, logger: Logger) {
42
41
  self.currentVersionNative = currentVersionNative
43
- self.installNext = installNext
44
42
  self.logger = logger
45
43
  }
46
44
 
@@ -84,7 +82,7 @@ public class DelayUpdateUtils {
84
82
 
85
83
  case "kill":
86
84
  if source == .killed {
87
- self.installNext()
85
+ logger.info("Kill delay (value: \(value ?? "")) condition removed at index \(index) after app kill")
88
86
  } else {
89
87
  delayConditionListToKeep.append(condition)
90
88
  logger.info("Kill delay (value: \(value ?? "")) condition kept at index \(index) (source: \(source.description))")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "7.19.1",
3
+ "version": "7.19.2",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",