@capawesome/capacitor-live-update 6.0.8 → 6.2.0-dev.0a2a6a5.1722676620

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.
Files changed (24) hide show
  1. package/README.md +34 -14
  2. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +136 -19
  3. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateConfig.java +26 -0
  4. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +31 -9
  5. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +17 -0
  6. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +29 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/DownloadBundleOptions.java +11 -1
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBundleResult.java +2 -1
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
  10. package/dist/docs.json +117 -9
  11. package/dist/esm/definitions.d.ts +62 -8
  12. package/dist/esm/definitions.js.map +1 -1
  13. package/dist/esm/web.d.ts +2 -2
  14. package/dist/esm/web.js.map +1 -1
  15. package/ios/Plugin/Classes/CustomError.swift +12 -0
  16. package/ios/Plugin/Classes/Options/DownloadBundleOptions.swift +7 -1
  17. package/ios/Plugin/Classes/Results/GetBundleResult.swift +1 -1
  18. package/ios/Plugin/Classes/Results/ReadyResult.swift +22 -0
  19. package/ios/Plugin/LiveUpdate.swift +145 -15
  20. package/ios/Plugin/LiveUpdateConfig.swift +2 -0
  21. package/ios/Plugin/LiveUpdatePlugin.swift +15 -4
  22. package/ios/Plugin/LiveUpdatePreferences.swift +14 -0
  23. package/ios/Plugin/Protocols/Api/GetLatestBundleResponse.swift +2 -0
  24. package/package.json +1 -1
@@ -1,17 +1,22 @@
1
1
  package io.capawesome.capacitorjs.plugins.liveupdate.classes.options;
2
2
 
3
3
  import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
4
5
 
