//! The updater, on a phone: nothing. The phone gets its builds from a store or //! a sideload, `tauri-plugin-updater` is desktop-only, and the desktop module //! (updater.rs) leans on it in every function. This file stands in for that //! module on mobile (`#[path]` in lib.rs) so the command list, the managed //! state and `init` keep the same names and the rest of the app never needs a //! `cfg`. Every command answers honestly: there is no update channel here. use serde::Serialize; use tauri::{AppHandle, State}; #[derive(Default)] pub struct UpdaterState; #[derive(Serialize, Clone)] pub struct Status { pub version: String, pub channel: String, pub auto_check: bool, pub endpoint_stable: String, pub endpoint_nightly: String, pub default_stable: String, pub default_nightly: String, pub has_token: bool, pub source_kind: String, pub available: Option<()>, pub checking: bool, pub installing: bool, pub last_check: Option, pub last_error: Option, pub progress: Option<()>, pub dev_build: bool, } fn status(app: &AppHandle) -> Status { Status { version: app.package_info().version.to_string(), channel: "mobile".into(), auto_check: false, endpoint_stable: String::new(), endpoint_nightly: String::new(), default_stable: String::new(), default_nightly: String::new(), has_token: false, source_kind: "none".into(), available: None, checking: false, installing: false, last_check: None, last_error: None, progress: None, dev_build: cfg!(debug_assertions), } } pub fn init(_app: &AppHandle) {} #[tauri::command] pub fn updater_status(app: AppHandle) -> Status { status(&app) } #[tauri::command] pub async fn updater_check(app: AppHandle) -> Result { Ok(status(&app)) } #[tauri::command] pub fn updater_set( app: AppHandle, _state: State<'_, UpdaterState>, _channel: Option, _auto_check: Option, _endpoint_stable: Option, _endpoint_nightly: Option, _token: Option, ) -> Status { status(&app) } #[tauri::command] pub async fn updater_install(_app: AppHandle) -> Result<(), String> { Err("updates are not installed in place on this platform".into()) }