@capgo/capacitor-updater 7.42.9 → 7.45.10
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/Package.swift +5 -2
- package/README.md +250 -77
- package/android/build.gradle +3 -3
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +682 -213
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +222 -35
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +49 -13
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +38 -13
- package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +13 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +476 -2
- package/dist/docs.json +402 -10
- package/dist/esm/definitions.d.ts +183 -22
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -2
- package/dist/esm/web.js +6 -4
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +6 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -4
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +653 -140
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +213 -50
- package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +37 -16
- package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +2 -0
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +347 -2
- package/package.json +12 -8
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Perfect for fixing bugs immediately, A/B testing features, and maintaining contr
|
|
|
50
50
|
- ⚔️ **Battle-Tested**: Used in more than 3000 projects.
|
|
51
51
|
- 📊 View your deployment statistics
|
|
52
52
|
- 🔋 Supports Android and iOS
|
|
53
|
-
- ⚡️ Capacitor 6/7 support
|
|
53
|
+
- ⚡️ Capacitor 4/5/6/7/8 support
|
|
54
54
|
- 🌐 **Open Source**: Licensed under the Mozilla Public License 2.0
|
|
55
55
|
- 🌐 **Open Source Backend**: Self install [our backend](https://github.com/Cap-go/capgo) in your infra
|
|
56
56
|
|
|
@@ -96,11 +96,11 @@ Starting from v8, the plugin uses [ZIPFoundation](https://github.com/weichsel/ZI
|
|
|
96
96
|
| v7.\*.\* | v7.\*.\* | ✅ |
|
|
97
97
|
| v6.\*.\* | v6.\*.\* | ✅ |
|
|
98
98
|
| v5.\*.\* | v5.\*.\* | ✅ |
|
|
99
|
-
| v4.\*.\* | v4.\*.\* |
|
|
99
|
+
| v4.\*.\* | v4.\*.\* | ✅ |
|
|
100
100
|
| v3.\*.\* | v3.\*.\* | ⚠️ Deprecated |
|
|
101
101
|
| > 7 | v4.\*.\* | ⚠️ Deprecated, our CI got crazy and bumped too much version |
|
|
102
102
|
|
|
103
|
-
> **Note:** Versions 5, 6, 7, and 8 all share the same features. The major version simply follows your Capacitor version. You can safely use any of these versions that matches your Capacitor installation.
|
|
103
|
+
> **Note:** Versions 4, 5, 6, 7, and 8 all share the same features. The major version simply follows your Capacitor version. You can safely use any of these versions that matches your Capacitor installation.
|
|
104
104
|
|
|
105
105
|
### iOS
|
|
106
106
|
|
|
@@ -158,6 +158,9 @@ npm install @capgo/capacitor-updater@lts-v6
|
|
|
158
158
|
|
|
159
159
|
# For Capacitor 5
|
|
160
160
|
npm install @capgo/capacitor-updater@lts-v5
|
|
161
|
+
|
|
162
|
+
# For Capacitor 4
|
|
163
|
+
npm install @capgo/capacitor-updater@lts-v4
|
|
161
164
|
```
|
|
162
165
|
|
|
163
166
|
## Auto-update setup
|
|
@@ -283,43 +286,44 @@ Downgrading to a previous version of the updater plugin is not supported.
|
|
|
283
286
|
|
|
284
287
|
CapacitorUpdater can be configured with these options:
|
|
285
288
|
|
|
286
|
-
| Prop
|
|
287
|
-
|
|
|
288
|
-
| **`appReadyTimeout`**
|
|
289
|
-
| **`responseTimeout`**
|
|
290
|
-
| **`autoDeleteFailed`**
|
|
291
|
-
| **`autoDeletePrevious`**
|
|
292
|
-
| **`autoUpdate`**
|
|
293
|
-
| **`resetWhenUpdate`**
|
|
294
|
-
| **`updateUrl`**
|
|
295
|
-
| **`channelUrl`**
|
|
296
|
-
| **`statsUrl`**
|
|
297
|
-
| **`publicKey`**
|
|
298
|
-
| **`version`**
|
|
299
|
-
| **`directUpdate`**
|
|
300
|
-
| **`autoSplashscreen`**
|
|
301
|
-
| **`autoSplashscreenLoader`**
|
|
302
|
-
| **`autoSplashscreenTimeout`**
|
|
303
|
-
| **`periodCheckDelay`**
|
|
304
|
-
| **`localS3`**
|
|
305
|
-
| **`localHost`**
|
|
306
|
-
| **`localWebHost`**
|
|
307
|
-
| **`localSupa`**
|
|
308
|
-
| **`localSupaAnon`**
|
|
309
|
-
| **`localApi`**
|
|
310
|
-
| **`localApiFiles`**
|
|
311
|
-
| **`allowModifyUrl`**
|
|
312
|
-
| **`allowModifyAppId`**
|
|
313
|
-
| **`allowManualBundleError`**
|
|
314
|
-
| **`persistCustomId`**
|
|
315
|
-
| **`persistModifyUrl`**
|
|
316
|
-
| **`allowSetDefaultChannel`**
|
|
317
|
-
| **`defaultChannel`**
|
|
318
|
-
| **`appId`**
|
|
319
|
-
| **`keepUrlPathAfterReload`**
|
|
320
|
-
| **`disableJSLogging`**
|
|
321
|
-
| **`osLogging`**
|
|
322
|
-
| **`shakeMenu`**
|
|
289
|
+
| Prop | Type | Description | Default | Since |
|
|
290
|
+
| ------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------- |
|
|
291
|
+
| **`appReadyTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering an update 'failed'. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | |
|
|
292
|
+
| **`responseTimeout`** | <code>number</code> | Configure the number of seconds the native plugin should wait before considering API timeout. Only available for Android and iOS. | <code>20 // (20 second)</code> | |
|
|
293
|
+
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
|
|
294
|
+
| **`autoDeletePrevious`** | <code>boolean</code> | Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS. | <code>true</code> | |
|
|
295
|
+
| **`autoUpdate`** | <code>boolean</code> | Configure whether the plugin should use Auto Update via an update server. Only available for Android and iOS. | <code>true</code> | |
|
|
296
|
+
| **`resetWhenUpdate`** | <code>boolean</code> | Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. 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. Only available for Android and iOS. | <code>true</code> | |
|
|
297
|
+
| **`updateUrl`** | <code>string</code> | Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS. | <code>https://plugin.capgo.app/updates</code> | |
|
|
298
|
+
| **`channelUrl`** | <code>string</code> | Configure the URL / endpoint for channel operations. Only available for Android and iOS. | <code>https://plugin.capgo.app/channel_self</code> | |
|
|
299
|
+
| **`statsUrl`** | <code>string</code> | Configure the URL / endpoint to which update statistics are sent. Only available for Android and iOS. Set to "" to disable stats reporting. | <code>https://plugin.capgo.app/stats</code> | |
|
|
300
|
+
| **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2 Only available for Android and iOS. | <code>undefined</code> | 6.2.0 |
|
|
301
|
+
| **`version`** | <code>string</code> | Configure the current version of the app. This will be used for the first update request. If not set, the plugin will get the version from the native code. Only available for Android and iOS. | <code>undefined</code> | 4.17.48 |
|
|
302
|
+
| **`directUpdate`** | <code>boolean \| 'always' \| 'atInstall' \| 'onLaunch'</code> | Configure when the plugin should direct install updates. Only for autoUpdate mode. Works well for apps less than 10MB and with uploads done using --delta flag. Zip or apps more than 10MB will be relatively slow for users to update. - false: Never do direct updates (use default behavior: download at start, set when backgrounded) - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false - true: (deprecated) Same as "always" for backward compatibility Activate this flag will automatically make the CLI upload delta in CICD envs and will ask for confirmation in local uploads. Only available for Android and iOS. | <code>false</code> | 5.1.0 |
|
|
303
|
+
| **`autoSplashscreen`** | <code>boolean</code> | 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. This removes the need to manually listen for appReady events and call SplashScreen.hide(). Only works when directUpdate is set to "atInstall", "always", "onLaunch", or true. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Requires autoUpdate and directUpdate to be enabled. Only available for Android and iOS. | <code>false</code> | 7.6.0 |
|
|
304
|
+
| **`autoSplashscreenLoader`** | <code>boolean</code> | Display a native loading indicator on top of the splashscreen while automatic direct updates are running. Only takes effect when {@link autoSplashscreen} is enabled. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Only available for Android and iOS. | <code>false</code> | 7.19.0 |
|
|
305
|
+
| **`autoSplashscreenTimeout`** | <code>number</code> | Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates. If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed. Set to `0` (zero) to disable the timeout. When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | 7.19.0 |
|
|
306
|
+
| **`periodCheckDelay`** | <code>number</code> | Configure the delay period for period update check. the unit is in seconds. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes). | <code>0 (disabled)</code> | |
|
|
307
|
+
| **`localS3`** | <code>boolean</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
308
|
+
| **`localHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
309
|
+
| **`localWebHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
310
|
+
| **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
311
|
+
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
|
|
312
|
+
| **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
|
|
313
|
+
| **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
|
|
314
|
+
| **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side. | <code>false</code> | 5.4.0 |
|
|
315
|
+
| **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
|
|
316
|
+
| **`allowManualBundleError`** | <code>boolean</code> | Allow marking bundles as errored from JavaScript while using manual update flows. When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`. | <code>false</code> | 7.20.0 |
|
|
317
|
+
| **`persistCustomId`** | <code>boolean</code> | Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Only available for Android and iOS. | <code>false (will be true by default in a future major release v8.x.x)</code> | 7.17.3 |
|
|
318
|
+
| **`persistModifyUrl`** | <code>boolean</code> | Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl}, {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts. Only available for Android and iOS. | <code>false</code> | 7.20.0 |
|
|
319
|
+
| **`allowSetDefaultChannel`** | <code>boolean</code> | Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel. When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`. | <code>true</code> | 7.34.0 |
|
|
320
|
+
| **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. Case sensitive. This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud. 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 | <code>undefined</code> | 5.5.0 |
|
|
321
|
+
| **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
|
|
322
|
+
| **`keepUrlPathAfterReload`** | <code>boolean</code> | Configure the plugin to keep the URL path after a reload. WARNING: When a reload is triggered, 'window.history' will be cleared. | <code>false</code> | 6.8.0 |
|
|
323
|
+
| **`disableJSLogging`** | <code>boolean</code> | 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 | <code>false</code> | 7.3.0 |
|
|
324
|
+
| **`osLogging`** | <code>boolean</code> | Enable OS-level logging. When enabled, logs are written to the system log which can be inspected in production builds. - **iOS**: Uses os_log instead of Swift.print, logs accessible via Console.app or Instruments - **Android**: Logs to Logcat (android.util.Log) When set to false, system logging is disabled on both platforms (only JavaScript console logging will occur if enabled). This is useful for debugging production apps (App Store/TestFlight builds on iOS, or production APKs on Android). | <code>true</code> | 8.42.0 |
|
|
325
|
+
| **`shakeMenu`** | <code>boolean</code> | Enable shake gesture to show update menu for debugging/testing purposes | <code>false</code> | 7.5.0 |
|
|
326
|
+
| **`allowShakeChannelSelector`** | <code>boolean</code> | Enable the shake gesture to show a channel selector menu for switching between update channels. When enabled AND `shakeMenu` is true, the shake gesture shows a channel selector instead of the default debug menu (Go Home/Reload/Close). After selecting a channel, the app automatically checks for updates and downloads if available. Only works if channels have `allow_self_set` enabled on the backend. Only available for Android and iOS. | <code>false</code> | 8.43.0 |
|
|
323
327
|
|
|
324
328
|
### Examples
|
|
325
329
|
|
|
@@ -363,7 +367,8 @@ In `capacitor.config.json`:
|
|
|
363
367
|
"keepUrlPathAfterReload": undefined,
|
|
364
368
|
"disableJSLogging": undefined,
|
|
365
369
|
"osLogging": undefined,
|
|
366
|
-
"shakeMenu": undefined
|
|
370
|
+
"shakeMenu": undefined,
|
|
371
|
+
"allowShakeChannelSelector": undefined
|
|
367
372
|
}
|
|
368
373
|
}
|
|
369
374
|
}
|
|
@@ -414,6 +419,7 @@ const config: CapacitorConfig = {
|
|
|
414
419
|
disableJSLogging: undefined,
|
|
415
420
|
osLogging: undefined,
|
|
416
421
|
shakeMenu: undefined,
|
|
422
|
+
allowShakeChannelSelector: undefined,
|
|
417
423
|
},
|
|
418
424
|
},
|
|
419
425
|
};
|
|
@@ -456,11 +462,14 @@ export default config;
|
|
|
456
462
|
* [`removeAllListeners()`](#removealllisteners)
|
|
457
463
|
* [`addListener('download', ...)`](#addlistenerdownload-)
|
|
458
464
|
* [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate-)
|
|
465
|
+
* [`addListener('updateCheckResult', ...)`](#addlistenerupdatecheckresult-)
|
|
459
466
|
* [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable-)
|
|
460
467
|
* [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete-)
|
|
461
468
|
* [`addListener('breakingAvailable', ...)`](#addlistenerbreakingavailable-)
|
|
462
469
|
* [`addListener('majorAvailable', ...)`](#addlistenermajoravailable-)
|
|
463
470
|
* [`addListener('updateFailed', ...)`](#addlistenerupdatefailed-)
|
|
471
|
+
* [`addListener('set', ...)`](#addlistenerset-)
|
|
472
|
+
* [`addListener('setNext', ...)`](#addlistenersetnext-)
|
|
464
473
|
* [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed-)
|
|
465
474
|
* [`addListener('appReloaded', ...)`](#addlistenerappreloaded-)
|
|
466
475
|
* [`addListener('appReady', ...)`](#addlistenerappready-)
|
|
@@ -471,6 +480,8 @@ export default config;
|
|
|
471
480
|
* [`getFailedUpdate()`](#getfailedupdate)
|
|
472
481
|
* [`setShakeMenu(...)`](#setshakemenu)
|
|
473
482
|
* [`isShakeMenuEnabled()`](#isshakemenuenabled)
|
|
483
|
+
* [`setShakeChannelSelector(...)`](#setshakechannelselector)
|
|
484
|
+
* [`isShakeChannelSelectorEnabled()`](#isshakechannelselectorenabled)
|
|
474
485
|
* [`getAppId()`](#getappid)
|
|
475
486
|
* [`setAppId(...)`](#setappid)
|
|
476
487
|
* [`getAppUpdateInfo(...)`](#getappupdateinfo)
|
|
@@ -919,27 +930,23 @@ After receiving the latest version info, you can:
|
|
|
919
930
|
2. Download it using {@link download}
|
|
920
931
|
3. Apply it using {@link next} or {@link set}
|
|
921
932
|
|
|
922
|
-
**Important:
|
|
933
|
+
**Important: Handling "no new version available"**
|
|
923
934
|
|
|
924
935
|
When the device's current version matches the latest version on the server (i.e., the device is already
|
|
925
936
|
up-to-date), the server returns a 200 response with `error: "no_new_version_available"` and
|
|
926
|
-
`message: "No new version available"`.
|
|
927
|
-
|
|
937
|
+
`message: "No new version available"`. This is a normal, expected condition and resolves with
|
|
938
|
+
`kind: "up_to_date"` when the backend provides that classification.
|
|
928
939
|
|
|
929
|
-
You should
|
|
940
|
+
You should check `kind` and `error` before attempting to download:
|
|
930
941
|
|
|
931
942
|
```typescript
|
|
932
|
-
|
|
933
|
-
|
|
943
|
+
const latest = await CapacitorUpdater.getLatest();
|
|
944
|
+
if (latest.kind === 'up_to_date') {
|
|
945
|
+
console.log('Already up to date');
|
|
946
|
+
} else if (latest.kind === 'blocked') {
|
|
947
|
+
console.log('Update is blocked:', latest.error);
|
|
948
|
+
} else if (latest.url) {
|
|
934
949
|
// New version is available, proceed with download
|
|
935
|
-
} catch (error) {
|
|
936
|
-
if (error.message === 'No new version available') {
|
|
937
|
-
// Device is already on the latest version - this is normal
|
|
938
|
-
console.log('Already up to date');
|
|
939
|
-
} else {
|
|
940
|
-
// Actual error occurred
|
|
941
|
-
console.error('Failed to check for updates:', error);
|
|
942
|
-
}
|
|
943
950
|
}
|
|
944
951
|
```
|
|
945
952
|
|
|
@@ -1241,6 +1248,7 @@ Remove all event listeners registered for this plugin.
|
|
|
1241
1248
|
This unregisters all listeners added via {@link addListener} for all event types:
|
|
1242
1249
|
- `download`
|
|
1243
1250
|
- `noNeedUpdate`
|
|
1251
|
+
- `updateCheckResult`
|
|
1244
1252
|
- `updateAvailable`
|
|
1245
1253
|
- `downloadComplete`
|
|
1246
1254
|
- `downloadFailed`
|
|
@@ -1298,6 +1306,31 @@ Listen for no need to update event, useful when you want force check every time
|
|
|
1298
1306
|
--------------------
|
|
1299
1307
|
|
|
1300
1308
|
|
|
1309
|
+
#### addListener('updateCheckResult', ...)
|
|
1310
|
+
|
|
1311
|
+
```typescript
|
|
1312
|
+
addListener(eventName: 'updateCheckResult', listenerFunc: (state: UpdateCheckResultEvent) => void) => Promise<PluginListenerHandle>
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
Listen for update check results before the updater decides whether to download.
|
|
1316
|
+
The backend can classify the <a href="#updatecheckresultevent">UpdateCheckResultEvent</a> payload as `up_to_date`, `blocked`, or `failed`.
|
|
1317
|
+
|
|
1318
|
+
This event is emitted alongside legacy events. For `up_to_date` and `blocked`, it is emitted before
|
|
1319
|
+
`noNeedUpdate` and does not emit `downloadFailed`. For `failed`, it is emitted before the legacy
|
|
1320
|
+
`downloadFailed` event and keeps the existing failure stats behavior.
|
|
1321
|
+
|
|
1322
|
+
| Param | Type |
|
|
1323
|
+
| ------------------ | --------------------------------------------------------------------------------------------- |
|
|
1324
|
+
| **`eventName`** | <code>'updateCheckResult'</code> |
|
|
1325
|
+
| **`listenerFunc`** | <code>(state: <a href="#updatecheckresultevent">UpdateCheckResultEvent</a>) => void</code> |
|
|
1326
|
+
|
|
1327
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
1328
|
+
|
|
1329
|
+
**Since:** 8.45.11
|
|
1330
|
+
|
|
1331
|
+
--------------------
|
|
1332
|
+
|
|
1333
|
+
|
|
1301
1334
|
#### addListener('updateAvailable', ...)
|
|
1302
1335
|
|
|
1303
1336
|
```typescript
|
|
@@ -1399,6 +1432,48 @@ Listen for update fail event in the App, let you know when update has fail to in
|
|
|
1399
1432
|
--------------------
|
|
1400
1433
|
|
|
1401
1434
|
|
|
1435
|
+
#### addListener('set', ...)
|
|
1436
|
+
|
|
1437
|
+
```typescript
|
|
1438
|
+
addListener(eventName: 'set', listenerFunc: (state: SetEvent) => void) => Promise<PluginListenerHandle>
|
|
1439
|
+
```
|
|
1440
|
+
|
|
1441
|
+
Listen for set event in the App, let you know when a bundle has been applied successfully.
|
|
1442
|
+
This event is retained natively until JavaScript consumes it, so if the app reloads before your
|
|
1443
|
+
listener is attached, the last pending `set` event is delivered once the listener subscribes.
|
|
1444
|
+
|
|
1445
|
+
| Param | Type |
|
|
1446
|
+
| ------------------ | ----------------------------------------------------------------- |
|
|
1447
|
+
| **`eventName`** | <code>'set'</code> |
|
|
1448
|
+
| **`listenerFunc`** | <code>(state: <a href="#setevent">SetEvent</a>) => void</code> |
|
|
1449
|
+
|
|
1450
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
1451
|
+
|
|
1452
|
+
**Since:** 8.43.12
|
|
1453
|
+
|
|
1454
|
+
--------------------
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
#### addListener('setNext', ...)
|
|
1458
|
+
|
|
1459
|
+
```typescript
|
|
1460
|
+
addListener(eventName: 'setNext', listenerFunc: (state: SetNextEvent) => void) => Promise<PluginListenerHandle>
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
Listen for set next event in the App, let you know when a bundle is queued as the next bundle to install.
|
|
1464
|
+
|
|
1465
|
+
| Param | Type |
|
|
1466
|
+
| ------------------ | ------------------------------------------------------------------------- |
|
|
1467
|
+
| **`eventName`** | <code>'setNext'</code> |
|
|
1468
|
+
| **`listenerFunc`** | <code>(state: <a href="#setnextevent">SetNextEvent</a>) => void</code> |
|
|
1469
|
+
|
|
1470
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
1471
|
+
|
|
1472
|
+
**Since:** 6.14.0
|
|
1473
|
+
|
|
1474
|
+
--------------------
|
|
1475
|
+
|
|
1476
|
+
|
|
1402
1477
|
#### addListener('downloadFailed', ...)
|
|
1403
1478
|
|
|
1404
1479
|
```typescript
|
|
@@ -1445,7 +1520,9 @@ Listen for reload event in the App, let you know when reload has happened
|
|
|
1445
1520
|
addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>
|
|
1446
1521
|
```
|
|
1447
1522
|
|
|
1448
|
-
Listen for app ready event in the App, let you know when app is ready to use
|
|
1523
|
+
Listen for app ready event in the App, let you know when app is ready to use.
|
|
1524
|
+
This event is retained natively until JavaScript consumes it, so it can still be delivered after
|
|
1525
|
+
a reload even if the listener is attached later in app startup.
|
|
1449
1526
|
|
|
1450
1527
|
| Param | Type |
|
|
1451
1528
|
| ------------------ | --------------------------------------------------------------------------- |
|
|
@@ -1663,6 +1740,50 @@ Use this to:
|
|
|
1663
1740
|
--------------------
|
|
1664
1741
|
|
|
1665
1742
|
|
|
1743
|
+
#### setShakeChannelSelector(...)
|
|
1744
|
+
|
|
1745
|
+
```typescript
|
|
1746
|
+
setShakeChannelSelector(options: SetShakeChannelSelectorOptions) => Promise<void>
|
|
1747
|
+
```
|
|
1748
|
+
|
|
1749
|
+
Enable or disable the shake channel selector at runtime.
|
|
1750
|
+
|
|
1751
|
+
When enabled AND shakeMenu is true, shaking the device shows a channel
|
|
1752
|
+
selector instead of the debug menu. This allows users to switch between
|
|
1753
|
+
update channels by shaking their device.
|
|
1754
|
+
|
|
1755
|
+
After selecting a channel, the app automatically checks for updates
|
|
1756
|
+
and downloads if available.
|
|
1757
|
+
|
|
1758
|
+
Can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
|
|
1759
|
+
|
|
1760
|
+
| Param | Type |
|
|
1761
|
+
| ------------- | ----------------------------------------------------------------------------------------- |
|
|
1762
|
+
| **`options`** | <code><a href="#setshakechannelselectoroptions">SetShakeChannelSelectorOptions</a></code> |
|
|
1763
|
+
|
|
1764
|
+
**Since:** 8.43.0
|
|
1765
|
+
|
|
1766
|
+
--------------------
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
#### isShakeChannelSelectorEnabled()
|
|
1770
|
+
|
|
1771
|
+
```typescript
|
|
1772
|
+
isShakeChannelSelectorEnabled() => Promise<ShakeChannelSelectorEnabled>
|
|
1773
|
+
```
|
|
1774
|
+
|
|
1775
|
+
Check if the shake channel selector is currently enabled.
|
|
1776
|
+
|
|
1777
|
+
Returns the current state of the shake channel selector feature that can be toggled via
|
|
1778
|
+
{@link setShakeChannelSelector} or configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
|
|
1779
|
+
|
|
1780
|
+
**Returns:** <code>Promise<<a href="#shakechannelselectorenabled">ShakeChannelSelectorEnabled</a>></code>
|
|
1781
|
+
|
|
1782
|
+
**Since:** 8.43.0
|
|
1783
|
+
|
|
1784
|
+
--------------------
|
|
1785
|
+
|
|
1786
|
+
|
|
1666
1787
|
#### getAppId()
|
|
1667
1788
|
|
|
1668
1789
|
```typescript
|
|
@@ -1965,9 +2086,10 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
1965
2086
|
|
|
1966
2087
|
##### ResetOptions
|
|
1967
2088
|
|
|
1968
|
-
| Prop | Type |
|
|
1969
|
-
| ---------------------- | -------------------- |
|
|
1970
|
-
| **`toLastSuccessful`** | <code>boolean</code> |
|
|
2089
|
+
| Prop | Type | Description | Default |
|
|
2090
|
+
| ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ |
|
|
2091
|
+
| **`toLastSuccessful`** | <code>boolean</code> | Reset to the last successfully loaded bundle instead of the builtin one. | <code>false</code> |
|
|
2092
|
+
| **`usePendingBundle`** | <code>boolean</code> | Apply the pending bundle set via {@link next} while resetting. When `true`, the plugin will switch to the pending bundle immediately and clear the pending flag. If no pending bundle exists, the reset will fail. | <code>false</code> |
|
|
1971
2093
|
|
|
1972
2094
|
|
|
1973
2095
|
##### CurrentBundleResult
|
|
@@ -1995,20 +2117,22 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
1995
2117
|
|
|
1996
2118
|
##### LatestVersion
|
|
1997
2119
|
|
|
1998
|
-
| Prop | Type
|
|
1999
|
-
| ---------------- |
|
|
2000
|
-
| **`version`** | <code>string</code>
|
|
2001
|
-
| **`checksum`** | <code>string</code>
|
|
2002
|
-
| **`breaking`** | <code>boolean</code>
|
|
2003
|
-
| **`major`** | <code>boolean</code>
|
|
2004
|
-
| **`message`** | <code>string</code>
|
|
2005
|
-
| **`sessionKey`** | <code>string</code>
|
|
2006
|
-
| **`error`** | <code>string</code>
|
|
2007
|
-
| **`
|
|
2008
|
-
| **`
|
|
2009
|
-
| **`
|
|
2010
|
-
| **`
|
|
2011
|
-
| **`
|
|
2120
|
+
| Prop | Type | Description | Since |
|
|
2121
|
+
| ---------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------- |
|
|
2122
|
+
| **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
|
|
2123
|
+
| **`checksum`** | <code>string</code> | | 6 |
|
|
2124
|
+
| **`breaking`** | <code>boolean</code> | Indicates whether the update was flagged as breaking by the backend. | 7.22.0 |
|
|
2125
|
+
| **`major`** | <code>boolean</code> | | |
|
|
2126
|
+
| **`message`** | <code>string</code> | Optional message from the server. When no new version is available, this will be "No new version available". | |
|
|
2127
|
+
| **`sessionKey`** | <code>string</code> | | |
|
|
2128
|
+
| **`error`** | <code>string</code> | Error code from the server, if any. Use `kind` for classification instead of parsing this value. | |
|
|
2129
|
+
| **`kind`** | <code><a href="#updateresponsekind">UpdateResponseKind</a></code> | Classification for this response, provided by the backend. | 8.45.11 |
|
|
2130
|
+
| **`statusCode`** | <code>number</code> | HTTP status code returned by the update server for classified update-check responses. | 8.45.11 |
|
|
2131
|
+
| **`old`** | <code>string</code> | The previous/current version name (provided for reference). | |
|
|
2132
|
+
| **`url`** | <code>string</code> | Download URL for the bundle (when a new version is available). | |
|
|
2133
|
+
| **`manifest`** | <code>ManifestEntry[]</code> | File list for delta updates (when using multi-file downloads). | 6.1 |
|
|
2134
|
+
| **`link`** | <code>string</code> | Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release). | 7.35.0 |
|
|
2135
|
+
| **`comment`** | <code>string</code> | Optional comment or description for this bundle version. | 7.35.0 |
|
|
2012
2136
|
|
|
2013
2137
|
|
|
2014
2138
|
##### GetLatestOptions
|
|
@@ -2127,6 +2251,18 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
2127
2251
|
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
|
|
2128
2252
|
|
|
2129
2253
|
|
|
2254
|
+
##### UpdateCheckResultEvent
|
|
2255
|
+
|
|
2256
|
+
| Prop | Type | Description | Since |
|
|
2257
|
+
| ---------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------- | ------- |
|
|
2258
|
+
| **`kind`** | <code><a href="#updateresponsekind">UpdateResponseKind</a></code> | Classification for the update check result, provided by the backend. | 8.45.11 |
|
|
2259
|
+
| **`error`** | <code>string</code> | Backend error code, when provided. | 8.45.11 |
|
|
2260
|
+
| **`message`** | <code>string</code> | Backend message, when provided. | 8.45.11 |
|
|
2261
|
+
| **`statusCode`** | <code>number</code> | HTTP status code returned by the update endpoint. | 8.45.11 |
|
|
2262
|
+
| **`version`** | <code>string</code> | Version referenced by the update check result. | 8.45.11 |
|
|
2263
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current bundle on the device. | 8.45.11 |
|
|
2264
|
+
|
|
2265
|
+
|
|
2130
2266
|
##### UpdateAvailableEvent
|
|
2131
2267
|
|
|
2132
2268
|
| Prop | Type | Description | Since |
|
|
@@ -2155,6 +2291,20 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
2155
2291
|
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a update failed to install. | 4.0.0 |
|
|
2156
2292
|
|
|
2157
2293
|
|
|
2294
|
+
##### SetEvent
|
|
2295
|
+
|
|
2296
|
+
| Prop | Type | Description | Since |
|
|
2297
|
+
| ------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------- |
|
|
2298
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a bundle has been applied successfully. This event uses native `retainUntilConsumed` behavior. | 8.43.12 |
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
##### SetNextEvent
|
|
2302
|
+
|
|
2303
|
+
| Prop | Type | Description | Since |
|
|
2304
|
+
| ------------ | ------------------------------------------------- | ----------------------------------------------------------- | ------ |
|
|
2305
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a bundle is queued as the next bundle to install. | 6.14.0 |
|
|
2306
|
+
|
|
2307
|
+
|
|
2158
2308
|
##### DownloadFailedEvent
|
|
2159
2309
|
|
|
2160
2310
|
| Prop | Type | Description | Since |
|
|
@@ -2164,10 +2314,10 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
2164
2314
|
|
|
2165
2315
|
##### AppReadyEvent
|
|
2166
2316
|
|
|
2167
|
-
| Prop | Type | Description
|
|
2168
|
-
| ------------ | ------------------------------------------------- |
|
|
2169
|
-
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emitted when the app is ready to use. | 5.2.0 |
|
|
2170
|
-
| **`status`** | <code>string</code> |
|
|
2317
|
+
| Prop | Type | Description | Since |
|
|
2318
|
+
| ------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------- | ----- |
|
|
2319
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emitted when the app is ready to use. This event uses native `retainUntilConsumed` behavior. | 5.2.0 |
|
|
2320
|
+
| **`status`** | <code>string</code> | | |
|
|
2171
2321
|
|
|
2172
2322
|
|
|
2173
2323
|
##### ChannelPrivateEvent
|
|
@@ -2210,6 +2360,20 @@ State information for flexible update progress (Android only).
|
|
|
2210
2360
|
| **`enabled`** | <code>boolean</code> |
|
|
2211
2361
|
|
|
2212
2362
|
|
|
2363
|
+
##### SetShakeChannelSelectorOptions
|
|
2364
|
+
|
|
2365
|
+
| Prop | Type |
|
|
2366
|
+
| ------------- | -------------------- |
|
|
2367
|
+
| **`enabled`** | <code>boolean</code> |
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
##### ShakeChannelSelectorEnabled
|
|
2371
|
+
|
|
2372
|
+
| Prop | Type |
|
|
2373
|
+
| ------------- | -------------------- |
|
|
2374
|
+
| **`enabled`** | <code>boolean</code> |
|
|
2375
|
+
|
|
2376
|
+
|
|
2213
2377
|
##### GetAppIdRes
|
|
2214
2378
|
|
|
2215
2379
|
| Prop | Type |
|
|
@@ -2290,6 +2454,15 @@ error: The bundle has failed to download.
|
|
|
2290
2454
|
<code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
|
|
2291
2455
|
|
|
2292
2456
|
|
|
2457
|
+
##### UpdateResponseKind
|
|
2458
|
+
|
|
2459
|
+
Classification for update-check responses that do not provide a downloadable bundle.
|
|
2460
|
+
The update backend provides this field directly. Missing or unknown values are treated as
|
|
2461
|
+
failed by native clients.
|
|
2462
|
+
|
|
2463
|
+
<code>'up_to_date' | 'blocked' | 'failed'</code>
|
|
2464
|
+
|
|
2465
|
+
|
|
2293
2466
|
##### BreakingAvailableEvent
|
|
2294
2467
|
|
|
2295
2468
|
Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.
|