@capawesome/capacitor-live-update 7.3.0 → 7.4.0-dev.f18299f8.1767510052

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 (31) hide show
  1. package/README.md +221 -2
  2. package/android/build.gradle +2 -0
  3. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +519 -246
  4. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateHttpClient.java +42 -5
  5. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +134 -3
  6. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +25 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +2 -2
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetConfigOptions.java +19 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +27 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +27 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/IsSyncingResult.java +26 -0
  13. package/dist/docs.json +319 -0
  14. package/dist/esm/definitions.d.ts +165 -0
  15. package/dist/esm/definitions.js.map +1 -1
  16. package/dist/esm/web.d.ts +8 -1
  17. package/dist/esm/web.js +21 -0
  18. package/dist/esm/web.js.map +1 -1
  19. package/dist/plugin.cjs.js +21 -0
  20. package/dist/plugin.cjs.js.map +1 -1
  21. package/dist/plugin.js +21 -0
  22. package/dist/plugin.js.map +1 -1
  23. package/ios/Plugin/Classes/Options/SetConfigOptions.swift +14 -0
  24. package/ios/Plugin/Classes/Results/GetBlockedBundlesResult.swift +16 -0
  25. package/ios/Plugin/Classes/Results/GetConfigResult.swift +19 -0
  26. package/ios/Plugin/Classes/Results/GetDownloadedBundlesResult.swift +16 -0
  27. package/ios/Plugin/Classes/Results/IsSyncingResult.swift +16 -0
  28. package/ios/Plugin/LiveUpdate.swift +77 -4
  29. package/ios/Plugin/LiveUpdatePlugin.swift +78 -1
  30. package/ios/Plugin/LiveUpdatePreferences.swift +44 -2
  31. package/package.json +1 -1
package/README.md CHANGED
@@ -56,13 +56,16 @@ npx cap sync
56
56
 
57
57
  #### Variables
58
58
 
59
- If needed, you can define the following project variable in your app’s `variables.gradle` file to change the default version of the dependency:
59
+ If needed, you can define the following project variable in your app's `variables.gradle` file to change the default version of the dependency:
60
60
 
61
- - `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `22.3.1`)
61
+ - `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `4.12.0`)
62
62
  - `$zip4jVersion` version of `net.lingala.zip4j:zip4j` (default: `2.11.5`)
63
+ - `$conscryptVersion` version of `org.conscrypt:conscrypt-android` (default: `2.5.3`)
63
64
 
64
65
  This can be useful if you encounter dependency conflicts with other plugins in your project.
65
66
 
67
+ **Note**: The plugin uses Google Conscrypt as the security provider to ensure better SSL/TLS certificate compatibility on older Android versions (especially Android 7 and below).
68
+
66
69
  ### iOS
67
70
 
68
71
  #### Privacy manifest