5
6
  public class DownloadBundleOptions {
6
7
 
7
8
  @NonNull
8
9
  private String bundleId;
9
10
 
11
+ @Nullable
12
+ private String checksum;
13
+
10
14
  @NonNull
11
15
  private String url;
12
16
 
13
- public DownloadBundleOptions(@NonNull String bundleId, @NonNull String url) {
17
+ public DownloadBundleOptions(@NonNull String bundleId, @Nullable String checksum, @NonNull String url) {
14
18
  this.bundleId = bundleId;
19
+ this.checksum = checksum;
15
20
  this.url = url;
16
21
  }
17
22
 
@@ -20,6 +25,11 @@ public class DownloadBundleOptions {
20
25
  return bundleId;
21
26
  }
22
27
 
28
+ @Nullable
29
+ public String getChecksum() {
30
+ return checksum;
31
+ }
32
+
23
33
  @NonNull
24
34
  public String getUrl() {
25
35
  return url;
@@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
4
4
  import androidx.annotation.Nullable;
5
5
  import com.getcapacitor.JSArray;
6
6
  import com.getcapacitor.JSObject;
7
+ import io.capawesome.capacitorjs.plugins.liveupdate.LiveUpdate;
7
8
  import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
8
9
  import org.json.JSONObject;
9
10
 
@@ -18,7 +19,7 @@ public class GetBundleResult implements Result {
18
19
 
19
20
  public JSObject toJSObject() {
20
21
  JSObject result = new JSObject();
21
- result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
22
+ result.put("bundleId", bundleId.equals(LiveUpdate.DEFAULT_WEB_ASSET_DIR) ? JSONObject.NULL : bundleId);
22
23
  return result;
23
24
  }
24
25
  }
@@ -0,0 +1,32 @@
1
+ package io.capawesome.capacitorjs.plugins.liveupdate.classes.results;
2
+
3
+ import androidx.annotation.Nullable;
4
+ import com.getcapacitor.JSObject;
5
+ import io.capawesome.capacitorjs.plugins.liveupdate.LiveUpdate;
6
+ import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
7
+ import org.json.JSONObject;
8
+
9
+ public class ReadyResult implements Result {
10
+
11
+ @Nullable
12
+ private String currentBundleId;
13
+
14
+ @Nullable
15
+ private String previousBundleId;
16
+
17
+ private boolean rollback;
18
+
19
+ public ReadyResult(@Nullable String currentBundleId, @Nullable String previousBundleId, boolean rollback) {
20
+ this.currentBundleId = currentBundleId;
21
+ this.previousBundleId = previousBundleId;
22
+ this.rollback = rollback;
23
+ }
24
+
25
+ public JSObject toJSObject() {
26
+ JSObject result = new JSObject();
27
+ result.put("currentBundleId", currentBundleId.equals(LiveUpdate.DEFAULT_WEB_ASSET_DIR) ? JSONObject.NULL : currentBundleId);
28
+ result.put("previousBundleId", previousBundleId.equals(LiveUpdate.DEFAULT_WEB_ASSET_DIR) ? JSONObject.NULL : previousBundleId);
29
+ result.put("rollback", rollback);
30
+ return result;
31
+ }
32
+ }
package/dist/docs.json CHANGED
@@ -172,9 +172,9 @@
172
172
  },
173
173
  {
174
174
  "name": "ready",
175
- "signature": "() => Promise<void>",
175
+ "signature": "() => Promise<ReadyResult>",
176
176
  "parameters": [],
177
- "returns": "Promise<void>",
177
+ "returns": "Promise<ReadyResult>",
178
178
  "tags": [
179
179
  {
180
180
  "name": "since",
@@ -182,7 +182,9 @@
182
182
  }
183
183
  ],
184
184
  "docs": "Notify the plugin that the app is ready to use and no rollback is needed.\n\n**Attention**: This method should be called as soon as the app is ready to use\nto prevent the app from being reset to the default bundle.\n\nOnly available on Android and iOS.",
185
- "complexTypes": [],
185
+ "complexTypes": [
186
+ "ReadyResult"
187
+ ],
186
188
  "slug": "ready"
187
189
  },
188
190
  {
@@ -343,34 +345,50 @@
343
345
  "methods": [],
344
346
  "properties": [
345
347
  {
346
- "name": "url",
348
+ "name": "bundleId",
347
349
  "tags": [
348
350
  {
349
351
  "text": "5.0.0",
350
352
  "name": "since"
351
353
  },
352
354
  {
353
- "text": "'https://example.com/bundle.zip'",
355
+ "text": "'1.0.0'",
354
356
  "name": "example"
355
357
  }
356
358
  ],
357
- "docs": "The URL of the bundle to download.\n\nThe bundle must be a ZIP file containing at least a `index.html` file.",
359
+ "docs": "The unique identifier of the bundle.",
358
360
  "complexTypes": [],
359
361
  "type": "string"
360
362
  },
361
363
  {
362
- "name": "bundleId",
364
+ "name": "checksum",
365
+ "tags": [
366
+ {
367
+ "text": "6.1.0",
368
+ "name": "since"
369
+ },
370
+ {
371
+ "text": "'aab8e0a312e807c8eaeb923e2bdccd7731c5508869c62ad8e6e43ee881414c84'",
372
+ "name": "example"
373
+ }
374
+ ],
375
+ "docs": "The checksum of the bundle to verify the integrity of the ZIP file.\n\nMust be a SHA-256 hash in hexadecimal format.",
376
+ "complexTypes": [],
377
+ "type": "string | undefined"
378
+ },
379
+ {
380
+ "name": "url",
363
381
  "tags": [
364
382
  {
365
383
  "text": "5.0.0",
366
384
  "name": "since"
367
385
  },
368
386
  {
369
- "text": "'1.0.0'",
387
+ "text": "'https://example.com/bundle.zip'",
370
388
  "name": "example"
371
389
  }
372
390
  ],
373
- "docs": "The unique identifier of the bundle.",
391
+ "docs": "The URL of the bundle to download.\n\nThe bundle must be a ZIP file containing at least a `index.html` file.",
374
392
  "complexTypes": [],
375
393
  "type": "string"
376
394
  }
@@ -582,6 +600,56 @@
582
600
  }
583
601
  ]
584
602
  },
603
+ {
604
+ "name": "ReadyResult",
605
+ "slug": "readyresult",
606
+ "docs": "",
607
+ "tags": [
608
+ {
609
+ "text": "7.0.0",
610
+ "name": "since"
611
+ }
612
+ ],
613
+ "methods": [],
614
+ "properties": [
615
+ {
616
+ "name": "previousBundleId",
617
+ "tags": [
618
+ {
619
+ "text": "7.0.0",
620
+ "name": "since"
621
+ }
622
+ ],
623
+ "docs": "The identifier of the previous bundle used.\n\nIf `null`, the default bundle was used.",
624
+ "complexTypes": [],
625
+ "type": "string | null"
626
+ },
627
+ {
628
+ "name": "currentBundleId",
629
+ "tags": [
630
+ {
631
+ "text": "7.0.0",
632
+ "name": "since"
633
+ }
634
+ ],
635
+ "docs": "The identifier of the current bundle used.\n\nIf `null`, the default bundle is being used.",
636
+ "complexTypes": [],
637
+ "type": "string | null"
638
+ },
639
+ {
640
+ "name": "rollback",
641
+ "tags": [
642
+ {
643
+ "text": "7.0.0",
644
+ "name": "since"
645
+ }
646
+ ],
647
+ "docs": "Whether or not the app was reset to the default bundle.",
648
+ "complexTypes": [],
649
+ "type": "boolean"
650
+ }
651
+ ]
652
+ },
585
653
  {
586
654
  "name": "SetBundleOptions",
587
655
  "slug": "setbundleoptions",
@@ -746,6 +814,46 @@
746
814
  "complexTypes": [],
747
815
  "type": "boolean | undefined"
748
816
  },
817
+ {
818
+ "name": "location",
819
+ "tags": [
820
+ {
821
+ "text": "6.2.0",
822
+ "name": "since"
823
+ },
824
+ {
825
+ "text": "'us'",
826
+ "name": "default"
827
+ },
828
+ {
829
+ "text": "'eu'",
830
+ "name": "example"
831
+ },
832
+ {
833
+ "text": "https ://capawesome.io/cloud/live-updates/advanced/privacy/",
834
+ "name": "see"
835
+ }
836
+ ],
837
+ "docs": "The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).",
838
+ "complexTypes": [],
839
+ "type": "'us' | 'eu' | undefined"
840
+ },
841
+ {
842
+ "name": "publicKey",
843
+ "tags": [
844
+ {
845
+ "text": "6.1.0",
846
+ "name": "since"
847
+ },
848
+ {
849
+ "text": "'-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----'",
850
+ "name": "example"
851
+ }
852
+ ],
853
+ "docs": "The public key to verify the integrity of the bundle.\n\nThe public key must be a PEM-encoded RSA public key.",
854
+ "complexTypes": [],
855
+ "type": "string | undefined"
856
+ },
749
857
  {
750
858
  "name": "readyTimeout",
751
859
  "tags": [
@@ -24,6 +24,24 @@ declare module '@capacitor/cli' {
24
24
  * @default true
25
25
  */
26
26
  enabled?: boolean;
27
+ /**
28
+ * The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).
29
+ *
30
+ * @since 6.2.0
31
+ * @default 'us'
32
+ * @example 'eu'
33
+ * @see https://capawesome.io/cloud/live-updates/advanced/privacy/
34
+ */
35
+ location?: 'us' | 'eu';
36
+ /**
37
+ * The public key to verify the integrity of the bundle.
38
+ *
39
+ * The public key must be a PEM-encoded RSA public key.
40
+ *
41
+ * @since 6.1.0
42
+ * @example '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----'
43
+ */
44
+ publicKey?: string;
27
45
  /**
28
46
  * The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle.
29
47
  *
@@ -124,7 +142,7 @@ export interface LiveUpdatePlugin {
124
142
  *
125
143
  * @since 5.0.0
126
144
  */
127
- ready(): Promise<void>;
145
+ ready(): Promise<ReadyResult>;
128
146
  /**
129
147
  * Reload the app to apply the new bundle.
130
148
  *
@@ -193,6 +211,22 @@ export interface DeleteBundleOptions {
193
211
  bundleId: string;
194
212
  }
195
213
  export interface DownloadBundleOptions {
214
+ /**
215
+ * The unique identifier of the bundle.
216
+ *
217
+ * @since 5.0.0
218
+ * @example '1.0.0'
219
+ */
220
+ bundleId: string;
221
+ /**
222
+ * The checksum of the bundle to verify the integrity of the ZIP file.
223
+ *
224
+ * Must be a SHA-256 hash in hexadecimal format.
225
+ *
226
+ * @since 6.1.0
227
+ * @example 'aab8e0a312e807c8eaeb923e2bdccd7731c5508869c62ad8e6e43ee881414c84'
228
+ */
229
+ checksum?: string;
196
230
  /**
197
231
  * The URL of the bundle to download.
198
232
  *
@@ -202,13 +236,6 @@ export interface DownloadBundleOptions {
202
236
  * @example 'https://example.com/bundle.zip'
203
237
  */
204
238
  url: string;
205
- /**
206
- * The unique identifier of the bundle.
207
- *
208
- * @since 5.0.0
209
- * @example '1.0.0'
210
- */
211
- bundleId: string;
212
239
  }
213
240
  /**
214
241
  * @since 5.0.0
@@ -309,6 +336,33 @@ export interface GetCustomIdResult {
309
336
  */
310
337
  customId: string | null;
311
338
  }
339
+ /**
340
+ * @since 7.0.0
341
+ */
342
+ export interface ReadyResult {
343
+ /**
344
+ * The identifier of the previous bundle used.
345
+ *
346
+ * If `null`, the default bundle was used.
347
+ *
348
+ * @since 7.0.0
349
+ */
350
+ previousBundleId: string | null;
351
+ /**
352
+ * The identifier of the current bundle used.
353
+ *
354
+ * If `null`, the default bundle is being used.
355
+ *
356
+ * @since 7.0.0
357
+ */
358
+ currentBundleId: string | null;
359
+ /**
360
+ * Whether or not the app was reset to the default bundle.
361
+ *
362
+ * @since 7.0.0
363
+ */
364
+ rollback: boolean;
365
+ }
312
366
  /**
313
367
  * @since 5.0.0
314
368
  */
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n LiveUpdate?: {\n /**\n * The app ID is used to identify the app when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * @since 5.0.0\n * @example '4100e356-e851-47fe-9d3c-b411eb325a99'\n */\n appId?: string;\n /**\n * Whether or not to automatically delete unused bundles.\n *\n * When enabled, the plugin will automatically delete unused bundles after calling `ready()`.\n *\n * @since 5.0.0\n * @default false\n */\n autoDeleteBundles?: boolean;\n /**\n * Whether or not the plugin is enabled.\n *\n * @since 5.0.0\n * @default true\n */\n enabled?: boolean;\n /**\n * The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle.\n *\n * @since 5.0.0\n * @default 10000\n */\n readyTimeout?: number;\n /**\n * Whether or not the app should be reset to the default bundle during an update.\n *\n * @since 5.0.0\n * @default true\n */\n resetOnUpdate?: boolean;\n };\n }\n}\n\nexport interface LiveUpdatePlugin {\n /**\n * Delete a bundle from the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n deleteBundle(options: DeleteBundleOptions): Promise<void>;\n /**\n * Download a bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n downloadBundle(options: DownloadBundleOptions): Promise<void>;\n /**\n * Get the active bundle identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundle(): Promise<GetBundleResult>;\n /**\n * Get all available bundle identifiers.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundles(): Promise<GetBundlesResult>;\n /**\n * Get the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getChannel(): Promise<GetChannelResult>;\n /**\n * Get the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getCustomId(): Promise<GetCustomIdResult>;\n /**\n * Get the device identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getDeviceId(): Promise<GetDeviceIdResult>;\n /**\n * Get the version code of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionCode(): Promise<GetVersionCodeResult>;\n /**\n * Get the version name of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionName(): Promise<GetVersionNameResult>;\n /**\n * Notify the plugin that the app is ready to use and no rollback is needed.\n *\n * **Attention**: This method should be called as soon as the app is ready to use\n * to prevent the app from being reset to the default bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n ready(): Promise<void>;\n /**\n * Reload the app to apply the new bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reload(): Promise<void>;\n /**\n * Reset the app to the default bundle.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reset(): Promise<void>;\n /**\n * Set the next bundle to use for the app.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setBundle(options: SetBundleOptions): Promise<void>;\n /**\n * Set the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setChannel(options: SetChannelOptions): Promise<void>;\n /**\n * Set the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n /**\n * Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n sync(): Promise<SyncResult>;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface DeleteBundleOptions {\n /**\n * The unique identifier of the bundle to delete.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\nexport interface DownloadBundleOptions {\n /**\n * The URL of the bundle to download.\n *\n * The bundle must be a ZIP file containing at least a `index.html` file.\n *\n * @since 5.0.0\n * @example 'https://example.com/bundle.zip'\n */\n url: string;\n /**\n * The unique identifier of the bundle.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundleResult {\n /**\n * The unique identifier of the active bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundlesResult {\n /**\n * An array of unique identifiers of all available bundles.\n *\n * @since 5.0.0\n */\n bundleIds: string[];\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetChannelResult {\n /**\n * The channel of the app.\n *\n * If `null`, the app is using the default channel.\n *\n * @since 5.0.0\n * @example 'production'\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetDeviceIdResult {\n /**\n * The unique identifier of the device.\n *\n * On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used.\n * The value of this property is the same for apps that come from the same vendor running on the same device.\n *\n * @since 5.0.0\n *\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n deviceId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionCodeResult {\n /**\n * The version code of the app.\n *\n * On **Android**, this is the `versionCode` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1\"\n */\n versionCode: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionNameResult {\n /**\n * The version name of the app.\n *\n * On **Android**, this is the `versionName` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1.0.0\"\n */\n versionName: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetCustomIdResult {\n /**\n * The custom identifier of the app.\n *\n * If `null`, no custom identifier is set.\n *\n * @since 5.0.0\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetBundleOptions {\n /**\n * The unique identifier of the bundle to use.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetChannelOptions {\n /**\n * The channel of the app.\n *\n * Set `null` to remove the channel.\n *\n * @since 5.0.0\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetCustomIdOptions {\n /**\n * The custom identifier of the app.\n *\n * Set `null` to remove the custom identifier.\n *\n * @since 5.0.0\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SyncResult {\n /**\n * The identifier of the next bundle to use.\n *\n * If `null`, the app is up-to-date and no new bundle is available.\n *\n * @since 5.0.0\n */\n nextBundleId: string | null;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n LiveUpdate?: {\n /**\n * The app ID is used to identify the app when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * @since 5.0.0\n * @example '4100e356-e851-47fe-9d3c-b411eb325a99'\n */\n appId?: string;\n /**\n * Whether or not to automatically delete unused bundles.\n *\n * When enabled, the plugin will automatically delete unused bundles after calling `ready()`.\n *\n * @since 5.0.0\n * @default false\n */\n autoDeleteBundles?: boolean;\n /**\n * Whether or not the plugin is enabled.\n *\n * @since 5.0.0\n * @default true\n */\n enabled?: boolean;\n /**\n * The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).\n *\n * @since 6.2.0\n * @default 'us'\n * @example 'eu'\n * @see https://capawesome.io/cloud/live-updates/advanced/privacy/\n */\n location?: 'us' | 'eu';\n /**\n * The public key to verify the integrity of the bundle.\n *\n * The public key must be a PEM-encoded RSA public key.\n *\n * @since 6.1.0\n * @example '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----'\n */\n publicKey?: string;\n /**\n * The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle.\n *\n * @since 5.0.0\n * @default 10000\n */\n readyTimeout?: number;\n /**\n * Whether or not the app should be reset to the default bundle during an update.\n *\n * @since 5.0.0\n * @default true\n */\n resetOnUpdate?: boolean;\n };\n }\n}\n\nexport interface LiveUpdatePlugin {\n /**\n * Delete a bundle from the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n deleteBundle(options: DeleteBundleOptions): Promise<void>;\n /**\n * Download a bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n downloadBundle(options: DownloadBundleOptions): Promise<void>;\n /**\n * Get the active bundle identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundle(): Promise<GetBundleResult>;\n /**\n * Get all available bundle identifiers.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundles(): Promise<GetBundlesResult>;\n /**\n * Get the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getChannel(): Promise<GetChannelResult>;\n /**\n * Get the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getCustomId(): Promise<GetCustomIdResult>;\n /**\n * Get the device identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getDeviceId(): Promise<GetDeviceIdResult>;\n /**\n * Get the version code of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionCode(): Promise<GetVersionCodeResult>;\n /**\n * Get the version name of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getVersionName(): Promise<GetVersionNameResult>;\n /**\n * Notify the plugin that the app is ready to use and no rollback is needed.\n *\n * **Attention**: This method should be called as soon as the app is ready to use\n * to prevent the app from being reset to the default bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n ready(): Promise<ReadyResult>;\n /**\n * Reload the app to apply the new bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reload(): Promise<void>;\n /**\n * Reset the app to the default bundle.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n reset(): Promise<void>;\n /**\n * Set the next bundle to use for the app.\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setBundle(options: SetBundleOptions): Promise<void>;\n /**\n * Set the channel of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setChannel(options: SetChannelOptions): Promise<void>;\n /**\n * Set the custom identifier of the app.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n /**\n * Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Call `reload()` or restart the app to apply the changes.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n sync(): Promise<SyncResult>;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface DeleteBundleOptions {\n /**\n * The unique identifier of the bundle to delete.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\nexport interface DownloadBundleOptions {\n /**\n * The unique identifier of the bundle.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n /**\n * The checksum of the bundle to verify the integrity of the ZIP file.\n *\n * Must be a SHA-256 hash in hexadecimal format.\n *\n * @since 6.1.0\n * @example 'aab8e0a312e807c8eaeb923e2bdccd7731c5508869c62ad8e6e43ee881414c84'\n */\n checksum?: string;\n /**\n * The URL of the bundle to download.\n *\n * The bundle must be a ZIP file containing at least a `index.html` file.\n *\n * @since 5.0.0\n * @example 'https://example.com/bundle.zip'\n */\n url: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundleResult {\n /**\n * The unique identifier of the active bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetBundlesResult {\n /**\n * An array of unique identifiers of all available bundles.\n *\n * @since 5.0.0\n */\n bundleIds: string[];\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetChannelResult {\n /**\n * The channel of the app.\n *\n * If `null`, the app is using the default channel.\n *\n * @since 5.0.0\n * @example 'production'\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetDeviceIdResult {\n /**\n * The unique identifier of the device.\n *\n * On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used.\n * The value of this property is the same for apps that come from the same vendor running on the same device.\n *\n * @since 5.0.0\n *\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n deviceId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionCodeResult {\n /**\n * The version code of the app.\n *\n * On **Android**, this is the `versionCode` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1\"\n */\n versionCode: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetVersionNameResult {\n /**\n * The version name of the app.\n *\n * On **Android**, this is the `versionName` from the `android/app/build.gradle` file.\n * On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.\n *\n * @since 5.0.0\n * @example \"1.0.0\"\n */\n versionName: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface GetCustomIdResult {\n /**\n * The custom identifier of the app.\n *\n * If `null`, no custom identifier is set.\n *\n * @since 5.0.0\n * @example '50d2a548-80b7-4dad-adc7-97c0e79d8a89'\n */\n customId: string | null;\n}\n\n/**\n * @since 7.0.0\n */\nexport interface ReadyResult {\n /**\n * The identifier of the previous bundle used.\n *\n * If `null`, the default bundle was used.\n *\n * @since 7.0.0\n */\n previousBundleId: string | null;\n /**\n * The identifier of the current bundle used.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 7.0.0\n */\n currentBundleId: string | null;\n /**\n * Whether or not the app was reset to the default bundle.\n *\n * @since 7.0.0\n */\n rollback: boolean;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetBundleOptions {\n /**\n * The unique identifier of the bundle to use.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetChannelOptions {\n /**\n * The channel of the app.\n *\n * Set `null` to remove the channel.\n *\n * @since 5.0.0\n */\n channel: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SetCustomIdOptions {\n /**\n * The custom identifier of the app.\n *\n * Set `null` to remove the custom identifier.\n *\n * @since 5.0.0\n */\n customId: string | null;\n}\n\n/**\n * @since 5.0.0\n */\nexport interface SyncResult {\n /**\n * The identifier of the next bundle to use.\n *\n * If `null`, the app is up-to-date and no new bundle is available.\n *\n * @since 5.0.0\n */\n nextBundleId: string | null;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { DeleteBundleOptions, DownloadBundleOptions, GetBundleResult, GetBundlesResult, GetChannelResult, GetCustomIdResult, GetDeviceIdResult, GetVersionCodeResult, GetVersionNameResult, LiveUpdatePlugin, SetBundleOptions, SetChannelOptions, SetCustomIdOptions, SyncResult } from './definitions';
2
+ import type { DeleteBundleOptions, DownloadBundleOptions, GetBundleResult, GetBundlesResult, GetChannelResult, GetCustomIdResult, GetDeviceIdResult, GetVersionCodeResult, GetVersionNameResult, LiveUpdatePlugin, ReadyResult, SetBundleOptions, SetChannelOptions, SetCustomIdOptions, SyncResult } from './definitions';
3
3
  export declare class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin {
4
4
  deleteBundle(_options: DeleteBundleOptions): Promise<void>;
5
5
  downloadBundle(_options: DownloadBundleOptions): Promise<void>;
@@ -10,7 +10,7 @@ export declare class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin
10
10
  getDeviceId(): Promise<GetDeviceIdResult>;
11
11
  getVersionCode(): Promise<GetVersionCodeResult>;
12
12
  getVersionName(): Promise<GetVersionNameResult>;
13
- ready(): Promise<void>;
13
+ ready(): Promise<ReadyResult>;
14
14
  reload(): Promise<void>;
15
15
  reset(): Promise<void>;
16
16
  setBundle(_options: SetBundleOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAmB5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IACnC,KAAK,CAAC,YAAY,CAAC,QAA6B;QACrD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,QAA+B;QACzD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,QAA0B;QAC/C,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,QAA2B;QACjD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,QAA4B;QACnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEO,uBAAuB;QAC7B,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n DeleteBundleOptions,\n DownloadBundleOptions,\n GetBundleResult,\n GetBundlesResult,\n GetChannelResult,\n GetCustomIdResult,\n GetDeviceIdResult,\n GetVersionCodeResult,\n GetVersionNameResult,\n LiveUpdatePlugin,\n SetBundleOptions,\n SetChannelOptions,\n SetCustomIdOptions,\n SyncResult,\n} from './definitions';\n\nexport class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin {\n public async deleteBundle(_options: DeleteBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async downloadBundle(_options: DownloadBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async getBundle(): Promise<GetBundleResult> {\n this.throwUnimplementedError();\n }\n\n public async getBundles(): Promise<GetBundlesResult> {\n this.throwUnimplementedError();\n }\n\n public async getChannel(): Promise<GetChannelResult> {\n this.throwUnimplementedError();\n }\n\n public async getCustomId(): Promise<GetCustomIdResult> {\n this.throwUnimplementedError();\n }\n\n public async getDeviceId(): Promise<GetDeviceIdResult> {\n this.throwUnimplementedError();\n }\n\n public async getVersionCode(): Promise<GetVersionCodeResult> {\n this.throwUnimplementedError();\n }\n\n public async getVersionName(): Promise<GetVersionNameResult> {\n this.throwUnimplementedError();\n }\n\n public async ready(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async reload(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async reset(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setBundle(_options: SetBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setChannel(_options: SetChannelOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setCustomId(_options: SetCustomIdOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async sync(): Promise<SyncResult> {\n this.throwUnimplementedError();\n }\n\n private throwUnimplementedError(): never {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAoB5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IACnC,KAAK,CAAC,YAAY,CAAC,QAA6B;QACrD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,QAA+B;QACzD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,QAA0B;QAC/C,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,QAA2B;QACjD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,QAA4B;QACnD,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAEO,uBAAuB;QAC7B,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n DeleteBundleOptions,\n DownloadBundleOptions,\n GetBundleResult,\n GetBundlesResult,\n GetChannelResult,\n GetCustomIdResult,\n GetDeviceIdResult,\n GetVersionCodeResult,\n GetVersionNameResult,\n LiveUpdatePlugin,\n ReadyResult,\n SetBundleOptions,\n SetChannelOptions,\n SetCustomIdOptions,\n SyncResult,\n} from './definitions';\n\nexport class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin {\n public async deleteBundle(_options: DeleteBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async downloadBundle(_options: DownloadBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async getBundle(): Promise<GetBundleResult> {\n this.throwUnimplementedError();\n }\n\n public async getBundles(): Promise<GetBundlesResult> {\n this.throwUnimplementedError();\n }\n\n public async getChannel(): Promise<GetChannelResult> {\n this.throwUnimplementedError();\n }\n\n public async getCustomId(): Promise<GetCustomIdResult> {\n this.throwUnimplementedError();\n }\n\n public async getDeviceId(): Promise<GetDeviceIdResult> {\n this.throwUnimplementedError();\n }\n\n public async getVersionCode(): Promise<GetVersionCodeResult> {\n this.throwUnimplementedError();\n }\n\n public async getVersionName(): Promise<GetVersionNameResult> {\n this.throwUnimplementedError();\n }\n\n public async ready(): Promise<ReadyResult> {\n this.throwUnimplementedError();\n }\n\n public async reload(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async reset(): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setBundle(_options: SetBundleOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setChannel(_options: SetChannelOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async setCustomId(_options: SetCustomIdOptions): Promise<void> {\n this.throwUnimplementedError();\n }\n\n public async sync(): Promise<SyncResult> {\n this.throwUnimplementedError();\n }\n\n private throwUnimplementedError(): never {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
@@ -7,8 +7,12 @@ public enum CustomError: Error {
7
7
  case bundleIndexHtmlMissing
8
8
  case bundleNotFound
9
9
  case channelMissing
10
+ case checksumCalculationFailed
11
+ case checksumMismatch
10
12
  case customIdMissing
11
13
  case downloadFailed
14
+ case signatureMissing
15
+ case signatureVerificationFailed
12
16
  case urlMissing
13
17
  }
14
18
 
@@ -27,10 +31,18 @@ extension CustomError: LocalizedError {
27
31
  return NSLocalizedString("bundle not found.", comment: "bundleNotFound")
28
32
  case .channelMissing:
29
33
  return NSLocalizedString("channel must be provided.", comment: "channelMissing")
34
+ case .checksumCalculationFailed:
35
+ return NSLocalizedString("Failed to calculate checksum.", comment: "checksumCalculationFailed")
36
+ case .checksumMismatch:
37
+ return NSLocalizedString("Checksum mismatch.", comment: "checksumMismatch")
30
38
  case .customIdMissing:
31
39
  return NSLocalizedString("customId must be provided.", comment: "customIdMissing")
32
40
  case .downloadFailed:
33
41
  return NSLocalizedString("Bundle could not be downloaded.", comment: "downloadFailed")
42
+ case .signatureMissing:
43
+ return NSLocalizedString("Bundle does not contain a signature.", comment: "signatureMissing")
44
+ case .signatureVerificationFailed:
45
+ return NSLocalizedString("Signature verification failed.", comment: "signatureVerificationFailed")
34
46
  case .urlMissing:
35
47
  return NSLocalizedString("url must be provided.", comment: "urlMissing")
36
48
  }
@@ -3,10 +3,12 @@ import Capacitor
3
3
 
4
4
  @objc public class DownloadBundleOptions: NSObject {
5
5
  private var bundleId: String
6
+ private var checksum: String?
6
7
  private var url: String
7
8
 
8
- init(bundleId: String, url: String) {
9
+ init(bundleId: String, checksum: String?, url: String) {
9
10
  self.bundleId = bundleId
11
+ self.checksum = checksum
10
12
  self.url = url
11
13
  }
12
14
 
@@ -14,6 +16,10 @@ import Capacitor
14
16
  return bundleId
15
17
  }
16
18
 
19
+ func getChecksum() -> String? {
20
+ return checksum
21
+ }
22
+
17
23
  func getUrl() -> String {
18
24
  return url
19
25
  }
@@ -10,7 +10,7 @@ import Capacitor
10
10
 
11
11
  public func toJSObject() -> AnyObject {
12
12
  var result = JSObject()
13
- result["bundleId"] = bundleId == nil ? NSNull() : bundleId
13
+ result["bundleId"] = bundleId == LiveUpdate.defaultWebAssetDir ? NSNull() : bundleId
14
14
  return result as AnyObject
15
15
  }
16
16
  }
@@ -0,0 +1,22 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class ReadyResult: NSObject, Result {
5
+ let currentBundleId: String?
6
+ let previousBundleId: String?
7
+ let rollback: Bool
8
+
9
+ init(currentBundleId: String?, previousBundleId: String?, rollback: Bool) {
10
+ self.currentBundleId = currentBundleId
11
+ self.previousBundleId = previousBundleId
12
+ self.rollback = rollback
13
+ }
14
+
15
+ public func toJSObject() -> AnyObject {
16
+ var result = JSObject()
17
+ result["currentBundleId"] = currentBundleId == LiveUpdate.defaultWebAssetDir ? NSNull() : currentBundleId
18
+ result["previousBundleId"] = previousBundleId == LiveUpdate.defaultWebAssetDir ? NSNull() : previousBundleId
19
+ result["rollback"] = rollback
20
+ return result as AnyObject
21
+ }
22
+ }