From 17f4dff791a51841ad1c86972d2cbed44c28e91b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 25 Apr 2026 12:50:46 +0000 Subject: [PATCH] feat(android): bundle.android config + frontend isAndroid/isMobile helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two small Phase 1 follow-ups for the Android target: 1. tauri.conf.json: add `bundle.android.minSdkVersion: 24`. Android 7.0 is the floor — gives us Vulkan availability (for the eventual GPU feature flag), AAudio for cpal, and is what Pixel-class hardware tests against. Keeps the global `identifier` on `uk.co.corbel.kon` for now; the Corbie rebrand sweep will land `corbel.technology.corbie` as a single coherent commit. 2. src/lib/utils/runtime.ts: add `isAndroid()` and `isMobile()` helpers alongside the existing `hasTauriRuntime()`. Both use UA sniffing — sufficient for feature-gating UI, never for security decisions. These are how the Svelte side will hide: - hotkey config (no global hotkey API on Android) - paste-mode picker (auto-paste maps to a copy-only flow) - meeting auto-capture toggle (process list unavailable) - multi-window buttons (open-viewer, open-float, etc.) - system-tray-related affordances Tauri 2 doesn't expose a synchronous platform-detection helper that works during initial render, so UA sniffing is the pragmatic choice. https://claude.ai/code/session_0189xUb6ie6t9qHkzatGZ9Rb --- src-tauri/tauri.conf.json | 5 ++++- src/lib/utils/runtime.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 21cd5cb..d3ffd7a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -35,6 +35,9 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ] + ], + "android": { + "minSdkVersion": 24 + } } } diff --git a/src/lib/utils/runtime.ts b/src/lib/utils/runtime.ts index 3845b71..2773f3a 100644 --- a/src/lib/utils/runtime.ts +++ b/src/lib/utils/runtime.ts @@ -16,3 +16,30 @@ export function hasTauriRuntime() { if (window.isTauri === true) return true; return false; } + +// Coarse-grained mobile / Android detection. Used by the Svelte UI to +// hide features that depend on desktop-only Tauri commands (multi-window, +// global hotkeys, auto-paste, meeting auto-capture, system tray) so an +// Android build's frontend renders only the surfaces that actually work. +// +// `isMobile()` is the broader check (covers iOS and Android) and falls +// back on the user-agent for non-Tauri previews. `isAndroid()` is the +// targeted check used where the platform genuinely matters (e.g. +// foreground-notification record button vs global hotkey). +// +// Tauri 2 doesn't expose a synchronous platform-detection helper that +// works during the initial Svelte render, so we rely on user-agent +// sniffing — fine for feature-gating UI, never for security decisions. + +const ANDROID_UA_RE = /android/i; +const MOBILE_UA_RE = /android|iphone|ipad|ipod|mobile/i; + +export function isAndroid(): boolean { + if (typeof navigator === "undefined") return false; + return ANDROID_UA_RE.test(navigator.userAgent); +} + +export function isMobile(): boolean { + if (typeof navigator === "undefined") return false; + return MOBILE_UA_RE.test(navigator.userAgent); +}