Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ export function ProcessingMenu({
const setAssistantOpen = useAppStore((s) => s.setAssistantOpen);
const setDashboardOpen = useAppStore((s) => s.setDashboardOpen);

// Whitebox, format Conversion, Raster tools, and AI Segmentation all require
// the Python sidecar, which cannot run on Android/iOS — hide them on mobile so
// they don't present and then fail. Vector (Turf), SQL (PGlite/DuckDB), Python
// (Pyodide), geocode, statistics, and the assistant run client-side and stay.
// The user agent is stable for the session, so evaluate once.
// Format Conversion, Raster tools, and AI Segmentation require the Python
// sidecar, which cannot run on Android/iOS — hide them on mobile so they don't
// present and then fail. Vector (Turf), SQL (PGlite/DuckDB), Python (Pyodide),
// geocode, statistics, and the assistant run client-side and stay. The user
// agent is stable for the session, so evaluate once.
const mobile = useMemo(() => isMobile(), []);
const uiProfile = useDesktopSettingsStore((s) => s.desktopSettings.uiProfile);
const show = (id: string) => isMenuItemVisible(uiProfile, id);
// The Whitebox toolbox (and its WASI/GeoLibre tool catalog) runs entirely in
// the browser via WebAssembly, so unlike the sidecar-backed tools it stays
// available on mobile.
const showWhitebox = show("processing.whitebox");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug (medium-high confidence): Making the Whitebox toolbox reachable on mobile exposes a case ProcessingDialog.tsx doesn't handle: its desktop flag is just isTauri() (ProcessingDialog.tsx:446), which is also true inside a Tauri Android/iOS webview — per is-mobile.ts's own comment, "the Tauri Android webview reports an Android UA."

Every other sidecar-backed dialog (Conversion, Raster, Segmentation) avoids this because it stays behind !mobile && show(...) here, so it's never opened on mobile at all. Whitebox is now the one exception, but ProcessingDialog's runLocal still defaults to !desktop (i.e. false, sidecar mode) on a mobile Tauri build, and its "Start server" button is gated only on desktop, not !mobile — so a mobile Tauri user opening this dialog lands in sidecar mode by default with a "Start server" button that calls startGeoLibreSidecar(), which cannot succeed on Android/iOS. They'd have to discover and manually check "Run locally" to get a working WASM tool.

Worth defaulting runLocal/gating the server buttons off desktop && !mobile instead of desktop alone.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug (medium confidence): Removing the !mobile gate here means the Whitebox toolbox is now shown on Tauri Android/iOS too, but ProcessingDialog.tsx still defaults runLocal to useState(!desktop), and desktop = isTauri() is true on Tauri mobile builds (per the isMobile() doc comment: "the Tauri Android webview reports an "Android" UA"). So on Tauri Android/iOS, runLocal defaults to false (sidecar mode) — but the sidecar can never run on mobile, so runtimeAvailable stays false and the Run button (disabled={... (!runLocal && runtimeAvailable !== true)}) stays disabled until the user manually checks "Run locally". The toolbox becomes visible-but-non-functional by default on that platform, which cuts against this PR's stated rationale ("unlike the sidecar-backed tools it stays available on mobile").

Suggest defaulting runLocal to something like !desktop || isMobile() so Tauri-mobile also opens straight into WASM mode.


// Open the Whitebox toolbox dialog preselected to a specific tool, used by the
// per-category submenus below. Two store writes: queue the tool, then open.
Expand Down Expand Up @@ -118,17 +122,16 @@ export function ProcessingMenu({
<DropdownMenuSeparator />
</>
)}
{!mobile && show("processing.whitebox") && (
{showWhitebox && (
<DropdownMenuItem onSelect={() => setProcessingOpen(true)}>
{t("toolbar.item.whitebox")}
</DropdownMenuItem>
)}
{/* Whitebox tools grouped by category/subcategory. Each leaf opens the
Whitebox toolbox dialog preselected to that tool. Catalog data lives
in lib/whitebox-menu-catalog.ts; gated with the Whitebox item since
they share the same sidecar/WASM backend (hidden on mobile). */}
{!mobile &&
show("processing.whitebox") &&
in lib/whitebox-menu-catalog.ts; gated with the Whitebox item, which
runs in the browser via WebAssembly (so available on mobile too). */}
{showWhitebox &&
WHITEBOX_MENU_CATALOG.map((cat) => (
<DropdownMenuSub key={cat.key}>
<DropdownMenuSubTrigger>{t(cat.labelKey)}</DropdownMenuSubTrigger>
Expand Down Expand Up @@ -512,7 +515,7 @@ export function ProcessingMenu({
)}
{/* Divide the tool-category submenus (Whitebox, GeoLibre) from the
workspaces and consoles below. Only when both sides are present. */}
{((!mobile && show("processing.whitebox")) || showGeolibre) &&
{(showWhitebox || showGeolibre) &&
showWorkspacesOrServices && <DropdownMenuSeparator />}
{show("processing.sqlWorkspace") && (
<DropdownMenuItem onSelect={() => setSqlWorkspaceOpen(true)}>
Expand Down
Loading
Loading