@capgo/capacitor-updater 4.17.12 → 4.17.20

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.
@@ -83,7 +83,7 @@ public class BundleInfo {
83
83
  return (
84
84
  !this.isBuiltin() &&
85
85
  this.downloaded != null &&
86
- !this.downloaded.equals("") &&
86
+ !this.downloaded.isEmpty() &&
87
87
  !this.isDeleted()
88
88
  );
89
89
  }
@@ -337,7 +337,11 @@ public class CapacitorUpdater {
337
337
  checksum
338
338
  );
339
339
  this.saveBundleInfo(id, info);
340
- if (!checksumRes.equals("") && !checksumRes.equals(checksum)) {
340
+ if (
341
+ checksumRes != null &&
342
+ !checksumRes.isEmpty() &&
343
+ !checksumRes.equals(checksum)
344
+ ) {
341
345
  Log.e(
342
346
  CapacitorUpdater.TAG,
343
347
  "Error checksum " + info.getChecksum() + " " + checksum
@@ -463,7 +467,13 @@ public class CapacitorUpdater {
463
467
 
464
468
  private void decryptFile(final File file, final String ivSessionKey)
465
469
  throws IOException {
466
- if (this.privateKey.equals("") || ivSessionKey.equals("")) {
470
+ // (str != null && !str.isEmpty())
471
+ if (
472
+ this.privateKey == null ||
473
+ this.privateKey.isEmpty() ||
474
+ ivSessionKey == null ||
475
+ ivSessionKey.isEmpty()
476
+ ) {
467
477
  return;
468
478
  }
469
479
  try {
@@ -47,7 +47,7 @@ public class CapacitorUpdaterPlugin
47
47
  private static final String channelUrlDefault =
48
48
  "https://api.capgo.app/channel_self";
49
49
 
50
- private final String PLUGIN_VERSION = "4.17.12";
50
+ private final String PLUGIN_VERSION = "4.17.20";
51
51
  private static final String DELAY_CONDITION_PREFERENCES = "";
52
52
 
53
53
  private SharedPreferences.Editor editor;
@@ -1053,7 +1053,7 @@ public class CapacitorUpdaterPlugin
1053
1053
  for (DelayCondition delayCondition : delayConditionList) {
1054
1054
  if (delayCondition.getKind().toString().equals("background")) {
1055
1055
  String value = delayCondition.getValue();
1056
- backgroundValue = (value != null || !value.equals("")) ? value : "0";
1056
+ backgroundValue = (value != null && !value.isEmpty()) ? value : "0";
1057
1057
  }
1058
1058
  }
1059
1059
  if (backgroundValue != null) {
@@ -104,10 +104,10 @@ public class DownloadService extends IntentService {
104
104
  String error
105
105
  ) {
106
106
  Intent intent = new Intent(NOTIFICATION);
107
- if (!dest.equals("")) {
107
+ if (dest != null && !dest.isEmpty()) {
108
108
  intent.putExtra(FILEDEST, dest);
109
109
  }
110
- if (!error.equals("")) {
110
+ if (error != null && !error.isEmpty()) {
111
111
  intent.putExtra(ERROR, error);
112
112
  }
113
113
  intent.putExtra(ID, id);
@@ -72,7 +72,7 @@ import Foundation
72
72
  }
73
73
 
74
74
  public func getVersionName() -> String {
75
- return self.version == "" ? BundleInfo.ID_BUILTIN : self.version
75
+ return (self.version ?? "").isEmpty ? BundleInfo.ID_BUILTIN : self.version
76
76
  }
77
77
 
78
78
  public func setVersionName(version: String) -> BundleInfo {
@@ -334,7 +334,7 @@ extension CustomError: LocalizedError {
334
334
  }
335
335
 
336
336
  private func decryptFile(filePath: URL, sessionKey: String) throws {
337
- if self.privateKey == "" || sessionKey == "" {
337
+ if (self.privateKey ?? "").isEmpty || (sessionKey ?? "").isEmpty {
338
338
  print("\(self.TAG) Cannot found privateKey or sessionKey")
339
339
  return
340
340
  }
@@ -437,7 +437,7 @@ extension CustomError: LocalizedError {
437
437
  private func setCurrentBundle(bundle: String) {
438
438
  UserDefaults.standard.set(bundle, forKey: self.CAP_SERVER_PATH)
439
439
  UserDefaults.standard.synchronize()
440
- print("\(self.TAG) Current bundle set to: \(bundle == "" ? BundleInfo.ID_BUILTIN : bundle)")
440
+ print("\(self.TAG) Current bundle set to: \((bundle ?? "").isEmpty ? BundleInfo.ID_BUILTIN : bundle)")
441
441
  }
442
442
 
443
443
  public func download(url: URL, version: String, sessionKey: String) throws -> BundleInfo {
@@ -625,7 +625,7 @@ extension CustomError: LocalizedError {
625
625
 
626
626
  func setChannel(channel: String) -> SetChannel {
627
627
  let setChannel: SetChannel = SetChannel()
628
- if self.channelUrl == "" {
628
+ if (self.channelUrl ?? "").isEmpty {
629
629
  print("\(self.TAG) Channel URL is not set")
630
630
  setChannel.message = "Channel URL is not set"
631
631
  setChannel.error = "missing_config"
@@ -662,7 +662,7 @@ extension CustomError: LocalizedError {
662
662
 
663
663
  func getChannel() -> GetChannel {
664
664
  let getChannel: GetChannel = GetChannel()
665
- if self.channelUrl == "" {
665
+ if (self.channelUrl ?? "").isEmpty {
666
666
  print("\(self.TAG) Channel URL is not set")
667
667
  getChannel.message = "Channel URL is not set"
668
668
  getChannel.error = "missing_config"
@@ -702,7 +702,7 @@ extension CustomError: LocalizedError {
702
702
  }
703
703
 
704
704
  func sendStats(action: String, versionName: String) {
705
- if self.statsUrl == "" {
705
+ if (self.statsUrl ?? "").isEmpty {
706
706
  return
707
707
  }
708
708
  var parameters: InfoObject = self.createInfoObject()
@@ -797,7 +797,7 @@ extension CustomError: LocalizedError {
797
797
  guard let bundlePath: String = UserDefaults.standard.string(forKey: self.CAP_SERVER_PATH) else {
798
798
  return BundleInfo.ID_BUILTIN
799
799
  }
800
- if bundlePath == "" {
800
+ if (bundlePath ?? "").isEmpty {
801
801
  return BundleInfo.ID_BUILTIN
802
802
  }
803
803
  let bundleID: String = bundlePath.components(separatedBy: "/").last ?? bundlePath
@@ -9,7 +9,7 @@ import Version
9
9
  @objc(CapacitorUpdaterPlugin)
10
10
  public class CapacitorUpdaterPlugin: CAPPlugin {
11
11
  private var implementation = CapacitorUpdater()
12
- private let PLUGIN_VERSION: String = "4.17.12"
12
+ private let PLUGIN_VERSION: String = "4.17.20"
13
13
  static let updateUrlDefault = "https://api.capgo.app/updates"
14
14
  static let statsUrlDefault = "https://api.capgo.app/stats"
15
15
  static let channelUrlDefault = "https://api.capgo.app/channel_self"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "4.17.12",
3
+ "version": "4.17.20",
4
4
  "packageManager": "pnpm@7.26.2",
5
5
  "license": "LGPL-3.0-only",
6
6
  "description": "Live update for capacitor apps",
@@ -46,31 +46,32 @@
46
46
  "prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
47
47
  "swiftlint": "node-swiftlint",
48
48
  "docgen": "docgen --api CapacitorUpdaterPlugin --output-readme README.md --output-json dist/docs.json",
49
+ "docgen:api": "docgen --api CapacitorUpdaterPlugin --output-readme api.md --output-json dist/docs.json",
49
50
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
50
51
  "clean": "rimraf ./dist",
51
52
  "watch": "tsc --watch",
52
53
  "prepublishOnly": "npm run build"
53
54
  },
54
55
  "devDependencies": {
55
- "@capacitor/android": "^4.5.0",
56
- "@capacitor/cli": "^4.5.0",
57
- "@capacitor/core": "^4.5.0",
56
+ "@capacitor/android": "^4.6.3",
57
+ "@capacitor/cli": "^4.6.3",
58
+ "@capacitor/core": "^4.6.3",
58
59
  "@capacitor/docgen": "^0.2.0",
59
- "@capacitor/ios": "^4.5.0",
60
+ "@capacitor/ios": "^4.6.3",
60
61
  "@ionic/eslint-config": "^0.3.0",
61
62
  "@ionic/prettier-config": "^2.0.0",
62
63
  "@ionic/swiftlint-config": "^1.1.2",
63
- "@types/node": "^18.11.9",
64
- "@typescript-eslint/eslint-plugin": "^5.44.0",
65
- "@typescript-eslint/parser": "^5.44.0",
66
- "eslint": "^8.28.0",
67
- "eslint-plugin-import": "^2.26.0",
68
- "prettier": "^2.8.0",
64
+ "@types/node": "^18.11.18",
65
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
66
+ "@typescript-eslint/parser": "^5.50.0",
67
+ "eslint": "^8.33.0",
68
+ "eslint-plugin-import": "^2.27.5",
69
+ "prettier": "^2.8.3",
69
70
  "prettier-plugin-java": "^2.0.0",
70
71
  "rimraf": "^3.0.2",
71
- "rollup": "^3.4.0",
72
+ "rollup": "^3.13.0",
72
73
  "swiftlint": "^1.0.1",
73
- "typescript": "^4.9.3"
74
+ "typescript": "^4.9.5"
74
75
  },
75
76
  "peerDependencies": {
76
77
  "@capacitor/core": "^4.0.0"