Skip to main content

UpdateService

Trait UpdateService 

Source
pub trait UpdateService:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn show_download_progress(&self) -> Result<(), PlatformError> { ... }
    fn update_download_progress(
        &self,
        _progress: i32,
    ) -> Result<(), PlatformError> { ... }
    fn dismiss_download_progress(&self) -> Result<(), PlatformError> { ... }
    fn show_update_prompt(
        &self,
        _callback_id: u64,
        _update_info_json: Option<&str>,
    ) -> Result<(), PlatformError> { ... }
    fn install_update(&self, package_path: &Path) -> Result<(), PlatformError> { ... }
}

Provided Methods§

Source

fn show_download_progress(&self) -> Result<(), PlatformError>

Show download progress UI

Source

fn update_download_progress(&self, _progress: i32) -> Result<(), PlatformError>

Update download progress (0-100)

Source

fn dismiss_download_progress(&self) -> Result<(), PlatformError>

Dismiss download progress UI

Source

fn show_update_prompt( &self, _callback_id: u64, _update_info_json: Option<&str>, ) -> Result<(), PlatformError>

Show update confirmation prompt and invoke callback with the result.

§Arguments
  • callback_id - Callback ID for result
  • update_info_json - Optional JSON string with update details: {“version”:“1.2.0”,“size”:15728640,“releaseNotes”:[“…”]}
§Callback behavior
  • Confirm: callback success with payload (e.g. {“confirm”:true})
  • Cancel: callback error code 2000
Source

fn install_update(&self, package_path: &Path) -> Result<(), PlatformError>

Requests installation of an application update from a local package file.

This launches the system installer and returns once the request is issued. It does not guarantee the update is installed successfully.

§Arguments
  • package_path - Local, readable update package path (e.g. .apk on Android)
§Platform Support / Notes
  • Android: Launches the system installer; requires user confirmation. Requires REQUEST_INSTALL_PACKAGES and a FileProvider for APK sharing.
  • macOS: Planned support for .pkg/.dmg installers.
  • iOS: Not supported (App Store only).
  • HarmonyOS: Not implemented (returns error).

Implementors§