@capawesome/capacitor-live-update 6.6.0 → 6.7.1

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 (30) hide show
  1. package/README.md +147 -40
  2. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +53 -7
  3. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +76 -3
  4. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +3 -0
  5. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/FetchLatestBundleOptions.java +24 -0
  6. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetNextBundleOptions.java +20 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SyncOptions.java +20 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +21 -2
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetCurrentBundleResult.java +22 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetNextBundleResult.java +22 -0
  11. package/dist/docs.json +254 -17
  12. package/dist/esm/definitions.d.ts +118 -12
  13. package/dist/esm/definitions.js.map +1 -1
  14. package/dist/esm/web.d.ts +4 -1
  15. package/dist/esm/web.js +9 -0
  16. package/dist/esm/web.js.map +1 -1
  17. package/dist/plugin.cjs.js +9 -0
  18. package/dist/plugin.cjs.js.map +1 -1
  19. package/dist/plugin.js +9 -0
  20. package/dist/plugin.js.map +1 -1
  21. package/ios/Plugin/Classes/Options/FetchLatestBundleOptions.swift +18 -0
  22. package/ios/Plugin/Classes/Options/SetNextBundleOptions.swift +14 -0
  23. package/ios/Plugin/Classes/Options/SyncOptions.swift +14 -0
  24. package/ios/Plugin/Classes/Results/FetchLatestBundle.swift +14 -2
  25. package/ios/Plugin/Classes/Results/GetCurrentBundleResult.swift +16 -0
  26. package/ios/Plugin/Classes/Results/GetNextBundleResult.swift +16 -0
  27. package/ios/Plugin/LiveUpdate.swift +46 -7
  28. package/ios/Plugin/LiveUpdatePlugin.m +4 -1
  29. package/ios/Plugin/LiveUpdatePlugin.swift +66 -21
  30. package/package.json +2 -2
