mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 14:53:24 +00:00
feat: autoplay toggle and setting
This commit is contained in:
@@ -36,7 +36,8 @@ const themeOptions: ThemeStoreOption[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export default function SettingsScreen() {
|
export default function SettingsScreen() {
|
||||||
const { gestureControls, setGestureControls } = usePlayerSettingsStore();
|
const { gestureControls, setGestureControls, autoPlay, setAutoPlay } =
|
||||||
|
usePlayerSettingsStore();
|
||||||
const toastController = useToastController();
|
const toastController = useToastController();
|
||||||
|
|
||||||
const handleGestureControlsToggle = async (isEnabled: boolean) => {
|
const handleGestureControlsToggle = async (isEnabled: boolean) => {
|
||||||
@@ -85,6 +86,13 @@ export default function SettingsScreen() {
|
|||||||
<MWSwitch.Thumb animation="quicker" />
|
<MWSwitch.Thumb animation="quicker" />
|
||||||
</MWSwitch>
|
</MWSwitch>
|
||||||
</XStack>
|
</XStack>
|
||||||
|
<XStack width={200} alignItems="center" gap="$4">
|
||||||
|
<Label minWidth={110}>Autoplay</Label>
|
||||||
|
<Separator minHeight={20} vertical />
|
||||||
|
<MWSwitch checked={autoPlay} onCheckedChange={setAutoPlay}>
|
||||||
|
<MWSwitch.Thumb animation="quicker" />
|
||||||
|
</MWSwitch>
|
||||||
|
</XStack>
|
||||||
</YStack>
|
</YStack>
|
||||||
</View>
|
</View>
|
||||||
<View justifyContent="center" alignItems="center">
|
<View justifyContent="center" alignItems="center">
|
||||||
|
@@ -46,6 +46,8 @@ export const useThemeSettingsStore = create<
|
|||||||
interface PlayerStoreState {
|
interface PlayerStoreState {
|
||||||
gestureControls: boolean;
|
gestureControls: boolean;
|
||||||
setGestureControls: (enabled: boolean) => void;
|
setGestureControls: (enabled: boolean) => void;
|
||||||
|
autoPlay: boolean;
|
||||||
|
setAutoPlay: (enabled: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const usePlayerSettingsStore = create<
|
export const usePlayerSettingsStore = create<
|
||||||
@@ -61,6 +63,8 @@ export const usePlayerSettingsStore = create<
|
|||||||
}),
|
}),
|
||||||
setGestureControls: (enabled: boolean) =>
|
setGestureControls: (enabled: boolean) =>
|
||||||
set({ gestureControls: enabled }),
|
set({ gestureControls: enabled }),
|
||||||
|
autoPlay: true,
|
||||||
|
setAutoPlay: (enabled: boolean) => set({ autoPlay: enabled }),
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: "player-settings",
|
name: "player-settings",
|
||||||
|
Reference in New Issue
Block a user