@capawesome/capacitor-live-update 6.7.1 → 7.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.
- package/CapawesomeCapacitorLiveUpdate.podspec +2 -2
- package/Package.swift +32 -0
- package/README.md +91 -81
- package/android/build.gradle +9 -9
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +165 -132
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateConfig.java +6 -27
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateHttpClient.java +7 -2
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +50 -78
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +12 -5
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +9 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/events/DownloadBundleProgressEvent.java +32 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/DownloadBundleOptions.java +1 -10
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +13 -1
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/DownloadProgressCallback.java +5 -0
- package/dist/docs.json +191 -158
- package/dist/esm/definitions.d.ts +107 -52
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Classes/Events/DownloadBundleProgressEvent.swift +25 -0
- package/ios/Plugin/Classes/Options/DownloadBundleOptions.swift +1 -7
- package/ios/Plugin/Classes/Results/{FetchLatestBundle.swift → FetchLatestBundleResult.swift} +6 -1
- package/ios/Plugin/Classes/Results/ReadyResult.swift +22 -0
- package/ios/Plugin/LiveUpdate.swift +167 -148
- package/ios/Plugin/LiveUpdateConfig.swift +2 -4
- package/ios/Plugin/LiveUpdateHttpClient.swift +6 -2
- package/ios/Plugin/LiveUpdatePlugin.swift +44 -38
- package/ios/Plugin/LiveUpdatePreferences.swift +9 -5
- package/ios/Plugin/Protocols/Api/GetLatestBundleResponse.swift +1 -0
- package/package.json +17 -18
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetBundleOptions.java +0 -18
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBundleResult.java +0 -24
- package/ios/Plugin/Classes/Options/SetBundleOptions.swift +0 -14
- package/ios/Plugin/Classes/Results/GetBundleResult.swift +0 -16
- package/ios/Plugin/LiveUpdatePlugin.h +0 -10
- package/ios/Plugin/LiveUpdatePlugin.m +0 -27
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
1
2
|
declare module '@capacitor/cli' {
|
|
2
3
|
interface PluginsConfig {
|
|
3
4
|
LiveUpdate?: {
|
|
@@ -27,13 +28,6 @@ declare module '@capacitor/cli' {
|
|
|
27
28
|
* @example 'production'
|
|
28
29
|
*/
|
|
29
30
|
defaultChannel?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Whether or not the plugin is enabled.
|
|
32
|
-
*
|
|
33
|
-
* @since 5.0.0
|
|
34
|
-
* @default true
|
|
35
|
-
*/
|
|
36
|
-
enabled?: boolean;
|
|
37
31
|
/**
|
|
38
32
|
* The timeout in milliseconds for HTTP requests.
|
|
39
33
|
*
|
|
@@ -41,15 +35,6 @@ declare module '@capacitor/cli' {
|
|
|
41
35
|
* @default 60000
|
|
42
36
|
*/
|
|
43
37
|
httpTimeout?: number;
|
|
44
|
-
/**
|
|
45
|
-
* The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud).
|
|
46
|
-
*
|
|
47
|
-
* @since 6.2.0
|
|
48
|
-
* @default 'us'
|
|
49
|
-
* @example 'eu'
|
|
50
|
-
* @deprecated This option will be removed in the future.
|
|
51
|
-
*/
|
|
52
|
-
location?: 'us' | 'eu';
|
|
53
38
|
/**
|
|
54
39
|
* The public key to verify the integrity of the bundle.
|
|
55
40
|
*
|
|
@@ -60,19 +45,28 @@ declare module '@capacitor/cli' {
|
|
|
60
45
|
*/
|
|
61
46
|
publicKey?: string;
|
|
62
47
|
/**
|
|
63
|
-
* The timeout in milliseconds to wait for the app to be ready
|
|
48
|
+
* The timeout in milliseconds to wait for the app to be ready
|
|
49
|
+
* before resetting to the default bundle.
|
|
50
|
+
*
|
|
51
|
+
* It is strongly **recommended** to configure this option so that
|
|
52
|
+
* the plugin can roll back to the default bundle in case of problems.
|
|
53
|
+
* If configured, the plugin will wait for the app to call the `ready()`
|
|
54
|
+
* method before resetting to the default bundle.
|
|
55
|
+
*
|
|
56
|
+
* Set to `0` to disable the timeout.
|
|
64
57
|
*
|
|
65
58
|
* @since 5.0.0
|
|
66
|
-
* @default
|
|
59
|
+
* @default 0
|
|
60
|
+
* @example 10000
|
|
67
61
|
*/
|
|
68
62
|
readyTimeout?: number;
|
|
69
63
|
/**
|
|
70
|
-
*
|
|
64
|
+
* The API domain of the [Capawesome Cloud](https://cloud.capawesome.io) server.
|
|
71
65
|
*
|
|
72
|
-
* @since
|
|
73
|
-
* @default
|
|
66
|
+
* @since 7.0.0
|
|
67
|
+
* @default 'api.cloud.capawesome.io'
|
|
74
68
|
*/
|
|
75
|
-
|
|
69
|
+
serverDomain?: string;
|
|
76
70
|
};
|
|
77
71
|
}
|
|
78
72
|
}
|
|
@@ -101,15 +95,6 @@ export interface LiveUpdatePlugin {
|
|
|
101
95
|
* @since 6.6.0
|
|
102
96
|
*/
|
|
103
97
|
fetchLatestBundle(options?: FetchLatestBundleOptions): Promise<FetchLatestBundleResult>;
|
|
104
|
-
/**
|
|
105
|
-
* Get the active bundle identifier.
|
|
106
|
-
*
|
|
107
|
-
* Only available on Android and iOS.
|
|
108
|
-
*
|
|
109
|
-
* @since 5.0.0
|
|
110
|
-
* @deprecated Use `getCurrentBundle()` instead.
|
|
111
|
-
*/
|
|
112
|
-
getBundle(): Promise<GetBundleResult>;
|
|
113
98
|
/**
|
|
114
99
|
* Get all identifiers of bundles that have been downloaded.
|
|
115
100
|
*
|
|
@@ -164,6 +149,9 @@ export interface LiveUpdatePlugin {
|
|
|
164
149
|
/**
|
|
165
150
|
* Get the version code of the app.
|
|
166
151
|
*
|
|
152
|
+
* On **Android**, this is the `versionCode` from the `android/app/build.gradle` file.
|
|
153
|
+
* On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.
|
|
154
|
+
*
|
|
167
155
|
* Only available on Android and iOS.
|
|
168
156
|
*
|
|
169
157
|
* @since 5.0.0
|
|
@@ -172,6 +160,9 @@ export interface LiveUpdatePlugin {
|
|
|
172
160
|
/**
|
|
173
161
|
* Get the version name of the app.
|
|
174
162
|
*
|
|
163
|
+
* On **Android**, this is the `versionName` from the `android/app/build.gradle` file.
|
|
164
|
+
* On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.
|
|
165
|
+
*
|
|
175
166
|
* Only available on Android and iOS.
|
|
176
167
|
*
|
|
177
168
|
* @since 5.0.0
|
|
@@ -187,7 +178,7 @@ export interface LiveUpdatePlugin {
|
|
|
187
178
|
*
|
|
188
179
|
* @since 5.0.0
|
|
189
180
|
*/
|
|
190
|
-
ready(): Promise<
|
|
181
|
+
ready(): Promise<ReadyResult>;
|
|
191
182
|
/**
|
|
192
183
|
* Reload the app to apply the new bundle.
|
|
193
184
|
*
|
|
@@ -206,17 +197,6 @@ export interface LiveUpdatePlugin {
|
|
|
206
197
|
* @since 5.0.0
|
|
207
198
|
*/
|
|
208
199
|
reset(): Promise<void>;
|
|
209
|
-
/**
|
|
210
|
-
* Set the next bundle to use for the app.
|
|
211
|
-
*
|
|
212
|
-
* Call `reload()` or restart the app to apply the changes.
|
|
213
|
-
*
|
|
214
|
-
* Only available on Android and iOS.
|
|
215
|
-
*
|
|
216
|
-
* @since 5.0.0
|
|
217
|
-
* @deprecated Use `setNextBundle()` instead.
|
|
218
|
-
*/
|
|
219
|
-
setBundle(options: SetBundleOptions): Promise<void>;
|
|
220
200
|
/**
|
|
221
201
|
* Set the channel to use for the update.
|
|
222
202
|
*
|
|
@@ -253,6 +233,14 @@ export interface LiveUpdatePlugin {
|
|
|
253
233
|
* @since 5.0.0
|
|
254
234
|
*/
|
|
255
235
|
sync(options?: SyncOptions): Promise<SyncResult>;
|
|
236
|
+
/**
|
|
237
|
+
* Listen for the download progress of a bundle.
|
|
238
|
+
*
|
|
239
|
+
* Only available on Android and iOS.
|
|
240
|
+
*
|
|
241
|
+
* @since 7.0.0
|
|
242
|
+
*/
|
|
243
|
+
addListener(eventName: 'downloadBundleProgress', listenerFunc: DownloadBundleProgressListener): Promise<PluginListenerHandle>;
|
|
256
244
|
}
|
|
257
245
|
/**
|
|
258
246
|
* @since 5.0.0
|
|
@@ -278,19 +266,12 @@ export interface DownloadBundleOptions {
|
|
|
278
266
|
/**
|
|
279
267
|
* The unique identifier of the bundle.
|
|
280
268
|
*
|
|
269
|
+
* **Attention**: The value `public` is reserved and cannot be used as a bundle identifier.
|
|
270
|
+
*
|
|
281
271
|
* @since 5.0.0
|
|
282
272
|
* @example '1.0.0'
|
|
283
273
|
*/
|
|
284
274
|
bundleId: string;
|
|
285
|
-
/**
|
|
286
|
-
* The checksum of the bundle to verify the integrity of the ZIP file.
|
|
287
|
-
*
|
|
288
|
-
* Must be a SHA-256 hash in base64 format.
|
|
289
|
-
*
|
|
290
|
-
* @since 6.1.0
|
|
291
|
-
* @deprecated The server should return a `X-Checksum` header instead.
|
|
292
|
-
*/
|
|
293
|
-
checksum?: string;
|
|
294
275
|
/**
|
|
295
276
|
* The URL of the bundle to download.
|
|
296
277
|
*
|
|
@@ -340,6 +321,15 @@ export interface FetchLatestBundleResult {
|
|
|
340
321
|
* @since 6.6.0
|
|
341
322
|
*/
|
|
342
323
|
bundleId: string | null;
|
|
324
|
+
/**
|
|
325
|
+
* Custom properties that are associated with the latest bundle.
|
|
326
|
+
*
|
|
327
|
+
* @since 7.0.0
|
|
328
|
+
* @example { "key": "value" }
|
|
329
|
+
*/
|
|
330
|
+
customProperties?: {
|
|
331
|
+
[key: string]: string;
|
|
332
|
+
};
|
|
343
333
|
/**
|
|
344
334
|
* The URL of the latest bundle to download.
|
|
345
335
|
* Pass this URL to the `downloadBundle(...)` method to download the bundle.
|
|
@@ -473,6 +463,33 @@ export interface GetCustomIdResult {
|
|
|
473
463
|
*/
|
|
474
464
|
customId: string | null;
|
|
475
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* @since 7.0.0
|
|
468
|
+
*/
|
|
469
|
+
export interface ReadyResult {
|
|
470
|
+
/**
|
|
471
|
+
* The identifier of the previous bundle used.
|
|
472
|
+
*
|
|
473
|
+
* If `null`, the default bundle was used.
|
|
474
|
+
*
|
|
475
|
+
* @since 7.0.0
|
|
476
|
+
*/
|
|
477
|
+
previousBundleId: string | null;
|
|
478
|
+
/**
|
|
479
|
+
* The identifier of the current bundle used.
|
|
480
|
+
*
|
|
481
|
+
* If `null`, the default bundle is being used.
|
|
482
|
+
*
|
|
483
|
+
* @since 7.0.0
|
|
484
|
+
*/
|
|
485
|
+
currentBundleId: string | null;
|
|
486
|
+
/**
|
|
487
|
+
* Whether or not the app was reset to the default bundle.
|
|
488
|
+
*
|
|
489
|
+
* @since 7.0.0
|
|
490
|
+
*/
|
|
491
|
+
rollback: boolean;
|
|
492
|
+
}
|
|
476
493
|
/**
|
|
477
494
|
* @since 5.0.0
|
|
478
495
|
*/
|
|
@@ -549,3 +566,41 @@ export interface SyncResult {
|
|
|
549
566
|
*/
|
|
550
567
|
nextBundleId: string | null;
|
|
551
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* Listener for the download progress of a bundle.
|
|
571
|
+
*
|
|
572
|
+
* @since 7.0.0
|
|
573
|
+
*/
|
|
574
|
+
export declare type DownloadBundleProgressListener = (event: DownloadBundleProgressEvent) => void;
|
|
575
|
+
/**
|
|
576
|
+
* Event that is triggered when the download progress of a bundle changes.
|
|
577
|
+
*
|
|
578
|
+
* @since 7.0.0
|
|
579
|
+
*/
|
|
580
|
+
export interface DownloadBundleProgressEvent {
|
|
581
|
+
/**
|
|
582
|
+
* The unique identifier of the bundle that is being downloaded.
|
|
583
|
+
*
|
|
584
|
+
* @since 7.0.0
|
|
585
|
+
*/
|
|
586
|
+
bundleId: string;
|
|
587
|
+
/**
|
|
588
|
+
* The number of bytes that have been downloaded.
|
|
589
|
+
*
|
|
590
|
+
* @since 7.0.0
|
|
591
|
+
*/
|
|
592
|
+
downloadedBytes: number;
|
|
593
|
+
/**
|
|
594
|
+
* The progress of the download in percent as a value between `0` and `1`.
|
|
595
|
+
*
|
|
596
|
+
* @since 7.0.0
|
|
597
|
+
* @example 0.5
|
|
598
|
+
*/
|
|
599
|
+
progress: number;
|
|
600
|
+
/**
|
|
601
|
+
* The total number of bytes to download.
|
|
602
|
+
*
|
|
603
|
+
* @since 7.0.0
|
|
604
|
+
*/
|
|
605
|
+
totalBytes: number;
|
|
606
|
+
}
|
|
@@ -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 * This is **NOT** the same as the app identifier (e.g. `com.example.app`).\n * This is a unique identifier generated by Capawesome Cloud (e.g. `6e351b4f-69a7-415e-a057-4567df7ffe94`).\n *\n * @since 5.0.0\n * @example '6e351b4f-69a7-415e-a057-4567df7ffe94'\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 * The default channel of the app.\n *\n * @since 6.3.0\n * @example 'production'\n */\n defaultChannel?: string;\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 for HTTP requests.\n *\n * @since 6.4.0\n * @default 60000\n */\n httpTimeout?: number;\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 * @deprecated This option will be removed in the future.\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 * Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Only available on Android and iOS.\n *\n * @since 6.6.0\n */\n fetchLatestBundle(options?: FetchLatestBundleOptions): Promise<FetchLatestBundleResult>;\n /**\n * Get the active bundle identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n * @deprecated Use `getCurrentBundle()` instead.\n */\n getBundle(): Promise<GetBundleResult>;\n /**\n * Get all identifiers of bundles that have been downloaded.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundles(): Promise<GetBundlesResult>;\n /**\n * Get the channel that is used for the update.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getChannel(): Promise<GetChannelResult>;\n /**\n * Get the bundle identifier of the current bundle.\n * The current bundle is the bundle that is currently used by the app.\n *\n * Only available on Android and iOS.\n *\n * @since 6.7.0\n */\n getCurrentBundle(): Promise<GetCurrentBundleResult>;\n /**\n * Get the custom identifier of the device.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getCustomId(): Promise<GetCustomIdResult>;\n /**\n * Get the unique device identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getDeviceId(): Promise<GetDeviceIdResult>;\n /**\n * Get the bundle identifier of the next bundle.\n * The next bundle is the bundle that will be used after calling `reload()`\n * or restarting the app.\n *\n * Only available on Android and iOS.\n *\n * @since 6.7.0\n */\n getNextBundle(): Promise<GetNextBundleResult>;\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 * @deprecated Use `setNextBundle()` instead.\n */\n setBundle(options: SetBundleOptions): Promise<void>;\n /**\n * Set the channel to use for the update.\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 device.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setCustomId(options: SetCustomIdOptions): 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 6.7.0\n */\n setNextBundle(options: SetNextBundleOptions): 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(options?: SyncOptions): 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 artifact type of the bundle.\n *\n * @since 6.6.0\n * @default 'zip'\n * @example 'manifest'\n */\n artifactType?: 'manifest' | 'zip';\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 base64 format.\n *\n * @since 6.1.0\n * @deprecated The server should return a `X-Checksum` header instead.\n */\n checksum?: string;\n /**\n * The URL of the bundle to download.\n *\n * For the `zip` artifact type, the URL must point to a ZIP file.\n * For the `manifest` artifact type, the URL serves as the base URL\n * to download the individual files. For example, if the URL is\n * `https://example.com/download`, the plugin will download the file\n * with the href `index.html` from `https://example.com/download?href=index.html`.\n *\n * To **verify the integrity** of the file, the server must return\n * a `X-Checksum` header with the SHA-256 hash in base64 format.\n *\n * To **verify the signature** of the file, the server must return\n * a `X-Signature` header with the signed SHA-256 hash in base64 format.\n *\n * @since 5.0.0\n * @example 'https://example.com/bundle.zip'\n */\n url: string;\n}\n\n/**\n * @since 6.7.0\n */\nexport interface FetchLatestBundleOptions {\n /**\n * The name of the channel where the latest bundle is fetched from.\n *\n * @since 6.7.0\n */\n channel?: string;\n}\n\n/**\n * @since 6.6.0\n */\nexport interface FetchLatestBundleResult {\n /**\n * The artifact type of the bundle.\n *\n * @since 6.7.0\n */\n artifactType?: 'manifest' | 'zip';\n /**\n * The unique identifier of the latest bundle.\n *\n * If `null`, no bundle is available.\n *\n * @since 6.6.0\n */\n bundleId: string | null;\n /**\n * The URL of the latest bundle to download.\n * Pass this URL to the `downloadBundle(...)` method to download the bundle.\n *\n * @since 6.7.0\n */\n downloadUrl?: 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 name.\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 6.7.0\n */\nexport interface GetCurrentBundleResult {\n /**\n * The unique identifier of the current bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 6.7.0\n */\n bundleId: 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 6.7.0\n */\nexport interface GetNextBundleResult {\n /**\n * The unique identifier of the next bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 6.7.0\n */\n bundleId: string | null;\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 device.\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 name.\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 device.\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 6.7.0\n */\nexport interface SetNextBundleOptions {\n /**\n * The unique identifier of the bundle to use.\n *\n * Set `null` to use the default bundle (same as calling `reset()`).\n *\n * @since 6.7.0\n * @example '1.0.0'\n */\n bundleId: string | null;\n}\n\n/**\n * @since 6.7.0\n */\nexport interface SyncOptions {\n /**\n * The name of the channel where the latest bundle is fetched from.\n *\n * @since 6.7.0\n */\n channel?: string;\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\nimport type { PluginListenerHandle } from '@capacitor/core';\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 * This is **NOT** the same as the app identifier (e.g. `com.example.app`).\n * This is a unique identifier generated by Capawesome Cloud (e.g. `6e351b4f-69a7-415e-a057-4567df7ffe94`).\n *\n * @since 5.0.0\n * @example '6e351b4f-69a7-415e-a057-4567df7ffe94'\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 * The default channel of the app.\n *\n * @since 6.3.0\n * @example 'production'\n */\n defaultChannel?: string;\n /**\n * The timeout in milliseconds for HTTP requests.\n *\n * @since 6.4.0\n * @default 60000\n */\n httpTimeout?: number;\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\n * before resetting to the default bundle.\n *\n * It is strongly **recommended** to configure this option so that\n * the plugin can roll back to the default bundle in case of problems.\n * If configured, the plugin will wait for the app to call the `ready()`\n * method before resetting to the default bundle.\n *\n * Set to `0` to disable the timeout.\n *\n * @since 5.0.0\n * @default 0\n * @example 10000\n */\n readyTimeout?: number;\n /**\n * The API domain of the [Capawesome Cloud](https://cloud.capawesome.io) server.\n *\n * @since 7.0.0\n * @default 'api.cloud.capawesome.io'\n */\n serverDomain?: string;\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 * Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).\n *\n * Only available on Android and iOS.\n *\n * @since 6.6.0\n */\n fetchLatestBundle(\n options?: FetchLatestBundleOptions,\n ): Promise<FetchLatestBundleResult>;\n /**\n * Get all identifiers of bundles that have been downloaded.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getBundles(): Promise<GetBundlesResult>;\n /**\n * Get the channel that is used for the update.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getChannel(): Promise<GetChannelResult>;\n /**\n * Get the bundle identifier of the current bundle.\n * The current bundle is the bundle that is currently used by the app.\n *\n * Only available on Android and iOS.\n *\n * @since 6.7.0\n */\n getCurrentBundle(): Promise<GetCurrentBundleResult>;\n /**\n * Get the custom identifier of the device.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getCustomId(): Promise<GetCustomIdResult>;\n /**\n * Get the unique device identifier.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n getDeviceId(): Promise<GetDeviceIdResult>;\n /**\n * Get the bundle identifier of the next bundle.\n * The next bundle is the bundle that will be used after calling `reload()`\n * or restarting the app.\n *\n * Only available on Android and iOS.\n *\n * @since 6.7.0\n */\n getNextBundle(): Promise<GetNextBundleResult>;\n /**\n * Get 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 * 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 * 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 * 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 channel to use for the update.\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 device.\n *\n * Only available on Android and iOS.\n *\n * @since 5.0.0\n */\n setCustomId(options: SetCustomIdOptions): 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 6.7.0\n */\n setNextBundle(options: SetNextBundleOptions): 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(options?: SyncOptions): Promise<SyncResult>;\n /**\n * Listen for the download progress of a bundle.\n *\n * Only available on Android and iOS.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'downloadBundleProgress',\n listenerFunc: DownloadBundleProgressListener,\n ): Promise<PluginListenerHandle>;\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 artifact type of the bundle.\n *\n * @since 6.6.0\n * @default 'zip'\n * @example 'manifest'\n */\n artifactType?: 'manifest' | 'zip';\n /**\n * The unique identifier of the bundle.\n *\n * **Attention**: The value `public` is reserved and cannot be used as a bundle identifier.\n *\n * @since 5.0.0\n * @example '1.0.0'\n */\n bundleId: string;\n /**\n * The URL of the bundle to download.\n *\n * For the `zip` artifact type, the URL must point to a ZIP file.\n * For the `manifest` artifact type, the URL serves as the base URL\n * to download the individual files. For example, if the URL is\n * `https://example.com/download`, the plugin will download the file\n * with the href `index.html` from `https://example.com/download?href=index.html`.\n *\n * To **verify the integrity** of the file, the server must return\n * a `X-Checksum` header with the SHA-256 hash in base64 format.\n *\n * To **verify the signature** of the file, the server must return\n * a `X-Signature` header with the signed SHA-256 hash in base64 format.\n *\n * @since 5.0.0\n * @example 'https://example.com/bundle.zip'\n */\n url: string;\n}\n\n/**\n * @since 6.7.0\n */\nexport interface FetchLatestBundleOptions {\n /**\n * The name of the channel where the latest bundle is fetched from.\n *\n * @since 6.7.0\n */\n channel?: string;\n}\n\n/**\n * @since 6.6.0\n */\nexport interface FetchLatestBundleResult {\n /**\n * The artifact type of the bundle.\n *\n * @since 6.7.0\n */\n artifactType?: 'manifest' | 'zip';\n /**\n * The unique identifier of the latest bundle.\n *\n * If `null`, no bundle is available.\n *\n * @since 6.6.0\n */\n bundleId: string | null;\n /**\n * Custom properties that are associated with the latest bundle.\n *\n * @since 7.0.0\n * @example { \"key\": \"value\" }\n */\n customProperties?: { [key: string]: string };\n /**\n * The URL of the latest bundle to download.\n * Pass this URL to the `downloadBundle(...)` method to download the bundle.\n *\n * @since 6.7.0\n */\n downloadUrl?: 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 name.\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 6.7.0\n */\nexport interface GetCurrentBundleResult {\n /**\n * The unique identifier of the current bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 6.7.0\n */\n bundleId: 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 6.7.0\n */\nexport interface GetNextBundleResult {\n /**\n * The unique identifier of the next bundle.\n *\n * If `null`, the default bundle is being used.\n *\n * @since 6.7.0\n */\n bundleId: string | null;\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 device.\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 name.\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 device.\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 6.7.0\n */\nexport interface SetNextBundleOptions {\n /**\n * The unique identifier of the bundle to use.\n *\n * Set `null` to use the default bundle (same as calling `reset()`).\n *\n * @since 6.7.0\n * @example '1.0.0'\n */\n bundleId: string | null;\n}\n\n/**\n * @since 6.7.0\n */\nexport interface SyncOptions {\n /**\n * The name of the channel where the latest bundle is fetched from.\n *\n * @since 6.7.0\n */\n channel?: string;\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\n/**\n * Listener for the download progress of a bundle.\n *\n * @since 7.0.0\n */\nexport type DownloadBundleProgressListener = (\n event: DownloadBundleProgressEvent,\n) => void;\n\n/**\n * Event that is triggered when the download progress of a bundle changes.\n *\n * @since 7.0.0\n */\nexport interface DownloadBundleProgressEvent {\n /**\n * The unique identifier of the bundle that is being downloaded.\n *\n * @since 7.0.0\n */\n bundleId: string;\n /**\n * The number of bytes that have been downloaded.\n *\n * @since 7.0.0\n */\n downloadedBytes: number;\n /**\n * The progress of the download in percent as a value between `0` and `1`.\n *\n * @since 7.0.0\n * @example 0.5\n */\n progress: number;\n /**\n * The total number of bytes to download.\n *\n * @since 7.0.0\n */\n totalBytes: number;\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { registerPlugin } from '@capacitor/core';
|
|
2
2
|
const LiveUpdate = registerPlugin('LiveUpdate', {
|
|
3
|
-
web: () => import('./web').then(
|
|
3
|
+
web: () => import('./web').then(m => new m.LiveUpdateWeb()),
|
|
4
4
|
});
|
|
5
5
|
export * from './definitions';
|
|
6
6
|
export { LiveUpdate };
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { LiveUpdatePlugin } from './definitions';\n\nconst LiveUpdate = registerPlugin<LiveUpdatePlugin>('LiveUpdate', {\n web: () => import('./web').then(m => new m.LiveUpdateWeb()),\n});\n\nexport * from './definitions';\nexport { LiveUpdate };\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { DeleteBundleOptions, DownloadBundleOptions, FetchLatestBundleResult, GetBundleResult, GetBundlesResult, GetChannelResult, GetCurrentBundleResult, GetCustomIdResult, GetDeviceIdResult, GetNextBundleResult, GetVersionCodeResult, GetVersionNameResult, LiveUpdatePlugin, SetBundleOptions, SetChannelOptions, SetCustomIdOptions, SetNextBundleOptions, SyncResult } from './definitions';
|
|
2
|
+
import type { DeleteBundleOptions, DownloadBundleOptions, FetchLatestBundleResult, GetBundleResult, GetBundlesResult, GetChannelResult, GetCurrentBundleResult, GetCustomIdResult, GetDeviceIdResult, GetNextBundleResult, GetVersionCodeResult, GetVersionNameResult, LiveUpdatePlugin, ReadyResult, SetBundleOptions, SetChannelOptions, SetCustomIdOptions, SetNextBundleOptions, 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>;
|
|
@@ -13,7 +13,7 @@ export declare class LiveUpdateWeb extends WebPlugin implements LiveUpdatePlugin
|
|
|
13
13
|
getNextBundle(): Promise<GetNextBundleResult>;
|
|
14
14
|
getVersionCode(): Promise<GetVersionCodeResult>;
|
|
15
15
|
getVersionName(): Promise<GetVersionNameResult>;
|
|
16
|
-
ready(): Promise<
|
|
16
|
+
ready(): Promise<ReadyResult>;
|
|
17
17
|
reload(): Promise<void>;
|
|
18
18
|
reset(): Promise<void>;
|
|
19
19
|
setBundle(_options: SetBundleOptions): Promise<void>;
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAwB5C,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,iBAAiB;QAC5B,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,gBAAgB;QAC3B,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,aAAa;QACxB,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,aAAa,CAAC,QAA8B;QACvD,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 FetchLatestBundleResult,\n GetBundleResult,\n GetBundlesResult,\n GetChannelResult,\n GetCurrentBundleResult,\n GetCustomIdResult,\n GetDeviceIdResult,\n GetNextBundleResult,\n GetVersionCodeResult,\n GetVersionNameResult,\n LiveUpdatePlugin,\n ReadyResult,\n SetBundleOptions,\n SetChannelOptions,\n SetCustomIdOptions,\n SetNextBundleOptions,\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 fetchLatestBundle(): Promise<FetchLatestBundleResult> {\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 getCurrentBundle(): Promise<GetCurrentBundleResult> {\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 getNextBundle(): Promise<GetNextBundleResult> {\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 setNextBundle(_options: SetNextBundleOptions): 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"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var core = require('@capacitor/core');
|
|
6
4
|
|
|
7
5
|
const LiveUpdate = core.registerPlugin('LiveUpdate', {
|
|
8
|
-
web: () => Promise.resolve().then(function () { return web; }).then(
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.LiveUpdateWeb()),
|
|
9
7
|
});
|
|
10
8
|
|
|
11
9
|
class LiveUpdateWeb extends core.WebPlugin {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then(
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then(m => new m.LiveUpdateWeb()),\n});\nexport * from './definitions';\nexport { LiveUpdate };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LiveUpdateWeb extends WebPlugin {\n async deleteBundle(_options) {\n this.throwUnimplementedError();\n }\n async downloadBundle(_options) {\n this.throwUnimplementedError();\n }\n async fetchLatestBundle() {\n this.throwUnimplementedError();\n }\n async getBundle() {\n this.throwUnimplementedError();\n }\n async getBundles() {\n this.throwUnimplementedError();\n }\n async getChannel() {\n this.throwUnimplementedError();\n }\n async getCurrentBundle() {\n this.throwUnimplementedError();\n }\n async getCustomId() {\n this.throwUnimplementedError();\n }\n async getDeviceId() {\n this.throwUnimplementedError();\n }\n async getNextBundle() {\n this.throwUnimplementedError();\n }\n async getVersionCode() {\n this.throwUnimplementedError();\n }\n async getVersionName() {\n this.throwUnimplementedError();\n }\n async ready() {\n this.throwUnimplementedError();\n }\n async reload() {\n this.throwUnimplementedError();\n }\n async reset() {\n this.throwUnimplementedError();\n }\n async setBundle(_options) {\n this.throwUnimplementedError();\n }\n async setChannel(_options) {\n this.throwUnimplementedError();\n }\n async setCustomId(_options) {\n this.throwUnimplementedError();\n }\n async setNextBundle(_options) {\n this.throwUnimplementedError();\n }\n async sync() {\n this.throwUnimplementedError();\n }\n throwUnimplementedError() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;AAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAChC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;AAClC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;AACtC;AACA,IAAI,uBAAuB,GAAG;AAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -2,7 +2,7 @@ var capacitorLiveUpdate = (function (exports, core) {
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const LiveUpdate = core.registerPlugin('LiveUpdate', {
|
|
5
|
-
web: () => Promise.resolve().then(function () { return web; }).then(
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.LiveUpdateWeb()),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
class LiveUpdateWeb extends core.WebPlugin {
|
|
@@ -78,8 +78,6 @@ var capacitorLiveUpdate = (function (exports, core) {
|
|
|
78
78
|
|
|
79
79
|
exports.LiveUpdate = LiveUpdate;
|
|
80
80
|
|
|
81
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
82
|
-
|
|
83
81
|
return exports;
|
|
84
82
|
|
|
85
83
|
})({}, capacitorExports);
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then(
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LiveUpdate = registerPlugin('LiveUpdate', {\n web: () => import('./web').then(m => new m.LiveUpdateWeb()),\n});\nexport * from './definitions';\nexport { LiveUpdate };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LiveUpdateWeb extends WebPlugin {\n async deleteBundle(_options) {\n this.throwUnimplementedError();\n }\n async downloadBundle(_options) {\n this.throwUnimplementedError();\n }\n async fetchLatestBundle() {\n this.throwUnimplementedError();\n }\n async getBundle() {\n this.throwUnimplementedError();\n }\n async getBundles() {\n this.throwUnimplementedError();\n }\n async getChannel() {\n this.throwUnimplementedError();\n }\n async getCurrentBundle() {\n this.throwUnimplementedError();\n }\n async getCustomId() {\n this.throwUnimplementedError();\n }\n async getDeviceId() {\n this.throwUnimplementedError();\n }\n async getNextBundle() {\n this.throwUnimplementedError();\n }\n async getVersionCode() {\n this.throwUnimplementedError();\n }\n async getVersionName() {\n this.throwUnimplementedError();\n }\n async ready() {\n this.throwUnimplementedError();\n }\n async reload() {\n this.throwUnimplementedError();\n }\n async reset() {\n this.throwUnimplementedError();\n }\n async setBundle(_options) {\n this.throwUnimplementedError();\n }\n async setChannel(_options) {\n this.throwUnimplementedError();\n }\n async setCustomId(_options) {\n this.throwUnimplementedError();\n }\n async setNextBundle(_options) {\n this.throwUnimplementedError();\n }\n async sync() {\n this.throwUnimplementedError();\n }\n throwUnimplementedError() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAChC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;IAClC,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,IAAI,CAAC,uBAAuB,EAAE;IACtC;IACA,IAAI,uBAAuB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class DownloadBundleProgressEvent: NSObject, Result {
|
|
5
|
+
let bundleId: String
|
|
6
|
+
let downloadedBytes: Int64
|
|
7
|
+
let progress: Double
|
|
8
|
+
let totalBytes: Int64
|
|
9
|
+
|
|
10
|
+
init(bundleId: String, downloadedBytes: Int64, totalBytes: Int64) {
|
|
11
|
+
self.bundleId = bundleId
|
|
12
|
+
self.downloadedBytes = downloadedBytes
|
|
13
|
+
self.progress = Double(downloadedBytes) / Double(totalBytes)
|
|
14
|
+
self.totalBytes = totalBytes
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public func toJSObject() -> AnyObject {
|
|
18
|
+
var result = JSObject()
|
|
19
|
+
result["bundleId"] = bundleId
|
|
20
|
+
result["downloadedBytes"] = Int(truncatingIfNeeded: downloadedBytes)
|
|
21
|
+
result["progress"] = progress
|
|
22
|
+
result["totalBytes"] = Int(truncatingIfNeeded: totalBytes)
|
|
23
|
+
return result as AnyObject
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -4,17 +4,15 @@ import Capacitor
|
|
|
4
4
|
@objc public class DownloadBundleOptions: NSObject {
|
|
5
5
|
private var artifactType: ArtifactType
|
|
6
6
|
private var bundleId: String
|
|
7
|
-
private var checksum: String?
|
|
8
7
|
private var url: String
|
|
9
8
|
|
|
10
|
-
init(artifactType: String, bundleId: String,
|
|
9
|
+
init(artifactType: String, bundleId: String, url: String) {
|
|
11
10
|
if artifactType == "manifest" {
|
|
12
11
|
self.artifactType = .manifest
|
|
13
12
|
} else {
|
|
14
13
|
self.artifactType = .zip
|
|
15
14
|
}
|
|
16
15
|
self.bundleId = bundleId
|
|
17
|
-
self.checksum = checksum
|
|
18
16
|
self.url = url
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -26,10 +24,6 @@ import Capacitor
|
|
|
26
24
|
return bundleId
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
func getChecksum() -> String? {
|
|
30
|
-
return checksum
|
|
31
|
-
}
|
|
32
|
-
|
|
33
27
|
func getUrl() -> String {
|
|
34
28
|
return url
|
|
35
29
|
}
|
package/ios/Plugin/Classes/Results/{FetchLatestBundle.swift → FetchLatestBundleResult.swift}
RENAMED
|
@@ -4,11 +4,13 @@ import Capacitor
|
|
|
4
4
|
@objc public class FetchLatestBundleResult: NSObject, Result {
|
|
5
5
|
private let artifactType: ArtifactType?
|
|
6
6
|
private let bundleId: String?
|
|
7
|
+
private let customProperties: [String: Any]?
|
|
7
8
|
private let downloadUrl: String?
|
|
8
9
|
|
|
9
|
-
init(artifactType: ArtifactType?, bundleId: String?, downloadUrl: String?) {
|
|
10
|
+
init(artifactType: ArtifactType?, bundleId: String?, customProperties: [String: Any]?, downloadUrl: String?) {
|
|
10
11
|
self.artifactType = artifactType
|
|
11
12
|
self.bundleId = bundleId
|
|
13
|
+
self.customProperties = customProperties
|
|
12
14
|
self.downloadUrl = downloadUrl
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -20,6 +22,9 @@ import Capacitor
|
|
|
20
22
|
result["artifactType"] = "zip"
|
|
21
23
|
}
|
|
22
24
|
result["bundleId"] = bundleId == nil ? NSNull() : bundleId
|
|
25
|
+
if let customProperties = JSTypes.coerceDictionaryToJSObject(customProperties) {
|
|
26
|
+
result["customProperties"] = customProperties
|
|
27
|
+
}
|
|
23
28
|
if let downloadUrl = downloadUrl {
|
|
24
29
|
result["downloadUrl"] = downloadUrl
|
|
25
30
|
}
|
|
@@ -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 == nil ? NSNull() : currentBundleId
|
|
18
|
+
result["previousBundleId"] = previousBundleId == nil ? NSNull() : previousBundleId
|
|
19
|
+
result["rollback"] = rollback
|
|
20
|
+
return result as AnyObject
|
|
21
|
+
}
|
|
22
|
+
}
|