@capgo/capacitor-updater 7.38.0 → 7.40.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/Package.swift +2 -2
- package/README.md +311 -140
- package/android/build.gradle +3 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +348 -25
- package/android/src/main/java/ee/forgr/capacitor_updater/DeviceIdHelper.java +0 -6
- package/dist/docs.json +517 -467
- package/dist/esm/definitions.d.ts +426 -319
- package/dist/esm/definitions.js +103 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/history.js +2 -2
- package/dist/esm/history.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +6 -1
- package/dist/esm/web.js +24 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +135 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +136 -4
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +212 -2
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +53 -57
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +1 -5
- package/package.json +6 -5
|
@@ -1,323 +1,4 @@
|
|
|
1
1
|
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
-
declare module '@capacitor/cli' {
|
|
3
|
-
interface PluginsConfig {
|
|
4
|
-
/**
|
|
5
|
-
* CapacitorUpdater can be configured with these options:
|
|
6
|
-
*/
|
|
7
|
-
CapacitorUpdater?: {
|
|
8
|
-
/**
|
|
9
|
-
* Configure the number of milliseconds the native plugin should wait before considering an update 'failed'.
|
|
10
|
-
*
|
|
11
|
-
* Only available for Android and iOS.
|
|
12
|
-
*
|
|
13
|
-
* @default 10000 // (10 seconds)
|
|
14
|
-
* @example 1000 // (1 second, minimum 1000)
|
|
15
|
-
*/
|
|
16
|
-
appReadyTimeout?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Configure the number of seconds the native plugin should wait before considering API timeout.
|
|
19
|
-
*
|
|
20
|
-
* Only available for Android and iOS.
|
|
21
|
-
*
|
|
22
|
-
* @default 20 // (20 second)
|
|
23
|
-
* @example 10 // (10 second)
|
|
24
|
-
*/
|
|
25
|
-
responseTimeout?: number;
|
|
26
|
-
/**
|
|
27
|
-
* Configure whether the plugin should use automatically delete failed bundles.
|
|
28
|
-
*
|
|
29
|
-
* Only available for Android and iOS.
|
|
30
|
-
*
|
|
31
|
-
* @default true
|
|
32
|
-
* @example false
|
|
33
|
-
*/
|
|
34
|
-
autoDeleteFailed?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Configure whether the plugin should use automatically delete previous bundles after a successful update.
|
|
37
|
-
*
|
|
38
|
-
* Only available for Android and iOS.
|
|
39
|
-
*
|
|
40
|
-
* @default true
|
|
41
|
-
* @example false
|
|
42
|
-
*/
|
|
43
|
-
autoDeletePrevious?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Configure whether the plugin should use Auto Update via an update server.
|
|
46
|
-
*
|
|
47
|
-
* Only available for Android and iOS.
|
|
48
|
-
*
|
|
49
|
-
* @default true
|
|
50
|
-
* @example false
|
|
51
|
-
*/
|
|
52
|
-
autoUpdate?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.
|
|
55
|
-
* Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native.
|
|
56
|
-
* Only available for Android and iOS.
|
|
57
|
-
*
|
|
58
|
-
* @default true
|
|
59
|
-
* @example false
|
|
60
|
-
*/
|
|
61
|
-
resetWhenUpdate?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Configure the URL / endpoint to which update checks are sent.
|
|
64
|
-
*
|
|
65
|
-
* Only available for Android and iOS.
|
|
66
|
-
*
|
|
67
|
-
* @default https://plugin.capgo.app/updates
|
|
68
|
-
* @example https://example.com/api/auto_update
|
|
69
|
-
*/
|
|
70
|
-
updateUrl?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Configure the URL / endpoint for channel operations.
|
|
73
|
-
*
|
|
74
|
-
* Only available for Android and iOS.
|
|
75
|
-
*
|
|
76
|
-
* @default https://plugin.capgo.app/channel_self
|
|
77
|
-
* @example https://example.com/api/channel
|
|
78
|
-
*/
|
|
79
|
-
channelUrl?: string;
|
|
80
|
-
/**
|
|
81
|
-
* Configure the URL / endpoint to which update statistics are sent.
|
|
82
|
-
*
|
|
83
|
-
* Only available for Android and iOS. Set to "" to disable stats reporting.
|
|
84
|
-
*
|
|
85
|
-
* @default https://plugin.capgo.app/stats
|
|
86
|
-
* @example https://example.com/api/stats
|
|
87
|
-
*/
|
|
88
|
-
statsUrl?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Configure the public key for end to end live update encryption Version 2
|
|
91
|
-
*
|
|
92
|
-
* Only available for Android and iOS.
|
|
93
|
-
*
|
|
94
|
-
* @default undefined
|
|
95
|
-
* @since 6.2.0
|
|
96
|
-
*/
|
|
97
|
-
publicKey?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Configure the current version of the app. This will be used for the first update request.
|
|
100
|
-
* If not set, the plugin will get the version from the native code.
|
|
101
|
-
*
|
|
102
|
-
* Only available for Android and iOS.
|
|
103
|
-
*
|
|
104
|
-
* @default undefined
|
|
105
|
-
* @since 4.17.48
|
|
106
|
-
*/
|
|
107
|
-
version?: string;
|
|
108
|
-
/**
|
|
109
|
-
* Configure when the plugin should direct install updates. Only for autoUpdate mode.
|
|
110
|
-
* Works well for apps less than 10MB and with uploads done using --partial flag.
|
|
111
|
-
* Zip or apps more than 10MB will be relatively slow for users to update.
|
|
112
|
-
* - false: Never do direct updates (use default behavior: download at start, set when backgrounded)
|
|
113
|
-
* - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false
|
|
114
|
-
* - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false
|
|
115
|
-
* - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false
|
|
116
|
-
* - true: (deprecated) Same as "always" for backward compatibility
|
|
117
|
-
*
|
|
118
|
-
* Only available for Android and iOS.
|
|
119
|
-
*
|
|
120
|
-
* @default false
|
|
121
|
-
* @since 5.1.0
|
|
122
|
-
*/
|
|
123
|
-
directUpdate?: boolean | 'atInstall' | 'always' | 'onLaunch';
|
|
124
|
-
/**
|
|
125
|
-
* Automatically handle splashscreen hiding when using directUpdate. When enabled, the plugin will automatically hide the splashscreen after updates are applied or when no update is needed.
|
|
126
|
-
* This removes the need to manually listen for appReady events and call SplashScreen.hide().
|
|
127
|
-
* Only works when directUpdate is set to "atInstall", "always", "onLaunch", or true.
|
|
128
|
-
* Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.
|
|
129
|
-
* Requires autoUpdate and directUpdate to be enabled.
|
|
130
|
-
*
|
|
131
|
-
* Only available for Android and iOS.
|
|
132
|
-
*
|
|
133
|
-
* @default false
|
|
134
|
-
* @since 7.6.0
|
|
135
|
-
*/
|
|
136
|
-
autoSplashscreen?: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Display a native loading indicator on top of the splashscreen while automatic direct updates are running.
|
|
139
|
-
* Only takes effect when {@link autoSplashscreen} is enabled.
|
|
140
|
-
* Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.
|
|
141
|
-
*
|
|
142
|
-
* Only available for Android and iOS.
|
|
143
|
-
*
|
|
144
|
-
* @default false
|
|
145
|
-
* @since 7.19.0
|
|
146
|
-
*/
|
|
147
|
-
autoSplashscreenLoader?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates.
|
|
150
|
-
* If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed.
|
|
151
|
-
* Set to `0` (zero) to disable the timeout.
|
|
152
|
-
* When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch.
|
|
153
|
-
* Requires {@link autoSplashscreen} to be enabled.
|
|
154
|
-
*
|
|
155
|
-
* Only available for Android and iOS.
|
|
156
|
-
*
|
|
157
|
-
* @default 10000 // (10 seconds)
|
|
158
|
-
* @since 7.19.0
|
|
159
|
-
*/
|
|
160
|
-
autoSplashscreenTimeout?: number;
|
|
161
|
-
/**
|
|
162
|
-
* Configure the delay period for period update check. the unit is in seconds.
|
|
163
|
-
*
|
|
164
|
-
* Only available for Android and iOS.
|
|
165
|
-
* Cannot be less than 600 seconds (10 minutes).
|
|
166
|
-
*
|
|
167
|
-
* @default 0 (disabled)
|
|
168
|
-
* @example 3600 (1 hour)
|
|
169
|
-
* @example 86400 (24 hours)
|
|
170
|
-
*/
|
|
171
|
-
periodCheckDelay?: number;
|
|
172
|
-
/**
|
|
173
|
-
* Configure the CLI to use a local server for testing or self-hosted update server.
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* @default undefined
|
|
177
|
-
* @since 4.17.48
|
|
178
|
-
*/
|
|
179
|
-
localS3?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* Configure the CLI to use a local server for testing or self-hosted update server.
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* @default undefined
|
|
185
|
-
* @since 4.17.48
|
|
186
|
-
*/
|
|
187
|
-
localHost?: string;
|
|
188
|
-
/**
|
|
189
|
-
* Configure the CLI to use a local server for testing or self-hosted update server.
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @default undefined
|
|
193
|
-
* @since 4.17.48
|
|
194
|
-
*/
|
|
195
|
-
localWebHost?: string;
|
|
196
|
-
/**
|
|
197
|
-
* Configure the CLI to use a local server for testing or self-hosted update server.
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* @default undefined
|
|
201
|
-
* @since 4.17.48
|
|
202
|
-
*/
|
|
203
|
-
localSupa?: string;
|
|
204
|
-
/**
|
|
205
|
-
* Configure the CLI to use a local server for testing.
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* @default undefined
|
|
209
|
-
* @since 4.17.48
|
|
210
|
-
*/
|
|
211
|
-
localSupaAnon?: string;
|
|
212
|
-
/**
|
|
213
|
-
* Configure the CLI to use a local api for testing.
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* @default undefined
|
|
217
|
-
* @since 6.3.3
|
|
218
|
-
*/
|
|
219
|
-
localApi?: string;
|
|
220
|
-
/**
|
|
221
|
-
* Configure the CLI to use a local file api for testing.
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* @default undefined
|
|
225
|
-
* @since 6.3.3
|
|
226
|
-
*/
|
|
227
|
-
localApiFiles?: string;
|
|
228
|
-
/**
|
|
229
|
-
* Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* @default false
|
|
233
|
-
* @since 5.4.0
|
|
234
|
-
*/
|
|
235
|
-
allowModifyUrl?: boolean;
|
|
236
|
-
/**
|
|
237
|
-
* Allow the plugin to modify the appId dynamically from the JavaScript side.
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* @default false
|
|
241
|
-
* @since 7.14.0
|
|
242
|
-
*/
|
|
243
|
-
allowModifyAppId?: boolean;
|
|
244
|
-
/**
|
|
245
|
-
* Allow marking bundles as errored from JavaScript while using manual update flows.
|
|
246
|
-
* When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.
|
|
247
|
-
*
|
|
248
|
-
* @default false
|
|
249
|
-
* @since 7.20.0
|
|
250
|
-
*/
|
|
251
|
-
allowManualBundleError?: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.
|
|
254
|
-
*
|
|
255
|
-
* Only available for Android and iOS.
|
|
256
|
-
*
|
|
257
|
-
* @default false (will be true by default in a future major release v8.x.x)
|
|
258
|
-
* @since 7.17.3
|
|
259
|
-
*/
|
|
260
|
-
persistCustomId?: boolean;
|
|
261
|
-
/**
|
|
262
|
-
* Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl},
|
|
263
|
-
* {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts.
|
|
264
|
-
*
|
|
265
|
-
* Only available for Android and iOS.
|
|
266
|
-
*
|
|
267
|
-
* @default false
|
|
268
|
-
* @since 7.20.0
|
|
269
|
-
*/
|
|
270
|
-
persistModifyUrl?: boolean;
|
|
271
|
-
/**
|
|
272
|
-
* Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel.
|
|
273
|
-
* When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`.
|
|
274
|
-
*
|
|
275
|
-
* @default true
|
|
276
|
-
* @since 7.34.0
|
|
277
|
-
*/
|
|
278
|
-
allowSetDefaultChannel?: boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Set the default channel for the app in the config. Case sensitive.
|
|
281
|
-
* This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.
|
|
282
|
-
* This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* @default undefined
|
|
286
|
-
* @since 5.5.0
|
|
287
|
-
*/
|
|
288
|
-
defaultChannel?: string;
|
|
289
|
-
/**
|
|
290
|
-
* Configure the app id for the app in the config.
|
|
291
|
-
*
|
|
292
|
-
* @default undefined
|
|
293
|
-
* @since 6.0.0
|
|
294
|
-
*/
|
|
295
|
-
appId?: string;
|
|
296
|
-
/**
|
|
297
|
-
* Configure the plugin to keep the URL path after a reload.
|
|
298
|
-
* WARNING: When a reload is triggered, 'window.history' will be cleared.
|
|
299
|
-
*
|
|
300
|
-
* @default false
|
|
301
|
-
* @since 6.8.0
|
|
302
|
-
*/
|
|
303
|
-
keepUrlPathAfterReload?: boolean;
|
|
304
|
-
/**
|
|
305
|
-
* Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done
|
|
306
|
-
*
|
|
307
|
-
* @default false
|
|
308
|
-
* @since 7.3.0
|
|
309
|
-
*/
|
|
310
|
-
disableJSLogging?: boolean;
|
|
311
|
-
/**
|
|
312
|
-
* Enable shake gesture to show update menu for debugging/testing purposes
|
|
313
|
-
*
|
|
314
|
-
* @default false
|
|
315
|
-
* @since 7.5.0
|
|
316
|
-
*/
|
|
317
|
-
shakeMenu?: boolean;
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
2
|
export interface CapacitorUpdaterPlugin {
|
|
322
3
|
/**
|
|
323
4
|
* Notify the native layer that JavaScript initialized successfully.
|
|
@@ -998,6 +679,29 @@ export interface CapacitorUpdaterPlugin {
|
|
|
998
679
|
* @since 7.34.0
|
|
999
680
|
*/
|
|
1000
681
|
addListener(eventName: 'channelPrivate', listenerFunc: (state: ChannelPrivateEvent) => void): Promise<PluginListenerHandle>;
|
|
682
|
+
/**
|
|
683
|
+
* Listen for flexible update state changes on Android.
|
|
684
|
+
*
|
|
685
|
+
* This event fires during the flexible update download process, providing:
|
|
686
|
+
* - Download progress (bytes downloaded / total bytes)
|
|
687
|
+
* - Installation status changes
|
|
688
|
+
*
|
|
689
|
+
* **Install status values:**
|
|
690
|
+
* - `UNKNOWN` (0): Unknown status
|
|
691
|
+
* - `PENDING` (1): Download pending
|
|
692
|
+
* - `DOWNLOADING` (2): Download in progress
|
|
693
|
+
* - `INSTALLING` (3): Installing the update
|
|
694
|
+
* - `INSTALLED` (4): Update installed (app restart needed)
|
|
695
|
+
* - `FAILED` (5): Update failed
|
|
696
|
+
* - `CANCELED` (6): Update was canceled
|
|
697
|
+
* - `DOWNLOADED` (11): Download complete, ready to install
|
|
698
|
+
*
|
|
699
|
+
* When status is `DOWNLOADED`, you should prompt the user and call
|
|
700
|
+
* {@link completeFlexibleUpdate} to finish the installation.
|
|
701
|
+
*
|
|
702
|
+
* @since 8.0.0
|
|
703
|
+
*/
|
|
704
|
+
addListener(eventName: 'onFlexibleUpdateStateChange', listenerFunc: (state: FlexibleUpdateState) => void): Promise<PluginListenerHandle>;
|
|
1001
705
|
/**
|
|
1002
706
|
* Check if the auto-update feature is available (not disabled by custom server configuration).
|
|
1003
707
|
*
|
|
@@ -1146,6 +850,127 @@ export interface CapacitorUpdaterPlugin {
|
|
|
1146
850
|
* @since 7.14.0
|
|
1147
851
|
*/
|
|
1148
852
|
setAppId(options: SetAppIdOptions): Promise<void>;
|
|
853
|
+
/**
|
|
854
|
+
* Get information about the app's availability in the App Store or Play Store.
|
|
855
|
+
*
|
|
856
|
+
* This method checks the native app stores to see if a newer version of the app
|
|
857
|
+
* is available for download. This is different from Capgo's OTA updates - this
|
|
858
|
+
* checks for native app updates that require going through the app stores.
|
|
859
|
+
*
|
|
860
|
+
* **Platform differences:**
|
|
861
|
+
* - **Android**: Uses Play Store's In-App Updates API for accurate update information
|
|
862
|
+
* - **iOS**: Queries the App Store lookup API (requires country code for accurate results)
|
|
863
|
+
*
|
|
864
|
+
* **Returns information about:**
|
|
865
|
+
* - Current installed version
|
|
866
|
+
* - Available version in the store (if any)
|
|
867
|
+
* - Whether an update is available
|
|
868
|
+
* - Update priority (Android only)
|
|
869
|
+
* - Whether immediate/flexible updates are allowed (Android only)
|
|
870
|
+
*
|
|
871
|
+
* Use this to:
|
|
872
|
+
* - Check if users need to update from the app store
|
|
873
|
+
* - Show "Update Available" prompts for native updates
|
|
874
|
+
* - Implement version gating (require minimum native version)
|
|
875
|
+
* - Combine with Capgo OTA updates for a complete update strategy
|
|
876
|
+
*
|
|
877
|
+
* @param options Optional {@link GetAppUpdateInfoOptions} with country code for iOS.
|
|
878
|
+
* @returns {Promise<AppUpdateInfo>} Information about the current and available app versions.
|
|
879
|
+
* @throws {Error} If the operation fails or store information is unavailable.
|
|
880
|
+
* @since 8.0.0
|
|
881
|
+
*/
|
|
882
|
+
getAppUpdateInfo(options?: GetAppUpdateInfoOptions): Promise<AppUpdateInfo>;
|
|
883
|
+
/**
|
|
884
|
+
* Open the app's page in the App Store or Play Store.
|
|
885
|
+
*
|
|
886
|
+
* This navigates the user to your app's store listing where they can manually
|
|
887
|
+
* update the app. Use this as a fallback when in-app updates are not available
|
|
888
|
+
* or when the user needs to update on iOS.
|
|
889
|
+
*
|
|
890
|
+
* **Platform behavior:**
|
|
891
|
+
* - **Android**: Opens Play Store to the app's page
|
|
892
|
+
* - **iOS**: Opens App Store to the app's page
|
|
893
|
+
*
|
|
894
|
+
* **Customization options:**
|
|
895
|
+
* - `appId`: Specify a custom App Store ID (iOS) - useful for opening a different app's page
|
|
896
|
+
* - `packageName`: Specify a custom package name (Android) - useful for opening a different app's page
|
|
897
|
+
*
|
|
898
|
+
* @param options Optional {@link OpenAppStoreOptions} to customize which app's store page to open.
|
|
899
|
+
* @returns {Promise<void>} Resolves when the store is opened.
|
|
900
|
+
* @throws {Error} If the store cannot be opened.
|
|
901
|
+
* @since 8.0.0
|
|
902
|
+
*/
|
|
903
|
+
openAppStore(options?: OpenAppStoreOptions): Promise<void>;
|
|
904
|
+
/**
|
|
905
|
+
* Perform an immediate in-app update on Android.
|
|
906
|
+
*
|
|
907
|
+
* This triggers Google Play's immediate update flow, which:
|
|
908
|
+
* 1. Shows a full-screen update UI
|
|
909
|
+
* 2. Downloads and installs the update
|
|
910
|
+
* 3. Restarts the app automatically
|
|
911
|
+
*
|
|
912
|
+
* The user cannot continue using the app until the update is complete.
|
|
913
|
+
* This is ideal for critical updates that must be installed immediately.
|
|
914
|
+
*
|
|
915
|
+
* **Requirements:**
|
|
916
|
+
* - Android only (throws error on iOS)
|
|
917
|
+
* - An update must be available (check with {@link getAppUpdateInfo} first)
|
|
918
|
+
* - The update must allow immediate updates (`immediateUpdateAllowed: true`)
|
|
919
|
+
*
|
|
920
|
+
* **User experience:**
|
|
921
|
+
* - Full-screen blocking UI
|
|
922
|
+
* - Progress shown during download
|
|
923
|
+
* - App automatically restarts after installation
|
|
924
|
+
*
|
|
925
|
+
* @returns {Promise<AppUpdateResult>} Result indicating success, cancellation, or failure.
|
|
926
|
+
* @throws {Error} If not on Android, no update is available, or immediate updates not allowed.
|
|
927
|
+
* @since 8.0.0
|
|
928
|
+
*/
|
|
929
|
+
performImmediateUpdate(): Promise<AppUpdateResult>;
|
|
930
|
+
/**
|
|
931
|
+
* Start a flexible in-app update on Android.
|
|
932
|
+
*
|
|
933
|
+
* This triggers Google Play's flexible update flow, which:
|
|
934
|
+
* 1. Downloads the update in the background
|
|
935
|
+
* 2. Allows the user to continue using the app
|
|
936
|
+
* 3. Notifies when download is complete
|
|
937
|
+
* 4. Requires calling {@link completeFlexibleUpdate} to install
|
|
938
|
+
*
|
|
939
|
+
* Monitor the download progress using the `onFlexibleUpdateStateChange` listener.
|
|
940
|
+
*
|
|
941
|
+
* **Requirements:**
|
|
942
|
+
* - Android only (throws error on iOS)
|
|
943
|
+
* - An update must be available (check with {@link getAppUpdateInfo} first)
|
|
944
|
+
* - The update must allow flexible updates (`flexibleUpdateAllowed: true`)
|
|
945
|
+
*
|
|
946
|
+
* **Typical flow:**
|
|
947
|
+
* 1. Call `startFlexibleUpdate()` to begin download
|
|
948
|
+
* 2. Listen to `onFlexibleUpdateStateChange` for progress
|
|
949
|
+
* 3. When status is `DOWNLOADED`, prompt user to restart
|
|
950
|
+
* 4. Call `completeFlexibleUpdate()` to install and restart
|
|
951
|
+
*
|
|
952
|
+
* @returns {Promise<AppUpdateResult>} Result indicating the update was started, cancelled, or failed.
|
|
953
|
+
* @throws {Error} If not on Android, no update is available, or flexible updates not allowed.
|
|
954
|
+
* @since 8.0.0
|
|
955
|
+
*/
|
|
956
|
+
startFlexibleUpdate(): Promise<AppUpdateResult>;
|
|
957
|
+
/**
|
|
958
|
+
* Complete a flexible in-app update on Android.
|
|
959
|
+
*
|
|
960
|
+
* After a flexible update has been downloaded (status `DOWNLOADED` in
|
|
961
|
+
* `onFlexibleUpdateStateChange`), call this method to install the update
|
|
962
|
+
* and restart the app.
|
|
963
|
+
*
|
|
964
|
+
* **Important:** This will immediately restart the app. Make sure to:
|
|
965
|
+
* - Save any user data before calling
|
|
966
|
+
* - Prompt the user before restarting
|
|
967
|
+
* - Only call when the download status is `DOWNLOADED`
|
|
968
|
+
*
|
|
969
|
+
* @returns {Promise<void>} Resolves when the update installation begins (app will restart).
|
|
970
|
+
* @throws {Error} If not on Android or no downloaded update is pending.
|
|
971
|
+
* @since 8.0.0
|
|
972
|
+
*/
|
|
973
|
+
completeFlexibleUpdate(): Promise<void>;
|
|
1149
974
|
}
|
|
1150
975
|
/**
|
|
1151
976
|
* pending: The bundle is pending to be **SET** as the next bundle.
|
|
@@ -1488,3 +1313,285 @@ export interface GetAppIdRes {
|
|
|
1488
1313
|
export interface SetAppIdOptions {
|
|
1489
1314
|
appId: string;
|
|
1490
1315
|
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Options for {@link CapacitorUpdaterPlugin.getAppUpdateInfo}.
|
|
1318
|
+
*
|
|
1319
|
+
* @since 8.0.0
|
|
1320
|
+
*/
|
|
1321
|
+
export interface GetAppUpdateInfoOptions {
|
|
1322
|
+
/**
|
|
1323
|
+
* Two-letter country code (ISO 3166-1 alpha-2) for the App Store lookup.
|
|
1324
|
+
*
|
|
1325
|
+
* This is required on iOS to get accurate App Store information, as app
|
|
1326
|
+
* availability and versions can vary by country.
|
|
1327
|
+
*
|
|
1328
|
+
* Examples: "US", "GB", "DE", "JP", "FR"
|
|
1329
|
+
*
|
|
1330
|
+
* On Android, this option is ignored as the Play Store handles region
|
|
1331
|
+
* detection automatically.
|
|
1332
|
+
*
|
|
1333
|
+
* @since 8.0.0
|
|
1334
|
+
*/
|
|
1335
|
+
country?: string;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Information about app updates available in the App Store or Play Store.
|
|
1339
|
+
*
|
|
1340
|
+
* @since 8.0.0
|
|
1341
|
+
*/
|
|
1342
|
+
export interface AppUpdateInfo {
|
|
1343
|
+
/**
|
|
1344
|
+
* The currently installed version name (e.g., "1.2.3").
|
|
1345
|
+
*
|
|
1346
|
+
* @since 8.0.0
|
|
1347
|
+
*/
|
|
1348
|
+
currentVersionName: string;
|
|
1349
|
+
/**
|
|
1350
|
+
* The version name available in the store, if an update is available.
|
|
1351
|
+
* May be undefined if no update information is available.
|
|
1352
|
+
*
|
|
1353
|
+
* @since 8.0.0
|
|
1354
|
+
*/
|
|
1355
|
+
availableVersionName?: string;
|
|
1356
|
+
/**
|
|
1357
|
+
* The currently installed version code (Android) or build number (iOS).
|
|
1358
|
+
*
|
|
1359
|
+
* @since 8.0.0
|
|
1360
|
+
*/
|
|
1361
|
+
currentVersionCode: string;
|
|
1362
|
+
/**
|
|
1363
|
+
* The version code available in the store (Android only).
|
|
1364
|
+
* On iOS, this will be the same as `availableVersionName`.
|
|
1365
|
+
*
|
|
1366
|
+
* @since 8.0.0
|
|
1367
|
+
*/
|
|
1368
|
+
availableVersionCode?: string;
|
|
1369
|
+
/**
|
|
1370
|
+
* The release date of the available version (iOS only).
|
|
1371
|
+
* Format: ISO 8601 date string.
|
|
1372
|
+
*
|
|
1373
|
+
* @since 8.0.0
|
|
1374
|
+
*/
|
|
1375
|
+
availableVersionReleaseDate?: string;
|
|
1376
|
+
/**
|
|
1377
|
+
* The current update availability status.
|
|
1378
|
+
*
|
|
1379
|
+
* @since 8.0.0
|
|
1380
|
+
*/
|
|
1381
|
+
updateAvailability: AppUpdateAvailability;
|
|
1382
|
+
/**
|
|
1383
|
+
* The priority of the update as set by the developer in Play Console (Android only).
|
|
1384
|
+
* Values range from 0 (default/lowest) to 5 (highest priority).
|
|
1385
|
+
*
|
|
1386
|
+
* Use this to decide whether to show an update prompt or force an update.
|
|
1387
|
+
*
|
|
1388
|
+
* @since 8.0.0
|
|
1389
|
+
*/
|
|
1390
|
+
updatePriority?: number;
|
|
1391
|
+
/**
|
|
1392
|
+
* Whether an immediate update is allowed (Android only).
|
|
1393
|
+
*
|
|
1394
|
+
* If `true`, you can call {@link CapacitorUpdaterPlugin.performImmediateUpdate}.
|
|
1395
|
+
*
|
|
1396
|
+
* @since 8.0.0
|
|
1397
|
+
*/
|
|
1398
|
+
immediateUpdateAllowed?: boolean;
|
|
1399
|
+
/**
|
|
1400
|
+
* Whether a flexible update is allowed (Android only).
|
|
1401
|
+
*
|
|
1402
|
+
* If `true`, you can call {@link CapacitorUpdaterPlugin.startFlexibleUpdate}.
|
|
1403
|
+
*
|
|
1404
|
+
* @since 8.0.0
|
|
1405
|
+
*/
|
|
1406
|
+
flexibleUpdateAllowed?: boolean;
|
|
1407
|
+
/**
|
|
1408
|
+
* Number of days since the update became available (Android only).
|
|
1409
|
+
*
|
|
1410
|
+
* Use this to implement "update nagging" - remind users more frequently
|
|
1411
|
+
* as the update ages.
|
|
1412
|
+
*
|
|
1413
|
+
* @since 8.0.0
|
|
1414
|
+
*/
|
|
1415
|
+
clientVersionStalenessDays?: number;
|
|
1416
|
+
/**
|
|
1417
|
+
* The current install status of a flexible update (Android only).
|
|
1418
|
+
*
|
|
1419
|
+
* @since 8.0.0
|
|
1420
|
+
*/
|
|
1421
|
+
installStatus?: FlexibleUpdateInstallStatus;
|
|
1422
|
+
/**
|
|
1423
|
+
* The minimum OS version required for the available update (iOS only).
|
|
1424
|
+
*
|
|
1425
|
+
* @since 8.0.0
|
|
1426
|
+
*/
|
|
1427
|
+
minimumOsVersion?: string;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Options for {@link CapacitorUpdaterPlugin.openAppStore}.
|
|
1431
|
+
*
|
|
1432
|
+
* @since 8.0.0
|
|
1433
|
+
*/
|
|
1434
|
+
export interface OpenAppStoreOptions {
|
|
1435
|
+
/**
|
|
1436
|
+
* The Android package name to open in the Play Store.
|
|
1437
|
+
*
|
|
1438
|
+
* If not specified, uses the current app's package name.
|
|
1439
|
+
* Use this to open a different app's store page.
|
|
1440
|
+
*
|
|
1441
|
+
* Only used on Android.
|
|
1442
|
+
*
|
|
1443
|
+
* @since 8.0.0
|
|
1444
|
+
*/
|
|
1445
|
+
packageName?: string;
|
|
1446
|
+
/**
|
|
1447
|
+
* The iOS App Store ID to open.
|
|
1448
|
+
*
|
|
1449
|
+
* If not specified, uses the current app's bundle identifier to look up the app.
|
|
1450
|
+
* Use this to open a different app's store page or when automatic lookup fails.
|
|
1451
|
+
*
|
|
1452
|
+
* Only used on iOS.
|
|
1453
|
+
*
|
|
1454
|
+
* @since 8.0.0
|
|
1455
|
+
*/
|
|
1456
|
+
appId?: string;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* State information for flexible update progress (Android only).
|
|
1460
|
+
*
|
|
1461
|
+
* @since 8.0.0
|
|
1462
|
+
*/
|
|
1463
|
+
export interface FlexibleUpdateState {
|
|
1464
|
+
/**
|
|
1465
|
+
* The current installation status.
|
|
1466
|
+
*
|
|
1467
|
+
* @since 8.0.0
|
|
1468
|
+
*/
|
|
1469
|
+
installStatus: FlexibleUpdateInstallStatus;
|
|
1470
|
+
/**
|
|
1471
|
+
* Number of bytes downloaded so far.
|
|
1472
|
+
* Only available during the `DOWNLOADING` status.
|
|
1473
|
+
*
|
|
1474
|
+
* @since 8.0.0
|
|
1475
|
+
*/
|
|
1476
|
+
bytesDownloaded?: number;
|
|
1477
|
+
/**
|
|
1478
|
+
* Total number of bytes to download.
|
|
1479
|
+
* Only available during the `DOWNLOADING` status.
|
|
1480
|
+
*
|
|
1481
|
+
* @since 8.0.0
|
|
1482
|
+
*/
|
|
1483
|
+
totalBytesToDownload?: number;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Result of an app update operation.
|
|
1487
|
+
*
|
|
1488
|
+
* @since 8.0.0
|
|
1489
|
+
*/
|
|
1490
|
+
export interface AppUpdateResult {
|
|
1491
|
+
/**
|
|
1492
|
+
* The result code of the update operation.
|
|
1493
|
+
*
|
|
1494
|
+
* @since 8.0.0
|
|
1495
|
+
*/
|
|
1496
|
+
code: AppUpdateResultCode;
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Update availability status.
|
|
1500
|
+
*
|
|
1501
|
+
* @since 8.0.0
|
|
1502
|
+
*/
|
|
1503
|
+
export declare enum AppUpdateAvailability {
|
|
1504
|
+
/**
|
|
1505
|
+
* Update availability is unknown.
|
|
1506
|
+
* This typically means the check hasn't completed or failed.
|
|
1507
|
+
*/
|
|
1508
|
+
UNKNOWN = 0,
|
|
1509
|
+
/**
|
|
1510
|
+
* No update is available.
|
|
1511
|
+
* The installed version is the latest.
|
|
1512
|
+
*/
|
|
1513
|
+
UPDATE_NOT_AVAILABLE = 1,
|
|
1514
|
+
/**
|
|
1515
|
+
* An update is available for download.
|
|
1516
|
+
*/
|
|
1517
|
+
UPDATE_AVAILABLE = 2,
|
|
1518
|
+
/**
|
|
1519
|
+
* An update is currently being downloaded or installed.
|
|
1520
|
+
*/
|
|
1521
|
+
UPDATE_IN_PROGRESS = 3
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Installation status for flexible updates (Android only).
|
|
1525
|
+
*
|
|
1526
|
+
* @since 8.0.0
|
|
1527
|
+
*/
|
|
1528
|
+
export declare enum FlexibleUpdateInstallStatus {
|
|
1529
|
+
/**
|
|
1530
|
+
* Unknown install status.
|
|
1531
|
+
*/
|
|
1532
|
+
UNKNOWN = 0,
|
|
1533
|
+
/**
|
|
1534
|
+
* Download is pending and will start soon.
|
|
1535
|
+
*/
|
|
1536
|
+
PENDING = 1,
|
|
1537
|
+
/**
|
|
1538
|
+
* Download is in progress.
|
|
1539
|
+
* Check `bytesDownloaded` and `totalBytesToDownload` for progress.
|
|
1540
|
+
*/
|
|
1541
|
+
DOWNLOADING = 2,
|
|
1542
|
+
/**
|
|
1543
|
+
* The update is being installed.
|
|
1544
|
+
*/
|
|
1545
|
+
INSTALLING = 3,
|
|
1546
|
+
/**
|
|
1547
|
+
* The update has been installed.
|
|
1548
|
+
* The app needs to be restarted to use the new version.
|
|
1549
|
+
*/
|
|
1550
|
+
INSTALLED = 4,
|
|
1551
|
+
/**
|
|
1552
|
+
* The update failed to download or install.
|
|
1553
|
+
*/
|
|
1554
|
+
FAILED = 5,
|
|
1555
|
+
/**
|
|
1556
|
+
* The update was canceled by the user.
|
|
1557
|
+
*/
|
|
1558
|
+
CANCELED = 6,
|
|
1559
|
+
/**
|
|
1560
|
+
* The update has been downloaded and is ready to install.
|
|
1561
|
+
* Call {@link CapacitorUpdaterPlugin.completeFlexibleUpdate} to install.
|
|
1562
|
+
*/
|
|
1563
|
+
DOWNLOADED = 11
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Result codes for app update operations.
|
|
1567
|
+
*
|
|
1568
|
+
* @since 8.0.0
|
|
1569
|
+
*/
|
|
1570
|
+
export declare enum AppUpdateResultCode {
|
|
1571
|
+
/**
|
|
1572
|
+
* The update completed successfully.
|
|
1573
|
+
*/
|
|
1574
|
+
OK = 0,
|
|
1575
|
+
/**
|
|
1576
|
+
* The user canceled the update.
|
|
1577
|
+
*/
|
|
1578
|
+
CANCELED = 1,
|
|
1579
|
+
/**
|
|
1580
|
+
* The update failed.
|
|
1581
|
+
*/
|
|
1582
|
+
FAILED = 2,
|
|
1583
|
+
/**
|
|
1584
|
+
* No update is available.
|
|
1585
|
+
*/
|
|
1586
|
+
NOT_AVAILABLE = 3,
|
|
1587
|
+
/**
|
|
1588
|
+
* The requested update type is not allowed.
|
|
1589
|
+
* For example, trying to perform an immediate update when only flexible is allowed.
|
|
1590
|
+
*/
|
|
1591
|
+
NOT_ALLOWED = 4,
|
|
1592
|
+
/**
|
|
1593
|
+
* Required information is missing.
|
|
1594
|
+
* This can happen if {@link CapacitorUpdaterPlugin.getAppUpdateInfo} wasn't called first.
|
|
1595
|
+
*/
|
|
1596
|
+
INFO_MISSING = 5
|
|
1597
|
+
}
|