@capawesome/capacitor-live-update 7.3.0 → 8.0.0

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 (33) hide show
  1. package/CapawesomeCapacitorLiveUpdate.podspec +3 -3
  2. package/Package.swift +4 -4
  3. package/README.md +235 -3
  4. package/android/build.gradle +10 -10
  5. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +519 -246
  6. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateHttpClient.java +33 -5
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +134 -3
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +25 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +2 -2
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetConfigOptions.java +19 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +27 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +27 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/IsSyncingResult.java +26 -0
  15. package/dist/docs.json +319 -0
  16. package/dist/esm/definitions.d.ts +167 -2
  17. package/dist/esm/definitions.js.map +1 -1
  18. package/dist/esm/web.d.ts +8 -1
  19. package/dist/esm/web.js +21 -0
  20. package/dist/esm/web.js.map +1 -1
  21. package/dist/plugin.cjs.js +21 -0
  22. package/dist/plugin.cjs.js.map +1 -1
  23. package/dist/plugin.js +21 -0
  24. package/dist/plugin.js.map +1 -1
  25. package/ios/Plugin/Classes/Options/SetConfigOptions.swift +14 -0
  26. package/ios/Plugin/Classes/Results/GetBlockedBundlesResult.swift +16 -0
  27. package/ios/Plugin/Classes/Results/GetConfigResult.swift +19 -0
  28. package/ios/Plugin/Classes/Results/GetDownloadedBundlesResult.swift +16 -0
  29. package/ios/Plugin/Classes/Results/IsSyncingResult.swift +16 -0
  30. package/ios/Plugin/LiveUpdate.swift +77 -4
  31. package/ios/Plugin/LiveUpdatePlugin.swift +78 -1
  32. package/ios/Plugin/LiveUpdatePreferences.swift +44 -2
  33. package/package.json +10 -10
@@ -11,10 +11,10 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '14.0'
14
+ s.ios.deployment_target = '16.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'Alamofire', '~> 5.9'
17
- s.dependency 'SSZipArchive', '~> 2.2.3'
16
+ s.dependency 'Alamofire', '~> 5.10.2'
17
+ s.dependency 'SSZipArchive', '~> 2.6.0'
18
18
  s.swift_version = '5.1'
19
19
  s.static_framework = true
20
20
  end
package/Package.swift CHANGED
@@ -3,16 +3,16 @@ import PackageDescription
3
3
 
