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
8 changes: 8 additions & 0 deletions apps/mobile/src/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import {
import { ScheduledTaskEditorProvider } from "./features/settings/scheduled-task-editor";
import { SettingsKeyboardRouteScreen } from "./features/settings/SettingsKeyboardRouteScreen";
import { SettingsLegalRouteScreen } from "./features/settings/SettingsLegalRouteScreen";
import { SettingsMicrophoneRouteScreen } from "./features/settings/SettingsMicrophoneRouteScreen";
import {
SettingsOpenSourceLicenseRouteScreen,
SettingsOpenSourceLicensesRouteScreen,
Expand Down Expand Up @@ -310,6 +311,13 @@ const SettingsContentStack = createV5SheetStackNavigator({
title: "Keyboard",
},
}),
SettingsMicrophone: createNativeStackScreen({
screen: SettingsMicrophoneRouteScreen,
linking: "microphone",
options: {
title: "Microphone",
},
}),
SettingsFollowUp: createNativeStackScreen({
screen: SettingsFollowUpRouteScreen,
linking: "follow-ups",
Expand Down
7 changes: 7 additions & 0 deletions apps/mobile/src/components/AppSymbol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import IconBolt from "@tabler/icons-react-native/IconBolt";
import IconBox from "@tabler/icons-react-native/IconBox";
import IconBrain from "@tabler/icons-react-native/IconBrain";
import IconCamera from "@tabler/icons-react-native/IconCamera";
import IconCar from "@tabler/icons-react-native/IconCar";
import IconChartBar from "@tabler/icons-react-native/IconChartBar";
import IconCheck from "@tabler/icons-react-native/IconCheck";
import IconCloud from "@tabler/icons-react-native/IconCloud";
Expand Down Expand Up @@ -58,6 +59,7 @@ import IconFilter from "@tabler/icons-react-native/IconFilter";
import IconFilterFilled from "@tabler/icons-react-native/IconFilterFilled";
import IconFolder from "@tabler/icons-react-native/IconFolder";
import IconFolderOpen from "@tabler/icons-react-native/IconFolderOpen";
import IconHeadphones from "@tabler/icons-react-native/IconHeadphones";
import IconFolderPlus from "@tabler/icons-react-native/IconFolderPlus";
import IconGitBranch from "@tabler/icons-react-native/IconGitBranch";
import IconGitMerge from "@tabler/icons-react-native/IconGitMerge";
Expand All @@ -83,6 +85,7 @@ import IconMoon from "@tabler/icons-react-native/IconMoon";
import IconNetwork from "@tabler/icons-react-native/IconNetwork";
import IconPalette from "@tabler/icons-react-native/IconPalette";
import IconPencil from "@tabler/icons-react-native/IconPencil";
import IconPlug from "@tabler/icons-react-native/IconPlug";
import IconPhoto from "@tabler/icons-react-native/IconPhoto";
import IconPin from "@tabler/icons-react-native/IconPin";
import IconPinnedOff from "@tabler/icons-react-native/IconPinnedOff";
Expand Down Expand Up @@ -146,7 +149,9 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
"bolt.circle": IconBolt,
"bolt.horizontal.circle": IconBolt,
brain: IconBrain,
"cable.connector": IconPlug,
camera: IconCamera,
car: IconCar,
"chart.bar.xaxis": IconChartBar,
checkmark: IconCheck,
"checkmark.circle": IconCircleCheck,
Expand Down Expand Up @@ -178,9 +183,11 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
gearshape: IconSettings,
globe: IconWorld,
hammer: IconHammer,
headphones: IconHeadphones,
house: IconHome,
"info.circle": IconInfoCircle,
internaldrive: IconDatabase,
iphone: IconDeviceMobile,
keyboard: IconKeyboard,
laptopcomputer: IconDeviceLaptop,
link: IconLink,
Expand Down
65 changes: 3 additions & 62 deletions apps/mobile/src/features/settings/EnvironmentRoutesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import { type EnvironmentId, sessionGrantsScope } from "@t3tools/contracts";
import { AUTH_SCOPE_OPTIONS } from "@t3tools/shared/authScopeOptions";
import { AsyncResult } from "effect/reactivity";
import * as Option from "effect/Option";
import { useEffect, useMemo, useRef, useState } from "react";
import { useState } from "react";
import { Alert, Platform, Pressable, View } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
import Reanimated, { ReduceMotion, useAnimatedStyle, withTiming } from "react-native-reanimated";

import { type AppSymbolName, SymbolView } from "../../components/AppSymbol";
Expand All @@ -27,6 +26,7 @@ import { environmentSession } from "../../state/session";
import { useAtomCommand } from "../../state/use-atom-command";
import { connectionTone } from "../connection/connectionTone";
import { SettingsActionRow } from "./components/SettingsActionRow";
import { SettingsDragHandle } from "./components/SettingsDragHandle";
import { SettingsSection } from "./components/SettingsSection";

const ICON_SIZE = Platform.OS === "android" ? 24 : 22;
Expand Down Expand Up @@ -324,7 +324,7 @@ function RouteRow(props: {
</View>
</View>
{props.editing ? (
<DragHandle
<SettingsDragHandle
title={label}
canMoveUp={props.position > 1}
canMoveDown={props.position < props.count}
Expand All @@ -337,62 +337,3 @@ function RouteRow(props: {
</Reanimated.View>
);
}

/** Pan recognition wins over the settings scroll view only inside the handle. */
function DragHandle(props: {
readonly title: string;
readonly canMoveUp: boolean;
readonly canMoveDown: boolean;
readonly onStart: () => void;
readonly onMove: (translation: number) => void;
readonly onEnd: (translation: number, cancelled: boolean) => void;
readonly onStep: (direction: "up" | "down") => void;
}) {
const latest = useRef(props);
useEffect(() => {
latest.current = props;
});
const translation = useRef(0);
const gesture = useMemo(
() =>
Gesture.Pan()
.minDistance(0)
.shouldCancelWhenOutside(false)
.runOnJS(true)
.onStart(() => {
translation.current = 0;
latest.current.onStart();
})
.onUpdate((event) => {
translation.current = event.translationY;
latest.current.onMove(event.translationY);
})
.onFinalize((_, success) => latest.current.onEnd(translation.current, !success)),
[],
);
return (
<GestureDetector gesture={gesture}>
<View
collapsable={false}
accessible
accessibilityRole="adjustable"
accessibilityLabel={`Reorder ${props.title}`}
accessibilityActions={[
...(props.canMoveUp ? [{ name: "decrement", label: "Move up" }] : []),
...(props.canMoveDown ? [{ name: "increment", label: "Move down" }] : []),
]}
onAccessibilityAction={({ nativeEvent }) => {
if (nativeEvent.actionName === "decrement" && props.canMoveUp) props.onStep("up");
if (nativeEvent.actionName === "increment" && props.canMoveDown) props.onStep("down");
}}
style={{ width: 48, alignSelf: "stretch", alignItems: "center", justifyContent: "center" }}
>
<SymbolView
name="line.3.horizontal"
size={20}
tintColorClassName="accent-foreground-muted"
/>
</View>
</GestureDetector>
);
}
Loading
Loading