mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 12:33:26 +00:00
refactor: default gesture controls to off on android bc android is funny
This commit is contained in:
@@ -2,6 +2,7 @@ import type { SelectProps } from "tamagui";
|
||||
import React from "react";
|
||||
import { TouchableOpacity } from "react-native-gesture-handler";
|
||||
import * as Application from "expo-application";
|
||||
import * as Brightness from "expo-brightness";
|
||||
import * as Linking from "expo-linking";
|
||||
import { FontAwesome, MaterialIcons } from "@expo/vector-icons";
|
||||
import { useToastController } from "@tamagui/toast";
|
||||
@@ -38,8 +39,15 @@ export default function SettingsScreen() {
|
||||
const { gestureControls, setGestureControls } = usePlayerSettingsStore();
|
||||
const toastController = useToastController();
|
||||
|
||||
const handleGestureControlsToggle = (isEnabled: boolean) => {
|
||||
setGestureControls(isEnabled);
|
||||
const handleGestureControlsToggle = async (isEnabled: boolean) => {
|
||||
if (isEnabled) {
|
||||
const { status } = await Brightness.requestPermissionsAsync();
|
||||
if (status === Brightness.PermissionStatus.GRANTED) {
|
||||
setGestureControls(isEnabled);
|
||||
}
|
||||
} else {
|
||||
setGestureControls(isEnabled);
|
||||
}
|
||||
};
|
||||
|
||||
const handleVersionPress = async () => {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useCallback, useState } from "react";
|
||||
import { useSharedValue } from "react-native-reanimated";
|
||||
import * as Brightness from "expo-brightness";
|
||||
|
||||
@@ -7,22 +7,6 @@ export const useBrightness = () => {
|
||||
|
||||
const brightness = useSharedValue(0.5);
|
||||
|
||||
useEffect(() => {
|
||||
async function init() {
|
||||
try {
|
||||
const { status } = await Brightness.requestPermissionsAsync();
|
||||
if (status === Brightness.PermissionStatus.GRANTED) {
|
||||
const currentBrightness = await Brightness.getBrightnessAsync();
|
||||
brightness.value = currentBrightness;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to get brightness permissions:", error);
|
||||
}
|
||||
}
|
||||
|
||||
void init();
|
||||
}, [brightness]);
|
||||
|
||||
const handleBrightnessChange = useCallback(async (newValue: number) => {
|
||||
try {
|
||||
await Brightness.setBrightnessAsync(newValue);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import type { StateStorage } from "zustand/middleware";
|
||||
import { Platform } from "react-native";
|
||||
import { MMKV } from "react-native-mmkv";
|
||||
import { create } from "zustand";
|
||||
import { createJSONStorage, persist } from "zustand/middleware";
|
||||
@@ -53,7 +54,11 @@ export const usePlayerSettingsStore = create<
|
||||
>(
|
||||
persist(
|
||||
(set) => ({
|
||||
gestureControls: true,
|
||||
gestureControls: Platform.select({
|
||||
ios: true,
|
||||
android: false,
|
||||
default: true,
|
||||
}),
|
||||
setGestureControls: (enabled: boolean) =>
|
||||
set({ gestureControls: enabled }),
|
||||
}),
|
||||
|
Reference in New Issue
Block a user