From f5d4d7b63c3b6055a0cc3cd44de49b389a50b8b5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 30 Jun 2026 00:18:38 -0700 Subject: [PATCH] Stop forcing native glass debug route --- apps/mobile/src/app/_layout.tsx | 52 +---- .../archive/ArchivedThreadsScreen.tsx | 186 ++++++++++++------ 2 files changed, 140 insertions(+), 98 deletions(-) diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index 785bc0b441..159bd50974 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -4,17 +4,10 @@ import { DMSans_700Bold, useFonts, } from "@expo-google-fonts/dm-sans"; -import { usePathname, useRouter } from "expo-router"; +import { usePathname } from "expo-router"; import Stack from "expo-router/stack"; -import { useCallback, useEffect } from "react"; -import { - LogBox, - Platform, - Settings, - StatusBar, - useColorScheme, - useWindowDimensions, -} from "react-native"; +import { useCallback } from "react"; +import { StatusBar, useColorScheme, useWindowDimensions } from "react-native"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import { KeyboardProvider } from "react-native-keyboard-controller"; import { SafeAreaProvider } from "react-native-safe-area-context"; @@ -39,16 +32,7 @@ import { deriveStableFormSheetDetent } from "../lib/layout"; import { useThemeColor } from "../lib/useThemeColor"; import { HardwareKeyboardCommandProvider } from "../features/keyboard/HardwareKeyboardCommandProvider"; -const debugLaunchRoute = - __DEV__ && Platform.OS === "ios" ? Settings.get("T3DebugRoute") : undefined; - -if (debugLaunchRoute !== "/debug/rns-glass") { - require("../../global.css"); -} - -if (debugLaunchRoute === "/debug/rns-glass") { - LogBox.ignoreAllLogs(true); -} +require("../../global.css"); function AppNavigator() { const pathname = usePathname(); @@ -64,24 +48,16 @@ function AppNavigator() { function AppNavigatorContent() { const pathname = usePathname(); - const isDebugRoute = pathname.startsWith("/debug/") || debugLaunchRoute === "/debug/rns-glass"; + const isDebugRoute = pathname.startsWith("/debug/"); if (isDebugRoute) { - return ; + return ; } - return ; + return ; } -function DebugNavigatorHost(props: { readonly pathname: string }) { - const router = useRouter(); - - useEffect(() => { - if (debugLaunchRoute === "/debug/rns-glass" && props.pathname !== "/debug/rns-glass") { - router.replace("/debug/rns-glass" as never); - } - }, [props.pathname, router]); - +function DebugNavigatorHost() { return ( <> @@ -99,22 +75,12 @@ function DebugNavigatorHost(props: { readonly pathname: string }) { ); } -function WorkspaceNavigatorHost(props: { readonly pathname: string }) { +function WorkspaceNavigatorHost() { const colorScheme = useColorScheme(); - const pathname = props.pathname; - const router = useRouter(); const statusBarBg = useThemeColor("--color-status-bar"); useAgentNotificationNavigation(); useThreadOutboxDrain(); - useEffect(() => { - if (!__DEV__ || Platform.OS !== "ios") return; - const debugRoute = Settings.get("T3DebugRoute"); - if (typeof debugRoute !== "string" || debugRoute.length === 0 || pathname === debugRoute) - return; - router.replace(debugRoute as never); - }, [pathname, router]); - return ( <> void; + readonly onRefresh: () => void; readonly onSearchQueryChange: (query: string) => void; readonly onSortOrderChange: (sortOrder: ArchivedThreadSortOrder) => void; }) { + const { width } = useWindowDimensions(); const hasCustomFilter = props.selectedEnvironmentId !== null || props.sortOrder !== "newest"; + const usesNativeMailToolbar = Platform.OS === "ios" && width < 700; + const archiveFilterMenu = { + title: "Archived thread options", + items: [ + { + type: "submenu" as const, + title: "Environment", + items: [ + { + type: "action" as const, + title: "All environments", + state: props.selectedEnvironmentId === null ? ("on" as const) : ("off" as const), + onPress: () => props.onEnvironmentChange(null), + }, + ...props.environments.map((environment) => ({ + type: "action" as const, + title: environment.label, + state: + props.selectedEnvironmentId === environment.environmentId + ? ("on" as const) + : ("off" as const), + onPress: () => props.onEnvironmentChange(environment.environmentId), + })), + ], + }, + { + type: "submenu" as const, + title: "Sort by archived date", + items: [ + { + type: "action" as const, + title: "Newest first", + state: props.sortOrder === "newest" ? ("on" as const) : ("off" as const), + onPress: () => props.onSortOrderChange("newest"), + }, + { + type: "action" as const, + title: "Oldest first", + state: props.sortOrder === "oldest" ? ("on" as const) : ("off" as const), + onPress: () => props.onSortOrderChange("oldest"), + }, + ], + }, + ], + }; return ( <> { - props.onSearchQueryChange(event.nativeEvent.text); - }, - onCancelButtonPress: () => { - props.onSearchQueryChange(""); - }, - }, + headerTransparent: usesNativeMailToolbar, + headerStyle: usesNativeMailToolbar ? { backgroundColor: "transparent" } : undefined, + headerShadowVisible: usesNativeMailToolbar ? false : undefined, + unstable_navigationItemStyle: usesNativeMailToolbar ? "editor" : undefined, + unstable_headerToolbarItems: usesNativeMailToolbar + ? () => [ + { + composeButtonId: "archived-refresh", + composeSystemImageName: "arrow.clockwise", + filterMenu: archiveFilterMenu, + filterButtonId: "archived-filter", + filterSystemImageName: hasCustomFilter + ? "line.3.horizontal.decrease.circle.fill" + : "line.3.horizontal.decrease", + onComposePress: props.onRefresh, + onSearchTextChange: props.onSearchQueryChange, + placeholder: "Search", + searchTextChangeId: "archived-search-text", + type: "mailSearchToolbar", + useFallbackSearchField: true, + }, + ] + : undefined, + headerSearchBarOptions: usesNativeMailToolbar + ? undefined + : { + autoCapitalize: "none", + hideNavigationBar: false, + obscureBackground: false, + placeholder: "Search archived threads", + placement: "stacked", + onChangeText: (event) => { + props.onSearchQueryChange(event.nativeEvent.text); + }, + onCancelButtonPress: () => { + props.onSearchQueryChange(""); + }, + }, }} /> - - - - Environment - props.onEnvironmentChange(null)} - > - All environments - - {props.environments.map((environment) => ( + {usesNativeMailToolbar ? null : ( + + + + Environment props.onEnvironmentChange(environment.environmentId)} + isOn={props.selectedEnvironmentId === null} + onPress={() => props.onEnvironmentChange(null)} > - {environment.label} + All environments - ))} - + {props.environments.map((environment) => ( + props.onEnvironmentChange(environment.environmentId)} + > + {environment.label} + + ))} + - - Sort by archived date - props.onSortOrderChange("newest")} - > - Newest first - - props.onSortOrderChange("oldest")} - > - Oldest first - + + Sort by archived date + props.onSortOrderChange("newest")} + > + Newest first + + props.onSortOrderChange("oldest")} + > + Oldest first + + - - + + )} ); } @@ -361,6 +436,7 @@ export function ArchivedThreadsScreen(props: {