@@ -0,0 +1,20 @@
1
+ package io.capawesome.capacitorjs.plugins.liveupdate.classes.options;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
5
+ import com.getcapacitor.PluginCall;
6
+
7
+ public class SetNextBundleOptions {
8
+
9
+ @Nullable
10
+ private final String bundleId;
11
+
12
+ public SetNextBundleOptions(@NonNull PluginCall call) {
13
+ this.bundleId = call.getString("bundleId");
14
+ }
15
+
16
+ @Nullable
17
+ public String getBundleId() {
18
+ return bundleId;
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ package io.capawesome.capacitorjs.plugins.liveupdate.classes.options;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
5
+ import com.getcapacitor.PluginCall;
6
+
7
+ public class SyncOptions {
8
+
9
+ @Nullable
10
+ private final String channel;
11
+
12
+ public SyncOptions(@NonNull PluginCall call) {
13
+ this.channel = call.getString("channel", null);
14
+ }
15
+
16
+ @Nullable
17
+ public String getChannel() {
18
+ return channel;
19
+ }
20
+ }
@@ -1,22 +1,41 @@
1
1
  package io.capawesome.capacitorjs.plugins.liveupdate.classes.results;
2
2
 
3
+ import androidx.annotation.NonNull;
3
4
  import androidx.annotation.Nullable;
4
5
  import com.getcapacitor.JSObject;
6
+ import io.capawesome.capacitorjs.plugins.liveupdate.enums.ArtifactType;
5
7
  import io.capawesome.capacitorjs.plugins.liveupdate.interfaces.Result;
6
8
  import org.json.JSONObject;
7
9
 
8
10
  public class FetchLatestBundleResult implements Result {
9
11
 
10
12
  @Nullable
11
- private String bundleId;
13
+ private final ArtifactType artifactType;
12
14
 
13
- public FetchLatestBundleResult(@Nullable String bundleId) {
15
+ @Nullable
16
+ private final String bundleId;
17
+
18
+ @Nullable
19
+ private final String downloadUrl;
20
+
21
+ public FetchLatestBundleResult(@Nullable ArtifactType artifactType, @Nullable String bundleId, @Nullable String downloadUrl) {
22
+ this.artifactType = artifactType;
14
23
  this.bundleId = bundleId;
24
+ this.downloadUrl = downloadUrl;
15
25
  }
16
26
 
27
+ @NonNull
17
28
  public JSObject toJSObject() {
18
29
  JSObject result = new JSObject();
30
+ if (artifactType == ArtifactType.MANIFEST) {
31
+ result.put("artifactType", "manifest");
32
+ } else if (artifactType == ArtifactType.ZIP) {
33
+ result.put("artifactType", "zip");
34
+ }
19
35
  result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
36
+ if (downloadUrl != null) {
37
+ result.put("downloadUrl", downloadUrl);
38
+ }
20
39
  return result;
21
40
  }
22
41
  }
@@ -0,0 +1,22 @@
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.interfaces.Result;
6
+ import org.json.JSONObject;
7
+
8
+ public class GetCurrentBundleResult implements Result {
9
+
10
+ @Nullable
11
+ private String bundleId;
12
+
13
+ public GetCurrentBundleResult(@Nullable String bundleId) {
14
+ this.bundleId = bundleId;
15
+ }
16
+
17
+ public JSObject toJSObject() {
18
+ JSObject result = new JSObject();
19
+ result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
20
+ return result;
21
+ }
22
+ }
@@ -0,0 +1,22 @@
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.interfaces.Result;
6
+ import org.json.JSONObject;
7
+
8
+ public class GetNextBundleResult implements Result {
9
+
10
+ @Nullable
11
+ private String bundleId;
12
+
13
+ public GetNextBundleResult(@Nullable String bundleId) {
14
+ this.bundleId = bundleId;
15
+ }
16
+
17
+ public JSObject toJSObject() {
18
+ JSObject result = new JSObject();
19
+ result.put("bundleId", bundleId == null ? JSONObject.NULL : bundleId);
20
+ return result;
21
+ }
22
+ }
package/dist/docs.json CHANGED
@@ -53,8 +53,14 @@
53
53
  },
54
54
  {
55
55
  "name": "fetchLatestBundle",
56
- "signature": "() => Promise<FetchLatestBundleResult>",
57
- "parameters": [],
56
+ "signature": "(options?: FetchLatestBundleOptions | undefined) => Promise<FetchLatestBundleResult>",
57
+ "parameters": [
58
+ {
59
+ "name": "options",
60
+ "docs": "",
61
+ "type": "FetchLatestBundleOptions | undefined"
62
+ }
63
+ ],
58
64
  "returns": "Promise<FetchLatestBundleResult>",
59
65
  "tags": [
60
66
  {
@@ -64,7 +70,8 @@
64
70
  ],
65
71
  "docs": "Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).\n\nOnly available on Android and iOS.",
66
72
  "complexTypes": [
67
- "FetchLatestBundleResult"
73
+ "FetchLatestBundleResult",
74
+ "FetchLatestBundleOptions"
68
75
  ],
69
76
  "slug": "fetchlatestbundle"
70
77
  },
@@ -77,6 +84,10 @@
77
84
  {
78
85
  "name": "since",
79
86
  "text": "5.0.0"
87
+ },
88
+ {
89
+ "name": "deprecated",
90
+ "text": "Use `getCurrentBundle()` instead."
80
91
  }
81
92
  ],
82
93
  "docs": "Get the active bundle identifier.\n\nOnly available on Android and iOS.",
@@ -113,12 +124,29 @@
113
124
  "text": "5.0.0"
114
125
  }
115
126
  ],
116
- "docs": "Get the channel of the app.\n\nOnly available on Android and iOS.",
127
+ "docs": "Get the channel that is used for the update.\n\nOnly available on Android and iOS.",
117
128
  "complexTypes": [
118
129
  "GetChannelResult"
119
130
  ],
120
131
  "slug": "getchannel"
121
132
  },
133
+ {
134
+ "name": "getCurrentBundle",
135
+ "signature": "() => Promise<GetCurrentBundleResult>",
136
+ "parameters": [],
137
+ "returns": "Promise<GetCurrentBundleResult>",
138
+ "tags": [
139
+ {
140
+ "name": "since",
141
+ "text": "6.7.0"
142
+ }
143
+ ],
144
+ "docs": "Get the bundle identifier of the current bundle.\nThe current bundle is the bundle that is currently used by the app.\n\nOnly available on Android and iOS.",
145
+ "complexTypes": [
146
+ "GetCurrentBundleResult"
147
+ ],
148
+ "slug": "getcurrentbundle"
149
+ },
122
150
  {
123
151
  "name": "getCustomId",
124
152
  "signature": "() => Promise<GetCustomIdResult>",
@@ -130,7 +158,7 @@
130
158
  "text": "5.0.0"
131
159
  }
