feat: expose a mobile sidebar-apps selector for the drawer

This commit is contained in:
Linus Rath
2026-08-29 18:30:08 +02:00
parent 22697fd111
commit 0e63d45599
+23
View File
@@ -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<void> {
try {
await Linking.openURL(app.url);
} catch {
// unsupported scheme - nothing to do
}
}