@capgo/capacitor-updater 5.3.21 → 5.3.23

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.
@@ -82,7 +82,6 @@ public class CapacitorUpdater {
82
82
  public Activity activity;
83
83
  public String PLUGIN_VERSION = "";
84
84
  public String versionBuild = "";
85
- public int periodCheckDelay = 300000;
86
85
  public String versionCode = "";
87
86
  public String versionOs = "";
88
87
 
@@ -56,7 +56,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
56
56
  private static final String channelUrlDefault =
57
57
  "https://api.capgo.app/channel_self";
58
58
 
59
- private final String PLUGIN_VERSION = "5.3.21";
59
+ private final String PLUGIN_VERSION = "5.3.23";
60
60
  private static final String DELAY_CONDITION_PREFERENCES = "";
61
61
 
62
62
  private SharedPreferences.Editor editor;
@@ -65,6 +65,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
65
65
 
66
66
  private Integer appReadyTimeout = 10000;
67
67
  private Integer counterActivityCreate = 0;
68
+ private Integer periodCheckDelay = 0;
68
69
  private Boolean autoDeleteFailed = true;
69
70
  private Boolean autoDeletePrevious = true;
70
71
  private Boolean autoUpdate = false;
@@ -171,10 +172,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
171
172
  this.getConfig().getString("statsUrl", statsUrlDefault);
172
173
  this.implementation.channelUrl =
173
174
  this.getConfig().getString("channelUrl", channelUrlDefault);
174
- int userValue = this.getConfig().getInt("periodCheckDelay", 600);
175
+ int userValue = this.getConfig().getInt("periodCheckDelay", 0);
175
176
 
176
- this.implementation.periodCheckDelay =
177
- (userValue == 0 ? 600 : userValue) * 1000;
177
+ if (userValue >= 0 && userValue <= 600) {
178
+ this.periodCheckDelay = 600 * 1000;
179
+ } else if (userValue > 600) {
180
+ this.periodCheckDelay = userValue * 1000;
181
+ }
178
182
 
179
183
  this.implementation.documentsDir = this.getContext().getFilesDir();
180
184
  this.implementation.prefs = this.prefs;
@@ -763,6 +767,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
763
767
  }
764
768
 
765
769
  public void checkForUpdateAfterDelay() {
770
+ if (this.periodCheckDelay == 0 || !this._isAutoUpdateEnabled()) {
771
+ return;
772
+ }
766
773
  final Timer timer = new Timer();
767
774
  timer.scheduleAtFixedRate(
768
775
  new TimerTask() {
@@ -796,7 +803,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
796
803
  }
797
804
  },
798
805
  0,
799
- CapacitorUpdaterPlugin.this.implementation.periodCheckDelay
806
+ this.periodCheckDelay
800
807
  );
801
808
  }
802
809
 
@@ -15,7 +15,7 @@ import Version
15
15
  @objc(CapacitorUpdaterPlugin)
16
16
  public class CapacitorUpdaterPlugin: CAPPlugin {
17
17
  public var implementation = CapacitorUpdater()
18
- private let PLUGIN_VERSION: String = "5.3.21"
18
+ private let PLUGIN_VERSION: String = "5.3.23"
19
19
  static let updateUrlDefault = "https://api.capgo.app/updates"
20
20
  static let statsUrlDefault = "https://api.capgo.app/stats"
21
21
  static let channelUrlDefault = "https://api.capgo.app/channel_self"
@@ -34,7 +34,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
34
34
  private var autoDeletePrevious = false
35
35
  private var backgroundWork: DispatchWorkItem?
36
36
  private var taskRunning = false
37
- private var periodCheckDelay = 300
37
+ private var periodCheckDelay = 0
38
38
  let semaphoreReady = DispatchSemaphore(value: 0)
39
39
 
40
40
  override public func load() {
@@ -55,8 +55,12 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
55
55
  appReadyTimeout = getConfig().getInt("appReadyTimeout", 10000)
56
56
  implementation.timeout = Double(getConfig().getInt("responseTimeout", 20))
57
57
  resetWhenUpdate = getConfig().getBoolean("resetWhenUpdate", true)
58
- let periodCheckDelayValue = getConfig().getInt("periodCheckDelay", 600)
59
- periodCheckDelay = (periodCheckDelayValue == 0) ? 600 : periodCheckDelayValue
58
+ let periodCheckDelayValue = getConfig().getInt("periodCheckDelay", 0)
59
+ if periodCheckDelayValue >= 0 && periodCheckDelayValue > 600 {
60
+ periodCheckDelay = 600
61
+ } else {
62
+ periodCheckDelay = periodCheckDelayValue
63
+ }
60
64
 
61
65
  implementation.privateKey = getConfig().getString("privateKey", self.defaultPrivateKey)!
62
66
  implementation.notifyDownload = notifyDownload
@@ -727,6 +731,9 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
727
731
  }
728
732
 
729
733
  @objc func checkForUpdateAfterDelay() {
734
+ if periodCheckDelay == 0 || !self._isAutoUpdateEnabled() {
735
+ return
736
+ }
730
737
  let timer = Timer.scheduledTimer(withTimeInterval: TimeInterval(periodCheckDelay), repeats: true) { _ in
731
738
  let url = URL(string: self.updateUrl)!
732
739
  let res = self.implementation.getLatest(url: url)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.3.21",
3
+ "version": "5.3.23",
4
4
  "packageManager": "pnpm@8.9.2",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",
@@ -54,23 +54,23 @@
54
54
  "prepublishOnly": "npm run build"
55
55
  },
56
56
  "devDependencies": {
57
- "@capacitor/android": "^5.0.3",
58
- "@capacitor/cli": "^5.0.3",
59
- "@capacitor/core": "^5.0.3",
57
+ "@capacitor/android": "^5.5.0",
58
+ "@capacitor/cli": "^5.5.0",
59
+ "@capacitor/core": "^5.5.0",
60
60
  "@capacitor/docgen": "^0.2.1",
61
- "@capacitor/ios": "^5.0.3",
61
+ "@capacitor/ios": "^5.5.0",
62
62
  "@ionic/eslint-config": "^0.3.0",
63
63
  "@ionic/prettier-config": "^4.0.0",
64
64
  "@ionic/swiftlint-config": "^1.1.2",
65
- "@types/node": "^20.2.3",
66
- "@typescript-eslint/eslint-plugin": "^6.0.0",
67
- "@typescript-eslint/parser": "^6.0.0",
68
- "eslint": "^8.41.0",
69
- "eslint-plugin-import": "^2.27.5",
65
+ "@types/node": "^20.8.7",
66
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
67
+ "@typescript-eslint/parser": "^6.8.0",
68
+ "eslint": "^8.52.0",
69
+ "eslint-plugin-import": "^2.29.0",
70
70
  "prettier": "^2.8.8",
71
71
  "prettier-plugin-java": "^2.1.0",
72
- "rimraf": "^5.0.1",
73
- "rollup": "^3.23.0",
72
+ "rimraf": "^5.0.5",
73
+ "rollup": "^3.29.4",
74
74
  "swiftlint": "^1.0.2",
75
75
  "typescript": "^5.0.4"
76
76
  },