132
160
  ],
133
- "docs": "Get the custom identifier of the app.\n\nOnly available on Android and iOS.",
161
+ "docs": "Get the custom identifier of the device.\n\nOnly available on Android and iOS.",
134
162
  "complexTypes": [
135
163
  "GetCustomIdResult"
136
164
  ],
@@ -147,12 +175,29 @@
147
175
  "text": "5.0.0"
148
176
  }
149
177
  ],
150
- "docs": "Get the device identifier of the app.\n\nOnly available on Android and iOS.",
178
+ "docs": "Get the unique device identifier.\n\nOnly available on Android and iOS.",
151
179
  "complexTypes": [
152
180
  "GetDeviceIdResult"
153
181
  ],
154
182
  "slug": "getdeviceid"
155
183
  },
184
+ {
185
+ "name": "getNextBundle",
186
+ "signature": "() => Promise<GetNextBundleResult>",
187
+ "parameters": [],
188
+ "returns": "Promise<GetNextBundleResult>",
189
+ "tags": [
190
+ {
191
+ "name": "since",
192
+ "text": "6.7.0"
193
+ }
194
+ ],
195
+ "docs": "Get the bundle identifier of the next bundle.\nThe next bundle is the bundle that will be used after calling `reload()`\nor restarting the app.\n\nOnly available on Android and iOS.",
196
+ "complexTypes": [
197
+ "GetNextBundleResult"
198
+ ],
199
+ "slug": "getnextbundle"
200
+ },
156
201
  {
157
202
  "name": "getVersionCode",
158
203
  "signature": "() => Promise<GetVersionCodeResult>",
@@ -247,6 +292,10 @@
247
292
  {
248
293
  "name": "since",
249
294
  "text": "5.0.0"
295
+ },
296
+ {
297
+ "name": "deprecated",
298
+ "text": "Use `setNextBundle()` instead."
250
299
  }
251
300
  ],
252
301
  "docs": "Set the next bundle to use for the app.\n\nCall `reload()` or restart the app to apply the changes.\n\nOnly available on Android and iOS.",
@@ -272,7 +321,7 @@
272
321
  "text": "5.0.0"
273
322
  }
274
323
  ],
275
- "docs": "Set the channel of the app.\n\nOnly available on Android and iOS.",
324
+ "docs": "Set the channel to use for the update.\n\nOnly available on Android and iOS.",
276
325
  "complexTypes": [
277
326
  "SetChannelOptions"
278
327
  ],
@@ -295,16 +344,45 @@
295
344
  "text": "5.0.0"
296
345
  }
297
346
  ],
298
- "docs": "Set the custom identifier of the app.\n\nOnly available on Android and iOS.",
347
+ "docs": "Set the custom identifier of the device.\n\nOnly available on Android and iOS.",
299
348
  "complexTypes": [
300
349
  "SetCustomIdOptions"
301
350
  ],
302
351
  "slug": "setcustomid"
303
352
  },
