Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ios): disable auto-update with flag (#3915)

Peter Chinman565f918d381e
diff --git a/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs b/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs
index bbe1b81893..dd5f9d80bc 100644
--- a/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs
+++ b/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs
@@ -137,6 +137,7 @@ impl BundleUpdateEvent {
pub struct MacroBundleUpdaterPlugin {
base_url: Url,
embedded_bundle_build: u64,
+ auto_update: bool,
}
impl MacroBundleUpdaterPlugin {
@@ -145,8 +146,20 @@ impl MacroBundleUpdaterPlugin {
Self {
base_url,
embedded_bundle_build,
+ auto_update: true,
}
}
+
+ /// Enable or disable automatic update activity.
+ ///
+ /// When disabled, the plugin never restores or applies a cached OTA bundle
+ /// at startup and never starts update checks on its own, so the embedded
+ /// bundle (or dev server) always wins. Explicit commands
+ /// (`check_for_update`, `perform_update`, `clear_bundle`) still work.
+ pub fn with_auto_update(mut self, enabled: bool) -> Self {
+ self.auto_update = enabled;
+ self
+ }
}
/// Approve or deny a pending bundle update.
@@ -358,7 +371,11 @@ impl<R: Runtime> Plugin<R> for MacroBundleUpdaterPlugin {
let mut service = Service::new(client, fs, system_info, self.embedded_bundle_build);
let mut acknowledge_setup_apply = false;
let mut start_update_check = false;
- if let Ok(cache_dir) = app.path().app_cache_dir() {
+ if !self.auto_update {
+ tracing::info!(
+ "[bundle-update] automatic bundle updates are disabled in this build"
+ );
+ } else if let Ok(cache_dir) = app.path().app_cache_dir() {
let restored_pending = tauri::async_runtime::block_on(async {
service.load_bundle_root(&cache_dir, native_build()).await
});
diff --git a/js/app/tauri/src-tauri/Cargo.toml b/js/app/tauri/src-tauri/Cargo.toml
index 2cc17013d6..bd21cb4278 100644
--- a/js/app/tauri/src-tauri/Cargo.toml
+++ b/js/app/tauri/src-tauri/Cargo.toml
@@ -18,6 +18,9 @@ serde_json = "1.0"
tauri-build = { version = "2.3.1", features = [] }
[features]
+# Automatic OTA bundle updates: check on launch/resume, apply cached bundles at
+# startup. Disabled via `--no-default-features` (just ios-dev,
+# ios-build-no-update) so the embedded bundle / dev server is always served.
auto_apply_update = []
default = ["auto_apply_update"]
diff --git a/js/app/tauri/src-tauri/src/lib.rs b/js/app/tauri/src-tauri/src/lib.rs
index 1918be5053..c123c2bffe 100644
--- a/js/app/tauri/src-tauri/src/lib.rs
+++ b/js/app/tauri/src-tauri/src/lib.rs
@@ -1,7 +1,8 @@
use logger::Logger;
+use macro_bundle_updater_plugin::inbound::plugin::retry_waiting_for_wifi;
+#[cfg(feature = "auto_apply_update")]
use macro_bundle_updater_plugin::inbound::plugin::{
- allow_update_reload_retry, apply_completed_update_from, retry_waiting_for_wifi,
- start_update_check,
+ allow_update_reload_retry, apply_completed_update_from, start_update_check,
};
use navigation_plugin::MacroNavigationPlugin;
use navigation_plugin::scheme::MacroScheme;
@@ -178,7 +179,11 @@ pub fn run() {
.parse()
.expect("valid url"),
embedded_bundle_build(),
- ),
+ )
+ // Builds without this feature (just ios-dev, ios-build-no-update)
+ // must never check for or apply OTA bundles on their own; manual
+ // checks from settings still work.
+ .with_auto_update(cfg!(feature = "auto_apply_update")),
);
#[cfg(mobile)]
@@ -296,15 +301,6 @@ pub fn run() {
}
});
}
- #[cfg(not(feature = "auto_apply_update"))]
- {
- let app = app_handle.clone();
- tauri::async_runtime::spawn(async move {
- if let Err(e) = start_update_check(&app).await {
- tracing::error!("Failed to start bundle update check on resume: {e}");
- }
- });
- }
}
_ => {}
});