功能和设置
复制安装步骤和完整的Markdown指南。
更新器插件配置
标题为“更新器插件配置”查看Github README 了解更多信息。
CapacitorUpdater 可以通过以下选项进行配置:
| 属性 | 类型 | 描述 | 默认值 | 自 |
|---|---|---|---|---|
appReadyTimeout | number | 配置 native 插件在考虑更新失败之前等待的毫秒数。可用于 Android、iOS 和 Electron。 | 10000 // (10 seconds) | |
responseTimeout | number | Configure the number of milliseconds the native plugin should wait before considering API timeout. Available on Android, iOS, and Electron. | 20000 // (20 seconds) | |
autoDeleteFailed | boolean | 配置是否使用自动删除失败的包。可用于 Android、iOS 和 Electron。 | true | |
autoDeletePrevious | boolean | 配置是否在更新成功后自动删除之前的包。可用于 Android、iOS 和 Electron。 | true | |
autoUpdate | boolean | ‘off’ | ‘atBackground’ | ‘atInstall’ | ‘onLaunch’ | ‘always’ | ‘onlyDownload’ | 通过更新服务器配置插件如何使用自动更新。 true 与“atBackground”相同,false 与“off”相同。 - off:禁用自动更新 - atBackground:在应用程序切换到后台时自动检查和下载,然后在应用程序切换到后台时应用 - atInstall:仅在新安装或原生应用程序更新后立即应用,否则使用 atBackground - onLaunch:在启动时立即应用,否则在启动检查后使用 atBackground - always:在自动更新运行时立即应用 - onlyDownload:自动检查和下载,发出updateAvailable,永远不会设置下一个捆绑包。 立即应用模式(“atInstall”,“onLaunch”,“always”)应与 —delta 一起上传,以避免更新慢下用户体验。 在 Android 和 iOS 上,需要设置 autoSplashscreen:true 和 @capacitor/splash-screen,launchAutoHide:false。 可用于 Android、iOS 和 Electron。 | “atBackground” // true is still accepted | |
resetWhenUpdate | boolean | 自动删除设备上安装的新版本原生应用程序捆绑包时下载的以前捆绑包。 可用于 Android、iOS 和 Electron。 | true | |
updateUrl | string | 配置更新检查的 URL / 端点。 可用于 Android、iOS 和 Electron。 | https://plugin.capgo.app/updates | |
channelUrl | string | 配置用于频道操作的 URL / 端点。 可用于 Android、iOS 和 Electron。 | https://plugin.capgo.app/channel_self | |
statsUrl | string | 配置更新统计信息的 URL / 端点。 可用于 Android、iOS 和 Electron。 将其设置为 "" 以禁用统计信息报告。 | https://plugin.capgo.app/stats | |
publicKey | string | 配置公钥用于端到端实时更新加密,版本 2。可用于 Android、iOS 和 Electron。 | undefined | 6.2.0 |
version | string | 配置应用程序的当前版本。首次更新请求时会使用此版本。如果未设置,插件将从原生 code 中获取版本。可用于 Android、iOS 和 Electron。 | undefined | 4.17.48 |
directUpdate | boolean | ‘always’ | ‘atInstall’ | ‘onLaunch’ | 已弃用。使用“atInstall”,“onLaunch”或“always”模式代替:autoUpdate。该选项仍支持现有应用程序。立即应用应上传 —delta 以避免更新时用户体验受影响。Android 和 iOS 上这些模式需要 autoSplashscreen:true 和 @capacitor/splash-screen 的 launchAutoHide:false。- false:永不进行直接更新- atInstall:与 autoUpdate:“atInstall”相同- onLaunch:与 autoUpdate:“onLaunch”相同- always:与 autoUpdate:“always”相同- true:与“always”相同,用于向后兼容性。可用于 Android、iOS 和 Electron。 | false | 5.1.0 |
autoSplashscreen | boolean | 在使用“atInstall”,“onLaunch”或“always”模式(包括已弃用的直接更新值)时必需,包括 @capacitor/splash-screen 必须已安装并配置 launchAutoHide:false。启用后,插件在更新应用程序或无需更新时隐藏启动屏幕。从而避免手动监听 appReady 事件并调用 SplashScreen.hide()。可用于 Android 和 iOS。 | false | 7.6.0 |
periodCheckDelay | number | 配置延迟更新检查的时间周期。单位为秒。可用于 Android、iOS 和 Electron。不能小于 600 秒(10 分钟)。 | 600 // (10 minutes) | |
localS3 | boolean | 配置CLI以使用本地服务器进行测试或自托管更新服务器。 | undefined | 4.17.48 |
localHost | string | 配置CLI以使用本地服务器进行测试或自托管更新服务器。 | undefined | 4.17.48 |
localWebHost | string | 配置CLI以使用本地服务器进行测试或自托管更新服务器。 | undefined | 4.17.48 |
localSupa | string | 配置CLI以使用本地服务器进行测试或自托管更新服务器。 | undefined | 4.17.48 |
localSupaAnon | string | 配置CLI以使用本地服务器进行测试。 | undefined | 4.17.48 |
localApi | string | 配置CLI以使用本地api进行测试。 | undefined | 6.3.3 |
localApiFiles | string | 配置CLI以使用本地文件api进行测试。 | undefined | 6.3.3 |
allowModifyUrl | boolean | 允许插件动态从 JavaScript 端修改 updateUrl、statsUrl 和 channelUrl。 | false | 5.4.0 |
defaultChannel | string | 设置应用程序的默认频道。区分大小写。这将覆盖云端设置的默认频道,但仍会尊重云端设置的覆盖。 | undefined | 5.5.0 |
appId | string | 配置应用程序的 ID。 | undefined | 6.0.0 |
keepUrlPathAfterReload | boolean | 配置插件以在重新加载后保留 URL 路径。警告:当触发重新加载时,‘window.history’ 将被清除。 | false | 6.8.0 |
disableJSLogging | boolean | 关闭插件的 JavaScript 日志。如果为 true,插件将不会在 JavaScript 控制台中记录日志。只有本机日志会被执行。 | false | 7.3.0 |
shakeMenu | boolean | 启用抖动手势以在调试/测试目的下显示更新菜单。 | false | 7.5.0 |
示例
示例在 capacitor.config.json:
{ "plugins": { "CapacitorUpdater": { "appReadyTimeout": 1000 // (1 second), "responseTimeout": 10 // (10 second), "autoDeleteFailed": false, "autoDeletePrevious": false, "autoUpdate": "onlyDownload", "resetWhenUpdate": false, "updateUrl": https://example.com/api/auto_update, "channelUrl": https://example.com/api/channel, "statsUrl": https://example.com/api/stats, "publicKey": undefined, "version": undefined, "directUpdate": undefined, "autoSplashscreen": undefined, "periodCheckDelay": undefined, "localS3": undefined, "localHost": undefined, "localWebHost": undefined, "localSupa": undefined, "localSupaAnon": undefined, "localApi": undefined, "localApiFiles": undefined, "allowModifyUrl": undefined, "defaultChannel": undefined, "appId": undefined, "keepUrlPathAfterReload": undefined, "disableJSLogging": undefined, "shakeMenu": undefined } }}在 capacitor.config.ts:
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = { plugins: { CapacitorUpdater: { appReadyTimeout: 1000 // (1 second), responseTimeout: 10 // (10 second), autoDeleteFailed: false, autoDeletePrevious: false, autoUpdate: 'onlyDownload', resetWhenUpdate: false, updateUrl: https://example.com/api/auto_update, channelUrl: https://example.com/api/channel, statsUrl: https://example.com/api/stats, publicKey: undefined, version: undefined, directUpdate: undefined, autoSplashscreen: undefined, periodCheckDelay: undefined, localS3: undefined, localHost: undefined, localWebHost: undefined, localSupa: undefined, localSupaAnon: undefined, localApi: undefined, localApiFiles: undefined, allowModifyUrl: undefined, defaultChannel: undefined, appId: undefined, keepUrlPathAfterReload: undefined, disableJSLogging: undefined, shakeMenu: undefined, }, },};
export default config;notifyAppReady()setUpdateUrl(...)setStatsUrl(...)setChannelUrl(...)download(...)next(...)set(...)delete(...)list(...)reset(...)current()reload()setMultiDelay(...)cancelDelay()getLatest(...)setChannel(...)unsetChannel(...)getChannel()listChannels()setCustomId(...)getBuiltinVersion()getDeviceId()getPluginVersion()isAutoUpdateEnabled()removeAllListeners()addListener('download', ...)addListener('noNeedUpdate', ...)addListener('updateAvailable', ...)addListener('downloadComplete', ...)addListener('majorAvailable', ...)addListener('updateFailed', ...)addListener('downloadFailed', ...)addListener('appReloaded', ...)addListener('appReady', ...)isAutoUpdateAvailable()getNextBundle()setShakeMenu(...)isShakeMenuEnabled()- 接口
- 类型别名
方法
方法notifyAppReady()
notifyAppReady()notifyAppReady() => Promise<AppReadyResult>通知Capacitor更新器当前包正在工作(如果不在每次应用启动时调用此方法,则会发生回滚) 默认情况下,此方法应在应用启动后10秒内被调用,否则会发生回滚。 可以通过{@link appReadyTimeout}更改此行为
返回: Promise<AppReadyResult>
setUpdateUrl(…)
setUpdateUrl(…)setUpdateUrl(options: UpdateUrl) => Promise<void>参数
| 类型 | 描述 | set the updateUrl for the app, this will be used to check for updates. |
|---|---|---|
options | UpdateUrl | 包含用于检查更新的 URL。 |
自从: 5.4.0
setStatsUrl(…)
标题:setStatsUrl(…)setStatsUrl(options: StatsUrl) => Promise<void>设置应用的statsUrl,用于发送统计数据。传入空字符串将禁用统计数据收集。
| 参数 | 类型 | 描述 |
|---|---|---|
options | StatsUrl | 包含用于发送统计数据的 URL。 |
自从: 5.4.0
setChannelUrl(…)
Section titled “setChannelUrl(…)”setChannelUrl(options: ChannelUrl) => Promise<void>为应用设置channelUrl,这将用于设置频道。
| 参数 | 类型 | 描述 |
|---|---|---|
options | ChannelUrl | 包含用于设置频道的URL。 |
自: 5.4.0
download(…)
Section titled “download(…)”download(options: DownloadOptions) => Promise<BundleInfo>从提供的URL下载一个新的包,应该是一个zip文件,或者一个唯一id的包里包含所有文件
| 参数 | 类型 | 描述 |
|---|---|---|
options | DownloadOptions | 下载新包 zip 时的 {@link} 下载选项}。 |
返回: Promise<BundleInfo>
next(…)
标题:next(…)next(options: BundleId) => Promise<BundleInfo>设置下次重载应用时使用的包。
| 参数 | 类型 | 描述 |
|---|---|---|
options | BundleId | 包含下一次应用启动时设置的下一个捆绑包的ID。 {@link} 捆绑包信息.id} |
返回: Promise<BundleInfo>
set(…)
标题:set(…)set(options: BundleId) => Promise<void>设置当前捆绑包并立即重新加载应用。
| 参数 | 类型 | 描述 |
|---|---|---|
options | BundleId | A {@link} BundleId} 对象,包含要设置为当前的新包 ID。 |
delete(…)
Section titled “delete(…)”delete(options: BundleId) => Promise<void>从原生应用存储中删除指定的包。使用 {@link list} 来获取存储的 Bundle IDs。
| Param | Type | Description |
|---|---|---|
options | BundleId | A {@link} BundleId包含要删除的包 ID 的对象(注意,这是包 ID,而不是版本名称) |
list(…)
标题:list(…)list(options?: ListOptions | undefined) => Promise<BundleListResult>获取本地下载的所有包
| 参数 | 类型 | 描述 |
|---|---|---|
options | ListOptions | 用于列出包的 {@link} ListOptions} |
返回: Promise<BundleListResult>
reset(…)
Section titled “reset(…)”reset(options?: ResetOptions | undefined) => Promise<void>将应用程序重置为 builtin (向苹果应用商店/谷歌-play商店发送的那个)或最后一次成功加载的捆绑包。
| Param | Type | 描述 |
|---|---|---|
options | ResetOptions | 包含 {@link} ResetOptions.toLastSuccessful}, true 重置为内置捆绑包,并且将重置为最后一次成功加载的捆绑包。 false Copy to clipboard |
current()
current()current() => Promise<CurrentBundleResult>获取当前的包,如果没有设置则返回 builtin. currentNative 是设备上安装的原始包
返回: Promise<CurrentBundleResult>
reload()
reload()reload() => Promise<void>setMultiDelay(…)
setMultiDelay(…)
复制到剪贴板setMultiDelay(options: MultiDelayConditions) => Promise<void>设置一个 {@link} 延迟条件} date 延迟更新条件 background 延迟更新条件 nativeVersion 延迟更新条件 kill 延迟更新条件
| 延迟更新条件 | 延迟更新条件 | 延迟更新条件 |
|---|---|---|
options | MultiDelayConditions | 参数类型描述 多重延迟条件设置多重延迟条件的数组 |
自 4.3.0
取消延迟()
标题:取消延迟()cancelDelay() => Promise<void>取消一个延迟条件(@link DelayCondition) 自获取最新(…)
标题:获取最新(…) 4.0.0
取消一个延迟条件(@link DelayCondition)
立即处理更新getLatest(options?: GetLatestOptions | undefined) => Promise<LatestVersion>从更新 URL 获取最新的包
| 参数 | 类型 |
|---|---|
options | GetLatestOptions |
返回值: Promise<LatestVersion>
自: 4.0.0
setChannel(…)
标题:setChannel(…)setChannel(options: SetChannelOptions) => Promise<ChannelRes>设置此设备的插件管理的本地频道。频道必须 allow_device_self_set 验证频道与后端, 然后在设备上存储所选频道。它不会创建或更新后端设备的覆盖, 因此设备不会在__CAPGO_KEEP_0__控制台中显示为被覆盖。只有从控制台或公共__CAPGO_KEEP_1__创建的 assignments 才会在设备覆盖 UI 中显示。
setChannel() validates the channel with the backend, then stores the selected channel locally on the device. It does not create or update a backend Device Override, so the device will not appear as overridden in the Capgo dashboard. Only assignments created from the dashboard or the Public API are shown in the Device Override UI.
注意事项:
- 不要在启动时使用此方法设置频道。请在您的__CAPGO_KEEP_0__配置中使用
defaultChannelin your Capacitor config instead. - 公共频道无法自行分配。
- 如果一个频道被标记为 ,调用
public将返回错误。要使用公共频道,请调用setChannel()- 设备将自动切换到匹配的公共频道。unsetChannel()使用 - 来发现可用的频道以及它们是否允许自行分配。
listChannels()参数
| Param | 类型 | 描述 |
|---|---|---|
options | SetChannelOptions | 是否是 {@link 设置通道选项} 设置 |
返回: Promise<ChannelRes>
自: 4.7.0
unsetChannel(…)
标题: “unsetChannel(…)”unsetChannel(options: UnsetChannelOptions) => Promise<void>清除本地设备的插件管理的通道。 这只清除本地存储的通道,不删除仪表板或公共 __CAPGO_KEEP_0__ 设备覆盖记录。 setChannel(); it does not delete Dashboard or Public API Device Override records.
在调用此方法后,正常渠道顺序适用:已有的仪表板或公共API设备覆盖优先级仍然有效;否则,设备可以回退到匹配公共/默认渠道的条件(平台、设备类型、构建类型)。
这在以下情况下很有用:
- 您想将设备移动回默认更新跟踪
- 您想使用公共渠道(由于公共渠道无法自行分配)
setChannel())
| 参数 | 类型 |
|---|---|
options | UnsetChannelOptions |
自 4.7.0
getChannel()
标题:“getChannel()”getChannel() => Promise<GetChannelRes>获取此设备的渠道
返回: Promise<GetChannelRes>
自从: 4.8.0
listChannels()
listChannels()部分listChannels() => Promise<ListChannelsResult>列出此设备可用的所有频道。返回与设备当前环境(平台、模拟器/真实设备、开发/生产构建)兼容的频道,并且是公共频道或允许自我分配。
结果中的每个频道包括:
public如果true,这是一个 默认频道。您无法使用setChannel()将其分配给自己。相反,如果您使用unsetChannel()删除您的频道分配,设备将自动从公共频道接收更新。allow_self_set: 如果true, 这是 自我分配的频道. You can explicitly assign the device to this channel usingsetChannel().
Returns: Promise<ListChannelsResult>
Since: 7.5.0
setCustomId(…)
Section titled “setCustomId(…)”setCustomId(options: SetCustomIdOptions) => Promise<void>为此设备设置一个自定义 ID
| 参数 | 类型 | 描述 |
|---|---|---|
options | SetCustomIdOptions | 是 {@link} SetCustomIdOptions} 自定义 ID 以设置 |
自从: 4.9.0
getBuiltinVersion()
标题: “getBuiltinVersion()”getBuiltinVersion() => Promise<BuiltinVersion>获取本机应用程序版本或在配置中设置的内置版本
返回: Promise<BuiltinVersion>
自从: 5.2.0
getDeviceId()
Section titled “getDeviceId()”getDeviceId() => Promise<DeviceId>获取设备唯一标识(用于自动更新服务器)
返回: Promise<DeviceId>
getPluginVersion()
Section titled “getPluginVersion()”getPluginVersion() => Promise<PluginVersion>获取本地Capacitor Updater 插件版本(用于自动更新服务器)
返回: Promise<PluginVersion>
isAutoUpdateEnabled()
Section titled “isAutoUpdateEnabled()”isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>获取自动更新配置的状态。
返回: Promise<AutoUpdateEnabled>
removeAllListeners()
标题:removeAllListeners()removeAllListeners() => Promise<void>移除此插件的所有监听器。
自: 1.0.0
addListener('download', …)
标题:addListener('download', …)addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>监听应用程序中的包下载事件。下载开始时、下载中和下载完成时触发一次。 此方法将返回下载进度百分比。
| 参数 | 类型 |
|---|---|
eventName | ‘download’ |
listenerFunc | (state: DownloadEvent) => void |
返回值: Promise<PluginListenerHandle>
自: 2.0.11
添加监听器(‘无需更新’,…)
标题:添加监听器(‘无需更新’,…)addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>监听无需更新事件,适用于每次启动应用时强制检查更新
| 参数 | 类型 |
|---|---|
eventName | ‘noNeedUpdate’ |
listenerFunc | (state: NoNeedEvent) => void |
返回值: Promise<PluginListenerHandle>
自: 4.0.0
添加监听器(‘更新可用’,…)
Section titled “添加监听器(‘updateAvailable’,…)”addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>监听可用更新事件,适用于每次启动应用时强制检查
| 参数 | 类型 |
|---|---|
eventName | ‘updateAvailable’ |
listenerFunc | (state: UpdateAvailableEvent) => void |
返回值: Promise<PluginListenerHandle>
自: 4.0.0
添加监听器(‘downloadComplete’,…)
Section titled “添加监听器(‘downloadComplete’,…)”addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>监听下载完成事件。
| 参数 | 类型 |
|---|---|
eventName | ‘downloadComplete’ |
listenerFunc | (state: DownloadCompleteEvent) => void |
返回值: Promise<PluginListenerHandle>
自: 4.0.0
addListener(‘majorAvailable’,…)
标题:addListener(‘majorAvailable’,…)addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>在 App 中监听重大更新事件,让您知道重大更新是否被禁用AutoUpdateBreaking设置
| 参数 | 类型 |
|---|---|
eventName | ‘majorAvailable’ |
listenerFunc | (state: MajorAvailableEvent) => void |
返回值: Promise<PluginListenerHandle>
自: 2.3.0
addListener(‘updateFailed’,…)
Section titled “添加监听器(‘updateFailed’,…)”addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>在 App 中监听更新失败事件,让你知道下次启动 App 时更新安装失败
| 参数 | 类型 |
|---|---|
eventName | ‘updateFailed’ |
listenerFunc | (state: UpdateFailedEvent) => void |
返回值: Promise<PluginListenerHandle>
Since: 2.3.0
添加监听器(‘downloadFailed’,…)
Section titled “添加监听器(‘downloadFailed’,…)”addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>在 App 中监听下载失败事件,让你知道某个包下载失败
| 参数 | 类型 |
|---|---|
eventName | ‘downloadFailed’ |
listenerFunc | (state: DownloadFailedEvent) => void |
返回值: Promise<PluginListenerHandle>
自: 4.0.0
添加监听器(‘appReloaded’,…)
标题:添加监听器(‘appReloaded’,…)addListener(eventName: 'appReloaded', listenerFunc: () => void) => Promise<PluginListenerHandle>在 App 中监听重载事件,让你知道重载已经发生
| 参数 | 类型 |
|---|---|
eventName | ‘appReloaded’ |
listenerFunc | () => void |
返回值: Promise<PluginListenerHandle>
自: 4.3.0
添加监听器(‘appReady’,…)
Section titled “addListener(‘appReady’, …)”addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>在 App 中监听 app ready 事件,让你知道 app 已经准备好使用
| Param | Type |
|---|---|
eventName | ‘appReady’ |
listenerFunc | (state: AppReadyEvent) => void |
Returns: Promise<PluginListenerHandle>
Since: 5.1.0
isAutoUpdateAvailable()
Section titled “isAutoUpdateAvailable()”isAutoUpdateAvailable() => Promise<AutoUpdateAvailable>获取是否有自动更新可用(不受 serverUrl 禁用的影响)
Returns: Promise<AutoUpdateAvailable>
getNextBundle()
getNextBundle()getNextBundle() => Promise<BundleInfo | null>获取将在应用重载时使用的下一个捆绑包。 如果没有设置下一个捆绑包,则返回 null。
返回: Promise<BundleInfo | null>
自: 6.8.0
setShakeMenu(…)
setShakeMenu(…)setShakeMenu(options: SetShakeMenuOptions) => Promise<void>用于调试/测试目的启用或禁用抖动菜单
| 参数 | 类型 | 概述 |
|---|---|---|
options | SetShakeMenuOptions | 包含一个布尔值来启用或禁用抖动菜单 |
自: 7.5.0
isShakeMenuEnabled()
标题:isShakeMenuEnabled()isShakeMenuEnabled() => Promise<ShakeMenuEnabled>获取抖动菜单的当前状态
返回: Promise<ShakeMenuEnabled>
自: 7.5.0
接口
标题:接口AppReadyResult
AppReadyResult| 属性 | 类型 |
|---|---|
bundle | BundleInfo |
应用程序信息
属性| 类型 | 更新 URL |
|---|---|
id | string |
version | string |
downloaded | string |
checksum | string |
status | BundleStatus |
属性
类型| 统计 URL | Section titled “UpdateUrl” |
|---|---|
url | string |
Section titled “BundleInfo”
StatsUrl| 属性 | 类型 |
|---|---|
url | string |
ChannelUrl
属性| 类型 | 下载选项 |
|---|---|
url | string |
此 URL 和版本用于从服务器下载捆绑包。如果您使用后端,则所有信息都将由 getLatest 方法提供。如果您不使用后端,则需要提供捆绑包的 URL 和版本。若捆绑包已使用 __CAPGO_KEEP_0__ 命令加密,则需要 SessionKey,应从该命令的结果中接收。
属性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. If you don’t use backend, you need to provide the URL and version of the bundle. SessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.
| 下载选项 | 此 URL 和版本用于从服务器下载捆绑包。如果您使用后端,则所有信息都将由 getLatest 方法提供。如果您不使用后端,则需要提供捆绑包的 URL 和版本。若捆绑包已使用 __CAPGO_KEEP_0__ 命令加密,则需要 SessionKey,应从该命令的结果中接收。 | 描述 | 默认 | 自 |
|---|---|---|---|---|
url | string | 要下载的捆绑包 zip 文件的 URL(例如:dist.zip)。(这可以是任何 URL。例如:Amazon S3,一个 GitHub 标签,任何您托管的捆绑包的其他地方。) | ||
version | string | 捆绑包的版本 code/名称 | ||
sessionKey | string | 当捆绑包使用会话密钥加密时,更新的会话密钥 | undefined | 4.0.0 |
checksum | string | 捆绑包的校验和,应为 sha256,如果捆绑包加密,则应使用私钥加密 | undefined | 4.0.0 |
manifest | ManifestEntry[] | Delta(manifest)多文件下载的清单 | undefined | 6.1.0 |
清单条目
标题:清单条目| 属性 | 类型 |
|---|---|
file_name | string | null |
file_hash | string | null |
download_url | string | null |
BundleId
BundleId| 属性 | 类型 |
|---|---|
id | string |
BundleListResult
BundleListResult| 属性 | 类型 |
|---|---|
bundles | BundleInfo[] |
ListOptions
ListOptions| 属性 | 类型 | 描述 | 默认 | 自 |
|---|---|---|---|---|
raw | boolean | 是否返回原始包列表或清单。如果为真,列表将尝试读取内部数据库而不是磁盘上的文件。 | false | 6.14.0 |
重置选项
标题:重置选项| 属性 | 类型 |
|---|---|
toLastSuccessful | boolean |
当前包结果
标题:当前包结果| 属性 | 类型 |
|---|---|
bundle | BundleInfo |
native | string |
多重延迟条件
多重延迟条件部分| 属性 | 类型 |
|---|---|
delayConditions | DelayCondition[] |
延迟条件
延迟条件部分| 属性 | 类型 | 描述 |
|---|---|---|
kind | DelayUntilNext | 设置多重延迟条件 |
value | string |
最新版本
最新版本部分| 属性 | 类型 | 描述 | 自 |
|---|---|---|---|
version | string | getLatest方法的返回结果 | 4.0.0 |
checksum | string | 6 | |
major | boolean | ||
message | string | ||
sessionKey | string | ||
error | string | ||
old | string | ||
url | string | ||
manifest | ManifestEntry[] | 6.1 |
GetLatestOptions
标题:GetLatestOptions| 属性 | 类型 | 描述 | 默认值 | 自 |
|---|---|---|---|---|
channel | string | 获取最新版本的频道 | undefined | 6.8.0 |
ChannelRes
频道资源| Prop | Type | 描述 | Since |
|---|---|---|---|
status | string | 设置频道的当前状态 | 4.7.0 |
error | string | ||
message | string |
SetChannelOptions
设置频道选项| Prop | Type |
|---|---|
channel | string |
triggerAutoUpdate | boolean |
UnsetChannelOptions
UnsetChannelOptions| 属性 | 类型 |
|---|---|
triggerAutoUpdate | boolean |
获取频道结果
属性| 类型 | 描述 | 自 | 获取频道的当前状态 |
|---|---|---|---|
channel | string | ListChannelsResult | 4.8.0 |
error | string | ||
message | string | ||
status | string | ||
allowSet | boolean |
ListChannelsResult
节标题:ListChannelsResult| 属性 | 类型 | 描述 | 自 |
|---|---|---|---|
channels | ChannelInfo[] | 可用的渠道列表 | 7.5.0 |
ChannelInfo
节标题:ChannelInfo| 属性 | 类型 | 描述 | 自 |
|---|---|---|---|
id | number | The numeric channel ID | 7.5.0 |
name | string | The channel name | 7.5.0 |
public | boolean | 如果为 true,则这是一个默认/备用频道。设备无法自行将其分配到公共频道。相反,当设备移除其频道覆盖(使用“”),它将自动从匹配的公共频道接收更新。 unsetChannel()如果为 true,设备可以使用“”显式将其分配到此频道。通常用于 beta 测试、 A/B 测试或优选更新跟踪。 | 7.5.0 |
allow_self_set | boolean | 频道命令使用频道“”,而不是此数字“”。 setChannel()SetCustomIdOptions | 7.5.0 |
标题:SetCustomIdOptions name属性 id.
| pagePath | targetLanguage |
|---|---|
customId | string |
内置版本
内置版本| 属性 | 类型 |
|---|---|
version | string |
设备 ID
设备 ID| 属性 | 类型 |
|---|---|
deviceId | string |
插件版本
插件版本| 属性 | 类型 |
|---|---|
version | string |
自动更新开关
自动更新开关| 属性 | 类型 |
|---|---|
enabled | boolean |
插件监听器句柄
属性| 类型 | 下载事件 |
|---|---|
remove | () => Promise<void> |
属性
类型| 下载事件 | 属性 | 概述 | 自 |
|---|---|---|---|
percent | number | 下载进度,范围为0到100。 | 4.0.0 |
bundle | BundleInfo |
无需事件
无需事件| 属性 | 类型 | 概述 | 自 |
|---|---|---|---|
bundle | BundleInfo | 下载进度,范围为0到100。 | 4.0.0 |
可用更新事件
下载进度,范围为0到100。| 属性 | 类型 | 描述 | 自 |
|---|---|---|---|
bundle | BundleInfo | 下载进度,范围为 0 到 100。 | 4.0.0 |
下载完成事件
下载完成事件| 属性 | 类型 | 描述 | 自 |
|---|---|---|---|
bundle | BundleInfo | 当有新更新可用时触发 | 4.0.0 |
主要可用事件
主要可用事件| 属性 | 类型 | 描述 | 自 |
|---|---|---|---|
version | string | 当有新主要捆绑包可用时触发。 | 4.0.0 |
更新失败事件
主要可用事件| 属性 | 类型 | 描述 | 自从 |
|---|---|---|---|
bundle | BundleInfo | 安装更新失败时触发。 | 4.0.0 |
下载失败事件
下载失败事件| 属性 | 类型 | 描述 | 自从 |
|---|---|---|---|
version | string | 下载失败时触发。 | 4.0.0 |
应用就绪事件
属性| section | 类型 | 描述 | 自 |
|---|---|---|---|
bundle | BundleInfo | 当应用程序准备好使用时发出。 | 5.2.0 |
status | string |
自动更新可用
标题:自动更新可用| 属性 | 类型 |
|---|---|
available | boolean |
设置摇动菜单选项
标题:设置摇动菜单选项| 属性 | 类型 |
|---|---|
enabled | boolean |
ShakeMenuEnabled
ShakeMenuEnabled| 属性 | 类型 |
|---|---|
enabled | boolean |
类型别名
类型别名Bundle状态
Bundle状态等待:包正在等待下一个包。 下载中:包正在下载中。 成功:包已下载并准备好作为下一个包。 SET SET Bundle状态 作为下一个捆绑包。 错误:捆绑包下载失败。
‘success’ | ‘error’ | ‘pending’ | ‘downloading’
延迟到下一个
标题:延迟到下一个‘background’ | ‘kill’ | ‘nativeVersion’ | ‘date’
继续从功能和设置
标题:继续从功能和设置如果您正在使用 功能和设置 来规划仪表板和API操作,连接它与 使用@capgo/capacitor-updater 为native能力在使用@capgo/capacitor-updater API概述 为实现细节在API概述, 简介 为简介中的实现细节 API 键 为API 键中的实现细节, 和 设备 为设备中的实现细节。