353
+ {
354
+ "name": "setNextBundle",
355
+ "signature": "(options: SetNextBundleOptions) => Promise<void>",
356
+ "parameters": [
357
+ {
358
+ "name": "options",
359
+ "docs": "",
360
+ "type": "SetNextBundleOptions"
361
+ }
362
+ ],
363
+ "returns": "Promise<void>",
364
+ "tags": [
365
+ {
366
+ "name": "since",
367
+ "text": "6.7.0"
368
+ }
369
+ ],
370
+ "docs": "Set the next bundle to use for the app.\n\nCall `reload()` or restart the app to apply the changes.\n\nOnly available on Android and iOS.",
371
+ "complexTypes": [
372
+ "SetNextBundleOptions"
373
+ ],
374
+ "slug": "setnextbundle"
375
+ },
304
376
  {
305
377
  "name": "sync",
306
- "signature": "() => Promise<SyncResult>",
307
- "parameters": [],
378
+ "signature": "(options?: SyncOptions | undefined) => Promise<SyncResult>",
379
+ "parameters": [
380
+ {
381
+ "name": "options",
382
+ "docs": "",
383
+ "type": "SyncOptions | undefined"
384
+ }
385
+ ],
308
386
  "returns": "Promise<SyncResult>",
309
387
  "tags": [
310
388
  {
@@ -314,7 +392,8 @@
314
392
  ],
315
393
  "docs": "Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).\n\nCall `reload()` or restart the app to apply the changes.\n\nOnly available on Android and iOS.",
316
394
  "complexTypes": [
317
- "SyncResult"
395
+ "SyncResult",
396
+ "SyncOptions"
318
397
  ],
319
398
  "slug": "sync"
320
399
  }
@@ -441,6 +520,18 @@
441
520
  ],
442
521
  "methods": [],
443
522
  "properties": [
523
+ {
524
+ "name": "artifactType",
525
+ "tags": [
526
+ {
527
+ "text": "6.7.0",
528
+ "name": "since"
529
+ }
530
+ ],
531
+ "docs": "The artifact type of the bundle.",
532
+ "complexTypes": [],
533
+ "type": "'manifest' | 'zip' | undefined"
534
+ },
444
535
  {
445
536
  "name": "bundleId",
446
537
  "tags": [
@@ -452,6 +543,44 @@
452
543
  "docs": "The unique identifier of the latest bundle.\n\nIf `null`, no bundle is available.",
453
544
  "complexTypes": [],
454
545
  "type": "string | null"
546
+ },
547
+ {
548
+ "name": "downloadUrl",
549
+ "tags": [
550
+ {
551
+ "text": "6.7.0",
552
+ "name": "since"
553
+ }
554
+ ],
555
+ "docs": "The URL of the latest bundle to download.\nPass this URL to the `downloadBundle(...)` method to download the bundle.",
556
+ "complexTypes": [],
557
+ "type": "string | undefined"
558
+ }
559
+ ]
560
+ },
561
+ {
562
+ "name": "FetchLatestBundleOptions",
563
+ "slug": "fetchlatestbundleoptions",
564
+ "docs": "",
565
+ "tags": [
566
+ {
567
+ "text": "6.7.0",
568
+ "name": "since"
569
+ }
570
+ ],
571
+ "methods": [],
572
+ "properties": [
573
+ {
574
+ "name": "channel",
575
+ "tags": [
576
+ {
577
+ "text": "6.7.0",
578
+ "name": "since"
579
+ }
580
+ ],
581
+ "docs": "The name of the channel where the latest bundle is fetched from.",
582
+ "complexTypes": [],
583
+ "type": "string | undefined"
455
584
  }
456
585
  ]
457
586
  },
@@ -535,7 +664,33 @@
535
664
  "name": "example"
536
665
  }
537
666
  ],
538
- "docs": "The channel of the app.\n\nIf `null`, the app is using the default channel.",
667
+ "docs": "The channel name.\n\nIf `null`, the app is using the default channel.",
668
+ "complexTypes": [],
669
+ "type": "string | null"
670
+ }
671
+ ]
672
+ },
673
+ {
674
+ "name": "GetCurrentBundleResult",
675
+ "slug": "getcurrentbundleresult",
676
+ "docs": "",
677
+ "tags": [
678
+ {
679
+ "text": "6.7.0",
680
+ "name": "since"
681
+ }
682
+ ],
683
+ "methods": [],
684
+ "properties": [
685
+ {
686
+ "name": "bundleId",
687
+ "tags": [
688
+ {
689
+ "text": "6.7.0",
690
+ "name": "since"
691
+ }
692
+ ],
693
+ "docs": "The unique identifier of the current bundle.\n\nIf `null`, the default bundle is being used.",
539
694
  "complexTypes": [],
540
695
  "type": "string | null"
541
696
  }
@@ -565,7 +720,7 @@
565
720
  "name": "example"
566
721
  }
567
722
  ],