@@ -273,26 +276,34 @@ const isNewBundleAvailable = async () => {
273
276
 
274
277
  <docgen-index>
275
278
 
279
+ * [`clearBlockedBundles()`](#clearblockedbundles)
276
280
  * [`deleteBundle(...)`](#deletebundle)
277
281
  * [`downloadBundle(...)`](#downloadbundle)
278
282
  * [`fetchLatestBundle(...)`](#fetchlatestbundle)
283
+ * [`getBlockedBundles()`](#getblockedbundles)
279
284
  * [`getBundles()`](#getbundles)
280
285
  * [`getChannel()`](#getchannel)
286
+ * [`getConfig()`](#getconfig)
287
+ * [`getDownloadedBundles()`](#getdownloadedbundles)
281
288
  * [`getCurrentBundle()`](#getcurrentbundle)
282
289
  * [`getCustomId()`](#getcustomid)
283
290
  * [`getDeviceId()`](#getdeviceid)
291
+ * [`isSyncing()`](#issyncing)
284
292
  * [`getNextBundle()`](#getnextbundle)
285
293
  * [`getVersionCode()`](#getversioncode)
286
294
  * [`getVersionName()`](#getversionname)
287
295
  * [`ready()`](#ready)
288
296
  * [`reload()`](#reload)
289
297
  * [`reset()`](#reset)
298
+ * [`resetConfig()`](#resetconfig)
290
299
  * [`setChannel(...)`](#setchannel)
300
+ * [`setConfig(...)`](#setconfig)
291
301
  * [`setCustomId(...)`](#setcustomid)
292
302
  * [`setNextBundle(...)`](#setnextbundle)
293
303
  * [`sync(...)`](#sync)
294
304
  * [`addListener('downloadBundleProgress', ...)`](#addlistenerdownloadbundleprogress-)
295
305
  * [`addListener('nextBundleSet', ...)`](#addlistenernextbundleset-)
306
+ * [`addListener('reloaded', ...)`](#addlistenerreloaded-)
296
307
  * [`removeAllListeners()`](#removealllisteners)
297
308
  * [Interfaces](#interfaces)
298
309
  * [Type Aliases](#type-aliases)
@@ -302,6 +313,24 @@ const isNewBundleAvailable = async () => {
302
313
  <docgen-api>
303
314
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
304
315
 
316
+ ### clearBlockedBundles()
317
+
318
+ ```typescript
319
+ clearBlockedBundles() => Promise<void>
320
+ ```
321
+
322
+ Clear all blocked bundles from the blocked list.
323
+
324
+ This removes all bundle identifiers that were automatically blocked
325
+ due to rollbacks when `autoBlockRolledBackBundles` is enabled.
326
+
327
+ Only available on Android and iOS.
328
+
329
+ **Since:** 7.4.0
330
+
331
+ --------------------
332
+
333
+
305
334
  ### deleteBundle(...)
306
335
 
307
336
  ```typescript
@@ -361,6 +390,26 @@ Only available on Android and iOS.
361
390
  --------------------
362
391
 
363
392
 
393
+ ### getBlockedBundles()
394
+
395
+ ```typescript
396
+ getBlockedBundles() => Promise<GetBlockedBundlesResult>
397
+ ```
398
+
399
+ Get all blocked bundle identifiers.
400
+
401
+ Returns the list of bundle identifiers that were automatically blocked
402
+ due to rollbacks when `autoBlockRolledBackBundles` is enabled.
403
+
404
+ Only available on Android and iOS.
405
+
406
+ **Returns:** <code>Promise&lt;<a href="#getblockedbundlesresult">GetBlockedBundlesResult</a>&gt;</code>
407
+
408
+ **Since:** 7.4.0
409
+
410
+ --------------------
411
+
412
+
364
413
  ### getBundles()
365
414
 
366
415
  ```typescript
@@ -395,6 +444,43 @@ Only available on Android and iOS.
395
444
  --------------------
396
445
 
397
446
 
447
+ ### getConfig()
448
+
449
+ ```typescript
450
+ getConfig() => Promise<GetConfigResult>
451
+ ```
452
+
453
+ Get the runtime configuration.
454
+
455
+ Returns the current plugin configuration including any runtime
456
+ overrides set via `setConfig()`.
457
+
458
+ Only available on Android and iOS.
459
+
460
+ **Returns:** <code>Promise&lt;<a href="#getconfigresult">GetConfigResult</a>&gt;</code>
461
+
462
+ **Since:** 7.4.0
463
+
464
+ --------------------
465
+
466
+
467
+ ### getDownloadedBundles()
468
+
469
+ ```typescript
470
+ getDownloadedBundles() => Promise<GetDownloadedBundlesResult>
471
+ ```
472
+
473
+ Get all identifiers of bundles that have been downloaded.
474
+
475
+ Only available on Android and iOS.
476
+
477
+ **Returns:** <code>Promise&lt;<a href="#getdownloadedbundlesresult">GetDownloadedBundlesResult</a>&gt;</code>
478
+
479
+ **Since:** 7.4.0
480
+
481
+ --------------------
482
+
483
+
398
484
  ### getCurrentBundle()
399
485
 
400
486
  ```typescript
@@ -447,6 +533,23 @@ Only available on Android and iOS.
447
533
  --------------------
448
534
 
449
535
 
536
+ ### isSyncing()
537
+
538
+ ```typescript
539
+ isSyncing() => Promise<IsSyncingResult>
540
+ ```
541
+
542
+ Check whether a sync operation is currently in progress.
543
+
544
+ Only available on Android and iOS.
545
+
546
+ **Returns:** <code>Promise&lt;<a href="#issyncingresult">IsSyncingResult</a>&gt;</code>
547
+
548
+ **Since:** 7.4.0
549
+
550
+ --------------------
551
+
552
+
450
553
  ### getNextBundle()
451
554
 
452
555
  ```typescript
@@ -558,6 +661,24 @@ Only available on Android and iOS.
558
661
  --------------------
559
662
 
560
663
 
664
+ ### resetConfig()
665
+
666
+ ```typescript
667
+ resetConfig() => Promise<void>
668
+ ```
669
+
670
+ Reset the runtime configuration to the values from the Capacitor config file.
671
+
672
+ This clears any runtime configuration set via `setConfig()`.
673
+ The changes take effect immediately.
674
+
675
+ Only available on Android and iOS.
676
+
677
+ **Since:** 7.4.0
678
+
679
+ --------------------
680
+
681
+
561
682
  ### setChannel(...)
562
683
 
563
684
  ```typescript
@@ -577,6 +698,32 @@ Only available on Android and iOS.
577
698
  --------------------
578
699
 
579
700
 
701
+ ### setConfig(...)
702
+
703
+ ```typescript
704
+ setConfig(options: SetConfigOptions) => Promise<void>
705
+ ```
706
+
707
+ Set the runtime configuration.
708
+
709
+ This allows updating plugin configuration options at runtime.
710
+ The changes are persisted across app restarts and take effect immediately.
711
+
712
+ **Important:** Runtime configuration is automatically reset to default values
713
+ whenever the native app is updated to a new version. This ensures that
714
+ configuration from previous versions doesn't persist after an app update.
715
+
716
+ Only available on Android and iOS.
717
+
718
+ | Param | Type |
719
+ | ------------- | ------------------------------------------------------------- |
720
+ | **`options`** | <code><a href="#setconfigoptions">SetConfigOptions</a></code> |
721
+
722
+ **Since:** 7.4.0
723
+
724
+ --------------------
725
+
726
+
580
727
  ### setCustomId(...)
581
728
 
582
729
  ```typescript
@@ -687,6 +834,35 @@ Only available on Android and iOS.
687
834
  --------------------
688
835
 
689
836
 
837
+ ### addListener('reloaded', ...)
838
+
839
+ ```typescript
840
+ addListener(eventName: 'reloaded', listenerFunc: ReloadedListener) => Promise<PluginListenerHandle>
841
+ ```
842
+
843
+ Listen for when the app is reloaded.
844
+
845
+ This event is triggered after the `reload()` method is called
846
+ and the app has been reloaded.
847
+
848
+ **Note:** To verify whether an update was successfully applied after a reload,
849
+ use the `ready()` method instead. The `ready()` method provides detailed information
850
+ about the current bundle, previous bundle, and whether a rollback occurred.
851
+
852
+ Only available on Android and iOS.
853
+
854
+ | Param | Type |
855
+ | ------------------ | ------------------------------------------------------------- |
856
+ | **`eventName`** | <code>'reloaded'</code> |
857
+ | **`listenerFunc`** | <code><a href="#reloadedlistener">ReloadedListener</a></code> |
858
+
859
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
860
+
861
+ **Since:** 7.4.0
862
+
863
+ --------------------
864
+
865
+
690
866
  ### removeAllListeners()
691
867
 
692
868
  ```typescript
@@ -740,6 +916,13 @@ Remove all listeners for this plugin.
740
916
  | **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
741
917
 
742
918
 
919
+ #### GetBlockedBundlesResult
920
+
921
+ | Prop | Type | Description | Since |
922
+ | --------------- | --------------------- | ------------------------------------------------------ | ----- |
923
+ | **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all blocked bundles. | 7.4.0 |
924
+
925
+
743
926
  #### GetBundlesResult
744
927
 
745
928
  | Prop | Type | Description | Since |
@@ -754,6 +937,21 @@ Remove all listeners for this plugin.
754
937
  | **`channel`** | <code>string \| null</code> | The channel name. If `null`, the app is using the default channel. | 5.0.0 |
755
938
 
756
939
 
940
+ #### GetConfigResult
941
+
942
+ | Prop | Type | Description | Since |
943
+ | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------ | ----- |
944
+ | **`appId`** | <code>string \| null</code> | The app ID used to identify the app. If `null`, no app ID is configured. | 7.4.0 |
945
+ | **`autoUpdateStrategy`** | <code>'none' \| 'background'</code> | The auto-update strategy for live updates. | 7.4.0 |
946
+
947
+
948
+ #### GetDownloadedBundlesResult
949
+
950
+ | Prop | Type | Description | Since |
951
+ | --------------- | --------------------- | --------------------------------------------------------- | ----- |
952
+ | **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all downloaded bundles. | 7.4.0 |
953
+
954
+
757
955
  #### GetCurrentBundleResult
758
956
 
759
957
  | Prop | Type | Description | Since |
@@ -775,6 +973,13 @@ Remove all listeners for this plugin.
775
973
  | **`deviceId`** | <code>string</code> | The unique identifier of the device. On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used. The value of this property is the same for apps that come from the same vendor running on the same device. | 5.0.0 |
776
974
 
777
975
 
976
+ #### IsSyncingResult
977
+
978
+ | Prop | Type | Description | Since |
979
+ | ------------- | -------------------- | -------------------------------------------------- | ----- |
980
+ | **`syncing`** | <code>boolean</code> | Whether a sync operation is currently in progress. | 7.4.0 |
981
+
982
+
778
983
  #### GetNextBundleResult
779
984
 
780
985
  | Prop | Type | Description | Since |
@@ -812,6 +1017,13 @@ Remove all listeners for this plugin.
812
1017
  | **`channel`** | <code>string \| null</code> | The channel name. Set `null` to remove the channel. | 5.0.0 |
813
1018
 
814
1019
 
1020
+ #### SetConfigOptions
1021
+
1022
+ | Prop | Type | Description | Since |
1023
+ | ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------- | ----- |
1024
+ | **`appId`** | <code>string \| null</code> | The app ID used to identify the app. Set `null` to reset to the value from the Capacitor config file. | 7.4.0 |
1025
+
1026
+
815
1027
  #### SetCustomIdOptions
816
1028
 
817
1029
  | Prop | Type | Description | Since |
@@ -884,6 +1096,13 @@ Listener for when a bundle is set as the next bundle.
884
1096
 
885
1097
  <code>(event: <a href="#nextbundlesetevent">NextBundleSetEvent</a>): void</code>
886
1098
 
1099
+
1100
+ #### ReloadedListener
1101
+
1102
+ Listener for when the app is reloaded.
1103
+
1104
+ <code>(): void</code>
1105
+
887
1106
  </docgen-api>
888
1107
 
889
1108
  ## Testing
@@ -5,6 +5,7 @@ ext {
5
5
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
6
  okhttp3Version = project.hasProperty('okhttp3Version') ? rootProject.ext.okhttp3Version : '4.12.0'
7
7
  zip4jVersion = project.hasProperty('zip4jVersion') ? rootProject.ext.zip4jVersion : '2.11.5'
8
+ conscryptVersion = project.hasProperty('conscryptVersion') ? rootProject.ext.conscryptVersion : '2.5.3'
8
9
  }
9
10
 
10
11
  buildscript {
@@ -56,6 +57,7 @@ dependencies {
56
57
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
57
58
  implementation "net.lingala.zip4j:zip4j:$zip4jVersion"
58
59
  implementation "com.squareup.okhttp3:okhttp:$okhttp3Version"
60
+ implementation "org.conscrypt:conscrypt-android:$conscryptVersion"
59
61
  testImplementation "junit:junit:$junitVersion"
60
62
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
61
63
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"