From 0e63d45599ac5123bf46d190831c145a733a4a98 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 29 Aug 2026 18:30:08 +0200 Subject: [PATCH] feat: expose a mobile sidebar-apps selector for the drawer --- src/lib/sidebar-apps.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/lib/sidebar-apps.ts diff --git a/src/lib/sidebar-apps.ts b/src/lib/sidebar-apps.ts new file mode 100644 index 00000000..f3e76e3e --- /dev/null +++ b/src/lib/sidebar-apps.ts @@ -0,0 +1,23 @@ +import { Linking } from 'react-native'; +import { useSettingsStore, type SidebarApp } from '../stores/settings-store'; + +/** + * Sidebar apps the user marked "show on mobile". The drawer (SidebarDrawer) + * is expected to render these below the folder list; the settings pane only + * edits them. Mirrors the webmail's navigation-rail filter on `showOnMobile`. + */ +export function useMobileSidebarApps(): SidebarApp[] { + return useSettingsStore((s) => s.sidebarApps.filter((app) => app.showOnMobile)); +} + +/** + * Open a sidebar app. Inline (iframe) apps have no native equivalent yet, so + * both open modes hand the URL to the system browser. + */ +export async function openSidebarApp(app: SidebarApp): Promise { + try { + await Linking.openURL(app.url); + } catch { + // unsupported scheme - nothing to do + } +}