@capgo/capacitor-updater 7.35.0-alpha.0 → 7.36.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/README.md +2 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +60 -8
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/dist/docs.json +24 -0
- package/dist/esm/definitions.d.ts +10 -0
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/BundleInfo.swift +37 -10
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +4 -4
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +16 -10
- package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +4 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1768,6 +1768,8 @@ If you don't use backend, you need to provide the URL and version of the bundle.
|
|
|
1768
1768
|
| **`old`** | <code>string</code> | The previous/current version name (provided for reference). | |
|
|
1769
1769
|
| **`url`** | <code>string</code> | Download URL for the bundle (when a new version is available). | |
|
|
1770
1770
|
| **`manifest`** | <code>ManifestEntry[]</code> | File list for partial updates (when using multi-file downloads). | 6.1 |
|
|
1771
|
+
| **`link`** | <code>string</code> | Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release). | 7.35.0 |
|
|
1772
|
+
| **`comment`** | <code>string</code> | Optional comment or description for this bundle version. | 7.35.0 |
|
|
1771
1773
|
|
|
1772
1774
|
|
|
1773
1775
|
##### GetLatestOptions
|
|
@@ -29,25 +29,53 @@ public class BundleInfo {
|
|
|
29
29
|
private final String version;
|
|
30
30
|
private final String checksum;
|
|
31
31
|
private final BundleStatus status;
|
|
32
|
+
private final String link;
|
|
33
|
+
private final String comment;
|
|
32
34
|
|
|
33
35
|
static {
|
|
34
36
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
public BundleInfo(final BundleInfo source) {
|
|
38
|
-
this(source.id, source.version, source.status, source.downloaded, source.checksum);
|
|
40
|
+
this(source.id, source.version, source.status, source.downloaded, source.checksum, source.link, source.comment);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
public BundleInfo(final String id, final String version, final BundleStatus status, final Date downloaded, final String checksum) {
|
|
42
|
-
this(id, version, status, sdf.format(downloaded), checksum);
|
|
44
|
+
this(id, version, status, sdf.format(downloaded), checksum, null, null);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public BundleInfo(
|
|
48
|
+
final String id,
|
|
49
|
+
final String version,
|
|
50
|
+
final BundleStatus status,
|
|
51
|
+
final Date downloaded,
|
|
52
|
+
final String checksum,
|
|
53
|
+
final String link,
|
|
54
|
+
final String comment
|
|
55
|
+
) {
|
|
56
|
+
this(id, version, status, sdf.format(downloaded), checksum, link, comment);
|
|
43
57
|
}
|
|
44
58
|
|
|
45
59
|
public BundleInfo(final String id, final String version, final BundleStatus status, final String downloaded, final String checksum) {
|
|
60
|
+
this(id, version, status, downloaded, checksum, null, null);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public BundleInfo(
|
|
64
|
+
final String id,
|
|
65
|
+
final String version,
|
|
66
|
+
final BundleStatus status,
|
|
67
|
+
final String downloaded,
|
|
68
|
+
final String checksum,
|
|
69
|
+
final String link,
|
|
70
|
+
final String comment
|
|
71
|
+
) {
|
|
46
72
|
this.downloaded = downloaded != null ? downloaded.trim() : "";
|
|
47
73
|
this.id = id != null ? id : "";
|
|
48
74
|
this.version = version;
|
|
49
75
|
this.checksum = checksum != null ? checksum : "";
|
|
50
76
|
this.status = status != null ? status : BundleStatus.ERROR;
|
|
77
|
+
this.link = link;
|
|
78
|
+
this.comment = comment;
|
|
51
79
|
}
|
|
52
80
|
|
|
53
81
|
public Boolean isBuiltin() {
|
|
@@ -75,7 +103,7 @@ public class BundleInfo {
|
|
|
75
103
|
}
|
|
76
104
|
|
|
77
105
|
public BundleInfo setDownloaded(Date downloaded) {
|
|
78
|
-
return new BundleInfo(this.id, this.version, this.status, downloaded, this.checksum);
|
|
106
|
+
return new BundleInfo(this.id, this.version, this.status, downloaded, this.checksum, this.link, this.comment);
|
|
79
107
|
}
|
|
80
108
|
|
|
81
109
|
public String getChecksum() {
|
|
@@ -83,7 +111,7 @@ public class BundleInfo {
|
|
|
83
111
|
}
|
|
84
112
|
|
|
85
113
|
public BundleInfo setChecksum(String checksum) {
|
|
86
|
-
return new BundleInfo(this.id, this.version, this.status, this.downloaded, checksum);
|
|
114
|
+
return new BundleInfo(this.id, this.version, this.status, this.downloaded, checksum, this.link, this.comment);
|
|
87
115
|
}
|
|
88
116
|
|
|
89
117
|
public String getId() {
|
|
@@ -91,7 +119,7 @@ public class BundleInfo {
|
|
|
91
119
|
}
|
|
92
120
|
|
|
93
121
|
public BundleInfo setId(String id) {
|
|
94
|
-
return new BundleInfo(id, this.version, this.status, this.downloaded, this.checksum);
|
|
122
|
+
return new BundleInfo(id, this.version, this.status, this.downloaded, this.checksum, this.link, this.comment);
|
|
95
123
|
}
|
|
96
124
|
|
|
97
125
|
public String getVersionName() {
|
|
@@ -99,7 +127,7 @@ public class BundleInfo {
|
|
|
99
127
|
}
|
|
100
128
|
|
|
101
129
|
public BundleInfo setVersionName(String version) {
|
|
102
|
-
return new BundleInfo(this.id, version, this.status, this.downloaded, this.checksum);
|
|
130
|
+
return new BundleInfo(this.id, version, this.status, this.downloaded, this.checksum, this.link, this.comment);
|
|
103
131
|
}
|
|
104
132
|
|
|
105
133
|
public BundleStatus getStatus() {
|
|
@@ -110,7 +138,23 @@ public class BundleInfo {
|
|
|
110
138
|
}
|
|
111
139
|
|
|
112
140
|
public BundleInfo setStatus(BundleStatus status) {
|
|
113
|
-
return new BundleInfo(this.id, this.version, status, this.downloaded, this.checksum);
|
|
141
|
+
return new BundleInfo(this.id, this.version, status, this.downloaded, this.checksum, this.link, this.comment);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public String getLink() {
|
|
145
|
+
return this.link;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public BundleInfo setLink(String link) {
|
|
149
|
+
return new BundleInfo(this.id, this.version, this.status, this.downloaded, this.checksum, link, this.comment);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public String getComment() {
|
|
153
|
+
return this.comment;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public BundleInfo setComment(String comment) {
|
|
157
|
+
return new BundleInfo(this.id, this.version, this.status, this.downloaded, this.checksum, this.link, comment);
|
|
114
158
|
}
|
|
115
159
|
|
|
116
160
|
public static BundleInfo fromJSON(final String jsonString) throws JSONException {
|
|
@@ -120,7 +164,9 @@ public class BundleInfo {
|
|
|
120
164
|
json.has("version") ? json.getString("version") : BundleInfo.VERSION_UNKNOWN,
|
|
121
165
|
json.has("status") ? BundleStatus.fromString(json.getString("status")) : BundleStatus.PENDING,
|
|
122
166
|
json.has("downloaded") ? json.getString("downloaded") : "",
|
|
123
|
-
json.has("checksum") ? json.getString("checksum") : ""
|
|
167
|
+
json.has("checksum") ? json.getString("checksum") : "",
|
|
168
|
+
json.has("link") ? json.getString("link") : null,
|
|
169
|
+
json.has("comment") ? json.getString("comment") : null
|
|
124
170
|
);
|
|
125
171
|
}
|
|
126
172
|
|
|
@@ -131,6 +177,12 @@ public class BundleInfo {
|
|
|
131
177
|
result.put("downloaded", this.getDownloaded());
|
|
132
178
|
result.put("checksum", this.getChecksum());
|
|
133
179
|
result.put("status", this.getStatus().toString());
|
|
180
|
+
if (this.link != null && !this.link.isEmpty()) {
|
|
181
|
+
result.put("link", this.link);
|
|
182
|
+
}
|
|
183
|
+
if (this.comment != null && !this.comment.isEmpty()) {
|
|
184
|
+
result.put("comment", this.comment);
|
|
185
|
+
}
|
|
134
186
|
return result;
|
|
135
187
|
}
|
|
136
188
|
|
|
@@ -72,7 +72,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
72
72
|
private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
|
|
73
73
|
private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
|
|
74
74
|
|
|
75
|
-
private final String pluginVersion = "7.
|
|
75
|
+
private final String pluginVersion = "7.36.0";
|
|
76
76
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
77
77
|
|
|
78
78
|
private SharedPreferences.Editor editor;
|
package/dist/docs.json
CHANGED
|
@@ -1764,6 +1764,30 @@
|
|
|
1764
1764
|
"ManifestEntry"
|
|
1765
1765
|
],
|
|
1766
1766
|
"type": "ManifestEntry[] | undefined"
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
"name": "link",
|
|
1770
|
+
"tags": [
|
|
1771
|
+
{
|
|
1772
|
+
"text": "7.35.0",
|
|
1773
|
+
"name": "since"
|
|
1774
|
+
}
|
|
1775
|
+
],
|
|
1776
|
+
"docs": "Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release).",
|
|
1777
|
+
"complexTypes": [],
|
|
1778
|
+
"type": "string | undefined"
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
"name": "comment",
|
|
1782
|
+
"tags": [
|
|
1783
|
+
{
|
|
1784
|
+
"text": "7.35.0",
|
|
1785
|
+
"name": "since"
|
|
1786
|
+
}
|
|
1787
|
+
],
|
|
1788
|
+
"docs": "Optional comment or description for this bundle version.",
|
|
1789
|
+
"complexTypes": [],
|
|
1790
|
+
"type": "string | undefined"
|
|
1767
1791
|
}
|
|
1768
1792
|
]
|
|
1769
1793
|
},
|
|
@@ -1345,6 +1345,16 @@ export interface LatestVersion {
|
|
|
1345
1345
|
* @since 6.1
|
|
1346
1346
|
*/
|
|
1347
1347
|
manifest?: ManifestEntry[];
|
|
1348
|
+
/**
|
|
1349
|
+
* Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release).
|
|
1350
|
+
* @since 7.35.0
|
|
1351
|
+
*/
|
|
1352
|
+
link?: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* Optional comment or description for this bundle version.
|
|
1355
|
+
* @since 7.35.0
|
|
1356
|
+
*/
|
|
1357
|
+
comment?: string;
|
|
1348
1358
|
}
|
|
1349
1359
|
export interface BundleInfo {
|
|
1350
1360
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\n/// <reference types=\"@capacitor/cli\" />\n\nimport type { PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * CapacitorUpdater can be configured with these options:\n */\n CapacitorUpdater?: {\n /**\n * Configure the number of milliseconds the native plugin should wait before considering an update 'failed'.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @example 1000 // (1 second)\n */\n appReadyTimeout?: number;\n /**\n * Configure the number of seconds the native plugin should wait before considering API timeout.\n *\n * Only available for Android and iOS.\n *\n * @default 20 // (20 second)\n * @example 10 // (10 second)\n */\n responseTimeout?: number;\n /**\n * Configure whether the plugin should use automatically delete failed bundles.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeleteFailed?: boolean;\n\n /**\n * Configure whether the plugin should use automatically delete previous bundles after a successful update.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeletePrevious?: boolean;\n\n /**\n * Configure whether the plugin should use Auto Update via an update server.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoUpdate?: boolean;\n\n /**\n * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n resetWhenUpdate?: boolean;\n\n /**\n * Configure the URL / endpoint to which update checks are sent.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/updates\n * @example https://example.com/api/auto_update\n */\n updateUrl?: string;\n\n /**\n * Configure the URL / endpoint for channel operations.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/channel_self\n * @example https://example.com/api/channel\n */\n channelUrl?: string;\n\n /**\n * Configure the URL / endpoint to which update statistics are sent.\n *\n * Only available for Android and iOS. Set to \"\" to disable stats reporting.\n *\n * @default https://plugin.capgo.app/stats\n * @example https://example.com/api/stats\n */\n statsUrl?: string;\n /**\n * Configure the public key for end to end live update encryption Version 2\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 6.2.0\n */\n publicKey?: string;\n\n /**\n * Configure the current version of the app. This will be used for the first update request.\n * If not set, the plugin will get the version from the native code.\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 4.17.48\n */\n version?: string;\n /**\n * Configure when the plugin should direct install updates. Only for autoUpdate mode.\n * Works well for apps less than 10MB and with uploads done using --partial flag.\n * Zip or apps more than 10MB will be relatively slow for users to update.\n * - false: Never do direct updates (use default behavior: download at start, set when backgrounded)\n * - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false\n * - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false\n * - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false\n * - true: (deprecated) Same as \"always\" for backward compatibility\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 5.1.0\n */\n directUpdate?: boolean | 'atInstall' | 'always' | 'onLaunch';\n\n /**\n * 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.\n * This removes the need to manually listen for appReady events and call SplashScreen.hide().\n * Only works when directUpdate is set to \"atInstall\", \"always\", \"onLaunch\", or true.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n * Requires autoUpdate and directUpdate to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.6.0\n */\n autoSplashscreen?: boolean;\n\n /**\n * Display a native loading indicator on top of the splashscreen while automatic direct updates are running.\n * Only takes effect when {@link autoSplashscreen} is enabled.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.19.0\n */\n autoSplashscreenLoader?: boolean;\n\n /**\n * Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates.\n * If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed.\n * Set to `0` (zero) to disable the timeout.\n * When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch.\n * Requires {@link autoSplashscreen} to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @since 7.19.0\n */\n autoSplashscreenTimeout?: number;\n\n /**\n * Configure the delay period for period update check. the unit is in seconds.\n *\n * Only available for Android and iOS.\n * Cannot be less than 600 seconds (10 minutes).\n *\n * @default 0 (disabled)\n * @example 3600 (1 hour)\n * @example 86400 (24 hours)\n */\n periodCheckDelay?: number;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localS3?: boolean;\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localHost?: string;\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localWebHost?: string;\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupa?: string;\n /**\n * Configure the CLI to use a local server for testing.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupaAnon?: string;\n /**\n * Configure the CLI to use a local api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApi?: string;\n /**\n * Configure the CLI to use a local file api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApiFiles?: string;\n /**\n * Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 5.4.0\n */\n allowModifyUrl?: boolean;\n\n /**\n * Allow the plugin to modify the appId dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 7.14.0\n */\n allowModifyAppId?: boolean;\n\n /**\n * Allow marking bundles as errored from JavaScript while using manual update flows.\n * When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.\n *\n * @default false\n * @since 7.20.0\n */\n allowManualBundleError?: boolean;\n\n /**\n * Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false (will be true by default in a future major release v8.x.x)\n * @since 7.17.3\n */\n persistCustomId?: boolean;\n\n /**\n * Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl},\n * {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.20.0\n */\n persistModifyUrl?: boolean;\n\n /**\n * Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel.\n * When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`.\n *\n * @default true\n * @since 7.34.0\n */\n allowSetDefaultChannel?: boolean;\n\n /**\n * Set the default channel for the app in the config. Case sensitive.\n * This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.\n * 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\n *\n *\n * @default undefined\n * @since 5.5.0\n */\n defaultChannel?: string;\n /**\n * Configure the app id for the app in the config.\n *\n * @default undefined\n * @since 6.0.0\n */\n appId?: string;\n\n /**\n * Configure the plugin to keep the URL path after a reload.\n * WARNING: When a reload is triggered, 'window.history' will be cleared.\n *\n * @default false\n * @since 6.8.0\n */\n keepUrlPathAfterReload?: boolean;\n /**\n * 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\n *\n * @default false\n * @since 7.3.0\n */\n disableJSLogging?: boolean;\n /**\n * Enable shake gesture to show update menu for debugging/testing purposes\n *\n * @default false\n * @since 7.5.0\n */\n shakeMenu?: boolean;\n };\n }\n}\n\nexport interface CapacitorUpdaterPlugin {\n /**\n * Notify the native layer that JavaScript initialized successfully.\n *\n * **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**\n *\n * This is a simple notification to confirm that your bundle's JavaScript loaded and executed.\n * The native web server successfully served the bundle files and your JS runtime started.\n * That's all it checks - nothing more complex.\n *\n * **What triggers rollback:**\n * - NOT calling this method within the timeout (default: 10 seconds)\n * - Complete JavaScript failure (bundle won't load at all)\n *\n * **What does NOT trigger rollback:**\n * - Runtime errors after initialization (API failures, crashes, etc.)\n * - Network request failures\n * - Application logic errors\n *\n * **IMPORTANT: Call this BEFORE any network requests.**\n * Don't wait for APIs, data loading, or async operations. Call it as soon as your\n * JavaScript bundle starts executing to confirm the bundle itself is valid.\n *\n * Best practices:\n * - Call immediately in your app entry point (main.js, app component mount, etc.)\n * - Don't put it after network calls or heavy initialization\n * - Don't wrap it in try/catch with conditions\n * - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time\n *\n * @returns {Promise<AppReadyResult>} Always resolves successfully with current bundle info. This method never fails.\n */\n notifyAppReady(): Promise<AppReadyResult>;\n\n /**\n * Set the update URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for checking for updates.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setUpdateUrl(options: UpdateUrl): Promise<void>;\n\n /**\n * Set the statistics URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Pass an empty string to disable statistics gathering entirely.\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n *\n * @param options Contains the URL to use for sending statistics, or an empty string to disable.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setStatsUrl(options: StatsUrl): Promise<void>;\n\n /**\n * Set the channel URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for channel operations.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setChannelUrl(options: ChannelUrl): Promise<void>;\n\n /**\n * Download a new bundle from the provided URL for later installation.\n *\n * The downloaded bundle is stored locally but not activated. To use it:\n * - Call {@link next} to set it for installation on next app backgrounding/restart\n * - Call {@link set} to activate it immediately (destroys current JavaScript context)\n *\n * The URL should point to a zip file containing either:\n * - Your app files directly in the zip root, or\n * - A single folder containing all your app files\n *\n * The bundle must include an `index.html` file at the root level.\n *\n * For encrypted bundles, provide the `sessionKey` and `checksum` parameters.\n * For multi-file partial updates, provide the `manifest` array.\n *\n * @example\n * const bundle = await CapacitorUpdater.download({\n * url: `https://example.com/versions/${version}/dist.zip`,\n * version: version\n * });\n * // Bundle is downloaded but not active yet\n * await CapacitorUpdater.next({ id: bundle.id }); // Will activate on next background\n *\n * @param options The {@link DownloadOptions} for downloading a new bundle zip.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the downloaded bundle.\n * @throws {Error} If the download fails or the bundle is invalid.\n */\n download(options: DownloadOptions): Promise<BundleInfo>;\n\n /**\n * Set the next bundle to be activated when the app backgrounds or restarts.\n *\n * This is the recommended way to apply updates as it doesn't interrupt the user's current session.\n * The bundle will be activated when:\n * - The app is backgrounded (user switches away), or\n * - The app is killed and relaunched, or\n * - {@link reload} is called manually\n *\n * Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.\n * Your app continues running normally until one of the above events occurs.\n *\n * Use {@link setMultiDelay} to add additional conditions before the update is applied.\n *\n * @param options Contains the ID of the bundle to set as next. Use {@link BundleInfo.id} from a downloaded bundle.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.\n * @throws {Error} When there is no index.html file inside the bundle folder or the bundle doesn't exist.\n */\n next(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Set the current bundle and immediately reloads the app.\n *\n * **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**\n *\n * When you call this method:\n * - The entire JavaScript context is immediately destroyed\n * - The app reloads from a different folder with different files\n * - NO code after this call will execute\n * - NO promises will resolve\n * - NO callbacks will fire\n * - Event listeners registered after this call are unreliable and may never fire\n *\n * The reload happens automatically - you don't need to do anything else.\n * If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.\n * For other state preservation needs, save your data before calling this method (e.g., to localStorage).\n *\n * **Do not** try to execute additional logic after calling `set()` - it won't work as expected.\n *\n * @param options A {@link BundleId} object containing the new bundle id to set as current.\n * @returns {Promise<void>} A promise that will never resolve because the JavaScript context is destroyed.\n * @throws {Error} When there is no index.html file inside the bundle folder.\n */\n set(options: BundleId): Promise<void>;\n\n /**\n * Delete a bundle from local storage to free up disk space.\n *\n * You cannot delete:\n * - The currently active bundle\n * - The `builtin` bundle (the version shipped with your app)\n * - The bundle set as `next` (call {@link next} with a different bundle first)\n *\n * Use {@link list} to get all available bundle IDs.\n *\n * **Note:** The bundle ID is NOT the same as the version name.\n * Use the `id` field from {@link BundleInfo}, not the `version` field.\n *\n * @param options A {@link BundleId} object containing the bundle ID to delete.\n * @returns {Promise<void>} Resolves when the bundle is successfully deleted.\n * @throws {Error} If the bundle is currently in use or doesn't exist.\n */\n delete(options: BundleId): Promise<void>;\n\n /**\n * Manually mark a bundle as failed/errored in manual update mode.\n *\n * This is useful when you detect that a bundle has critical issues and want to prevent\n * it from being used again. The bundle status will be changed to `error` and the plugin\n * will avoid using this bundle in the future.\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`\n * - Only works in manual update mode (when autoUpdate is disabled)\n *\n * Common use case: After downloading and testing a bundle, you discover it has critical\n * bugs and want to mark it as failed so it won't be retried.\n *\n * @param options A {@link BundleId} object containing the bundle ID to mark as errored.\n * @returns {Promise<BundleInfo>} The updated {@link BundleInfo} with status set to `error`.\n * @throws {Error} When the bundle does not exist or `allowManualBundleError` is false.\n * @since 7.20.0\n */\n setBundleError(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Get all locally downloaded bundles stored in your app.\n *\n * This returns all bundles that have been downloaded and are available locally, including:\n * - The currently active bundle\n * - The `builtin` bundle (shipped with your app)\n * - Any downloaded bundles waiting to be activated\n * - Failed bundles (with `error` status)\n *\n * Use this to:\n * - Check available disk space by counting bundles\n * - Delete old bundles with {@link delete}\n * - Monitor bundle download status\n *\n * @param options The {@link ListOptions} for customizing the bundle list output.\n * @returns {Promise<BundleListResult>} A promise containing the array of {@link BundleInfo} objects.\n * @throws {Error} If the operation fails.\n */\n list(options?: ListOptions): Promise<BundleListResult>;\n\n /**\n * Reset the app to a known good bundle.\n *\n * This method helps recover from problematic updates by reverting to either:\n * - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)\n * - The last successfully loaded bundle (most recent bundle that worked correctly)\n *\n * **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**\n * See {@link set} for details on the implications of this operation.\n *\n * Use cases:\n * - Emergency recovery when an update causes critical issues\n * - Testing rollback functionality\n * - Providing users a \"reset to factory\" option\n *\n * @param options {@link ResetOptions} to control reset behavior. If `toLastSuccessful` is `false` (or omitted), resets to builtin. If `true`, resets to last successful bundle.\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reset operation fails.\n */\n reset(options?: ResetOptions): Promise<void>;\n\n /**\n * Get information about the currently active bundle.\n *\n * Returns:\n * - `bundle`: The currently active bundle information\n * - `native`: The version of the builtin bundle (the original app version from App/Play Store)\n *\n * If no updates have been applied, `bundle.id` will be `\"builtin\"`, indicating the app\n * is running the original version shipped with the native app.\n *\n * Use this to:\n * - Display the current version to users\n * - Check if an update is currently active\n * - Compare against available updates\n * - Log the active bundle for debugging\n *\n * @returns {Promise<CurrentBundleResult>} A promise with the current bundle and native version info.\n * @throws {Error} If the operation fails.\n */\n current(): Promise<CurrentBundleResult>;\n\n /**\n * Manually reload the app to apply a pending update.\n *\n * This triggers the same reload behavior that happens automatically when the app backgrounds.\n * If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.\n *\n * **IMPORTANT: This destroys the current JavaScript context immediately.**\n * See {@link set} for details on the implications of this operation.\n *\n * Common use cases:\n * - Applying an update immediately after download instead of waiting for backgrounding\n * - Providing a \"Restart now\" button to users after an update is ready\n * - Testing update flows during development\n *\n * If no update is pending (no call to {@link next}), this simply reloads the current bundle.\n *\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reload operation fails.\n */\n reload(): Promise<void>;\n\n /**\n * Configure conditions that must be met before a pending update is applied.\n *\n * After calling {@link next} to queue an update, use this method to control when it gets applied.\n * The update will only be installed after ALL specified conditions are satisfied.\n *\n * Available condition types:\n * - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.\n * - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)\n * - `date`: Wait until a specific date/time (ISO 8601 format)\n * - `nativeVersion`: Wait until the native app is updated to a specific version\n *\n * Condition value formats:\n * - `background`: Number in milliseconds (e.g., `\"300000\"` for 5 minutes), or omit for immediate\n * - `kill`: No value needed\n * - `date`: ISO 8601 date string (e.g., `\"2025-12-31T23:59:59Z\"`)\n * - `nativeVersion`: Version string (e.g., `\"2.0.0\"`)\n *\n * @example\n * // Update after user kills app OR after 5 minutes in background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [\n * { kind: 'kill' },\n * { kind: 'background', value: '300000' }\n * ]\n * });\n *\n * @example\n * // Update after a specific date\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'date', value: '2025-12-31T23:59:59Z' }]\n * });\n *\n * @example\n * // Default behavior: update on next background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'background' }]\n * });\n *\n * @param options Contains the {@link MultiDelayConditions} array of conditions.\n * @returns {Promise<void>} Resolves when the delay conditions are set.\n * @throws {Error} If the operation fails or conditions are invalid.\n * @since 4.3.0\n */\n setMultiDelay(options: MultiDelayConditions): Promise<void>;\n\n /**\n * Cancel all delay conditions and apply the pending update immediately.\n *\n * If you've set delay conditions with {@link setMultiDelay}, this method clears them\n * and triggers the pending update to be applied on the next app background or restart.\n *\n * This is useful when:\n * - User manually requests to update now (e.g., clicks \"Update now\" button)\n * - Your app detects it's a good time to update (e.g., user finished critical task)\n * - You want to override a time-based delay early\n *\n * @returns {Promise<void>} Resolves when the delay conditions are cleared.\n * @throws {Error} If the operation fails.\n * @since 4.0.0\n */\n cancelDelay(): Promise<void>;\n\n /**\n * Check the update server for the latest available bundle version.\n *\n * This queries your configured update URL (or Capgo backend) to see if a newer bundle\n * is available for download. It does NOT download the bundle automatically.\n *\n * The response includes:\n * - `version`: The latest available version identifier\n * - `url`: Download URL for the bundle (if available)\n * - `breaking`: Whether this update is marked as incompatible (requires native app update)\n * - `message`: Optional message from the server\n * - `manifest`: File list for partial updates (if using multi-file downloads)\n *\n * After receiving the latest version info, you can:\n * 1. Compare it with your current version\n * 2. Download it using {@link download}\n * 3. Apply it using {@link next} or {@link set}\n *\n * **Important: Error handling for \"no new version available\"**\n *\n * When the device's current version matches the latest version on the server (i.e., the device is already\n * up-to-date), the server returns a 200 response with `error: \"no_new_version_available\"` and\n * `message: \"No new version available\"`. **This causes `getLatest()` to throw an error**, even though\n * this is a normal, expected condition.\n *\n * You should catch this specific error to handle it gracefully:\n *\n * ```typescript\n * try {\n * const latest = await CapacitorUpdater.getLatest();\n * // New version is available, proceed with download\n * } catch (error) {\n * if (error.message === 'No new version available') {\n * // Device is already on the latest version - this is normal\n * console.log('Already up to date');\n * } else {\n * // Actual error occurred\n * console.error('Failed to check for updates:', error);\n * }\n * }\n * ```\n *\n * In this scenario, the server:\n * - Logs the request with a \"No new version available\" message\n * - Sends a \"noNew\" stat action to track that the device checked for updates but was already current (done on the backend)\n *\n * @param options Optional {@link GetLatestOptions} to specify which channel to check.\n * @returns {Promise<LatestVersion>} Information about the latest available bundle version.\n * @throws {Error} Always throws when no new version is available (`error: \"no_new_version_available\"`), or when the request fails.\n * @since 4.0.0\n */\n getLatest(options?: GetLatestOptions): Promise<LatestVersion>;\n\n /**\n * Assign this device to a specific update channel at runtime.\n *\n * Channels allow you to distribute different bundle versions to different groups of users\n * (e.g., \"production\", \"beta\", \"staging\"). This method switches the device to a new channel.\n *\n * **Requirements:**\n * - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)\n * - The backend may accept or reject the request based on channel settings\n *\n * **When to use:**\n * - After the app is ready and the user has interacted (e.g., opted into beta program)\n * - To implement in-app channel switching (beta toggle, tester access, etc.)\n * - For user-driven channel changes\n *\n * **When NOT to use:**\n * - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead\n * - Before user interaction\n *\n * **Important: Listen for the `channelPrivate` event**\n *\n * When a user attempts to set a channel that doesn't allow device self-assignment, the method will\n * throw an error AND fire a {@link addListener}('channelPrivate') event. You should listen to this event\n * to provide appropriate feedback to users:\n *\n * ```typescript\n * CapacitorUpdater.addListener('channelPrivate', (data) => {\n * console.warn(`Cannot access channel \"${data.channel}\": ${data.message}`);\n * // Show user-friendly message\n * });\n * ```\n *\n * This sends a request to the Capgo backend linking your device ID to the specified channel.\n *\n * @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.\n * @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.\n * @throws {Error} If the channel doesn't exist or doesn't allow self-assignment.\n * @since 4.7.0\n */\n setChannel(options: SetChannelOptions): Promise<ChannelRes>;\n\n /**\n * Remove the device's channel assignment and return to the default channel.\n *\n * This unlinks the device from any specifically assigned channel, causing it to fall back to:\n * - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or\n * - Your backend's default channel for this app\n *\n * Use this when:\n * - Users opt out of beta/testing programs\n * - You want to reset a device to standard update distribution\n * - Testing channel switching behavior\n *\n * @param options {@link UnsetChannelOptions} containing optional auto-update trigger.\n * @returns {Promise<void>} Resolves when the channel is successfully unset.\n * @throws {Error} If the operation fails.\n * @since 4.7.0\n */\n unsetChannel(options: UnsetChannelOptions): Promise<void>;\n\n /**\n * Get the current channel assigned to this device.\n *\n * Returns information about:\n * - `channel`: The currently assigned channel name (if any)\n * - `allowSet`: Whether the channel allows self-assignment\n * - `status`: Operation status\n * - `error`/`message`: Additional information (if applicable)\n *\n * Use this to:\n * - Display current channel to users (e.g., \"You're on the Beta channel\")\n * - Check if a device is on a specific channel before showing features\n * - Verify channel assignment after calling {@link setChannel}\n *\n * @returns {Promise<GetChannelRes>} The current channel information.\n * @throws {Error} If the operation fails.\n * @since 4.8.0\n */\n getChannel(): Promise<GetChannelRes>;\n\n /**\n * Get a list of all channels available for this device to self-assign to.\n *\n * Only returns channels where `allow_self_set` is `true`. These are channels that\n * users can switch to using {@link setChannel} without backend administrator intervention.\n *\n * Each channel includes:\n * - `id`: Unique channel identifier\n * - `name`: Human-readable channel name\n * - `public`: Whether the channel is publicly visible\n * - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)\n *\n * Use this to:\n * - Build a channel selector UI for users (e.g., \"Join Beta\" button)\n * - Show available testing/preview channels\n * - Implement channel discovery features\n *\n * @returns {Promise<ListChannelsResult>} List of channels the device can self-assign to.\n * @throws {Error} If the operation fails or the request to the backend fails.\n * @since 7.5.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Set a custom identifier for this device.\n *\n * This allows you to identify devices by your own custom ID (user ID, account ID, etc.)\n * instead of or in addition to the device's unique hardware ID. The custom ID is sent\n * to your update server and can be used for:\n * - Targeting specific users for updates\n * - Analytics and user tracking\n * - Debugging and support (correlating devices with users)\n * - A/B testing or feature flagging\n *\n * **Persistence:**\n * - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts\n * - When `false`, the ID is only kept for the current session\n *\n * **Clearing the custom ID:**\n * - Pass an empty string `\"\"` to remove any stored custom ID\n *\n * @param options The {@link SetCustomIdOptions} containing the custom identifier string.\n * @returns {Promise<void>} Resolves immediately (synchronous operation).\n * @throws {Error} If the operation fails.\n * @since 4.9.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n\n /**\n * Get the builtin bundle version (the original version shipped with your native app).\n *\n * This returns the version of the bundle that was included when the app was installed\n * from the App Store or Play Store. This is NOT the currently active bundle version -\n * use {@link current} for that.\n *\n * Returns:\n * - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or\n * - The native app version from platform configs (package.json, Info.plist, build.gradle)\n *\n * Use this to:\n * - Display the \"factory\" version to users\n * - Compare against downloaded bundle versions\n * - Determine if any updates have been applied\n * - Debugging version mismatches\n *\n * @returns {Promise<BuiltinVersion>} The builtin bundle version string.\n * @since 5.2.0\n */\n getBuiltinVersion(): Promise<BuiltinVersion>;\n\n /**\n * Get the unique, privacy-friendly identifier for this device.\n *\n * This ID is used to identify the device when communicating with update servers.\n * It's automatically generated and stored securely by the plugin.\n *\n * **Privacy & Security characteristics:**\n * - Generated as a UUID (not based on hardware identifiers)\n * - Stored securely in platform-specific secure storage\n * - Android: Android Keystore (persists across app reinstalls on API 23+)\n * - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`\n * - Not synced to cloud (iOS)\n * - Follows Apple and Google privacy best practices\n * - Users can clear it via system settings (Android) or keychain access (iOS)\n *\n * **Persistence:**\n * The device ID persists across app reinstalls to maintain consistent device identity\n * for update tracking and analytics.\n *\n * Use this to:\n * - Debug update delivery issues (check what ID the server sees)\n * - Implement device-specific features\n * - Correlate server logs with specific devices\n *\n * @returns {Promise<DeviceId>} The unique device identifier string.\n * @throws {Error} If the operation fails.\n */\n getDeviceId(): Promise<DeviceId>;\n\n /**\n * Get the version of the Capacitor Updater plugin installed in your app.\n *\n * This returns the version of the native plugin code (Android/iOS), which is sent\n * to the update server with each request. This is NOT your app version or bundle version.\n *\n * Use this to:\n * - Debug plugin-specific issues (when reporting bugs)\n * - Verify plugin installation and version\n * - Check compatibility with backend features\n * - Display in debug/about screens\n *\n * @returns {Promise<PluginVersion>} The Capacitor Updater plugin version string.\n * @throws {Error} If the operation fails.\n */\n getPluginVersion(): Promise<PluginVersion>;\n\n /**\n * Check if automatic updates are currently enabled.\n *\n * Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,\n * meaning the plugin will automatically check for, download, and apply updates.\n *\n * Returns `false` if in manual mode, where you control the update flow using\n * {@link getLatest}, {@link download}, {@link next}, and {@link set}.\n *\n * Use this to:\n * - Determine which update flow your app is using\n * - Show/hide manual update UI based on mode\n * - Debug update behavior\n *\n * @returns {Promise<AutoUpdateEnabled>} `true` if auto-update is enabled, `false` if in manual mode.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateEnabled(): Promise<AutoUpdateEnabled>;\n\n /**\n * Remove all event listeners registered for this plugin.\n *\n * This unregisters all listeners added via {@link addListener} for all event types:\n * - `download`\n * - `noNeedUpdate`\n * - `updateAvailable`\n * - `downloadComplete`\n * - `downloadFailed`\n * - `breakingAvailable` / `majorAvailable`\n * - `updateFailed`\n * - `appReloaded`\n * - `appReady`\n *\n * Use this during cleanup (e.g., when unmounting components or closing screens)\n * to prevent memory leaks from lingering event listeners.\n *\n * @returns {Promise<void>} Resolves when all listeners are removed.\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.\n * This will return you all download percent during the download\n *\n * @since 2.0.11\n */\n addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for no need to update event, useful when you want force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for available update event, useful when you want to force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'updateAvailable',\n listenerFunc: (state: UpdateAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for downloadComplete events.\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadComplete',\n listenerFunc: (state: DownloadCompleteEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for breaking update events when the backend flags an update as incompatible with the current app.\n * Emits the same payload as the legacy `majorAvailable` listener.\n *\n * @since 7.22.0\n */\n addListener(\n eventName: 'breakingAvailable',\n listenerFunc: (state: BreakingAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking\n *\n * @deprecated Deprecated alias for {@link addListener} with `breakingAvailable`. Emits the same payload. will be removed in v8\n * @since 2.3.0\n */\n addListener(\n eventName: 'majorAvailable',\n listenerFunc: (state: MajorAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for update fail event in the App, let you know when update has fail to install at next app start\n *\n * @since 2.3.0\n */\n addListener(\n eventName: 'updateFailed',\n listenerFunc: (state: UpdateFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for download fail event in the App, let you know when a bundle download has failed\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (state: DownloadFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for reload event in the App, let you know when reload has happened\n *\n * @since 4.3.0\n */\n addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for app ready event in the App, let you know when app is ready to use, this event is retain till consumed.\n *\n * @since 5.1.0\n */\n addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for channel private event, fired when attempting to set a channel that doesn't allow device self-assignment.\n *\n * This event is useful for:\n * - Informing users they don't have permission to switch to a specific channel\n * - Implementing custom error handling for channel restrictions\n * - Logging unauthorized channel access attempts\n *\n * @since 7.34.0\n */\n addListener(\n eventName: 'channelPrivate',\n listenerFunc: (state: ChannelPrivateEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Check if the auto-update feature is available (not disabled by custom server configuration).\n *\n * Returns `false` when a custom `updateUrl` is configured, as this typically indicates\n * you're using a self-hosted update server that may not support all auto-update features.\n *\n * Returns `true` when using the default Capgo backend or when the feature is available.\n *\n * This is different from {@link isAutoUpdateEnabled}:\n * - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off\n * - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration\n *\n * @returns {Promise<AutoUpdateAvailable>} `false` when custom updateUrl is set, `true` otherwise.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateAvailable(): Promise<AutoUpdateAvailable>;\n\n /**\n * Get information about the bundle queued to be activated on next reload.\n *\n * Returns:\n * - {@link BundleInfo} object if a bundle has been queued via {@link next}\n * - `null` if no update is pending\n *\n * This is useful to:\n * - Check if an update is waiting to be applied\n * - Display \"Update pending\" status to users\n * - Show version info of the queued update\n * - Decide whether to show a \"Restart to update\" prompt\n *\n * The queued bundle will be activated when:\n * - The app is backgrounded (default behavior)\n * - The app is killed and restarted\n * - {@link reload} is called manually\n * - Delay conditions set by {@link setMultiDelay} are met\n *\n * @returns {Promise<BundleInfo | null>} The pending bundle info, or `null` if none is queued.\n * @throws {Error} If the operation fails.\n * @since 6.8.0\n */\n getNextBundle(): Promise<BundleInfo | null>;\n\n /**\n * Retrieve information about the most recent bundle that failed to load.\n *\n * When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),\n * the plugin automatically rolls back and stores information about the failure. This method\n * retrieves that failure information.\n *\n * **IMPORTANT: The stored value is cleared after being retrieved once.**\n * Calling this method multiple times will only return the failure info on the first call,\n * then `null` on subsequent calls until another failure occurs.\n *\n * Returns:\n * - {@link UpdateFailedEvent} with bundle info if a failure was recorded\n * - `null` if no failure has occurred or if it was already retrieved\n *\n * Use this to:\n * - Show users why an update failed\n * - Log failure information for debugging\n * - Implement custom error handling/reporting\n * - Display rollback notifications\n *\n * @returns {Promise<UpdateFailedEvent | null>} The failed update info (cleared after first retrieval), or `null`.\n * @throws {Error} If the operation fails.\n * @since 7.22.0\n */\n getFailedUpdate(): Promise<UpdateFailedEvent | null>;\n\n /**\n * Enable or disable the shake gesture menu for debugging and testing.\n *\n * When enabled, users can shake their device to open a debug menu that shows:\n * - Current bundle information\n * - Available bundles\n * - Options to switch bundles manually\n * - Update status\n *\n * This is useful during development and testing to:\n * - Quickly test different bundle versions\n * - Debug update flows\n * - Switch between production and test bundles\n * - Verify bundle installations\n *\n * **Important:** Disable this in production builds or only enable for internal testers.\n *\n * Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * @param options {@link SetShakeMenuOptions} with `enabled: true` to enable or `enabled: false` to disable.\n * @returns {Promise<void>} Resolves when the setting is applied.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n setShakeMenu(options: SetShakeMenuOptions): Promise<void>;\n\n /**\n * Check if the shake gesture debug menu is currently enabled.\n *\n * Returns the current state of the shake menu feature that can be toggled via\n * {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * Use this to:\n * - Check if debug features are enabled\n * - Show/hide debug settings UI\n * - Verify configuration during testing\n *\n * @returns {Promise<ShakeMenuEnabled>} Object with `enabled: true` or `enabled: false`.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n isShakeMenuEnabled(): Promise<ShakeMenuEnabled>;\n\n /**\n * Get the currently configured App ID used for update server communication.\n *\n * Returns the App ID that identifies this app to the update server. This can be:\n * - The value set via {@link setAppId}, or\n * - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or\n * - The default app identifier from your native app configuration\n *\n * Use this to:\n * - Verify which App ID is being used for updates\n * - Debug update delivery issues\n * - Display app configuration in debug screens\n * - Confirm App ID after calling {@link setAppId}\n *\n * @returns {Promise<GetAppIdRes>} Object containing the current `appId` string.\n * @throws {Error} If the operation fails.\n * @since 7.14.0\n */\n getAppId(): Promise<GetAppIdRes>;\n\n /**\n * Dynamically change the App ID used for update server communication.\n *\n * This overrides the App ID used to identify your app to the update server, allowing you\n * to switch between different app configurations at runtime (e.g., production vs staging\n * app IDs, or multi-tenant configurations).\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`\n *\n * **Important considerations:**\n * - Changing the App ID will affect which updates this device receives\n * - The new App ID must exist on your update server\n * - This is primarily for advanced use cases (multi-tenancy, environment switching)\n * - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead\n *\n * @param options {@link SetAppIdOptions} containing the new App ID string.\n * @returns {Promise<void>} Resolves when the App ID is successfully changed.\n * @throws {Error} If `allowModifyAppId` is false or the operation fails.\n * @since 7.14.0\n */\n setAppId(options: SetAppIdOptions): Promise<void>;\n}\n\n/**\n * pending: The bundle is pending to be **SET** as the next bundle.\n * downloading: The bundle is being downloaded.\n * success: The bundle has been downloaded and is ready to be **SET** as the next bundle.\n * error: The bundle has failed to download.\n */\nexport type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';\n\nexport type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';\n\nexport interface NoNeedEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateAvailableEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface ChannelRes {\n /**\n * Current status of set channel\n *\n * @since 4.7.0\n */\n status: string;\n error?: string;\n message?: string;\n}\n\nexport interface GetChannelRes {\n /**\n * Current status of get channel\n *\n * @since 4.8.0\n */\n channel?: string;\n error?: string;\n message?: string;\n status?: string;\n allowSet?: boolean;\n}\n\nexport interface ChannelInfo {\n /**\n * The channel ID\n *\n * @since 7.5.0\n */\n id: string;\n /**\n * The channel name\n *\n * @since 7.5.0\n */\n name: string;\n /**\n * Whether this is a public channel\n *\n * @since 7.5.0\n */\n public: boolean;\n /**\n * Whether devices can self-assign to this channel\n *\n * @since 7.5.0\n */\n allow_self_set: boolean;\n}\n\nexport interface ListChannelsResult {\n /**\n * List of available channels\n *\n * @since 7.5.0\n */\n channels: ChannelInfo[];\n}\n\nexport interface DownloadEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n percent: number;\n bundle: BundleInfo;\n}\n\nexport interface MajorAvailableEvent {\n /**\n * Emit when a breaking update is available.\n *\n * @deprecated Deprecated alias for {@link BreakingAvailableEvent}. Receives the same payload.\n * @since 4.0.0\n */\n version: string;\n}\n\n/**\n * Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.\n *\n * @since 7.22.0\n */\nexport type BreakingAvailableEvent = MajorAvailableEvent;\n\nexport interface DownloadFailedEvent {\n /**\n * Emit when a download fail.\n *\n * @since 4.0.0\n */\n version: string;\n}\n\nexport interface DownloadCompleteEvent {\n /**\n * Emit when a new update is available.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateFailedEvent {\n /**\n * Emit when a update failed to install.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface AppReadyEvent {\n /**\n * Emitted when the app is ready to use.\n *\n * @since 5.2.0\n */\n bundle: BundleInfo;\n status: string;\n}\n\nexport interface ChannelPrivateEvent {\n /**\n * Emitted when attempting to set a channel that doesn't allow device self-assignment.\n *\n * @since 7.34.0\n */\n channel: string;\n message: string;\n}\n\nexport interface ManifestEntry {\n file_name: string | null;\n file_hash: string | null;\n download_url: string | null;\n}\n\nexport interface LatestVersion {\n /**\n * Result of getLatest method\n *\n * @since 4.0.0\n */\n version: string;\n /**\n * @since 6\n */\n checksum?: string;\n /**\n * Indicates whether the update was flagged as breaking by the backend.\n *\n * @since 7.22.0\n */\n breaking?: boolean;\n /**\n * @deprecated Use {@link LatestVersion.breaking} instead.\n */\n major?: boolean;\n /**\n * Optional message from the server.\n * When no new version is available, this will be \"No new version available\".\n */\n message?: string;\n sessionKey?: string;\n /**\n * Error code from the server, if any.\n * Common values:\n * - `\"no_new_version_available\"`: Device is already on the latest version (not a failure)\n * - Other error codes indicate actual failures in the update process\n */\n error?: string;\n /**\n * The previous/current version name (provided for reference).\n */\n old?: string;\n /**\n * Download URL for the bundle (when a new version is available).\n */\n url?: string;\n /**\n * File list for partial updates (when using multi-file downloads).\n * @since 6.1\n */\n manifest?: ManifestEntry[];\n}\n\nexport interface BundleInfo {\n id: string;\n version: string;\n downloaded: string;\n checksum: string;\n status: BundleStatus;\n}\n\nexport interface SetChannelOptions {\n channel: string;\n triggerAutoUpdate?: boolean;\n}\n\nexport interface UnsetChannelOptions {\n triggerAutoUpdate?: boolean;\n}\n\nexport interface SetCustomIdOptions {\n /**\n * Custom identifier to associate with the device. Use an empty string to clear any saved value.\n */\n customId: string;\n}\n\nexport interface DelayCondition {\n /**\n * Set up delay conditions in setMultiDelay\n * @param value is useless for @param kind \"kill\", optional for \"background\" (default value: \"0\") and required for \"nativeVersion\" and \"date\"\n */\n kind: DelayUntilNext;\n value?: string;\n}\n\nexport interface GetLatestOptions {\n /**\n * The channel to get the latest version for\n * The channel must allow 'self_assign' for this to work\n * @since 6.8.0\n * @default undefined\n */\n channel?: string;\n}\n\nexport interface AppReadyResult {\n bundle: BundleInfo;\n}\n\nexport interface UpdateUrl {\n url: string;\n}\n\nexport interface StatsUrl {\n url: string;\n}\n\nexport interface ChannelUrl {\n url: string;\n}\n\n/**\n * This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.\n * If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.\n */\nexport interface DownloadOptions {\n /**\n * 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.)\n */\n url: string;\n /**\n * The version code/name of this bundle/version\n */\n version: string;\n /**\n * The session key for the update, when the bundle is encrypted with a session key\n * @since 4.0.0\n * @default undefined\n */\n sessionKey?: string;\n /**\n * The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted\n * @since 4.0.0\n * @default undefined\n */\n checksum?: string;\n /**\n * The manifest for multi-file downloads\n * @since 6.1.0\n * @default undefined\n */\n manifest?: ManifestEntry[];\n}\n\nexport interface BundleId {\n id: string;\n}\n\nexport interface BundleListResult {\n bundles: BundleInfo[];\n}\n\nexport interface ResetOptions {\n toLastSuccessful: boolean;\n}\n\nexport interface ListOptions {\n /**\n * Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.\n * @since 6.14.0\n * @default false\n */\n raw?: boolean;\n}\n\nexport interface CurrentBundleResult {\n bundle: BundleInfo;\n native: string;\n}\n\nexport interface MultiDelayConditions {\n delayConditions: DelayCondition[];\n}\n\nexport interface BuiltinVersion {\n version: string;\n}\n\nexport interface DeviceId {\n deviceId: string;\n}\n\nexport interface PluginVersion {\n version: string;\n}\n\nexport interface AutoUpdateEnabled {\n enabled: boolean;\n}\n\nexport interface AutoUpdateAvailable {\n available: boolean;\n}\n\nexport interface SetShakeMenuOptions {\n enabled: boolean;\n}\n\nexport interface ShakeMenuEnabled {\n enabled: boolean;\n}\n\nexport interface GetAppIdRes {\n appId: string;\n}\n\nexport interface SetAppIdOptions {\n appId: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\n/// <reference types=\"@capacitor/cli\" />\n\nimport type { PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * CapacitorUpdater can be configured with these options:\n */\n CapacitorUpdater?: {\n /**\n * Configure the number of milliseconds the native plugin should wait before considering an update 'failed'.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @example 1000 // (1 second)\n */\n appReadyTimeout?: number;\n /**\n * Configure the number of seconds the native plugin should wait before considering API timeout.\n *\n * Only available for Android and iOS.\n *\n * @default 20 // (20 second)\n * @example 10 // (10 second)\n */\n responseTimeout?: number;\n /**\n * Configure whether the plugin should use automatically delete failed bundles.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeleteFailed?: boolean;\n\n /**\n * Configure whether the plugin should use automatically delete previous bundles after a successful update.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeletePrevious?: boolean;\n\n /**\n * Configure whether the plugin should use Auto Update via an update server.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoUpdate?: boolean;\n\n /**\n * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n resetWhenUpdate?: boolean;\n\n /**\n * Configure the URL / endpoint to which update checks are sent.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/updates\n * @example https://example.com/api/auto_update\n */\n updateUrl?: string;\n\n /**\n * Configure the URL / endpoint for channel operations.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/channel_self\n * @example https://example.com/api/channel\n */\n channelUrl?: string;\n\n /**\n * Configure the URL / endpoint to which update statistics are sent.\n *\n * Only available for Android and iOS. Set to \"\" to disable stats reporting.\n *\n * @default https://plugin.capgo.app/stats\n * @example https://example.com/api/stats\n */\n statsUrl?: string;\n /**\n * Configure the public key for end to end live update encryption Version 2\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 6.2.0\n */\n publicKey?: string;\n\n /**\n * Configure the current version of the app. This will be used for the first update request.\n * If not set, the plugin will get the version from the native code.\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 4.17.48\n */\n version?: string;\n /**\n * Configure when the plugin should direct install updates. Only for autoUpdate mode.\n * Works well for apps less than 10MB and with uploads done using --partial flag.\n * Zip or apps more than 10MB will be relatively slow for users to update.\n * - false: Never do direct updates (use default behavior: download at start, set when backgrounded)\n * - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false\n * - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false\n * - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false\n * - true: (deprecated) Same as \"always\" for backward compatibility\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 5.1.0\n */\n directUpdate?: boolean | 'atInstall' | 'always' | 'onLaunch';\n\n /**\n * 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.\n * This removes the need to manually listen for appReady events and call SplashScreen.hide().\n * Only works when directUpdate is set to \"atInstall\", \"always\", \"onLaunch\", or true.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n * Requires autoUpdate and directUpdate to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.6.0\n */\n autoSplashscreen?: boolean;\n\n /**\n * Display a native loading indicator on top of the splashscreen while automatic direct updates are running.\n * Only takes effect when {@link autoSplashscreen} is enabled.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.19.0\n */\n autoSplashscreenLoader?: boolean;\n\n /**\n * Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates.\n * If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed.\n * Set to `0` (zero) to disable the timeout.\n * When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch.\n * Requires {@link autoSplashscreen} to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @since 7.19.0\n */\n autoSplashscreenTimeout?: number;\n\n /**\n * Configure the delay period for period update check. the unit is in seconds.\n *\n * Only available for Android and iOS.\n * Cannot be less than 600 seconds (10 minutes).\n *\n * @default 0 (disabled)\n * @example 3600 (1 hour)\n * @example 86400 (24 hours)\n */\n periodCheckDelay?: number;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localS3?: boolean;\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localHost?: string;\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localWebHost?: string;\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupa?: string;\n /**\n * Configure the CLI to use a local server for testing.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupaAnon?: string;\n /**\n * Configure the CLI to use a local api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApi?: string;\n /**\n * Configure the CLI to use a local file api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApiFiles?: string;\n /**\n * Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 5.4.0\n */\n allowModifyUrl?: boolean;\n\n /**\n * Allow the plugin to modify the appId dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 7.14.0\n */\n allowModifyAppId?: boolean;\n\n /**\n * Allow marking bundles as errored from JavaScript while using manual update flows.\n * When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.\n *\n * @default false\n * @since 7.20.0\n */\n allowManualBundleError?: boolean;\n\n /**\n * Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false (will be true by default in a future major release v8.x.x)\n * @since 7.17.3\n */\n persistCustomId?: boolean;\n\n /**\n * Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl},\n * {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.20.0\n */\n persistModifyUrl?: boolean;\n\n /**\n * Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel.\n * When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`.\n *\n * @default true\n * @since 7.34.0\n */\n allowSetDefaultChannel?: boolean;\n\n /**\n * Set the default channel for the app in the config. Case sensitive.\n * This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.\n * 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\n *\n *\n * @default undefined\n * @since 5.5.0\n */\n defaultChannel?: string;\n /**\n * Configure the app id for the app in the config.\n *\n * @default undefined\n * @since 6.0.0\n */\n appId?: string;\n\n /**\n * Configure the plugin to keep the URL path after a reload.\n * WARNING: When a reload is triggered, 'window.history' will be cleared.\n *\n * @default false\n * @since 6.8.0\n */\n keepUrlPathAfterReload?: boolean;\n /**\n * 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\n *\n * @default false\n * @since 7.3.0\n */\n disableJSLogging?: boolean;\n /**\n * Enable shake gesture to show update menu for debugging/testing purposes\n *\n * @default false\n * @since 7.5.0\n */\n shakeMenu?: boolean;\n };\n }\n}\n\nexport interface CapacitorUpdaterPlugin {\n /**\n * Notify the native layer that JavaScript initialized successfully.\n *\n * **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**\n *\n * This is a simple notification to confirm that your bundle's JavaScript loaded and executed.\n * The native web server successfully served the bundle files and your JS runtime started.\n * That's all it checks - nothing more complex.\n *\n * **What triggers rollback:**\n * - NOT calling this method within the timeout (default: 10 seconds)\n * - Complete JavaScript failure (bundle won't load at all)\n *\n * **What does NOT trigger rollback:**\n * - Runtime errors after initialization (API failures, crashes, etc.)\n * - Network request failures\n * - Application logic errors\n *\n * **IMPORTANT: Call this BEFORE any network requests.**\n * Don't wait for APIs, data loading, or async operations. Call it as soon as your\n * JavaScript bundle starts executing to confirm the bundle itself is valid.\n *\n * Best practices:\n * - Call immediately in your app entry point (main.js, app component mount, etc.)\n * - Don't put it after network calls or heavy initialization\n * - Don't wrap it in try/catch with conditions\n * - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time\n *\n * @returns {Promise<AppReadyResult>} Always resolves successfully with current bundle info. This method never fails.\n */\n notifyAppReady(): Promise<AppReadyResult>;\n\n /**\n * Set the update URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for checking for updates.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setUpdateUrl(options: UpdateUrl): Promise<void>;\n\n /**\n * Set the statistics URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Pass an empty string to disable statistics gathering entirely.\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n *\n * @param options Contains the URL to use for sending statistics, or an empty string to disable.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setStatsUrl(options: StatsUrl): Promise<void>;\n\n /**\n * Set the channel URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for channel operations.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setChannelUrl(options: ChannelUrl): Promise<void>;\n\n /**\n * Download a new bundle from the provided URL for later installation.\n *\n * The downloaded bundle is stored locally but not activated. To use it:\n * - Call {@link next} to set it for installation on next app backgrounding/restart\n * - Call {@link set} to activate it immediately (destroys current JavaScript context)\n *\n * The URL should point to a zip file containing either:\n * - Your app files directly in the zip root, or\n * - A single folder containing all your app files\n *\n * The bundle must include an `index.html` file at the root level.\n *\n * For encrypted bundles, provide the `sessionKey` and `checksum` parameters.\n * For multi-file partial updates, provide the `manifest` array.\n *\n * @example\n * const bundle = await CapacitorUpdater.download({\n * url: `https://example.com/versions/${version}/dist.zip`,\n * version: version\n * });\n * // Bundle is downloaded but not active yet\n * await CapacitorUpdater.next({ id: bundle.id }); // Will activate on next background\n *\n * @param options The {@link DownloadOptions} for downloading a new bundle zip.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the downloaded bundle.\n * @throws {Error} If the download fails or the bundle is invalid.\n */\n download(options: DownloadOptions): Promise<BundleInfo>;\n\n /**\n * Set the next bundle to be activated when the app backgrounds or restarts.\n *\n * This is the recommended way to apply updates as it doesn't interrupt the user's current session.\n * The bundle will be activated when:\n * - The app is backgrounded (user switches away), or\n * - The app is killed and relaunched, or\n * - {@link reload} is called manually\n *\n * Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.\n * Your app continues running normally until one of the above events occurs.\n *\n * Use {@link setMultiDelay} to add additional conditions before the update is applied.\n *\n * @param options Contains the ID of the bundle to set as next. Use {@link BundleInfo.id} from a downloaded bundle.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.\n * @throws {Error} When there is no index.html file inside the bundle folder or the bundle doesn't exist.\n */\n next(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Set the current bundle and immediately reloads the app.\n *\n * **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**\n *\n * When you call this method:\n * - The entire JavaScript context is immediately destroyed\n * - The app reloads from a different folder with different files\n * - NO code after this call will execute\n * - NO promises will resolve\n * - NO callbacks will fire\n * - Event listeners registered after this call are unreliable and may never fire\n *\n * The reload happens automatically - you don't need to do anything else.\n * If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.\n * For other state preservation needs, save your data before calling this method (e.g., to localStorage).\n *\n * **Do not** try to execute additional logic after calling `set()` - it won't work as expected.\n *\n * @param options A {@link BundleId} object containing the new bundle id to set as current.\n * @returns {Promise<void>} A promise that will never resolve because the JavaScript context is destroyed.\n * @throws {Error} When there is no index.html file inside the bundle folder.\n */\n set(options: BundleId): Promise<void>;\n\n /**\n * Delete a bundle from local storage to free up disk space.\n *\n * You cannot delete:\n * - The currently active bundle\n * - The `builtin` bundle (the version shipped with your app)\n * - The bundle set as `next` (call {@link next} with a different bundle first)\n *\n * Use {@link list} to get all available bundle IDs.\n *\n * **Note:** The bundle ID is NOT the same as the version name.\n * Use the `id` field from {@link BundleInfo}, not the `version` field.\n *\n * @param options A {@link BundleId} object containing the bundle ID to delete.\n * @returns {Promise<void>} Resolves when the bundle is successfully deleted.\n * @throws {Error} If the bundle is currently in use or doesn't exist.\n */\n delete(options: BundleId): Promise<void>;\n\n /**\n * Manually mark a bundle as failed/errored in manual update mode.\n *\n * This is useful when you detect that a bundle has critical issues and want to prevent\n * it from being used again. The bundle status will be changed to `error` and the plugin\n * will avoid using this bundle in the future.\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`\n * - Only works in manual update mode (when autoUpdate is disabled)\n *\n * Common use case: After downloading and testing a bundle, you discover it has critical\n * bugs and want to mark it as failed so it won't be retried.\n *\n * @param options A {@link BundleId} object containing the bundle ID to mark as errored.\n * @returns {Promise<BundleInfo>} The updated {@link BundleInfo} with status set to `error`.\n * @throws {Error} When the bundle does not exist or `allowManualBundleError` is false.\n * @since 7.20.0\n */\n setBundleError(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Get all locally downloaded bundles stored in your app.\n *\n * This returns all bundles that have been downloaded and are available locally, including:\n * - The currently active bundle\n * - The `builtin` bundle (shipped with your app)\n * - Any downloaded bundles waiting to be activated\n * - Failed bundles (with `error` status)\n *\n * Use this to:\n * - Check available disk space by counting bundles\n * - Delete old bundles with {@link delete}\n * - Monitor bundle download status\n *\n * @param options The {@link ListOptions} for customizing the bundle list output.\n * @returns {Promise<BundleListResult>} A promise containing the array of {@link BundleInfo} objects.\n * @throws {Error} If the operation fails.\n */\n list(options?: ListOptions): Promise<BundleListResult>;\n\n /**\n * Reset the app to a known good bundle.\n *\n * This method helps recover from problematic updates by reverting to either:\n * - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)\n * - The last successfully loaded bundle (most recent bundle that worked correctly)\n *\n * **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**\n * See {@link set} for details on the implications of this operation.\n *\n * Use cases:\n * - Emergency recovery when an update causes critical issues\n * - Testing rollback functionality\n * - Providing users a \"reset to factory\" option\n *\n * @param options {@link ResetOptions} to control reset behavior. If `toLastSuccessful` is `false` (or omitted), resets to builtin. If `true`, resets to last successful bundle.\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reset operation fails.\n */\n reset(options?: ResetOptions): Promise<void>;\n\n /**\n * Get information about the currently active bundle.\n *\n * Returns:\n * - `bundle`: The currently active bundle information\n * - `native`: The version of the builtin bundle (the original app version from App/Play Store)\n *\n * If no updates have been applied, `bundle.id` will be `\"builtin\"`, indicating the app\n * is running the original version shipped with the native app.\n *\n * Use this to:\n * - Display the current version to users\n * - Check if an update is currently active\n * - Compare against available updates\n * - Log the active bundle for debugging\n *\n * @returns {Promise<CurrentBundleResult>} A promise with the current bundle and native version info.\n * @throws {Error} If the operation fails.\n */\n current(): Promise<CurrentBundleResult>;\n\n /**\n * Manually reload the app to apply a pending update.\n *\n * This triggers the same reload behavior that happens automatically when the app backgrounds.\n * If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.\n *\n * **IMPORTANT: This destroys the current JavaScript context immediately.**\n * See {@link set} for details on the implications of this operation.\n *\n * Common use cases:\n * - Applying an update immediately after download instead of waiting for backgrounding\n * - Providing a \"Restart now\" button to users after an update is ready\n * - Testing update flows during development\n *\n * If no update is pending (no call to {@link next}), this simply reloads the current bundle.\n *\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reload operation fails.\n */\n reload(): Promise<void>;\n\n /**\n * Configure conditions that must be met before a pending update is applied.\n *\n * After calling {@link next} to queue an update, use this method to control when it gets applied.\n * The update will only be installed after ALL specified conditions are satisfied.\n *\n * Available condition types:\n * - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.\n * - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)\n * - `date`: Wait until a specific date/time (ISO 8601 format)\n * - `nativeVersion`: Wait until the native app is updated to a specific version\n *\n * Condition value formats:\n * - `background`: Number in milliseconds (e.g., `\"300000\"` for 5 minutes), or omit for immediate\n * - `kill`: No value needed\n * - `date`: ISO 8601 date string (e.g., `\"2025-12-31T23:59:59Z\"`)\n * - `nativeVersion`: Version string (e.g., `\"2.0.0\"`)\n *\n * @example\n * // Update after user kills app OR after 5 minutes in background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [\n * { kind: 'kill' },\n * { kind: 'background', value: '300000' }\n * ]\n * });\n *\n * @example\n * // Update after a specific date\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'date', value: '2025-12-31T23:59:59Z' }]\n * });\n *\n * @example\n * // Default behavior: update on next background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'background' }]\n * });\n *\n * @param options Contains the {@link MultiDelayConditions} array of conditions.\n * @returns {Promise<void>} Resolves when the delay conditions are set.\n * @throws {Error} If the operation fails or conditions are invalid.\n * @since 4.3.0\n */\n setMultiDelay(options: MultiDelayConditions): Promise<void>;\n\n /**\n * Cancel all delay conditions and apply the pending update immediately.\n *\n * If you've set delay conditions with {@link setMultiDelay}, this method clears them\n * and triggers the pending update to be applied on the next app background or restart.\n *\n * This is useful when:\n * - User manually requests to update now (e.g., clicks \"Update now\" button)\n * - Your app detects it's a good time to update (e.g., user finished critical task)\n * - You want to override a time-based delay early\n *\n * @returns {Promise<void>} Resolves when the delay conditions are cleared.\n * @throws {Error} If the operation fails.\n * @since 4.0.0\n */\n cancelDelay(): Promise<void>;\n\n /**\n * Check the update server for the latest available bundle version.\n *\n * This queries your configured update URL (or Capgo backend) to see if a newer bundle\n * is available for download. It does NOT download the bundle automatically.\n *\n * The response includes:\n * - `version`: The latest available version identifier\n * - `url`: Download URL for the bundle (if available)\n * - `breaking`: Whether this update is marked as incompatible (requires native app update)\n * - `message`: Optional message from the server\n * - `manifest`: File list for partial updates (if using multi-file downloads)\n *\n * After receiving the latest version info, you can:\n * 1. Compare it with your current version\n * 2. Download it using {@link download}\n * 3. Apply it using {@link next} or {@link set}\n *\n * **Important: Error handling for \"no new version available\"**\n *\n * When the device's current version matches the latest version on the server (i.e., the device is already\n * up-to-date), the server returns a 200 response with `error: \"no_new_version_available\"` and\n * `message: \"No new version available\"`. **This causes `getLatest()` to throw an error**, even though\n * this is a normal, expected condition.\n *\n * You should catch this specific error to handle it gracefully:\n *\n * ```typescript\n * try {\n * const latest = await CapacitorUpdater.getLatest();\n * // New version is available, proceed with download\n * } catch (error) {\n * if (error.message === 'No new version available') {\n * // Device is already on the latest version - this is normal\n * console.log('Already up to date');\n * } else {\n * // Actual error occurred\n * console.error('Failed to check for updates:', error);\n * }\n * }\n * ```\n *\n * In this scenario, the server:\n * - Logs the request with a \"No new version available\" message\n * - Sends a \"noNew\" stat action to track that the device checked for updates but was already current (done on the backend)\n *\n * @param options Optional {@link GetLatestOptions} to specify which channel to check.\n * @returns {Promise<LatestVersion>} Information about the latest available bundle version.\n * @throws {Error} Always throws when no new version is available (`error: \"no_new_version_available\"`), or when the request fails.\n * @since 4.0.0\n */\n getLatest(options?: GetLatestOptions): Promise<LatestVersion>;\n\n /**\n * Assign this device to a specific update channel at runtime.\n *\n * Channels allow you to distribute different bundle versions to different groups of users\n * (e.g., \"production\", \"beta\", \"staging\"). This method switches the device to a new channel.\n *\n * **Requirements:**\n * - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)\n * - The backend may accept or reject the request based on channel settings\n *\n * **When to use:**\n * - After the app is ready and the user has interacted (e.g., opted into beta program)\n * - To implement in-app channel switching (beta toggle, tester access, etc.)\n * - For user-driven channel changes\n *\n * **When NOT to use:**\n * - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead\n * - Before user interaction\n *\n * **Important: Listen for the `channelPrivate` event**\n *\n * When a user attempts to set a channel that doesn't allow device self-assignment, the method will\n * throw an error AND fire a {@link addListener}('channelPrivate') event. You should listen to this event\n * to provide appropriate feedback to users:\n *\n * ```typescript\n * CapacitorUpdater.addListener('channelPrivate', (data) => {\n * console.warn(`Cannot access channel \"${data.channel}\": ${data.message}`);\n * // Show user-friendly message\n * });\n * ```\n *\n * This sends a request to the Capgo backend linking your device ID to the specified channel.\n *\n * @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.\n * @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.\n * @throws {Error} If the channel doesn't exist or doesn't allow self-assignment.\n * @since 4.7.0\n */\n setChannel(options: SetChannelOptions): Promise<ChannelRes>;\n\n /**\n * Remove the device's channel assignment and return to the default channel.\n *\n * This unlinks the device from any specifically assigned channel, causing it to fall back to:\n * - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or\n * - Your backend's default channel for this app\n *\n * Use this when:\n * - Users opt out of beta/testing programs\n * - You want to reset a device to standard update distribution\n * - Testing channel switching behavior\n *\n * @param options {@link UnsetChannelOptions} containing optional auto-update trigger.\n * @returns {Promise<void>} Resolves when the channel is successfully unset.\n * @throws {Error} If the operation fails.\n * @since 4.7.0\n */\n unsetChannel(options: UnsetChannelOptions): Promise<void>;\n\n /**\n * Get the current channel assigned to this device.\n *\n * Returns information about:\n * - `channel`: The currently assigned channel name (if any)\n * - `allowSet`: Whether the channel allows self-assignment\n * - `status`: Operation status\n * - `error`/`message`: Additional information (if applicable)\n *\n * Use this to:\n * - Display current channel to users (e.g., \"You're on the Beta channel\")\n * - Check if a device is on a specific channel before showing features\n * - Verify channel assignment after calling {@link setChannel}\n *\n * @returns {Promise<GetChannelRes>} The current channel information.\n * @throws {Error} If the operation fails.\n * @since 4.8.0\n */\n getChannel(): Promise<GetChannelRes>;\n\n /**\n * Get a list of all channels available for this device to self-assign to.\n *\n * Only returns channels where `allow_self_set` is `true`. These are channels that\n * users can switch to using {@link setChannel} without backend administrator intervention.\n *\n * Each channel includes:\n * - `id`: Unique channel identifier\n * - `name`: Human-readable channel name\n * - `public`: Whether the channel is publicly visible\n * - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)\n *\n * Use this to:\n * - Build a channel selector UI for users (e.g., \"Join Beta\" button)\n * - Show available testing/preview channels\n * - Implement channel discovery features\n *\n * @returns {Promise<ListChannelsResult>} List of channels the device can self-assign to.\n * @throws {Error} If the operation fails or the request to the backend fails.\n * @since 7.5.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Set a custom identifier for this device.\n *\n * This allows you to identify devices by your own custom ID (user ID, account ID, etc.)\n * instead of or in addition to the device's unique hardware ID. The custom ID is sent\n * to your update server and can be used for:\n * - Targeting specific users for updates\n * - Analytics and user tracking\n * - Debugging and support (correlating devices with users)\n * - A/B testing or feature flagging\n *\n * **Persistence:**\n * - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts\n * - When `false`, the ID is only kept for the current session\n *\n * **Clearing the custom ID:**\n * - Pass an empty string `\"\"` to remove any stored custom ID\n *\n * @param options The {@link SetCustomIdOptions} containing the custom identifier string.\n * @returns {Promise<void>} Resolves immediately (synchronous operation).\n * @throws {Error} If the operation fails.\n * @since 4.9.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n\n /**\n * Get the builtin bundle version (the original version shipped with your native app).\n *\n * This returns the version of the bundle that was included when the app was installed\n * from the App Store or Play Store. This is NOT the currently active bundle version -\n * use {@link current} for that.\n *\n * Returns:\n * - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or\n * - The native app version from platform configs (package.json, Info.plist, build.gradle)\n *\n * Use this to:\n * - Display the \"factory\" version to users\n * - Compare against downloaded bundle versions\n * - Determine if any updates have been applied\n * - Debugging version mismatches\n *\n * @returns {Promise<BuiltinVersion>} The builtin bundle version string.\n * @since 5.2.0\n */\n getBuiltinVersion(): Promise<BuiltinVersion>;\n\n /**\n * Get the unique, privacy-friendly identifier for this device.\n *\n * This ID is used to identify the device when communicating with update servers.\n * It's automatically generated and stored securely by the plugin.\n *\n * **Privacy & Security characteristics:**\n * - Generated as a UUID (not based on hardware identifiers)\n * - Stored securely in platform-specific secure storage\n * - Android: Android Keystore (persists across app reinstalls on API 23+)\n * - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`\n * - Not synced to cloud (iOS)\n * - Follows Apple and Google privacy best practices\n * - Users can clear it via system settings (Android) or keychain access (iOS)\n *\n * **Persistence:**\n * The device ID persists across app reinstalls to maintain consistent device identity\n * for update tracking and analytics.\n *\n * Use this to:\n * - Debug update delivery issues (check what ID the server sees)\n * - Implement device-specific features\n * - Correlate server logs with specific devices\n *\n * @returns {Promise<DeviceId>} The unique device identifier string.\n * @throws {Error} If the operation fails.\n */\n getDeviceId(): Promise<DeviceId>;\n\n /**\n * Get the version of the Capacitor Updater plugin installed in your app.\n *\n * This returns the version of the native plugin code (Android/iOS), which is sent\n * to the update server with each request. This is NOT your app version or bundle version.\n *\n * Use this to:\n * - Debug plugin-specific issues (when reporting bugs)\n * - Verify plugin installation and version\n * - Check compatibility with backend features\n * - Display in debug/about screens\n *\n * @returns {Promise<PluginVersion>} The Capacitor Updater plugin version string.\n * @throws {Error} If the operation fails.\n */\n getPluginVersion(): Promise<PluginVersion>;\n\n /**\n * Check if automatic updates are currently enabled.\n *\n * Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,\n * meaning the plugin will automatically check for, download, and apply updates.\n *\n * Returns `false` if in manual mode, where you control the update flow using\n * {@link getLatest}, {@link download}, {@link next}, and {@link set}.\n *\n * Use this to:\n * - Determine which update flow your app is using\n * - Show/hide manual update UI based on mode\n * - Debug update behavior\n *\n * @returns {Promise<AutoUpdateEnabled>} `true` if auto-update is enabled, `false` if in manual mode.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateEnabled(): Promise<AutoUpdateEnabled>;\n\n /**\n * Remove all event listeners registered for this plugin.\n *\n * This unregisters all listeners added via {@link addListener} for all event types:\n * - `download`\n * - `noNeedUpdate`\n * - `updateAvailable`\n * - `downloadComplete`\n * - `downloadFailed`\n * - `breakingAvailable` / `majorAvailable`\n * - `updateFailed`\n * - `appReloaded`\n * - `appReady`\n *\n * Use this during cleanup (e.g., when unmounting components or closing screens)\n * to prevent memory leaks from lingering event listeners.\n *\n * @returns {Promise<void>} Resolves when all listeners are removed.\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.\n * This will return you all download percent during the download\n *\n * @since 2.0.11\n */\n addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for no need to update event, useful when you want force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for available update event, useful when you want to force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'updateAvailable',\n listenerFunc: (state: UpdateAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for downloadComplete events.\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadComplete',\n listenerFunc: (state: DownloadCompleteEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for breaking update events when the backend flags an update as incompatible with the current app.\n * Emits the same payload as the legacy `majorAvailable` listener.\n *\n * @since 7.22.0\n */\n addListener(\n eventName: 'breakingAvailable',\n listenerFunc: (state: BreakingAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking\n *\n * @deprecated Deprecated alias for {@link addListener} with `breakingAvailable`. Emits the same payload. will be removed in v8\n * @since 2.3.0\n */\n addListener(\n eventName: 'majorAvailable',\n listenerFunc: (state: MajorAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for update fail event in the App, let you know when update has fail to install at next app start\n *\n * @since 2.3.0\n */\n addListener(\n eventName: 'updateFailed',\n listenerFunc: (state: UpdateFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for download fail event in the App, let you know when a bundle download has failed\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (state: DownloadFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for reload event in the App, let you know when reload has happened\n *\n * @since 4.3.0\n */\n addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for app ready event in the App, let you know when app is ready to use, this event is retain till consumed.\n *\n * @since 5.1.0\n */\n addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for channel private event, fired when attempting to set a channel that doesn't allow device self-assignment.\n *\n * This event is useful for:\n * - Informing users they don't have permission to switch to a specific channel\n * - Implementing custom error handling for channel restrictions\n * - Logging unauthorized channel access attempts\n *\n * @since 7.34.0\n */\n addListener(\n eventName: 'channelPrivate',\n listenerFunc: (state: ChannelPrivateEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Check if the auto-update feature is available (not disabled by custom server configuration).\n *\n * Returns `false` when a custom `updateUrl` is configured, as this typically indicates\n * you're using a self-hosted update server that may not support all auto-update features.\n *\n * Returns `true` when using the default Capgo backend or when the feature is available.\n *\n * This is different from {@link isAutoUpdateEnabled}:\n * - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off\n * - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration\n *\n * @returns {Promise<AutoUpdateAvailable>} `false` when custom updateUrl is set, `true` otherwise.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateAvailable(): Promise<AutoUpdateAvailable>;\n\n /**\n * Get information about the bundle queued to be activated on next reload.\n *\n * Returns:\n * - {@link BundleInfo} object if a bundle has been queued via {@link next}\n * - `null` if no update is pending\n *\n * This is useful to:\n * - Check if an update is waiting to be applied\n * - Display \"Update pending\" status to users\n * - Show version info of the queued update\n * - Decide whether to show a \"Restart to update\" prompt\n *\n * The queued bundle will be activated when:\n * - The app is backgrounded (default behavior)\n * - The app is killed and restarted\n * - {@link reload} is called manually\n * - Delay conditions set by {@link setMultiDelay} are met\n *\n * @returns {Promise<BundleInfo | null>} The pending bundle info, or `null` if none is queued.\n * @throws {Error} If the operation fails.\n * @since 6.8.0\n */\n getNextBundle(): Promise<BundleInfo | null>;\n\n /**\n * Retrieve information about the most recent bundle that failed to load.\n *\n * When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),\n * the plugin automatically rolls back and stores information about the failure. This method\n * retrieves that failure information.\n *\n * **IMPORTANT: The stored value is cleared after being retrieved once.**\n * Calling this method multiple times will only return the failure info on the first call,\n * then `null` on subsequent calls until another failure occurs.\n *\n * Returns:\n * - {@link UpdateFailedEvent} with bundle info if a failure was recorded\n * - `null` if no failure has occurred or if it was already retrieved\n *\n * Use this to:\n * - Show users why an update failed\n * - Log failure information for debugging\n * - Implement custom error handling/reporting\n * - Display rollback notifications\n *\n * @returns {Promise<UpdateFailedEvent | null>} The failed update info (cleared after first retrieval), or `null`.\n * @throws {Error} If the operation fails.\n * @since 7.22.0\n */\n getFailedUpdate(): Promise<UpdateFailedEvent | null>;\n\n /**\n * Enable or disable the shake gesture menu for debugging and testing.\n *\n * When enabled, users can shake their device to open a debug menu that shows:\n * - Current bundle information\n * - Available bundles\n * - Options to switch bundles manually\n * - Update status\n *\n * This is useful during development and testing to:\n * - Quickly test different bundle versions\n * - Debug update flows\n * - Switch between production and test bundles\n * - Verify bundle installations\n *\n * **Important:** Disable this in production builds or only enable for internal testers.\n *\n * Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * @param options {@link SetShakeMenuOptions} with `enabled: true` to enable or `enabled: false` to disable.\n * @returns {Promise<void>} Resolves when the setting is applied.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n setShakeMenu(options: SetShakeMenuOptions): Promise<void>;\n\n /**\n * Check if the shake gesture debug menu is currently enabled.\n *\n * Returns the current state of the shake menu feature that can be toggled via\n * {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * Use this to:\n * - Check if debug features are enabled\n * - Show/hide debug settings UI\n * - Verify configuration during testing\n *\n * @returns {Promise<ShakeMenuEnabled>} Object with `enabled: true` or `enabled: false`.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n isShakeMenuEnabled(): Promise<ShakeMenuEnabled>;\n\n /**\n * Get the currently configured App ID used for update server communication.\n *\n * Returns the App ID that identifies this app to the update server. This can be:\n * - The value set via {@link setAppId}, or\n * - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or\n * - The default app identifier from your native app configuration\n *\n * Use this to:\n * - Verify which App ID is being used for updates\n * - Debug update delivery issues\n * - Display app configuration in debug screens\n * - Confirm App ID after calling {@link setAppId}\n *\n * @returns {Promise<GetAppIdRes>} Object containing the current `appId` string.\n * @throws {Error} If the operation fails.\n * @since 7.14.0\n */\n getAppId(): Promise<GetAppIdRes>;\n\n /**\n * Dynamically change the App ID used for update server communication.\n *\n * This overrides the App ID used to identify your app to the update server, allowing you\n * to switch between different app configurations at runtime (e.g., production vs staging\n * app IDs, or multi-tenant configurations).\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`\n *\n * **Important considerations:**\n * - Changing the App ID will affect which updates this device receives\n * - The new App ID must exist on your update server\n * - This is primarily for advanced use cases (multi-tenancy, environment switching)\n * - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead\n *\n * @param options {@link SetAppIdOptions} containing the new App ID string.\n * @returns {Promise<void>} Resolves when the App ID is successfully changed.\n * @throws {Error} If `allowModifyAppId` is false or the operation fails.\n * @since 7.14.0\n */\n setAppId(options: SetAppIdOptions): Promise<void>;\n}\n\n/**\n * pending: The bundle is pending to be **SET** as the next bundle.\n * downloading: The bundle is being downloaded.\n * success: The bundle has been downloaded and is ready to be **SET** as the next bundle.\n * error: The bundle has failed to download.\n */\nexport type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';\n\nexport type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';\n\nexport interface NoNeedEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateAvailableEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface ChannelRes {\n /**\n * Current status of set channel\n *\n * @since 4.7.0\n */\n status: string;\n error?: string;\n message?: string;\n}\n\nexport interface GetChannelRes {\n /**\n * Current status of get channel\n *\n * @since 4.8.0\n */\n channel?: string;\n error?: string;\n message?: string;\n status?: string;\n allowSet?: boolean;\n}\n\nexport interface ChannelInfo {\n /**\n * The channel ID\n *\n * @since 7.5.0\n */\n id: string;\n /**\n * The channel name\n *\n * @since 7.5.0\n */\n name: string;\n /**\n * Whether this is a public channel\n *\n * @since 7.5.0\n */\n public: boolean;\n /**\n * Whether devices can self-assign to this channel\n *\n * @since 7.5.0\n */\n allow_self_set: boolean;\n}\n\nexport interface ListChannelsResult {\n /**\n * List of available channels\n *\n * @since 7.5.0\n */\n channels: ChannelInfo[];\n}\n\nexport interface DownloadEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n percent: number;\n bundle: BundleInfo;\n}\n\nexport interface MajorAvailableEvent {\n /**\n * Emit when a breaking update is available.\n *\n * @deprecated Deprecated alias for {@link BreakingAvailableEvent}. Receives the same payload.\n * @since 4.0.0\n */\n version: string;\n}\n\n/**\n * Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.\n *\n * @since 7.22.0\n */\nexport type BreakingAvailableEvent = MajorAvailableEvent;\n\nexport interface DownloadFailedEvent {\n /**\n * Emit when a download fail.\n *\n * @since 4.0.0\n */\n version: string;\n}\n\nexport interface DownloadCompleteEvent {\n /**\n * Emit when a new update is available.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateFailedEvent {\n /**\n * Emit when a update failed to install.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface AppReadyEvent {\n /**\n * Emitted when the app is ready to use.\n *\n * @since 5.2.0\n */\n bundle: BundleInfo;\n status: string;\n}\n\nexport interface ChannelPrivateEvent {\n /**\n * Emitted when attempting to set a channel that doesn't allow device self-assignment.\n *\n * @since 7.34.0\n */\n channel: string;\n message: string;\n}\n\nexport interface ManifestEntry {\n file_name: string | null;\n file_hash: string | null;\n download_url: string | null;\n}\n\nexport interface LatestVersion {\n /**\n * Result of getLatest method\n *\n * @since 4.0.0\n */\n version: string;\n /**\n * @since 6\n */\n checksum?: string;\n /**\n * Indicates whether the update was flagged as breaking by the backend.\n *\n * @since 7.22.0\n */\n breaking?: boolean;\n /**\n * @deprecated Use {@link LatestVersion.breaking} instead.\n */\n major?: boolean;\n /**\n * Optional message from the server.\n * When no new version is available, this will be \"No new version available\".\n */\n message?: string;\n sessionKey?: string;\n /**\n * Error code from the server, if any.\n * Common values:\n * - `\"no_new_version_available\"`: Device is already on the latest version (not a failure)\n * - Other error codes indicate actual failures in the update process\n */\n error?: string;\n /**\n * The previous/current version name (provided for reference).\n */\n old?: string;\n /**\n * Download URL for the bundle (when a new version is available).\n */\n url?: string;\n /**\n * File list for partial updates (when using multi-file downloads).\n * @since 6.1\n */\n manifest?: ManifestEntry[];\n /**\n * Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release).\n * @since 7.35.0\n */\n link?: string;\n /**\n * Optional comment or description for this bundle version.\n * @since 7.35.0\n */\n comment?: string;\n}\n\nexport interface BundleInfo {\n id: string;\n version: string;\n downloaded: string;\n checksum: string;\n status: BundleStatus;\n}\n\nexport interface SetChannelOptions {\n channel: string;\n triggerAutoUpdate?: boolean;\n}\n\nexport interface UnsetChannelOptions {\n triggerAutoUpdate?: boolean;\n}\n\nexport interface SetCustomIdOptions {\n /**\n * Custom identifier to associate with the device. Use an empty string to clear any saved value.\n */\n customId: string;\n}\n\nexport interface DelayCondition {\n /**\n * Set up delay conditions in setMultiDelay\n * @param value is useless for @param kind \"kill\", optional for \"background\" (default value: \"0\") and required for \"nativeVersion\" and \"date\"\n */\n kind: DelayUntilNext;\n value?: string;\n}\n\nexport interface GetLatestOptions {\n /**\n * The channel to get the latest version for\n * The channel must allow 'self_assign' for this to work\n * @since 6.8.0\n * @default undefined\n */\n channel?: string;\n}\n\nexport interface AppReadyResult {\n bundle: BundleInfo;\n}\n\nexport interface UpdateUrl {\n url: string;\n}\n\nexport interface StatsUrl {\n url: string;\n}\n\nexport interface ChannelUrl {\n url: string;\n}\n\n/**\n * This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.\n * If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.\n */\nexport interface DownloadOptions {\n /**\n * 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.)\n */\n url: string;\n /**\n * The version code/name of this bundle/version\n */\n version: string;\n /**\n * The session key for the update, when the bundle is encrypted with a session key\n * @since 4.0.0\n * @default undefined\n */\n sessionKey?: string;\n /**\n * The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted\n * @since 4.0.0\n * @default undefined\n */\n checksum?: string;\n /**\n * The manifest for multi-file downloads\n * @since 6.1.0\n * @default undefined\n */\n manifest?: ManifestEntry[];\n}\n\nexport interface BundleId {\n id: string;\n}\n\nexport interface BundleListResult {\n bundles: BundleInfo[];\n}\n\nexport interface ResetOptions {\n toLastSuccessful: boolean;\n}\n\nexport interface ListOptions {\n /**\n * Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.\n * @since 6.14.0\n * @default false\n */\n raw?: boolean;\n}\n\nexport interface CurrentBundleResult {\n bundle: BundleInfo;\n native: string;\n}\n\nexport interface MultiDelayConditions {\n delayConditions: DelayCondition[];\n}\n\nexport interface BuiltinVersion {\n version: string;\n}\n\nexport interface DeviceId {\n deviceId: string;\n}\n\nexport interface PluginVersion {\n version: string;\n}\n\nexport interface AutoUpdateEnabled {\n enabled: boolean;\n}\n\nexport interface AutoUpdateAvailable {\n available: boolean;\n}\n\nexport interface SetShakeMenuOptions {\n enabled: boolean;\n}\n\nexport interface ShakeMenuEnabled {\n enabled: boolean;\n}\n\nexport interface GetAppIdRes {\n appId: string;\n}\n\nexport interface SetAppIdOptions {\n appId: string;\n}\n"]}
|
|
@@ -16,21 +16,25 @@ import Foundation
|
|
|
16
16
|
private let version: String
|
|
17
17
|
private let checksum: String
|
|
18
18
|
private let status: BundleStatus
|
|
19
|
+
private let link: String?
|
|
20
|
+
private let comment: String?
|
|
19
21
|
|
|
20
|
-
convenience init(id: String, version: String, status: BundleStatus, downloaded: Date, checksum: String) {
|
|
21
|
-
self.init(id: id, version: version, status: status, downloaded: downloaded.iso8601withFractionalSeconds, checksum: checksum)
|
|
22
|
+
convenience init(id: String, version: String, status: BundleStatus, downloaded: Date, checksum: String, link: String? = nil, comment: String? = nil) {
|
|
23
|
+
self.init(id: id, version: version, status: status, downloaded: downloaded.iso8601withFractionalSeconds, checksum: checksum, link: link, comment: comment)
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
init(id: String, version: String, status: BundleStatus, downloaded: String = BundleInfo.DOWNLOADED_BUILTIN, checksum: String) {
|
|
26
|
+
init(id: String, version: String, status: BundleStatus, downloaded: String = BundleInfo.DOWNLOADED_BUILTIN, checksum: String, link: String? = nil, comment: String? = nil) {
|
|
25
27
|
self.downloaded = downloaded.trim()
|
|
26
28
|
self.id = id
|
|
27
29
|
self.version = version
|
|
28
30
|
self.checksum = checksum
|
|
29
31
|
self.status = status
|
|
32
|
+
self.link = link
|
|
33
|
+
self.comment = comment
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
enum CodingKeys: String, CodingKey {
|
|
33
|
-
case downloaded, id, version, status, checksum
|
|
37
|
+
case downloaded, id, version, status, checksum, link, comment
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
public func isBuiltin() -> Bool {
|
|
@@ -62,11 +66,11 @@ import Foundation
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
public func setChecksum(checksum: String) -> BundleInfo {
|
|
65
|
-
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: checksum)
|
|
69
|
+
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: checksum, link: self.link, comment: self.comment)
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
public func setDownloaded(downloaded: Date) -> BundleInfo {
|
|
69
|
-
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: downloaded, checksum: self.checksum)
|
|
73
|
+
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: downloaded, checksum: self.checksum, link: self.link, comment: self.comment)
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
public func getId() -> String {
|
|
@@ -74,7 +78,7 @@ import Foundation
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
public func setId(id: String) -> BundleInfo {
|
|
77
|
-
return BundleInfo(id: id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: self.checksum)
|
|
81
|
+
return BundleInfo(id: id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: self.checksum, link: self.link, comment: self.comment)
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
public func getVersionName() -> String {
|
|
@@ -82,7 +86,7 @@ import Foundation
|
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
public func setVersionName(version: String) -> BundleInfo {
|
|
85
|
-
return BundleInfo(id: self.id, version: version, status: self.status, downloaded: self.downloaded, checksum: self.checksum)
|
|
89
|
+
return BundleInfo(id: self.id, version: version, status: self.status, downloaded: self.downloaded, checksum: self.checksum, link: self.link, comment: self.comment)
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
public func getStatus() -> String {
|
|
@@ -90,17 +94,40 @@ import Foundation
|
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
public func setStatus(status: String) -> BundleInfo {
|
|
93
|
-
return BundleInfo(id: self.id, version: self.version, status: BundleStatus(localizedString: status)!, downloaded: self.downloaded, checksum: self.checksum)
|
|
97
|
+
return BundleInfo(id: self.id, version: self.version, status: BundleStatus(localizedString: status)!, downloaded: self.downloaded, checksum: self.checksum, link: self.link, comment: self.comment)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public func getLink() -> String? {
|
|
101
|
+
return self.link
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public func setLink(link: String?) -> BundleInfo {
|
|
105
|
+
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: self.checksum, link: link, comment: self.comment)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public func getComment() -> String? {
|
|
109
|
+
return self.comment
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public func setComment(comment: String?) -> BundleInfo {
|
|
113
|
+
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: self.checksum, link: self.link, comment: comment)
|
|
94
114
|
}
|
|
95
115
|
|
|
96
116
|
public func toJSON() -> [String: String] {
|
|
97
|
-
|
|
117
|
+
var result: [String: String] = [
|
|
98
118
|
"id": self.getId(),
|
|
99
119
|
"version": self.getVersionName(),
|
|
100
120
|
"downloaded": self.getDownloaded(),
|
|
101
121
|
"checksum": self.getChecksum(),
|
|
102
122
|
"status": self.getStatus()
|
|
103
123
|
]
|
|
124
|
+
if let link = self.link {
|
|
125
|
+
result["link"] = link
|
|
126
|
+
}
|
|
127
|
+
if let comment = self.comment {
|
|
128
|
+
result["comment"] = comment
|
|
129
|
+
}
|
|
130
|
+
return result
|
|
104
131
|
}
|
|
105
132
|
|
|
106
133
|
public static func == (lhs: BundleInfo, rhs: BundleInfo) -> Bool {
|
|
@@ -54,7 +54,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
54
54
|
CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
|
|
55
55
|
]
|
|
56
56
|
public var implementation = CapgoUpdater()
|
|
57
|
-
private let pluginVersion: String = "7.
|
|
57
|
+
private let pluginVersion: String = "7.36.0"
|
|
58
58
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
59
59
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
60
60
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
@@ -358,7 +358,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
private func cleanupObsoleteVersions() {
|
|
361
|
-
let previous = UserDefaults.standard.string(forKey: "LatestNativeBuildVersion") ?? "0"
|
|
361
|
+
let previous = UserDefaults.standard.string(forKey: "LatestNativeBuildVersion") ?? UserDefaults.standard.string(forKey: "LatestVersionNative") ?? "0"
|
|
362
362
|
if previous != "0" && self.currentBuildVersion != previous {
|
|
363
363
|
_ = self._reset(toLastSuccessful: false)
|
|
364
364
|
let res = implementation.list()
|
|
@@ -1337,9 +1337,9 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1337
1337
|
}
|
|
1338
1338
|
}
|
|
1339
1339
|
if res.manifest != nil {
|
|
1340
|
-
nextImpl = try self.implementation.downloadManifest(manifest: res.manifest!, version: latestVersionName, sessionKey: sessionKey)
|
|
1340
|
+
nextImpl = try self.implementation.downloadManifest(manifest: res.manifest!, version: latestVersionName, sessionKey: sessionKey, link: res.link, comment: res.comment)
|
|
1341
1341
|
} else {
|
|
1342
|
-
nextImpl = try self.implementation.download(url: downloadUrl, version: latestVersionName, sessionKey: sessionKey)
|
|
1342
|
+
nextImpl = try self.implementation.download(url: downloadUrl, version: latestVersionName, sessionKey: sessionKey, link: res.link, comment: res.comment)
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
1345
|
guard let next = nextImpl else {
|
|
@@ -372,6 +372,12 @@ import UIKit
|
|
|
372
372
|
if let manifest = response.value?.manifest {
|
|
373
373
|
latest.manifest = manifest
|
|
374
374
|
}
|
|
375
|
+
if let link = response.value?.link {
|
|
376
|
+
latest.link = link
|
|
377
|
+
}
|
|
378
|
+
if let comment = response.value?.comment {
|
|
379
|
+
latest.comment = comment
|
|
380
|
+
}
|
|
375
381
|
case let .failure(error):
|
|
376
382
|
self.logger.error("Error getting Latest \(response.value.debugDescription) \(error)")
|
|
377
383
|
latest.message = "Error getting Latest \(String(describing: response.value))"
|
|
@@ -404,7 +410,7 @@ import UIKit
|
|
|
404
410
|
return actualHash == expectedHash
|
|
405
411
|
}
|
|
406
412
|
|
|
407
|
-
public func downloadManifest(manifest: [ManifestEntry], version: String, sessionKey: String) throws -> BundleInfo {
|
|
413
|
+
public func downloadManifest(manifest: [ManifestEntry], version: String, sessionKey: String, link: String? = nil, comment: String? = nil) throws -> BundleInfo {
|
|
408
414
|
let id = self.randomString(length: 10)
|
|
409
415
|
logger.info("downloadManifest start \(id)")
|
|
410
416
|
let destFolder = self.getBundleDirectory(id: id)
|
|
@@ -414,7 +420,7 @@ import UIKit
|
|
|
414
420
|
try FileManager.default.createDirectory(at: destFolder, withIntermediateDirectories: true, attributes: nil)
|
|
415
421
|
|
|
416
422
|
// Create and save BundleInfo before starting the download process
|
|
417
|
-
let bundleInfo = BundleInfo(id: id, version: version, status: BundleStatus.DOWNLOADING, downloaded: Date(), checksum: "")
|
|
423
|
+
let bundleInfo = BundleInfo(id: id, version: version, status: BundleStatus.DOWNLOADING, downloaded: Date(), checksum: "", link: link, comment: comment)
|
|
418
424
|
self.saveBundleInfo(id: id, bundle: bundleInfo)
|
|
419
425
|
|
|
420
426
|
// Send stats for manifest download start
|
|
@@ -449,11 +455,11 @@ import UIKit
|
|
|
449
455
|
let fileNameWithoutPath = (fileName as NSString).lastPathComponent
|
|
450
456
|
let cacheFileName = "\(fileHash)_\(fileNameWithoutPath)"
|
|
451
457
|
let cacheFilePath = cacheFolder.appendingPathComponent(cacheFileName)
|
|
452
|
-
|
|
458
|
+
|
|
453
459
|
// Check if file is Brotli compressed and remove .br extension from destination
|
|
454
460
|
let isBrotli = fileName.hasSuffix(".br")
|
|
455
461
|
let destFileName = isBrotli ? String(fileName.dropLast(3)) : fileName
|
|
456
|
-
|
|
462
|
+
|
|
457
463
|
let destFilePath = destFolder.appendingPathComponent(destFileName)
|
|
458
464
|
let builtinFilePath = builtinFolder.appendingPathComponent(fileName)
|
|
459
465
|
|
|
@@ -685,7 +691,7 @@ import UIKit
|
|
|
685
691
|
return status == COMPRESSION_STATUS_END ? decompressedData : nil
|
|
686
692
|
}
|
|
687
693
|
|
|
688
|
-
public func download(url: URL, version: String, sessionKey: String) throws -> BundleInfo {
|
|
694
|
+
public func download(url: URL, version: String, sessionKey: String, link: String? = nil, comment: String? = nil) throws -> BundleInfo {
|
|
689
695
|
let id: String = self.randomString(length: 10)
|
|
690
696
|
let semaphore = DispatchSemaphore(value: 0)
|
|
691
697
|
if version != getLocalUpdateVersion() {
|
|
@@ -752,7 +758,7 @@ import UIKit
|
|
|
752
758
|
semaphore.signal()
|
|
753
759
|
}
|
|
754
760
|
}
|
|
755
|
-
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.DOWNLOADING, downloaded: Date(), checksum: checksum))
|
|
761
|
+
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.DOWNLOADING, downloaded: Date(), checksum: checksum, link: link, comment: comment))
|
|
756
762
|
let reachabilityManager = NetworkReachabilityManager()
|
|
757
763
|
reachabilityManager?.startListening { status in
|
|
758
764
|
switch status {
|
|
@@ -770,7 +776,7 @@ import UIKit
|
|
|
770
776
|
|
|
771
777
|
if mainError != nil {
|
|
772
778
|
logger.error("Failed to download: \(String(describing: mainError))")
|
|
773
|
-
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum))
|
|
779
|
+
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum, link: link, comment: comment))
|
|
774
780
|
throw mainError!
|
|
775
781
|
}
|
|
776
782
|
|
|
@@ -780,7 +786,7 @@ import UIKit
|
|
|
780
786
|
try FileManager.default.moveItem(at: tempDataPath, to: finalPath)
|
|
781
787
|
} catch {
|
|
782
788
|
logger.error("Failed decrypt file : \(error)")
|
|
783
|
-
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum))
|
|
789
|
+
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum, link: link, comment: comment))
|
|
784
790
|
cleanDownloadData()
|
|
785
791
|
throw error
|
|
786
792
|
}
|
|
@@ -793,7 +799,7 @@ import UIKit
|
|
|
793
799
|
|
|
794
800
|
} catch {
|
|
795
801
|
logger.error("Failed to unzip file: \(error)")
|
|
796
|
-
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum))
|
|
802
|
+
self.saveBundleInfo(id: id, bundle: BundleInfo(id: id, version: version, status: BundleStatus.ERROR, downloaded: Date(), checksum: checksum, link: link, comment: comment))
|
|
797
803
|
// Best-effort cleanup of the decrypted zip file when unzip fails
|
|
798
804
|
do {
|
|
799
805
|
if FileManager.default.fileExists(atPath: finalPath.path) {
|
|
@@ -808,7 +814,7 @@ import UIKit
|
|
|
808
814
|
|
|
809
815
|
self.notifyDownload(id: id, percent: 90)
|
|
810
816
|
logger.info("Downloading: 90% (wrapping up)")
|
|
811
|
-
let info = BundleInfo(id: id, version: version, status: BundleStatus.PENDING, downloaded: Date(), checksum: checksum)
|
|
817
|
+
let info = BundleInfo(id: id, version: version, status: BundleStatus.PENDING, downloaded: Date(), checksum: checksum, link: link, comment: comment)
|
|
812
818
|
self.saveBundleInfo(id: id, bundle: info)
|
|
813
819
|
self.cleanDownloadData()
|
|
814
820
|
|
|
@@ -160,6 +160,8 @@ struct AppVersionDec: Decodable {
|
|
|
160
160
|
let breaking: Bool?
|
|
161
161
|
let data: [String: String]?
|
|
162
162
|
let manifest: [ManifestEntry]?
|
|
163
|
+
let link: String?
|
|
164
|
+
let comment: String?
|
|
163
165
|
// The HTTP status code is captured separately in CapgoUpdater; this struct only mirrors JSON.
|
|
164
166
|
}
|
|
165
167
|
|
|
@@ -174,6 +176,8 @@ public class AppVersion: NSObject {
|
|
|
174
176
|
var breaking: Bool?
|
|
175
177
|
var data: [String: String]?
|
|
176
178
|
var manifest: [ManifestEntry]?
|
|
179
|
+
var link: String?
|
|
180
|
+
var comment: String?
|
|
177
181
|
var statusCode: Int = 0
|
|
178
182
|
}
|
|
179
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-updater",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.36.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Live update for capacitor apps",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"ionic",
|
|
38
38
|
"appflow alternative",
|
|
39
39
|
"capawesome alternative",
|
|
40
|
+
"@capawesome/capacitor-live-update",
|
|
40
41
|
"native"
|
|
41
42
|
],
|
|
42
43
|
"scripts": {
|