@capgo/capacitor-updater 5.0.0-alpha.0 → 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/CapgoCapacitorUpdater.podspec +1 -1
- package/LICENCE +373 -661
- package/README.md +339 -75
- package/android/build.gradle +13 -12
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +205 -121
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +32 -24
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +1041 -441
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1217 -536
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +153 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +62 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +14 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +126 -0
- package/dist/docs.json +727 -171
- package/dist/esm/definitions.d.ts +234 -45
- package/dist/esm/definitions.js +5 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +9 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +12 -6
- package/dist/esm/web.js +64 -20
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +70 -23
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +70 -23
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/BundleInfo.swift +38 -19
- package/ios/Plugin/BundleStatus.swift +11 -4
- package/ios/Plugin/CapacitorUpdater.swift +520 -192
- package/ios/Plugin/CapacitorUpdaterPlugin.m +8 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +447 -190
- package/ios/Plugin/CryptoCipher.swift +240 -0
- package/ios/Plugin/DelayCondition.swift +74 -0
- package/ios/Plugin/DelayUntilNext.swift +30 -0
- package/ios/Plugin/UserDefaultsExtension.swift +48 -0
- package/package.json +26 -20
- package/ios/Plugin/ObjectPreferences.swift +0 -97
|
@@ -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
|
* These configuration values are available:
|
|
@@ -37,40 +37,96 @@ declare module '@capacitor/cli' {
|
|
|
37
37
|
*
|
|
38
38
|
* Only available for Android and iOS.
|
|
39
39
|
*
|
|
40
|
-
* @default
|
|
40
|
+
* @default true
|
|
41
41
|
* @example false
|
|
42
42
|
*/
|
|
43
43
|
autoUpdate?: boolean;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.
|
|
46
46
|
*
|
|
47
47
|
* Only available for Android and iOS.
|
|
48
48
|
*
|
|
49
|
-
* @default
|
|
50
|
-
* @example
|
|
49
|
+
* @default true
|
|
50
|
+
* @example false
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
resetWhenUpdate?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Configure the URL / endpoint to which update checks are sent.
|
|
55
55
|
*
|
|
56
56
|
* Only available for Android and iOS.
|
|
57
57
|
*
|
|
58
|
-
* @default
|
|
59
|
-
* @example
|
|
58
|
+
* @default https://api.capgo.app/auto_update
|
|
59
|
+
* @example https://example.com/api/auto_update
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
updateUrl?: string;
|
|
62
62
|
/**
|
|
63
63
|
* Configure the URL / endpoint to which update statistics are sent.
|
|
64
64
|
*
|
|
65
|
-
* Only available for Android and iOS.
|
|
65
|
+
* Only available for Android and iOS. Set to "" to disable stats reporting.
|
|
66
66
|
*
|
|
67
|
-
* @default https://capgo.app/
|
|
67
|
+
* @default https://api.capgo.app/stats
|
|
68
68
|
* @example https://example.com/api/stats
|
|
69
69
|
*/
|
|
70
70
|
statsUrl?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Configure the private key for end to end live update encryption.
|
|
73
|
+
*
|
|
74
|
+
* Only available for Android and iOS.
|
|
75
|
+
*
|
|
76
|
+
* @default undefined
|
|
77
|
+
*/
|
|
78
|
+
privateKey?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Configure the current version of the app. This will be used for the first update request.
|
|
81
|
+
* If not set, the plugin will get the version from the native code.
|
|
82
|
+
*
|
|
83
|
+
* Only available for Android and iOS.
|
|
84
|
+
*
|
|
85
|
+
* @default undefined
|
|
86
|
+
* @since 4.17.48
|
|
87
|
+
*/
|
|
88
|
+
version?: string;
|
|
71
89
|
};
|
|
72
90
|
}
|
|
73
91
|
}
|
|
92
|
+
export interface noNeedEvent {
|
|
93
|
+
/**
|
|
94
|
+
* Current status of download, between 0 and 100.
|
|
95
|
+
*
|
|
96
|
+
* @since 4.0.0
|
|
97
|
+
*/
|
|
98
|
+
bundle: BundleInfo;
|
|
99
|
+
}
|
|
100
|
+
export interface updateAvailableEvent {
|
|
101
|
+
/**
|
|
102
|
+
* Current status of download, between 0 and 100.
|
|
103
|
+
*
|
|
104
|
+
* @since 4.0.0
|
|
105
|
+
*/
|
|
106
|
+
bundle: BundleInfo;
|
|
107
|
+
}
|
|
108
|
+
export interface channelRes {
|
|
109
|
+
/**
|
|
110
|
+
* Current status of set channel
|
|
111
|
+
*
|
|
112
|
+
* @since 4.7.0
|
|
113
|
+
*/
|
|
114
|
+
status: string;
|
|
115
|
+
error?: any;
|
|
116
|
+
message?: any;
|
|
117
|
+
}
|
|
118
|
+
export interface getChannelRes {
|
|
119
|
+
/**
|
|
120
|
+
* Current status of get channel
|
|
121
|
+
*
|
|
122
|
+
* @since 4.8.0
|
|
123
|
+
*/
|
|
124
|
+
channel?: string;
|
|
125
|
+
error?: any;
|
|
126
|
+
message?: any;
|
|
127
|
+
status?: string;
|
|
128
|
+
allowSet?: boolean;
|
|
129
|
+
}
|
|
74
130
|
export interface DownloadEvent {
|
|
75
131
|
/**
|
|
76
132
|
* Current status of download, between 0 and 100.
|
|
@@ -82,7 +138,15 @@ export interface DownloadEvent {
|
|
|
82
138
|
}
|
|
83
139
|
export interface MajorAvailableEvent {
|
|
84
140
|
/**
|
|
85
|
-
* Emit when a new major
|
|
141
|
+
* Emit when a new major bundle is available.
|
|
142
|
+
*
|
|
143
|
+
* @since 4.0.0
|
|
144
|
+
*/
|
|
145
|
+
version: string;
|
|
146
|
+
}
|
|
147
|
+
export interface DownloadFailedEvent {
|
|
148
|
+
/**
|
|
149
|
+
* Emit when a download fail.
|
|
86
150
|
*
|
|
87
151
|
* @since 4.0.0
|
|
88
152
|
*/
|
|
@@ -104,43 +168,81 @@ export interface UpdateFailedEvent {
|
|
|
104
168
|
*/
|
|
105
169
|
bundle: BundleInfo;
|
|
106
170
|
}
|
|
171
|
+
export interface latestVersion {
|
|
172
|
+
/**
|
|
173
|
+
* Res of getLatest method
|
|
174
|
+
*
|
|
175
|
+
* @since 4.0.0
|
|
176
|
+
*/
|
|
177
|
+
version: string;
|
|
178
|
+
major?: boolean;
|
|
179
|
+
message?: string;
|
|
180
|
+
sessionKey?: string;
|
|
181
|
+
error?: string;
|
|
182
|
+
old?: string;
|
|
183
|
+
url?: string;
|
|
184
|
+
}
|
|
107
185
|
export interface BundleInfo {
|
|
108
186
|
id: string;
|
|
109
187
|
version: string;
|
|
110
188
|
downloaded: string;
|
|
189
|
+
checksum: string;
|
|
111
190
|
status: BundleStatus;
|
|
112
191
|
}
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
export
|
|
117
|
-
|
|
192
|
+
export interface SetChannelOptions {
|
|
193
|
+
channel: string;
|
|
194
|
+
}
|
|
195
|
+
export interface SetCustomIdOptions {
|
|
196
|
+
customId: string;
|
|
197
|
+
}
|
|
198
|
+
export interface DelayCondition {
|
|
199
|
+
/**
|
|
200
|
+
* Set up delay conditions in setMultiDelay
|
|
201
|
+
* @param value is useless for @param kind "kill", optional for "background" (default value: "0") and required for "nativeVersion" and "date"
|
|
202
|
+
*/
|
|
203
|
+
kind: DelayUntilNext;
|
|
204
|
+
value?: string;
|
|
205
|
+
}
|
|
206
|
+
export type BundleStatus = "success" | "error" | "pending" | "downloading";
|
|
207
|
+
export type DelayUntilNext = "background" | "kill" | "nativeVersion" | "date";
|
|
208
|
+
export type DownloadChangeListener = (state: DownloadEvent) => void;
|
|
209
|
+
export type NoNeedListener = (state: noNeedEvent) => void;
|
|
210
|
+
export type UpdateAvailabledListener = (state: updateAvailableEvent) => void;
|
|
211
|
+
export type DownloadFailedListener = (state: DownloadFailedEvent) => void;
|
|
212
|
+
export type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
|
|
213
|
+
export type MajorAvailableListener = (state: MajorAvailableEvent) => void;
|
|
214
|
+
export type UpdateFailedListener = (state: UpdateFailedEvent) => void;
|
|
215
|
+
export type AppReloadedListener = (state: void) => void;
|
|
118
216
|
export interface CapacitorUpdaterPlugin {
|
|
119
217
|
/**
|
|
120
218
|
* Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
|
|
219
|
+
* By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
|
|
220
|
+
* Change this behaviour with {@link appReadyTimeout}
|
|
121
221
|
*
|
|
122
|
-
* @returns {Promise<
|
|
123
|
-
* @throws An error if
|
|
222
|
+
* @returns {Promise<BundleInfo>} an Promise resolved directly
|
|
223
|
+
* @throws An error if something went wrong
|
|
124
224
|
*/
|
|
125
225
|
notifyAppReady(): Promise<BundleInfo>;
|
|
126
226
|
/**
|
|
127
|
-
* Download a new
|
|
227
|
+
* Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
|
|
128
228
|
*
|
|
129
|
-
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified
|
|
229
|
+
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.
|
|
130
230
|
* @param url 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.)
|
|
131
|
-
* @param version
|
|
231
|
+
* @param version set the version code/name of this bundle/version
|
|
132
232
|
* @example https://example.com/versions/{version}/dist.zip
|
|
133
233
|
*/
|
|
134
234
|
download(options: {
|
|
135
235
|
url: string;
|
|
136
|
-
version
|
|
236
|
+
version: string;
|
|
237
|
+
sessionKey?: string;
|
|
238
|
+
checksum?: string;
|
|
137
239
|
}): Promise<BundleInfo>;
|
|
138
240
|
/**
|
|
139
241
|
* Set the next bundle to be used when the app is reloaded.
|
|
140
242
|
*
|
|
141
243
|
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle id.
|
|
142
244
|
* @param id The bundle id to set as current, next time the app is reloaded. See {@link BundleInfo.id}
|
|
143
|
-
* @throws An error if there are is no index.html file inside the
|
|
245
|
+
* @throws An error if there are is no index.html file inside the bundle folder.
|
|
144
246
|
*/
|
|
145
247
|
next(options: {
|
|
146
248
|
id: string;
|
|
@@ -150,7 +252,7 @@ export interface CapacitorUpdaterPlugin {
|
|
|
150
252
|
*
|
|
151
253
|
* @param id The bundle id to set as current. See {@link BundleInfo.id}
|
|
152
254
|
* @returns {Promise<Void>} An empty promise.
|
|
153
|
-
* @throws An error if there are is no index.html file inside the
|
|
255
|
+
* @throws An error if there are is no index.html file inside the bundle folder.
|
|
154
256
|
*/
|
|
155
257
|
set(options: {
|
|
156
258
|
id: string;
|
|
@@ -166,16 +268,16 @@ export interface CapacitorUpdaterPlugin {
|
|
|
166
268
|
id: string;
|
|
167
269
|
}): Promise<void>;
|
|
168
270
|
/**
|
|
169
|
-
* Get all available
|
|
271
|
+
* Get all available bundles
|
|
170
272
|
*
|
|
171
|
-
* @returns {Promise<{
|
|
273
|
+
* @returns {Promise<{bundles: BundleInfo[]}>} an Promise witht the bundles list
|
|
172
274
|
* @throws An error if the something went wrong
|
|
173
275
|
*/
|
|
174
276
|
list(): Promise<{
|
|
175
277
|
bundles: BundleInfo[];
|
|
176
278
|
}>;
|
|
177
279
|
/**
|
|
178
|
-
* Set the `builtin`
|
|
280
|
+
* Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
|
|
179
281
|
*
|
|
180
282
|
* @returns {Promise<void>} an empty Promise
|
|
181
283
|
* @param toLastSuccessful [false] if yes it reset to to the last successfully loaded bundle instead of `builtin`
|
|
@@ -187,7 +289,7 @@ export interface CapacitorUpdaterPlugin {
|
|
|
187
289
|
/**
|
|
188
290
|
* Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
|
|
189
291
|
*
|
|
190
|
-
* @returns {Promise<{
|
|
292
|
+
* @returns {Promise<{ bundle: BundleInfo, native: string }>} an Promise with the current bundle info
|
|
191
293
|
* @throws An error if the something went wrong
|
|
192
294
|
*/
|
|
193
295
|
current(): Promise<{
|
|
@@ -202,46 +304,127 @@ export interface CapacitorUpdaterPlugin {
|
|
|
202
304
|
*/
|
|
203
305
|
reload(): Promise<void>;
|
|
204
306
|
/**
|
|
205
|
-
* Set
|
|
307
|
+
* Set DelayCondition, skip updates until one of the conditions is met
|
|
206
308
|
*
|
|
207
309
|
* @returns {Promise<void>} an Promise resolved directly
|
|
310
|
+
* @param options are the {@link DelayCondition} list to set
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* setMultiDelay({ delayConditions: [{ kind: 'kill' }, { kind: 'background', value: '300000' }] })
|
|
314
|
+
* // installs the update after the user kills the app or after a background of 300000 ms (5 minutes)
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* setMultiDelay({ delayConditions: [{ kind: 'date', value: '2022-09-14T06:14:11.920Z' }] })
|
|
318
|
+
* // installs the update after the specific iso8601 date is expired
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* setMultiDelay({ delayConditions: [{ kind: 'background' }] })
|
|
322
|
+
* // installs the update after the the first background (default behaviour without setting delay)
|
|
323
|
+
*
|
|
208
324
|
* @throws An error if the something went wrong
|
|
325
|
+
* @since 4.3.0
|
|
209
326
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
327
|
+
setMultiDelay(options: {
|
|
328
|
+
delayConditions: DelayCondition[];
|
|
212
329
|
}): Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* Cancel delay to updates as usual
|
|
332
|
+
*
|
|
333
|
+
* @returns {Promise<void>} an Promise resolved directly
|
|
334
|
+
* @throws An error if the something went wrong
|
|
335
|
+
* @since 4.0.0
|
|
336
|
+
*/
|
|
337
|
+
cancelDelay(): Promise<void>;
|
|
338
|
+
/**
|
|
339
|
+
* Get Latest bundle available from update Url
|
|
340
|
+
*
|
|
341
|
+
* @returns {Promise<latestVersion>} an Promise resolved when url is loaded
|
|
342
|
+
* @throws An error if the something went wrong
|
|
343
|
+
* @since 4.0.0
|
|
344
|
+
*/
|
|
345
|
+
getLatest(): Promise<latestVersion>;
|
|
346
|
+
/**
|
|
347
|
+
* Set Channel for this device
|
|
348
|
+
*
|
|
349
|
+
* @returns {Promise<channelRes>} an Promise resolved when channel is set
|
|
350
|
+
* @param options is the {@link SetChannelOptions} channel to set
|
|
351
|
+
* @throws An error if the something went wrong
|
|
352
|
+
* @since 4.7.0
|
|
353
|
+
*/
|
|
354
|
+
setChannel(options: SetChannelOptions): Promise<channelRes>;
|
|
355
|
+
/**
|
|
356
|
+
* get Channel for this device
|
|
357
|
+
*
|
|
358
|
+
* @returns {Promise<channelRes>} an Promise resolved with channel info
|
|
359
|
+
* @throws An error if the something went wrong
|
|
360
|
+
* @since 4.8.0
|
|
361
|
+
*/
|
|
362
|
+
getChannel(): Promise<getChannelRes>;
|
|
363
|
+
/**
|
|
364
|
+
* Set Channel for this device
|
|
365
|
+
*
|
|
366
|
+
* @returns {Promise<void>} an Promise resolved instantly
|
|
367
|
+
* @param options is the {@link SetCustomIdOptions} customId to set
|
|
368
|
+
* @throws An error if the something went wrong
|
|
369
|
+
* @since 4.9.0
|
|
370
|
+
*/
|
|
371
|
+
setCustomId(options: SetCustomIdOptions): Promise<void>;
|
|
213
372
|
/**
|
|
214
373
|
* Listen for download event in the App, let you know when the download is started, loading and finished
|
|
215
374
|
*
|
|
216
375
|
* @since 2.0.11
|
|
217
376
|
*/
|
|
218
|
-
addListener(eventName:
|
|
377
|
+
addListener(eventName: "download", listenerFunc: DownloadChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
378
|
+
/**
|
|
379
|
+
* Listen for no need to update event, usefull when you want force check every time the app is launched
|
|
380
|
+
*
|
|
381
|
+
* @since 4.0.0
|
|
382
|
+
*/
|
|
383
|
+
addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
384
|
+
/**
|
|
385
|
+
* Listen for availbale update event, usefull when you want to force check every time the app is launched
|
|
386
|
+
*
|
|
387
|
+
* @since 4.0.0
|
|
388
|
+
*/
|
|
389
|
+
addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
219
390
|
/**
|
|
220
391
|
* Listen for download event in the App, let you know when the download is started, loading and finished
|
|
221
392
|
*
|
|
222
393
|
* @since 4.0.0
|
|
223
394
|
*/
|
|
224
|
-
addListener(eventName:
|
|
395
|
+
addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
225
396
|
/**
|
|
226
397
|
* Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
|
|
227
398
|
*
|
|
228
399
|
* @since 2.3.0
|
|
229
400
|
*/
|
|
230
|
-
addListener(eventName:
|
|
401
|
+
addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
231
402
|
/**
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
addListener(eventName:
|
|
403
|
+
* Listen for update fail event in the App, let you know when update has fail to install at next app start
|
|
404
|
+
*
|
|
405
|
+
* @since 2.3.0
|
|
406
|
+
*/
|
|
407
|
+
addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
408
|
+
/**
|
|
409
|
+
* Listen for download fail event in the App, let you know when download has fail finished
|
|
410
|
+
*
|
|
411
|
+
* @since 4.0.0
|
|
412
|
+
*/
|
|
413
|
+
addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
414
|
+
/**
|
|
415
|
+
* Listen for download fail event in the App, let you know when download has fail finished
|
|
416
|
+
*
|
|
417
|
+
* @since 4.3.0
|
|
418
|
+
*/
|
|
419
|
+
addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
237
420
|
/**
|
|
238
421
|
* Get unique ID used to identify device (sent to auto update server)
|
|
239
422
|
*
|
|
240
|
-
* @returns {Promise<{
|
|
423
|
+
* @returns {Promise<{ deviceId: string }>} an Promise with id for this device
|
|
241
424
|
* @throws An error if the something went wrong
|
|
242
425
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
426
|
+
getDeviceId(): Promise<{
|
|
427
|
+
deviceId: string;
|
|
245
428
|
}>;
|
|
246
429
|
/**
|
|
247
430
|
* Get the native Capacitor Updater plugin version (sent to auto update server)
|
|
@@ -261,4 +444,10 @@ export interface CapacitorUpdaterPlugin {
|
|
|
261
444
|
isAutoUpdateEnabled(): Promise<{
|
|
262
445
|
enabled: boolean;
|
|
263
446
|
}>;
|
|
447
|
+
/**
|
|
448
|
+
* Remove all listeners for this plugin.
|
|
449
|
+
*
|
|
450
|
+
* @since 1.0.0
|
|
451
|
+
*/
|
|
452
|
+
removeAllListeners(): Promise<void>;
|
|
264
453
|
}
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
1
6
|
export {};
|
|
2
7
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CapacitorUpdaterPlugin } from
|
|
1
|
+
import type { CapacitorUpdaterPlugin } from "./definitions";
|
|
2
2
|
declare const CapacitorUpdater: CapacitorUpdaterPlugin;
|
|
3
|
-
export * from
|
|
3
|
+
export * from "./definitions";
|
|
4
4
|
export { CapacitorUpdater };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { registerPlugin } from "@capacitor/core";
|
|
7
|
+
const CapacitorUpdater = registerPlugin("CapacitorUpdater", {
|
|
8
|
+
web: () => import("./web").then((m) => new m.CapacitorUpdaterWeb()),
|
|
4
9
|
});
|
|
5
|
-
export * from
|
|
10
|
+
export * from "./definitions";
|
|
6
11
|
export { CapacitorUpdater };
|
|
7
12
|
//# sourceMappingURL=index.js.map
|
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,gBAAgB,GAAG,cAAc,CACrC,kBAAkB,EAClB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,gBAAgB,GAAG,cAAc,CACrC,kBAAkB,EAClB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;CACpE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
2
|
-
import type { CapacitorUpdaterPlugin, BundleInfo } from
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
|
+
import type { CapacitorUpdaterPlugin, BundleInfo, latestVersion, DelayCondition, channelRes, SetChannelOptions, getChannelRes, SetCustomIdOptions } from "./definitions";
|
|
3
3
|
export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorUpdaterPlugin {
|
|
4
4
|
download(options: {
|
|
5
5
|
url: string;
|
|
@@ -14,8 +14,8 @@ export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorU
|
|
|
14
14
|
set(options: {
|
|
15
15
|
id: string;
|
|
16
16
|
}): Promise<void>;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
getDeviceId(): Promise<{
|
|
18
|
+
deviceId: string;
|
|
19
19
|
}>;
|
|
20
20
|
getPluginVersion(): Promise<{
|
|
21
21
|
version: string;
|
|
@@ -34,8 +34,14 @@ export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorU
|
|
|
34
34
|
native: string;
|
|
35
35
|
}>;
|
|
36
36
|
reload(): Promise<void>;
|
|
37
|
+
getLatest(): Promise<latestVersion>;
|
|
38
|
+
setChannel(options: SetChannelOptions): Promise<channelRes>;
|
|
39
|
+
setCustomId(options: SetCustomIdOptions): Promise<void>;
|
|
40
|
+
getChannel(): Promise<getChannelRes>;
|
|
37
41
|
notifyAppReady(): Promise<BundleInfo>;
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
setMultiDelay(options: {
|
|
43
|
+
delayConditions: DelayCondition[];
|
|
40
44
|
}): Promise<void>;
|
|
45
|
+
setDelay(option: DelayCondition): Promise<void>;
|
|
46
|
+
cancelDelay(): Promise<void>;
|
|
41
47
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -1,54 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
import { WebPlugin } from "@capacitor/core";
|
|
7
|
+
const BUNDLE_BUILTIN = {
|
|
8
|
+
status: "success",
|
|
9
|
+
version: "",
|
|
10
|
+
downloaded: "1970-01-01T00:00:00.000Z",
|
|
11
|
+
id: "builtin",
|
|
12
|
+
checksum: "",
|
|
13
|
+
};
|
|
3
14
|
export class CapacitorUpdaterWeb extends WebPlugin {
|
|
4
15
|
async download(options) {
|
|
5
|
-
console.warn(
|
|
16
|
+
console.warn("Cannot download version in web", options);
|
|
6
17
|
return BUNDLE_BUILTIN;
|
|
7
18
|
}
|
|
8
19
|
async next(options) {
|
|
9
|
-
console.warn(
|
|
20
|
+
console.warn("Cannot set next version in web", options);
|
|
10
21
|
return BUNDLE_BUILTIN;
|
|
11
22
|
}
|
|
12
23
|
async isAutoUpdateEnabled() {
|
|
13
|
-
console.warn(
|
|
24
|
+
console.warn("Cannot get isAutoUpdateEnabled in web");
|
|
14
25
|
return { enabled: false };
|
|
15
26
|
}
|
|
16
27
|
async set(options) {
|
|
17
|
-
console.warn(
|
|
28
|
+
console.warn("Cannot set active bundle in web", options);
|
|
18
29
|
return;
|
|
19
30
|
}
|
|
20
|
-
async
|
|
21
|
-
console.warn(
|
|
22
|
-
return {
|
|
31
|
+
async getDeviceId() {
|
|
32
|
+
console.warn("Cannot get ID in web");
|
|
33
|
+
return { deviceId: "default" };
|
|
23
34
|
}
|
|
24
35
|
async getPluginVersion() {
|
|
25
|
-
console.warn(
|
|
26
|
-
return { version:
|
|
36
|
+
console.warn("Cannot get plugin version in web");
|
|
37
|
+
return { version: "default" };
|
|
27
38
|
}
|
|
28
39
|
async delete(options) {
|
|
29
|
-
console.warn(
|
|
40
|
+
console.warn("Cannot delete bundle in web", options);
|
|
30
41
|
}
|
|
31
42
|
async list() {
|
|
32
|
-
console.warn(
|
|
43
|
+
console.warn("Cannot list bundles in web");
|
|
33
44
|
return { bundles: [] };
|
|
34
45
|
}
|
|
35
46
|
async reset(options) {
|
|
36
|
-
console.warn(
|
|
47
|
+
console.warn("Cannot reset version in web", options);
|
|
37
48
|
}
|
|
38
49
|
async current() {
|
|
39
|
-
console.warn(
|
|
40
|
-
return { bundle: BUNDLE_BUILTIN, native:
|
|
50
|
+
console.warn("Cannot get current bundle in web");
|
|
51
|
+
return { bundle: BUNDLE_BUILTIN, native: "0.0.0" };
|
|
41
52
|
}
|
|
42
53
|
async reload() {
|
|
43
|
-
console.warn(
|
|
54
|
+
console.warn("Cannot reload current bundle in web");
|
|
44
55
|
return;
|
|
45
56
|
}
|
|
57
|
+
async getLatest() {
|
|
58
|
+
console.warn("Cannot getLatest current bundle in web");
|
|
59
|
+
return {
|
|
60
|
+
version: "0.0.0",
|
|
61
|
+
message: "Cannot getLatest current bundle in web",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async setChannel(options) {
|
|
65
|
+
console.warn("Cannot setChannel in web", options);
|
|
66
|
+
return {
|
|
67
|
+
status: "error",
|
|
68
|
+
error: "Cannot setChannel in web",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async setCustomId(options) {
|
|
72
|
+
console.warn("Cannot setCustomId in web", options);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
async getChannel() {
|
|
76
|
+
console.warn("Cannot getChannel in web");
|
|
77
|
+
return {
|
|
78
|
+
status: "error",
|
|
79
|
+
error: "Cannot getChannel in web",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
46
82
|
async notifyAppReady() {
|
|
47
|
-
console.warn(
|
|
83
|
+
console.warn("Cannot notify App Ready in web");
|
|
48
84
|
return BUNDLE_BUILTIN;
|
|
49
85
|
}
|
|
50
|
-
async
|
|
51
|
-
console.warn(
|
|
86
|
+
async setMultiDelay(options) {
|
|
87
|
+
console.warn("Cannot setMultiDelay in web", options === null || options === void 0 ? void 0 : options.delayConditions);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
async setDelay(option) {
|
|
91
|
+
console.warn("Cannot setDelay in web", option);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
async cancelDelay() {
|
|
95
|
+
console.warn("Cannot cancelDelay in web");
|
|
52
96
|
return;
|
|
53
97
|
}
|
|
54
98
|
}
|
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":"AA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