@capgo/capacitor-updater 6.13.2 → 6.14.2
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.
- package/README.md +25 -14
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +134 -194
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +23 -23
- package/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +964 -1153
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1259 -1628
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +161 -197
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipherV2.java +202 -256
- package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +16 -16
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +44 -48
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +378 -467
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +71 -83
- package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +19 -28
- package/dist/docs.json +57 -21
- package/dist/esm/definitions.d.ts +24 -15
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +43 -43
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +43 -43
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +43 -43
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +51 -29
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +3 -2
- package/package.json +5 -7
|
@@ -16,98 +16,86 @@ import java.util.concurrent.TimeUnit;
|
|
|
16
16
|
|
|
17
17
|
public class DownloadWorkerManager {
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
private static final String TAG = "DownloadWorkerManager";
|
|
20
|
+
private static volatile boolean isInitialized = false;
|
|
21
|
+
private static final Set<String> activeVersions = new HashSet<>();
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
23
|
+
private static synchronized void initializeIfNeeded(Context context) {
|
|
24
|
+
if (!isInitialized) {
|
|
25
|
+
try {
|
|
26
|
+
Configuration config = new Configuration.Builder().setMinimumLoggingLevel(android.util.Log.INFO).build();
|
|
27
|
+
WorkManager.initialize(context, config);
|
|
28
|
+
isInitialized = true;
|
|
29
|
+
} catch (IllegalStateException e) {
|
|
30
|
+
// WorkManager was already initialized, ignore
|
|
31
|
+
}
|
|
32
|
+
}
|
|
34
33
|
}
|
|
35
|
-
}
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
public static synchronized boolean isVersionDownloading(String version) {
|
|
36
|
+
return activeVersions.contains(version);
|
|
37
|
+
}
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
public static void enqueueDownload(
|
|
40
|
+
Context context,
|
|
41
|
+
String url,
|
|
42
|
+
String id,
|
|
43
|
+
String documentsDir,
|
|
44
|
+
String dest,
|
|
45
|
+
String version,
|
|
46
|
+
String sessionKey,
|
|
47
|
+
String checksum,
|
|
48
|
+
String publicKey,
|
|
49
|
+
boolean isManifest
|
|
50
|
+
) {
|
|
51
|
+
initializeIfNeeded(context.getApplicationContext());
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
// If version is already downloading, don't start another one
|
|
54
|
+
if (isVersionDownloading(version)) {
|
|
55
|
+
Log.i(TAG, "Version " + version + " is already downloading");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
activeVersions.add(version);
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
// Create input data
|
|
61
|
+
Data inputData = new Data.Builder()
|
|
62
|
+
.putString(DownloadService.URL, url)
|
|
63
|
+
.putString(DownloadService.ID, id)
|
|
64
|
+
.putString(DownloadService.DOCDIR, documentsDir)
|
|
65
|
+
.putString(DownloadService.FILEDEST, dest)
|
|
66
|
+
.putString(DownloadService.VERSION, version)
|
|
67
|
+
.putString(DownloadService.SESSIONKEY, sessionKey)
|
|
68
|
+
.putString(DownloadService.CHECKSUM, checksum)
|
|
69
|
+
.putBoolean(DownloadService.IS_MANIFEST, isManifest)
|
|
70
|
+
.putString(DownloadService.PUBLIC_KEY, publicKey)
|
|
71
|
+
.build();
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.setRequiredNetworkType(NetworkType.CONNECTED)
|
|
78
|
-
.build();
|
|
73
|
+
// Create network constraints
|
|
74
|
+
Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build();
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.setBackoffCriteria(
|
|
90
|
-
BackoffPolicy.LINEAR,
|
|
91
|
-
WorkRequest.MIN_BACKOFF_MILLIS,
|
|
92
|
-
TimeUnit.MILLISECONDS
|
|
93
|
-
)
|
|
94
|
-
.build();
|
|
76
|
+
// Create work request with tags for tracking
|
|
77
|
+
OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(DownloadService.class)
|
|
78
|
+
.setConstraints(constraints)
|
|
79
|
+
.setInputData(inputData)
|
|
80
|
+
.addTag(id)
|
|
81
|
+
.addTag(version) // Add version tag for tracking
|
|
82
|
+
.addTag("capacitor_updater_download")
|
|
83
|
+
.setBackoffCriteria(BackoffPolicy.LINEAR, WorkRequest.MIN_BACKOFF_MILLIS, TimeUnit.MILLISECONDS)
|
|
84
|
+
.build();
|
|
95
85
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
// Enqueue work
|
|
87
|
+
WorkManager.getInstance(context).enqueue(workRequest);
|
|
88
|
+
}
|
|
99
89
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
public static void cancelVersionDownload(Context context, String version) {
|
|
91
|
+
initializeIfNeeded(context.getApplicationContext());
|
|
92
|
+
WorkManager.getInstance(context).cancelAllWorkByTag(version);
|
|
93
|
+
activeVersions.remove(version);
|
|
94
|
+
}
|
|
105
95
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
activeVersions.clear();
|
|
112
|
-
}
|
|
96
|
+
public static void cancelAllDownloads(Context context) {
|
|
97
|
+
initializeIfNeeded(context.getApplicationContext());
|
|
98
|
+
WorkManager.getInstance(context).cancelAllWorkByTag("capacitor_updater_download");
|
|
99
|
+
activeVersions.clear();
|
|
100
|
+
}
|
|
113
101
|
}
|
|
@@ -6,36 +6,27 @@ import android.os.Build;
|
|
|
6
6
|
|
|
7
7
|
public class InternalUtils {
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
public static String getPackageName(PackageManager pm, String packageName) {
|
|
10
|
+
try {
|
|
11
|
+
PackageInfo pInfo = getPackageInfoInternal(pm, packageName);
|
|
12
|
+
return (pInfo != null) ? pInfo.packageName : null;
|
|
13
|
+
} catch (PackageManager.NameNotFoundException e) {
|
|
14
|
+
// Exception is handled internally, and null is returned to indicate the package name could not be retrieved
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
16
17
|
}
|
|
17
|
-
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
packageName,
|
|
26
|
-
PackageManager.PackageInfoFlags.of(0)
|
|
27
|
-
);
|
|
28
|
-
} else {
|
|
29
|
-
return getPackageInfoLegacy(pm, packageName, (int) (long) 0);
|
|
19
|
+
private static PackageInfo getPackageInfoInternal(PackageManager pm, String packageName) throws PackageManager.NameNotFoundException {
|
|
20
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
21
|
+
return pm.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(0));
|
|
22
|
+
} else {
|
|
23
|
+
return getPackageInfoLegacy(pm, packageName, (int) (long) 0);
|
|
24
|
+
}
|
|
30
25
|
}
|
|
31
|
-
}
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
) throws PackageManager.NameNotFoundException {
|
|
39
|
-
return pm.getPackageInfo(packageName, flags);
|
|
40
|
-
}
|
|
27
|
+
@SuppressWarnings("deprecation")
|
|
28
|
+
private static PackageInfo getPackageInfoLegacy(PackageManager pm, String packageName, int flags)
|
|
29
|
+
throws PackageManager.NameNotFoundException {
|
|
30
|
+
return pm.getPackageInfo(packageName, flags);
|
|
31
|
+
}
|
|
41
32
|
}
|
package/dist/docs.json
CHANGED
|
@@ -255,14 +255,24 @@
|
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
"name": "list",
|
|
258
|
-
"signature": "() => Promise<BundleListResult>",
|
|
259
|
-
"parameters": [
|
|
258
|
+
"signature": "(options?: ListOptions | undefined) => Promise<BundleListResult>",
|
|
259
|
+
"parameters": [
|
|
260
|
+
{
|
|
261
|
+
"name": "options",
|
|
262
|
+
"docs": "The {@link ListOptions} for listing bundles",
|
|
263
|
+
"type": "ListOptions | undefined"
|
|
264
|
+
}
|
|
265
|
+
],
|
|
260
266
|
"returns": "Promise<BundleListResult>",
|
|
261
267
|
"tags": [
|
|
262
268
|
{
|
|
263
269
|
"name": "returns",
|
|
264
270
|
"text": "A Promise containing the {@link BundleListResult.bundles}"
|
|
265
271
|
},
|
|
272
|
+
{
|
|
273
|
+
"name": "param",
|
|
274
|
+
"text": "options The {@link ListOptions} for listing bundles"
|
|
275
|
+
},
|
|
266
276
|
{
|
|
267
277
|
"name": "throws",
|
|
268
278
|
"text": "{Error}"
|
|
@@ -270,7 +280,8 @@
|
|
|
270
280
|
],
|
|
271
281
|
"docs": "Get all locally downloaded bundles in your app",
|
|
272
282
|
"complexTypes": [
|
|
273
|
-
"BundleListResult"
|
|
283
|
+
"BundleListResult",
|
|
284
|
+
"ListOptions"
|
|
274
285
|
],
|
|
275
286
|
"slug": "list"
|
|
276
287
|
},
|
|
@@ -672,7 +683,7 @@
|
|
|
672
683
|
},
|
|
673
684
|
{
|
|
674
685
|
"name": "addListener",
|
|
675
|
-
"signature": "(eventName:
|
|
686
|
+
"signature": "(eventName: 'download', listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>",
|
|
676
687
|
"parameters": [
|
|
677
688
|
{
|
|
678
689
|
"name": "eventName",
|
|
@@ -701,7 +712,7 @@
|
|
|
701
712
|
},
|
|
702
713
|
{
|
|
703
714
|
"name": "addListener",
|
|
704
|
-
"signature": "(eventName:
|
|
715
|
+
"signature": "(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>",
|
|
705
716
|
"parameters": [
|
|
706
717
|
{
|
|
707
718
|
"name": "eventName",
|
|
@@ -730,7 +741,7 @@
|
|
|
730
741
|
},
|
|
731
742
|
{
|
|
732
743
|
"name": "addListener",
|
|
733
|
-
"signature": "(eventName:
|
|
744
|
+
"signature": "(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>",
|
|
734
745
|
"parameters": [
|
|
735
746
|
{
|
|
736
747
|
"name": "eventName",
|
|
@@ -759,7 +770,7 @@
|
|
|
759
770
|
},
|
|
760
771
|
{
|
|
761
772
|
"name": "addListener",
|
|
762
|
-
"signature": "(eventName:
|
|
773
|
+
"signature": "(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>",
|
|
763
774
|
"parameters": [
|
|
764
775
|
{
|
|
765
776
|
"name": "eventName",
|
|
@@ -788,7 +799,7 @@
|
|
|
788
799
|
},
|
|
789
800
|
{
|
|
790
801
|
"name": "addListener",
|
|
791
|
-
"signature": "(eventName:
|
|
802
|
+
"signature": "(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>",
|
|
792
803
|
"parameters": [
|
|
793
804
|
{
|
|
794
805
|
"name": "eventName",
|
|
@@ -817,7 +828,7 @@
|
|
|
817
828
|
},
|
|
818
829
|
{
|
|
819
830
|
"name": "addListener",
|
|
820
|
-
"signature": "(eventName:
|
|
831
|
+
"signature": "(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>",
|
|
821
832
|
"parameters": [
|
|
822
833
|
{
|
|
823
834
|
"name": "eventName",
|
|
@@ -846,7 +857,7 @@
|
|
|
846
857
|
},
|
|
847
858
|
{
|
|
848
859
|
"name": "addListener",
|
|
849
|
-
"signature": "(eventName:
|
|
860
|
+
"signature": "(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>",
|
|
850
861
|
"parameters": [
|
|
851
862
|
{
|
|
852
863
|
"name": "eventName",
|
|
@@ -875,7 +886,7 @@
|
|
|
875
886
|
},
|
|
876
887
|
{
|
|
877
888
|
"name": "addListener",
|
|
878
|
-
"signature": "(eventName:
|
|
889
|
+
"signature": "(eventName: 'appReloaded', listenerFunc: () => void) => Promise<PluginListenerHandle>",
|
|
879
890
|
"parameters": [
|
|
880
891
|
{
|
|
881
892
|
"name": "eventName",
|
|
@@ -903,7 +914,7 @@
|
|
|
903
914
|
},
|
|
904
915
|
{
|
|
905
916
|
"name": "addListener",
|
|
906
|
-
"signature": "(eventName:
|
|
917
|
+
"signature": "(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>",
|
|
907
918
|
"parameters": [
|
|
908
919
|
{
|
|
909
920
|
"name": "eventName",
|
|
@@ -1104,7 +1115,7 @@
|
|
|
1104
1115
|
"tags": [],
|
|
1105
1116
|
"docs": "The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.)",
|
|
1106
1117
|
"complexTypes": [],
|
|
1107
|
-
"type": "string"
|
|
1118
|
+
"type": "string | undefined"
|
|
1108
1119
|
},
|
|
1109
1120
|
{
|
|
1110
1121
|
"name": "version",
|
|
@@ -1181,6 +1192,31 @@
|
|
|
1181
1192
|
}
|
|
1182
1193
|
]
|
|
1183
1194
|
},
|
|
1195
|
+
{
|
|
1196
|
+
"name": "ListOptions",
|
|
1197
|
+
"slug": "listoptions",
|
|
1198
|
+
"docs": "",
|
|
1199
|
+
"tags": [],
|
|
1200
|
+
"methods": [],
|
|
1201
|
+
"properties": [
|
|
1202
|
+
{
|
|
1203
|
+
"name": "raw",
|
|
1204
|
+
"tags": [
|
|
1205
|
+
{
|
|
1206
|
+
"text": "6.14.0",
|
|
1207
|
+
"name": "since"
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
"text": "false",
|
|
1211
|
+
"name": "default"
|
|
1212
|
+
}
|
|
1213
|
+
],
|
|
1214
|
+
"docs": "Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.",
|
|
1215
|
+
"complexTypes": [],
|
|
1216
|
+
"type": "boolean | undefined"
|
|
1217
|
+
}
|
|
1218
|
+
]
|
|
1219
|
+
},
|
|
1184
1220
|
{
|
|
1185
1221
|
"name": "ResetOptions",
|
|
1186
1222
|
"slug": "resetoptions",
|
|
@@ -1856,19 +1892,19 @@
|
|
|
1856
1892
|
"docs": "",
|
|
1857
1893
|
"types": [
|
|
1858
1894
|
{
|
|
1859
|
-
"text": "
|
|
1895
|
+
"text": "'success'",
|
|
1860
1896
|
"complexTypes": []
|
|
1861
1897
|
},
|
|
1862
1898
|
{
|
|
1863
|
-
"text": "
|
|
1899
|
+
"text": "'error'",
|
|
1864
1900
|
"complexTypes": []
|
|
1865
1901
|
},
|
|
1866
1902
|
{
|
|
1867
|
-
"text": "
|
|
1903
|
+
"text": "'pending'",
|
|
1868
1904
|
"complexTypes": []
|
|
1869
1905
|
},
|
|
1870
1906
|
{
|
|
1871
|
-
"text": "
|
|
1907
|
+
"text": "'downloading'",
|
|
1872
1908
|
"complexTypes": []
|
|
1873
1909
|
}
|
|
1874
1910
|
]
|
|
@@ -1879,19 +1915,19 @@
|
|
|
1879
1915
|
"docs": "",
|
|
1880
1916
|
"types": [
|
|
1881
1917
|
{
|
|
1882
|
-
"text": "
|
|
1918
|
+
"text": "'background'",
|
|
1883
1919
|
"complexTypes": []
|
|
1884
1920
|
},
|
|
1885
1921
|
{
|
|
1886
|
-
"text": "
|
|
1922
|
+
"text": "'kill'",
|
|
1887
1923
|
"complexTypes": []
|
|
1888
1924
|
},
|
|
1889
1925
|
{
|
|
1890
|
-
"text": "
|
|
1926
|
+
"text": "'nativeVersion'",
|
|
1891
1927
|
"complexTypes": []
|
|
1892
1928
|
},
|
|
1893
1929
|
{
|
|
1894
|
-
"text": "
|
|
1930
|
+
"text": "'date'",
|
|
1895
1931
|
"complexTypes": []
|
|
1896
1932
|
}
|
|
1897
1933
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginListenerHandle } from
|
|
2
|
-
declare module
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
declare module '@capacitor/cli' {
|
|
3
3
|
interface PluginsConfig {
|
|
4
4
|
/**
|
|
5
5
|
* CapacitorUpdater can be configured with these options:
|
|
@@ -295,9 +295,10 @@ export interface CapacitorUpdaterPlugin {
|
|
|
295
295
|
* Get all locally downloaded bundles in your app
|
|
296
296
|
*
|
|
297
297
|
* @returns {Promise<BundleListResult>} A Promise containing the {@link BundleListResult.bundles}
|
|
298
|
+
* @param options The {@link ListOptions} for listing bundles
|
|
298
299
|
* @throws {Error}
|
|
299
300
|
*/
|
|
300
|
-
list(): Promise<BundleListResult>;
|
|
301
|
+
list(options?: ListOptions): Promise<BundleListResult>;
|
|
301
302
|
/**
|
|
302
303
|
* Reset the app to the `builtin` bundle (the one sent to Apple App Store / Google Play Store ) or the last successfully loaded bundle.
|
|
303
304
|
*
|
|
@@ -438,55 +439,55 @@ export interface CapacitorUpdaterPlugin {
|
|
|
438
439
|
*
|
|
439
440
|
* @since 2.0.11
|
|
440
441
|
*/
|
|
441
|
-
addListener(eventName:
|
|
442
|
+
addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle>;
|
|
442
443
|
/**
|
|
443
444
|
* Listen for no need to update event, useful when you want force check every time the app is launched
|
|
444
445
|
*
|
|
445
446
|
* @since 4.0.0
|
|
446
447
|
*/
|
|
447
|
-
addListener(eventName:
|
|
448
|
+
addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;
|
|
448
449
|
/**
|
|
449
450
|
* Listen for available update event, useful when you want to force check every time the app is launched
|
|
450
451
|
*
|
|
451
452
|
* @since 4.0.0
|
|
452
453
|
*/
|
|
453
|
-
addListener(eventName:
|
|
454
|
+
addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void): Promise<PluginListenerHandle>;
|
|
454
455
|
/**
|
|
455
456
|
* Listen for downloadComplete events.
|
|
456
457
|
*
|
|
457
458
|
* @since 4.0.0
|
|
458
459
|
*/
|
|
459
|
-
addListener(eventName:
|
|
460
|
+
addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void): Promise<PluginListenerHandle>;
|
|
460
461
|
/**
|
|
461
462
|
* Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
|
|
462
463
|
*
|
|
463
464
|
* @since 2.3.0
|
|
464
465
|
*/
|
|
465
|
-
addListener(eventName:
|
|
466
|
+
addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void): Promise<PluginListenerHandle>;
|
|
466
467
|
/**
|
|
467
468
|
* Listen for update fail event in the App, let you know when update has fail to install at next app start
|
|
468
469
|
*
|
|
469
470
|
* @since 2.3.0
|
|
470
471
|
*/
|
|
471
|
-
addListener(eventName:
|
|
472
|
+
addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void): Promise<PluginListenerHandle>;
|
|
472
473
|
/**
|
|
473
474
|
* Listen for download fail event in the App, let you know when a bundle download has failed
|
|
474
475
|
*
|
|
475
476
|
* @since 4.0.0
|
|
476
477
|
*/
|
|
477
|
-
addListener(eventName:
|
|
478
|
+
addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void): Promise<PluginListenerHandle>;
|
|
478
479
|
/**
|
|
479
480
|
* Listen for reload event in the App, let you know when reload has happened
|
|
480
481
|
*
|
|
481
482
|
* @since 4.3.0
|
|
482
483
|
*/
|
|
483
|
-
addListener(eventName:
|
|
484
|
+
addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
484
485
|
/**
|
|
485
486
|
* Listen for app ready event in the App, let you know when app is ready to use
|
|
486
487
|
*
|
|
487
488
|
* @since 5.1.0
|
|
488
489
|
*/
|
|
489
|
-
addListener(eventName:
|
|
490
|
+
addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle>;
|
|
490
491
|
/**
|
|
491
492
|
* Get if auto update is available (not disabled by serverUrl).
|
|
492
493
|
*
|
|
@@ -504,8 +505,8 @@ export interface CapacitorUpdaterPlugin {
|
|
|
504
505
|
*/
|
|
505
506
|
getNextBundle(): Promise<BundleInfo | null>;
|
|
506
507
|
}
|
|
507
|
-
export type BundleStatus =
|
|
508
|
-
export type DelayUntilNext =
|
|
508
|
+
export type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
|
|
509
|
+
export type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
|
|
509
510
|
export interface NoNeedEvent {
|
|
510
511
|
/**
|
|
511
512
|
* Current status of download, between 0 and 100.
|
|
@@ -671,7 +672,7 @@ export interface DownloadOptions {
|
|
|
671
672
|
/**
|
|
672
673
|
* The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.)
|
|
673
674
|
*/
|
|
674
|
-
url
|
|
675
|
+
url?: string;
|
|
675
676
|
/**
|
|
676
677
|
* The version code/name of this bundle/version
|
|
677
678
|
*/
|
|
@@ -698,6 +699,14 @@ export interface BundleListResult {
|
|
|
698
699
|
export interface ResetOptions {
|
|
699
700
|
toLastSuccessful: boolean;
|
|
700
701
|
}
|
|
702
|
+
export interface ListOptions {
|
|
703
|
+
/**
|
|
704
|
+
* Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.
|
|
705
|
+
* @since 6.14.0
|
|
706
|
+
* @default false
|
|
707
|
+
*/
|
|
708
|
+
raw?: boolean;
|
|
709
|
+
}
|
|
701
710
|
export interface CurrentBundleResult {
|
|
702
711
|
bundle: BundleInfo;
|
|
703
712
|
native: string;
|