ios: cfg-gate desktop-only menu and plugin imports
tauri::menu is gated #[cfg(desktop)] in tauri 2; unconditional import
broke `cargo check --target aarch64-apple-ios`. Same fix pattern as
GoingsOn's notifications gating.
- main.rs: cfg-gate menu imports + builder.menu()/on_menu_event() chain
- lib.rs: restructure shell/window_state/updater plugin install as
cfg-gated rebind instead of mut + block, and gate Emitter import
cargo check --target aarch64-apple-ios now clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 files changed,
+24 insertions,
-16 deletions
| 1 |
1 |
|
# Balanced Breakfast - Mobile Port
|
| 2 |
2 |
|
|
| 3 |
|
- |
Done: Phases 1-5, Phase 6 partial. Active: None. Next: Phase 6 remaining, Phase 7 polish.
|
|
3 |
+ |
Done: Phases 1-6 (build config + iOS init + iOS cfg-gating). Active: None. Next: iOS simulator smoke test, Android init, Phase 7 polish.
|
| 4 |
4 |
|
|
| 5 |
5 |
|
---
|
| 6 |
6 |
|
|
| 7 |
|
- |
## Phase 6: Tauri Mobile Build Config — Remaining
|
| 8 |
|
- |
- [ ] Platform-conditional `rusqlite` bundled feature for Android
|
| 9 |
|
- |
- [ ] Split capabilities: `default.json` (cross-platform) + `desktop.json` (shell, notifications)
|
| 10 |
|
- |
- [ ] `cargo tauri ios init` → generates `gen/apple/`
|
|
7 |
+ |
## Phase 6: Tauri Mobile Build Config
|
|
8 |
+ |
- [x] Platform-conditional sqlx bundled sqlite (via workspace `libsqlite3-sys` bundled feature)
|
|
9 |
+ |
- [x] Split capabilities: `default.json` (cross-platform) + `desktop.json` (shell)
|
|
10 |
+ |
- [x] `cargo tauri ios init` → `gen/apple/`
|
|
11 |
+ |
- [x] iOS cfg-gating: `tauri::menu` (desktop-only), updater, shell, window-state all behind `cfg(not(any(target_os = "ios", target_os = "android")))`. `cargo check --target aarch64-apple-ios` clean.
|
| 11 |
12 |
|
- [ ] `cargo tauri android init` → generates `gen/android/`
|
| 12 |
|
- |
- [ ] iOS simulator test
|
|
13 |
+ |
- [ ] iOS simulator smoke test (`cargo tauri ios dev`)
|
| 13 |
14 |
|
- [ ] Android emulator test
|
| 14 |
15 |
|
- [ ] All CRUD operations verified on mobile WebView
|
| 15 |
16 |
|
|
| 14 |
14 |
|
|
| 15 |
15 |
|
use state::AppState;
|
| 16 |
16 |
|
use std::sync::Arc;
|
| 17 |
|
- |
use tauri::{Emitter, Manager};
|
|
17 |
+ |
use tauri::Manager;
|
|
18 |
+ |
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
|
19 |
+ |
use tauri::Emitter;
|
| 18 |
20 |
|
|
| 19 |
21 |
|
/// Build the Tauri app with all commands registered.
|
| 20 |
22 |
|
pub fn build_app() -> tauri::Builder<tauri::Wry> {
|
| 21 |
|
- |
let mut builder = tauri::Builder::default();
|
|
23 |
+ |
let builder = tauri::Builder::default();
|
| 22 |
24 |
|
|
| 23 |
25 |
|
// Desktop-only plugins
|
| 24 |
26 |
|
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
| 25 |
|
- |
{
|
| 26 |
|
- |
builder = builder
|
| 27 |
|
- |
.plugin(tauri_plugin_shell::init())
|
| 28 |
|
- |
.plugin(tauri_plugin_window_state::Builder::new().build())
|
| 29 |
|
- |
.plugin(tauri_plugin_updater::Builder::new().build());
|
| 30 |
|
- |
}
|
|
27 |
+ |
let builder = builder
|
|
28 |
+ |
.plugin(tauri_plugin_shell::init())
|
|
29 |
+ |
.plugin(tauri_plugin_window_state::Builder::new().build())
|
|
30 |
+ |
.plugin(tauri_plugin_updater::Builder::new().build());
|
| 31 |
31 |
|
|
| 32 |
32 |
|
builder
|
| 33 |
33 |
|
.plugin(tauri_plugin_dialog::init())
|
| 2 |
2 |
|
// Prevents additional console window on Windows in release
|
| 3 |
3 |
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
| 4 |
4 |
|
|
|
5 |
+ |
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
| 5 |
6 |
|
use tauri::menu::{Menu, MenuItem, PredefinedMenuItem, Submenu};
|
|
7 |
+ |
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
| 6 |
8 |
|
use tauri::{Emitter, Manager};
|
| 7 |
9 |
|
use tracing::info;
|
| 8 |
10 |
|
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
| 17 |
19 |
|
|
| 18 |
20 |
|
info!("Starting Balanced Breakfast");
|
| 19 |
21 |
|
|
| 20 |
|
- |
balanced_breakfast_desktop::build_app()
|
|
22 |
+ |
let builder = balanced_breakfast_desktop::build_app();
|
|
23 |
+ |
|
|
24 |
+ |
#[cfg(not(any(target_os = "ios", target_os = "android")))]
|
|
25 |
+ |
let builder = builder
|
| 21 |
26 |
|
.menu(|app| {
|
| 22 |
27 |
|
#[cfg(target_os = "macos")]
|
| 23 |
28 |
|
let app_menu = Submenu::with_items(
|
| 110 |
115 |
|
if let Some(window) = app.get_webview_window("main") {
|
| 111 |
116 |
|
let _: Result<(), _> = window.emit(&format!("menu:{}", event_id), ());
|
| 112 |
117 |
|
}
|
| 113 |
|
- |
})
|
|
118 |
+ |
});
|
|
119 |
+ |
|
|
120 |
+ |
builder
|
| 114 |
121 |
|
.run(tauri::generate_context!())
|
| 115 |
122 |
|
.expect("error while running tauri application");
|
| 116 |
123 |
|
}
|