@capgo/capacitor-updater 7.42.9 → 7.43.3
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 +1 -1
- package/README.md +101 -38
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +153 -49
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +53 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +13 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +436 -2
- package/dist/docs.json +112 -0
- package/dist/esm/definitions.d.ts +49 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -1
- package/dist/esm/web.js +6 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +6 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +97 -6
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +330 -2
- package/package.json +3 -2
package/Package.swift
CHANGED
|
@@ -11,7 +11,7 @@ let package = Package(
|
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
|
|
14
|
-
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.11.
|
|
14
|
+
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.11.1")),
|
|
15
15
|
.package(url: "https://github.com/weichsel/ZIPFoundation.git", from: "0.9.20"),
|
|
16
16
|
.package(url: "https://github.com/mrackwitz/Version.git", exact: "0.8.0"),
|
|
17
17
|
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.7.0")
|
package/README.md
CHANGED
|
@@ -283,43 +283,44 @@ Downgrading to a previous version of the updater plugin is not supported.
|
|
|
283
283
|
|
|
284
284
|
CapacitorUpdater can be configured with these options:
|
|
285
285
|
|
|
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`**
|
|
286
|
+
| Prop | Type | Description | Default | Since |
|
|
287
|
+
| ------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------- |
|
|
288
|
+
| **`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> | |
|
|
289
|
+
| **`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> | |
|
|
290
|
+
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
|
|
291
|
+
| **`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> | |
|
|
292
|
+
| **`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> | |
|
|
293
|
+
| **`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> | |
|
|
294
|
+
| **`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> | |
|
|
295
|
+
| **`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> | |
|
|
296
|
+
| **`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> | |
|
|
297
|
+
| **`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 |
|
|
298
|
+
| **`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 |
|
|
299
|
+
| **`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 |
|
|
300
|
+
| **`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 |
|
|
301
|
+
| **`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 |
|
|
302
|
+
| **`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 |
|
|
303
|
+
| **`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> | |
|
|
304
|
+
| **`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 |
|
|
305
|
+
| **`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 |
|
|
306
|
+
| **`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 |
|
|
307
|
+
| **`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 |
|
|
308
|
+
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
|
|
309
|
+
| **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
|
|
310
|
+
| **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
|
|
311
|
+
| **`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 |
|
|
312
|
+
| **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
|
|
313
|
+
| **`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 |
|
|
314
|
+
| **`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 |
|
|
315
|
+
| **`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 |
|
|
316
|
+
| **`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 |
|
|
317
|
+
| **`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 |
|
|
318
|
+
| **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
|
|
319
|
+
| **`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 |
|
|
320
|
+
| **`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 |
|
|
321
|
+
| **`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 |
|
|
322
|
+
| **`shakeMenu`** | <code>boolean</code> | Enable shake gesture to show update menu for debugging/testing purposes | <code>false</code> | 7.5.0 |
|
|
323
|
+
| **`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
324
|
|
|
324
325
|
### Examples
|
|
325
326
|
|
|
@@ -363,7 +364,8 @@ In `capacitor.config.json`:
|
|
|
363
364
|
"keepUrlPathAfterReload": undefined,
|
|
364
365
|
"disableJSLogging": undefined,
|
|
365
366
|
"osLogging": undefined,
|
|
366
|
-
"shakeMenu": undefined
|
|
367
|
+
"shakeMenu": undefined,
|
|
368
|
+
"allowShakeChannelSelector": undefined
|
|
367
369
|
}
|
|
368
370
|
}
|
|
369
371
|
}
|
|
@@ -414,6 +416,7 @@ const config: CapacitorConfig = {
|
|
|
414
416
|
disableJSLogging: undefined,
|
|
415
417
|
osLogging: undefined,
|
|
416
418
|
shakeMenu: undefined,
|
|
419
|
+
allowShakeChannelSelector: undefined,
|
|
417
420
|
},
|
|
418
421
|
},
|
|
419
422
|
};
|
|
@@ -471,6 +474,8 @@ export default config;
|
|
|
471
474
|
* [`getFailedUpdate()`](#getfailedupdate)
|
|
472
475
|
* [`setShakeMenu(...)`](#setshakemenu)
|
|
473
476
|
* [`isShakeMenuEnabled()`](#isshakemenuenabled)
|
|
477
|
+
* [`setShakeChannelSelector(...)`](#setshakechannelselector)
|
|
478
|
+
* [`isShakeChannelSelectorEnabled()`](#isshakechannelselectorenabled)
|
|
474
479
|
* [`getAppId()`](#getappid)
|
|
475
480
|
* [`setAppId(...)`](#setappid)
|
|
476
481
|
* [`getAppUpdateInfo(...)`](#getappupdateinfo)
|
|
@@ -1663,6 +1668,50 @@ Use this to:
|
|
|
1663
1668
|
--------------------
|
|
1664
1669
|
|
|
1665
1670
|
|
|
1671
|
+
#### setShakeChannelSelector(...)
|
|
1672
|
+
|
|
1673
|
+
```typescript
|
|
1674
|
+
setShakeChannelSelector(options: SetShakeChannelSelectorOptions) => Promise<void>
|
|
1675
|
+
```
|
|
1676
|
+
|
|
1677
|
+
Enable or disable the shake channel selector at runtime.
|
|
1678
|
+
|
|
1679
|
+
When enabled AND shakeMenu is true, shaking the device shows a channel
|
|
1680
|
+
selector instead of the debug menu. This allows users to switch between
|
|
1681
|
+
update channels by shaking their device.
|
|
1682
|
+
|
|
1683
|
+
After selecting a channel, the app automatically checks for updates
|
|
1684
|
+
and downloads if available.
|
|
1685
|
+
|
|
1686
|
+
Can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
|
|
1687
|
+
|
|
1688
|
+
| Param | Type |
|
|
1689
|
+
| ------------- | ----------------------------------------------------------------------------------------- |
|
|
1690
|
+
| **`options`** | <code><a href="#setshakechannelselectoroptions">SetShakeChannelSelectorOptions</a></code> |
|
|
1691
|
+
|
|
1692
|
+
**Since:** 8.43.0
|
|
1693
|
+
|
|
1694
|
+
--------------------
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
#### isShakeChannelSelectorEnabled()
|
|
1698
|
+
|
|
1699
|
+
```typescript
|
|
1700
|
+
isShakeChannelSelectorEnabled() => Promise<ShakeChannelSelectorEnabled>
|
|
1701
|
+
```
|
|
1702
|
+
|
|
1703
|
+
Check if the shake channel selector is currently enabled.
|
|
1704
|
+
|
|
1705
|
+
Returns the current state of the shake channel selector feature that can be toggled via
|
|
1706
|
+
{@link setShakeChannelSelector} or configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
|
|
1707
|
+
|
|
1708
|
+
**Returns:** <code>Promise<<a href="#shakechannelselectorenabled">ShakeChannelSelectorEnabled</a>></code>
|
|
1709
|
+
|
|
1710
|
+
**Since:** 8.43.0
|
|
1711
|
+
|
|
1712
|
+
--------------------
|
|
1713
|
+
|
|
1714
|
+
|
|
1666
1715
|
#### getAppId()
|
|
1667
1716
|
|
|
1668
1717
|
```typescript
|
|
@@ -2210,6 +2259,20 @@ State information for flexible update progress (Android only).
|
|
|
2210
2259
|
| **`enabled`** | <code>boolean</code> |
|
|
2211
2260
|
|
|
2212
2261
|
|
|
2262
|
+
##### SetShakeChannelSelectorOptions
|
|
2263
|
+
|
|
2264
|
+
| Prop | Type |
|
|
2265
|
+
| ------------- | -------------------- |
|
|
2266
|
+
| **`enabled`** | <code>boolean</code> |
|
|
2267
|
+
|
|
2268
|
+
|
|
2269
|
+
##### ShakeChannelSelectorEnabled
|
|
2270
|
+
|
|
2271
|
+
| Prop | Type |
|
|
2272
|
+
| ------------- | -------------------- |
|
|
2273
|
+
| **`enabled`** | <code>boolean</code> |
|
|
2274
|
+
|
|
2275
|
+
|
|
2213
2276
|
##### GetAppIdRes
|
|
2214
2277
|
|
|
2215
2278
|
| Prop | Type |
|