568
- "docs": "The custom identifier of the app.\n\nIf `null`, no custom identifier is set.",
723
+ "docs": "The custom identifier of the device.\n\nIf `null`, no custom identifier is set.",
569
724
  "complexTypes": [],
570
725
  "type": "string | null"
571
726
  }
@@ -601,6 +756,32 @@
601
756
  }
602
757
  ]
603
758
  },
759
+ {
760
+ "name": "GetNextBundleResult",
761
+ "slug": "getnextbundleresult",
762
+ "docs": "",
763
+ "tags": [
764
+ {
765
+ "text": "6.7.0",
766
+ "name": "since"
767
+ }
768
+ ],
769
+ "methods": [],
770
+ "properties": [
771
+ {
772
+ "name": "bundleId",
773
+ "tags": [
774
+ {
775
+ "text": "6.7.0",
776
+ "name": "since"
777
+ }
778
+ ],
779
+ "docs": "The unique identifier of the next bundle.\n\nIf `null`, the default bundle is being used.",
780
+ "complexTypes": [],
781
+ "type": "string | null"
782
+ }
783
+ ]
784
+ },
604
785
  {
605
786
  "name": "GetVersionCodeResult",
606
787
  "slug": "getversioncoderesult",
@@ -711,7 +892,7 @@
711
892
  "name": "since"
712
893
  }
713
894
  ],
714
- "docs": "The channel of the app.\n\nSet `null` to remove the channel.",
895
+ "docs": "The channel name.\n\nSet `null` to remove the channel.",
715
896
  "complexTypes": [],
716
897
  "type": "string | null"
717
898
  }
@@ -737,7 +918,37 @@
737
918
  "name": "since"
738
919
  }
739
920
  ],
740
- "docs": "The custom identifier of the app.\n\nSet `null` to remove the custom identifier.",
921
+ "docs": "The custom identifier of the device.\n\nSet `null` to remove the custom identifier.",
922
+ "complexTypes": [],
923
+ "type": "string | null"
924
+ }
925
+ ]
926
+ },
927
+ {
928
+ "name": "SetNextBundleOptions",
929
+ "slug": "setnextbundleoptions",
930
+ "docs": "",
931
+ "tags": [
932
+ {
933
+ "text": "6.7.0",
934
+ "name": "since"
935
+ }
936
+ ],
937
+ "methods": [],
938
+ "properties": [
939
+ {
940
+ "name": "bundleId",
941
+ "tags": [
942
+ {
943
+ "text": "6.7.0",
944
+ "name": "since"
945
+ },
946
+ {
947
+ "text": "'1.0.0'",
948
+ "name": "example"
949
+ }
950
+ ],
951
+ "docs": "The unique identifier of the bundle to use.\n\nSet `null` to use the default bundle (same as calling `reset()`).",
741
952
  "complexTypes": [],
742
953
  "type": "string | null"
743
954
  }
@@ -768,6 +979,32 @@
768
979
  "type": "string | null"
769
980
  }
770
981
  ]
982
+ },
983
+ {
984
+ "name": "SyncOptions",
985
+ "slug": "syncoptions",
986
+ "docs": "",
987
+ "tags": [
988
+ {
989
+ "text": "6.7.0",
990
+ "name": "since"
991
+ }
992
+ ],
993
+ "methods": [],
994
+ "properties": [
995
+ {
996
+ "name": "channel",
997
+ "tags": [
998
+ {
999
+ "text": "6.7.0",
1000
+ "name": "since"
1001
+ }
1002
+ ],
1003
+ "docs": "The name of the channel where the latest bundle is fetched from.",
1004
+ "complexTypes": [],
1005
+ "type": "string | undefined"
1006
+ }
1007
+ ]
771
1008
  }
772
1009
  ],
773
1010
  "enums": [],
@@ -873,8 +1110,8 @@
873
1110
  "name": "example"
874
1111
  },
875
1112
  {
876
- "text": "https ://capawesome.io/cloud/live-updates/advanced/privacy/",
877
- "name": "see"
1113
+ "text": "This option will be removed in the future.",
1114
+ "name": "deprecated"
878
1115
  }
879
1116
  ],
880
1117
  "docs": "The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).",