@capgo/capacitor-updater 4.12.3 → 4.12.9

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.
@@ -61,7 +61,7 @@ public class CapacitorUpdater {
61
61
  private static final String bundleDirectory = "versions";
62
62
 
63
63
  public static final String TAG = "Capacitor-updater";
64
- public static final String pluginVersion = "4.12.3";
64
+ public static final String pluginVersion = "4.12.9";
65
65
 
66
66
  public SharedPreferences.Editor editor;
67
67
  public SharedPreferences prefs;
@@ -32,15 +32,9 @@ public class RSACipher {
32
32
  public static PrivateKey stringToPrivateKey(String private_key)
33
33
  throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
34
34
  try {
35
- // Remove the "BEGIN" and "END" lines, as well as any whitespace
36
- String pkcs8Pem = private_key.toString();
37
- pkcs8Pem = pkcs8Pem.replace("-----BEGIN PRIVATE KEY-----", "");
38
- pkcs8Pem = pkcs8Pem.replace("-----END PRIVATE KEY-----", "");
39
- pkcs8Pem = pkcs8Pem.replaceAll("\\s+", "");
35
+ // Base64 decode the private_key
40
36
 
41
- // Base64 decode the result
42
-
43
- byte[] pkcs8EncodedBytes = Base64.decode(pkcs8Pem, Base64.DEFAULT);
37
+ byte[] pkcs8EncodedBytes = Base64.decode(private_key, Base64.DEFAULT);
44
38
 
45
39
  // extract the private key
46
40
 
@@ -189,16 +189,16 @@ export interface DelayCondition {
189
189
  kind: DelayUntilNext;
190
190
  value?: string;
191
191
  }
192
- export declare type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
193
- export declare type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
194
- export declare type DownloadChangeListener = (state: DownloadEvent) => void;
195
- export declare type NoNeedListener = (state: noNeedEvent) => void;
196
- export declare type UpdateAvailabledListener = (state: updateAvailableEvent) => void;
197
- export declare type DownloadFailedListener = (state: DownloadFailedEvent) => void;
198
- export declare type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
199
- export declare type MajorAvailableListener = (state: MajorAvailableEvent) => void;
200
- export declare type UpdateFailedListener = (state: UpdateFailedEvent) => void;
201
- export declare type AppReloadedListener = (state: void) => void;
192
+ export type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
193
+ export type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
194
+ export type DownloadChangeListener = (state: DownloadEvent) => void;
195
+ export type NoNeedListener = (state: noNeedEvent) => void;
196
+ export type UpdateAvailabledListener = (state: updateAvailableEvent) => void;
197
+ export type DownloadFailedListener = (state: DownloadFailedEvent) => void;
198
+ export type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
199
+ export type MajorAvailableListener = (state: MajorAvailableEvent) => void;
200
+ export type UpdateFailedListener = (state: UpdateFailedEvent) => void;
201
+ export type AppReloadedListener = (state: void) => void;
202
202
  export interface CapacitorUpdaterPlugin {
203
203
  /**
204
204
  * Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
@@ -221,7 +221,7 @@ extension CustomError: LocalizedError {
221
221
  public let TAG = "✨ Capacitor-updater:"
222
222
  public let CAP_SERVER_PATH = "serverBasePath"
223
223
  public var customId = ""
224
- public let pluginVersion = "4.12.3"
224
+ public let pluginVersion = "4.12.9"
225
225
  public var statsUrl = ""
226
226
  public var channelUrl = ""
227
227
  public var appId = ""
@@ -111,15 +111,17 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
111
111
  }
112
112
  let url = URL(string: urlString)
113
113
  print("\(self.implementation.TAG) Downloading \(url!)")
114
- do {
115
- let res = try self.implementation.download(url: url!, version: version)
116
- call.resolve(res.toJSON())
117
- } catch {
118
- print("\(self.implementation.TAG) Failed to download from: \(url!) \(error.localizedDescription)")
119
- self.notifyListeners("downloadFailed", data: ["version": version])
120
- let current: BundleInfo = self.implementation.getCurrentBundle()
121
- self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
122
- call.reject("Failed to download from: \(url!)", error.localizedDescription)
114
+ DispatchQueue.global(qos: .background).async {
115
+ do {
116
+ let res = try self.implementation.download(url: url!, version: version)
117
+ call.resolve(res.toJSON())
118
+ } catch {
119
+ print("\(self.implementation.TAG) Failed to download from: \(url!) \(error.localizedDescription)")
120
+ self.notifyListeners("downloadFailed", data: ["version": version])
121
+ let current: BundleInfo = self.implementation.getCurrentBundle()
122
+ self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
123
+ call.reject("Failed to download from: \(url!)", error.localizedDescription)
124
+ }
123
125
  }
124
126
  }
125
127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "4.12.3",
3
+ "version": "4.12.9",
4
4
  "license": "LGPL-3.0-only",
5
5
  "description": "OTA update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",
@@ -51,24 +51,25 @@
51
51
  "prepublishOnly": "npm run build"
52
52
  },
53
53
  "devDependencies": {
54
- "@capacitor/android": "^4.4.0",
55
- "@capacitor/cli": "^4.4.0",
56
- "@capacitor/core": "^4.4.0",
54
+ "@capacitor/android": "^4.5.0",
55
+ "@capacitor/cli": "^4.5.0",
56
+ "@capacitor/core": "^4.5.0",
57
57
  "@capacitor/docgen": "^0.2.0",
58
- "@capacitor/ios": "^4.4.0",
58
+ "@capacitor/ios": "^4.5.0",
59
59
  "@ionic/eslint-config": "^0.3.0",
60
60
  "@ionic/prettier-config": "^2.0.0",
61
61
  "@ionic/swiftlint-config": "^1.1.2",
62
- "@typescript-eslint/eslint-plugin": "^5.42.1",
63
- "@typescript-eslint/parser": "^5.42.1",
64
- "eslint": "^8.27.0",
62
+ "@types/node": "^18.11.9",
63
+ "@typescript-eslint/eslint-plugin": "^5.44.0",
64
+ "@typescript-eslint/parser": "^5.44.0",
65
+ "eslint": "^8.28.0",
65
66
  "eslint-plugin-import": "^2.26.0",
66
- "prettier": "^2.7.1",
67
+ "prettier": "^2.8.0",
67
68
  "prettier-plugin-java": "^1.6.2",
68
69
  "rimraf": "^3.0.2",
69
- "rollup": "^3.2.5",
70
+ "rollup": "^3.4.0",
70
71
  "swiftlint": "^1.0.1",
71
- "typescript": "^4.6.2"
72
+ "typescript": "^4.9.3"
72
73
  },
73
74
  "peerDependencies": {
74
75
  "@capacitor/core": "^4.0.0"