4
4
  let package = Package(
5
5
  name: "CapawesomeCapacitorLiveUpdate",
6
- platforms: [.iOS(.v14)],
6
+ platforms: [.iOS(.v16)],
7
7
  products: [
8
8
  .library(
9
9
  name: "CapawesomeCapacitorLiveUpdate",
10
10
  targets: ["LiveUpdatePlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
14
- .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.9.0")),
15
- .package(url: "https://github.com/ZipArchive/ZipArchive.git", .upToNextMinor(from: "2.4.0"))
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
+ .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMinor(from: "5.10.2")),
15
+ .package(url: "https://github.com/ZipArchive/ZipArchive.git", .upToNextMinor(from: "2.6.0"))
16
16
  ],
17
17
  targets: [
18
18
  .target(
package/README.md CHANGED
@@ -31,8 +31,9 @@ Missing a feature? Just [open an issue](https://github.com/capawesome-team/capac
31
31
 
32
32
  | Plugin Version | Capacitor Version | Status |
33
33
  | -------------- | ----------------- | -------------- |
34
- | 7.x.x | >=7.x.x | Active support |
35
- | 6.x.x | 6.x.x | Maintenance |
34
+ | 8.x.x | >=8.x.x | Active support |
35
+ | 7.x.x | 7.x.x | Maintenance |
36
+ | 6.x.x | 6.x.x | Deprecated |
36
37
  | 5.x.x | 5.x.x | Deprecated |
37
38
 
38
39
  ## Guides
@@ -58,7 +59,7 @@ npx cap sync
58
59
 
59
60
  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
61
 
61
- - `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `22.3.1`)
62
+ - `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `5.3.2`)
62
63
  - `$zip4jVersion` version of `net.lingala.zip4j:zip4j` (default: `2.11.5`)
63
64
 
64
65
  This can be useful if you encounter dependency conflicts with other plugins in your project.
@@ -92,6 +93,21 @@ Add the `NSPrivacyAccessedAPICategoryUserDefaults` dictionary key to your [Priva
92
93
 
93
94
  We recommend to declare [`CA92.1`](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401) as the reason for accessing the [`UserDefaults`](https://developer.apple.com/documentation/foundation/userdefaults) API.
94
95
 
96
+ #### Minimum Deployment Target
97
+
98
+ If you are using **Swift Package Manager**, make sure that your iOS deployment target is set to at least `16.0` in your Xcode project settings (usually in `ios/App/App.xcodeproj`):
99
+
100
+ ```diff
101
+ -IPHONEOS_DEPLOYMENT_TARGET = 15.0
102
+ +IPHONEOS_DEPLOYMENT_TARGET = 16.0
103
+ ```
104
+
105
+ If you are using **CocoaPods**, make sure that your iOS deployment target is set to at least `16.0` in your `Podfile`:
106
+
107
+ ```ruby
108
+ platform :ios, '16.0'
109
+ ```
110
+
95
111
  ## Configuration
96
112
 
97
113
  <docgen-config>
@@ -273,26 +289,34 @@ const isNewBundleAvailable = async () => {
273
289
 
274
290
  <docgen-index>
275
291
 
292
+ * [`clearBlockedBundles()`](#clearblockedbundles)
276
293
  * [`deleteBundle(...)`](#deletebundle)
277
294
  * [`downloadBundle(...)`](#downloadbundle)
278
295
  * [`fetchLatestBundle(...)`](#fetchlatestbundle)
296
+ * [`getBlockedBundles()`](#getblockedbundles)
279
297
  * [`getBundles()`](#getbundles)
280
298
  * [`getChannel()`](#getchannel)
299
+ * [`getConfig()`](#getconfig)
300
+ * [`getDownloadedBundles()`](#getdownloadedbundles)
281
301
  * [`getCurrentBundle()`](#getcurrentbundle)
282
302
  * [`getCustomId()`](#getcustomid)
283
303
  * [`getDeviceId()`](#getdeviceid)
304
+ * [`isSyncing()`](#issyncing)
284
305
  * [`getNextBundle()`](#getnextbundle)
285
306
  * [`getVersionCode()`](#getversioncode)
286
307
  * [`getVersionName()`](#getversionname)
287
308
  * [`ready()`](#ready)
288
309
  * [`reload()`](#reload)
289
310
  * [`reset()`](#reset)
311
+ * [`resetConfig()`](#resetconfig)
290
312
  * [`setChannel(...)`](#setchannel)
313
+ * [`setConfig(...)`](#setconfig)
291
314
  * [`setCustomId(...)`](#setcustomid)
292
315
  * [`setNextBundle(...)`](#setnextbundle)
293
316
  * [`sync(...)`](#sync)
294
317
  * [`addListener('downloadBundleProgress', ...)`](#addlistenerdownloadbundleprogress-)
295
318
  * [`addListener('nextBundleSet', ...)`](#addlistenernextbundleset-)
319
+ * [`addListener('reloaded', ...)`](#addlistenerreloaded-)
296
320
  * [`removeAllListeners()`](#removealllisteners)
297
321
  * [Interfaces](#interfaces)
298
322
  * [Type Aliases](#type-aliases)
@@ -302,6 +326,24 @@ const isNewBundleAvailable = async () => {
302
326
  <docgen-api>
303
327
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
304
328
 
329
+ ### clearBlockedBundles()
330
+
331
+ ```typescript
332
+ clearBlockedBundles() => Promise<void>
333
+ ```
334
+
335
+ Clear all blocked bundles from the blocked list.
336
+
337
+ This removes all bundle identifiers that were automatically blocked
338
+ due to rollbacks when `autoBlockRolledBackBundles` is enabled.
339
+
340
+ Only available on Android and iOS.
341
+
342
+ **Since:** 7.4.0
343
+
344
+ --------------------
345
+
346
+
305
347
  ### deleteBundle(...)
306
348
 
307
349
  ```typescript
@@ -361,6 +403,26 @@ Only available on Android and iOS.
361
403
  --------------------
362
404
 
363
405
 
406
+ ### getBlockedBundles()
407
+
408
+ ```typescript
409
+ getBlockedBundles() => Promise<GetBlockedBundlesResult>
410
+ ```
411
+
412
+ Get all blocked bundle identifiers.
413
+
414
+ Returns the list of bundle identifiers that were automatically blocked
415
+ due to rollbacks when `autoBlockRolledBackBundles` is enabled.
416
+
417
+ Only available on Android and iOS.
418
+
419
+ **Returns:** <code>Promise&lt;<a href="#getblockedbundlesresult">GetBlockedBundlesResult</a>&gt;</code>
420
+
421
+ **Since:** 7.4.0
422
+
423
+ --------------------
424
+
425
+
364
426
  ### getBundles()
365
427
 
366
428
  ```typescript
@@ -395,6 +457,43 @@ Only available on Android and iOS.
395
457
  --------------------
396
458
 
397
459
 
460
+ ### getConfig()
461
+
462
+ ```typescript
463
+ getConfig() => Promise<GetConfigResult>
464
+ ```
465
+
466
+ Get the runtime configuration.
467
+
468
+ Returns the current plugin configuration including any runtime
469
+ overrides set via `setConfig()`.
470
+
471
+ Only available on Android and iOS.
472
+
473
+ **Returns:** <code>Promise&lt;<a href="#getconfigresult">GetConfigResult</a>&gt;</code>
474
+
475
+ **Since:** 7.4.0
476
+
477
+ --------------------
478
+
479
+
480
+ ### getDownloadedBundles()
481
+
482
+ ```typescript
483
+ getDownloadedBundles() => Promise<GetDownloadedBundlesResult>
484
+ ```
485
+
486
+ Get all identifiers of bundles that have been downloaded.
487
+
488
+ Only available on Android and iOS.
489
+
490
+ **Returns:** <code>Promise&lt;<a href="#getdownloadedbundlesresult">GetDownloadedBundlesResult</a>&gt;</code>
491
+
492
+ **Since:** 7.4.0
493
+
494
+ --------------------
495
+
496
+
398
497
  ### getCurrentBundle()
399
498
 
400
499
  ```typescript
@@ -447,6 +546,23 @@ Only available on Android and iOS.
447
546
  --------------------
448
547
 
449
548
 
549
+ ### isSyncing()
550
+
551
+ ```typescript
552
+ isSyncing() => Promise<IsSyncingResult>
553
+ ```
554
+
555
+ Check whether a sync operation is currently in progress.
556
+
557
+ Only available on Android and iOS.
558
+
559
+ **Returns:** <code>Promise&lt;<a href="#issyncingresult">IsSyncingResult</a>&gt;</code>
560
+
561
+ **Since:** 7.4.0
562
+
563
+ --------------------
564
+
565
+
450
566
  ### getNextBundle()
451
567
 
452
568
  ```typescript
@@ -558,6 +674,24 @@ Only available on Android and iOS.
558
674
  --------------------
559
675
 
560
676
 
677
+ ### resetConfig()
678
+
679
+ ```typescript
680
+ resetConfig() => Promise<void>
681
+ ```
682
+
683
+ Reset the runtime configuration to the values from the Capacitor config file.
684
+
685
+ This clears any runtime configuration set via `setConfig()`.
686
+ The changes take effect immediately.
687
+
688
+ Only available on Android and iOS.
689
+
690
+ **Since:** 7.4.0
691
+
692
+ --------------------
693
+
694
+
561
695
  ### setChannel(...)
562
696
 
563
697
  ```typescript
@@ -577,6 +711,32 @@ Only available on Android and iOS.
577
711
  --------------------
578
712
 
579
713
 
714
+ ### setConfig(...)
715
+
716
+ ```typescript
717
+ setConfig(options: SetConfigOptions) => Promise<void>
718
+ ```
719
+
720
+ Set the runtime configuration.
721
+
722
+ This allows updating plugin configuration options at runtime.
723
+ The changes are persisted across app restarts and take effect immediately.
724
+
725
+ **Important:** Runtime configuration is automatically reset to default values
726
+ whenever the native app is updated to a new version. This ensures that
727
+ configuration from previous versions doesn't persist after an app update.
728
+
729
+ Only available on Android and iOS.
730
+
731
+ | Param | Type |
732
+ | ------------- | ------------------------------------------------------------- |
733
+ | **`options`** | <code><a href="#setconfigoptions">SetConfigOptions</a></code> |
734
+
735
+ **Since:** 7.4.0
736
+
737
+ --------------------
738
+
739
+
580
740
  ### setCustomId(...)
581
741
 
582
742
  ```typescript
@@ -687,6 +847,35 @@ Only available on Android and iOS.
687
847
  --------------------
688
848
 
689
849
 
850
+ ### addListener('reloaded', ...)
851
+
852
+ ```typescript
853
+ addListener(eventName: 'reloaded', listenerFunc: ReloadedListener) => Promise<PluginListenerHandle>
854
+ ```
855
+
856
+ Listen for when the app is reloaded.
857
+
858
+ This event is triggered after the `reload()` method is called
859
+ and the app has been reloaded.
860
+
861
+ **Note:** To verify whether an update was successfully applied after a reload,
862
+ use the `ready()` method instead. The `ready()` method provides detailed information
863
+ about the current bundle, previous bundle, and whether a rollback occurred.
864
+
865
+ Only available on Android and iOS.
866
+
867
+ | Param | Type |
868
+ | ------------------ | ------------------------------------------------------------- |
869
+ | **`eventName`** | <code>'reloaded'</code> |
870
+ | **`listenerFunc`** | <code><a href="#reloadedlistener">ReloadedListener</a></code> |
871
+
872
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
873
+
874
+ **Since:** 7.4.0
875
+
876
+ --------------------
877
+
878
+
690
879
  ### removeAllListeners()
691
880
 
692
881
  ```typescript
@@ -740,6 +929,13 @@ Remove all listeners for this plugin.
740
929
  | **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
741
930
 
742
931
 
932
+ #### GetBlockedBundlesResult
933
+
934
+ | Prop | Type | Description | Since |
935
+ | --------------- | --------------------- | ------------------------------------------------------ | ----- |
936
+ | **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all blocked bundles. | 7.4.0 |
937
+
938
+
743
939
  #### GetBundlesResult
744
940
 
745
941
  | Prop | Type | Description | Since |
@@ -754,6 +950,21 @@ Remove all listeners for this plugin.
754
950
  | **`channel`** | <code>string \| null</code> | The channel name. If `null`, the app is using the default channel. | 5.0.0 |
755
951
 
756
952
 
953
+ #### GetConfigResult
954
+
955
+ | Prop | Type | Description | Since |
956
+ | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------ | ----- |
957
+ | **`appId`** | <code>string \| null</code> | The app ID used to identify the app. If `null`, no app ID is configured. | 7.4.0 |
958
+ | **`autoUpdateStrategy`** | <code>'none' \| 'background'</code> | The auto-update strategy for live updates. | 7.4.0 |
959
+
960
+
961
+ #### GetDownloadedBundlesResult
962
+
963
+ | Prop | Type | Description | Since |
964
+ | --------------- | --------------------- | --------------------------------------------------------- | ----- |
965
+ | **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all downloaded bundles. | 7.4.0 |
966
+
967
+
757
968
  #### GetCurrentBundleResult
758
969
 
759
970
  | Prop | Type | Description | Since |
@@ -775,6 +986,13 @@ Remove all listeners for this plugin.
775
986
  | **`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
987
 
777
988
 
989
+ #### IsSyncingResult
990
+
991
+ | Prop | Type | Description | Since |
992
+ | ------------- | -------------------- | -------------------------------------------------- | ----- |
993
+ | **`syncing`** | <code>boolean</code> | Whether a sync operation is currently in progress. | 7.4.0 |
994
+
995
+
778
996
  #### GetNextBundleResult
779
997
 
780
998
  | Prop | Type | Description | Since |
@@ -812,6 +1030,13 @@ Remove all listeners for this plugin.
812
1030
  | **`channel`** | <code>string \| null</code> | The channel name. Set `null` to remove the channel. | 5.0.0 |
813
1031
 
814
1032
 
1033
+ #### SetConfigOptions
1034
+
1035
+ | Prop | Type | Description | Since |
1036
+ | ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------- | ----- |
1037
+ | **`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 |
1038
+
1039
+
815
1040
  #### SetCustomIdOptions
816
1041
 
817
1042
  | Prop | Type | Description | Since |
@@ -884,6 +1109,13 @@ Listener for when a bundle is set as the next bundle.
884
1109
 
885
1110
  <code>(event: <a href="#nextbundlesetevent">NextBundleSetEvent</a>): void</code>
886
1111
 
1112
+
1113
+ #### ReloadedListener
1114
+
1115
+ Listener for when the app is reloaded.
1116
+
1117
+ <code>(): void</code>
1118
+
887
1119
  </docgen-api>
888
1120
 
889
1121
  ## Testing
@@ -1,9 +1,9 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
- okhttp3Version = project.hasProperty('okhttp3Version') ? rootProject.ext.okhttp3Version : '4.12.0'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
6
+ okhttp3Version = project.hasProperty('okhttp3Version') ? rootProject.ext.okhttp3Version : '5.3.2'
7
7
  zip4jVersion = project.hasProperty('zip4jVersion') ? rootProject.ext.zip4jVersion : '2.11.5'
8
8
  }
9
9
 
@@ -13,18 +13,18 @@ buildscript {
13
13
  mavenCentral()
14
14
  }
15
15
  dependencies {
16
- classpath 'com.android.tools.build:gradle:8.7.2'
16
+ classpath 'com.android.tools.build:gradle:8.13.0'
17
17
  }
18
18
  }
19
19
 
20
20
  apply plugin: 'com.android.library'
21
21
 
22
22
  android {
23
- namespace "io.capawesome.capacitorjs.plugins.liveupdate"
24
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
23
+ namespace = "io.capawesome.capacitorjs.plugins.liveupdate"
24
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
25
25
  defaultConfig {
26
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
27
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
26
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
27
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
28
28
  versionCode 1
29
29
  versionName "1.0"
30
30
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,7 +36,7 @@ android {
36
36
  }
37
37
  }
38
38
  lintOptions {
39
- abortOnError false
39
+ abortOnError = false
40
40
  }
41
41
  compileOptions {
42
42
  sourceCompatibility JavaVersion.VERSION_21