Add iOS build target and refactor Tauri app initialization - #264
Merged
Conversation
Splits the Rust app into a shared lib.rs (mobile_entry_point) with a thin main.rs wrapper, adds the [lib] crate target tauri ios init requires, and gates desktop-only pieces (native menu, self-hosted updater, updater restart) behind #[cfg(desktop)] since none apply on iOS. Adds tauri.ios.conf.json to override the identifier to the App Store bundle ID without touching the existing desktop identifier, and splits capabilities into cross-platform vs desktop-only files. Also closes a touch-accessibility gap: the command palette had no on-screen trigger, only a keyboard shortcut and a desktop menu item. Adds isIOS to platform.ts (fixing isMac misdetecting iPhone/iPad) to gate the startup update check off on iOS, and removes a stale capacitor://localhost CSP entry left over from an earlier plan. CI/App Store Connect signing is a deliberate follow-up, not included.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR scaffolds a Tauri iOS build target alongside the existing Mac/Windows desktop app, enabling the app to run in the iOS Simulator and eventually ship to the App Store. The changes include extracting shared app initialization logic into a library crate, gating desktop-only features (native menu, self-hosted updater) behind
#[cfg(desktop)], and updating platform detection to distinguish iPadOS from macOS.Type of Change
Changes Made
Rust / Tauri Backend
src-tauri/src/lib.rs(new): Extractedpub fn run()containing all app initialization logic, annotated with#[cfg_attr(mobile, tauri::mobile_entry_point)]for iOS compatibility. Desktop-only features (menu, updater, process plugins) are conditionally compiled via#[cfg(desktop)].src-tauri/src/main.rs: Simplified to a thin entry point that callstimetraked_lib::run(), keeping only the Windows-specificwindows_subsystemattribute.src-tauri/Cargo.toml: Added[lib]section declaringtimetraked_libwithcrate-type = ["staticlib", "cdylib", "rlib"](required for Tauri iOS/Android builds). Movedtauri-plugin-updaterandtauri-plugin-processto a platform-specific dependency block scoped to non-mobile targets.src-tauri/tauri.ios.conf.json(new): iOS platform-override config with App Store bundle IDcom.adamjolicoeur.timetraked, separate from the desktop identifier to preserve existing app-data/keychain/updater identity.src-tauri/capabilities/default.json: Removed desktop-only permissions (updater:default,process:allow-restart), keeping only cross-platform ones (core:default,opener:default,dialog:default).src-tauri/capabilities/desktop.json(new): Desktop-only capability set with"platforms": ["macOS", "windows", "linux"]to prevent iOS from requesting unavailable plugins.src-tauri/src/menu.rs: Updated documentation to note that menu building is desktop-only (#[cfg(desktop)]).Frontend / TypeScript
src/lib/platform.ts: Enhanced platform detection:isIOSexport that detects iPhone/iPad/iPod user agents and distinguishes iPadOS (which spoofs "Macintosh" since iPadOS 13) from real Macs viamaxTouchPoints > 1.isMacto exclude iOS devices:isMac = /Mac/.test(userAgent) && !isIOS.src/lib/tauriElectronApiShim.ts: AddedisIOScheck to skip silent update checks on iOS (App Store owns distribution/updates).src/App.tsx: Added a Command Palette button (Search icon) to the header for easier access on touch devices.index.html: Cleaned up CSP meta tag by removing obsoletecapacitor://localhostreferences (leftover from an earlier Capacitor-based plan) and clarified that Tauri's own CSP header is injected at runtime.Configuration & Scripts
package.json: Added three new npm scripts:pnpm tauri:ios:init— scaffold the Xcode projectpnpm tauri:ios:dev— launch in iOS Simulator with hot reloadpnpm tauri:ios:build— build the iOS app bundleAGENTS.md: Updated version to 2.7.0 and last-updated date; expanded documentation for platform detection, menu building, and thehttps://claude.ai/code/session_01LkgcfBvaBCuTwcYah1WrTn