diff --git a/app/settings.tsx b/app/settings.tsx index f2e080b..66a4550 100644 --- a/app/settings.tsx +++ b/app/settings.tsx @@ -11,6 +11,7 @@ import { APIConfigSection } from "@/components/settings/APIConfigSection"; import { LiveStreamSection } from "@/components/settings/LiveStreamSection"; import { RemoteInputSection } from "@/components/settings/RemoteInputSection"; import { VideoSourceSection } from "@/components/settings/VideoSourceSection"; +import Toast from "react-native-toast-message"; export default function SettingsScreen() { const { loadSettings, saveSettings, setApiBaseUrl, setM3uUrl } = useSettingsStore(); @@ -20,6 +21,7 @@ export default function SettingsScreen() { const [hasChanges, setHasChanges] = useState(false); const [isLoading, setIsLoading] = useState(false); const [currentFocusIndex, setCurrentFocusIndex] = useState(0); + const [currentSection, setCurrentSection] = useState(null); const saveButtonRef = useRef(null); const apiSectionRef = useRef(null); @@ -39,10 +41,10 @@ export default function SettingsScreen() { const handleRemoteInput = (message: string) => { // Handle remote input based on currently focused section - if (currentFocusIndex === 1 && apiSectionRef.current) { + if (currentSection === "api" && apiSectionRef.current) { // API Config Section setApiBaseUrl(message); - } else if (currentFocusIndex === 2 && liveStreamSectionRef.current) { + } else if (currentSection === "livestream" && liveStreamSectionRef.current) { // Live Stream Section setM3uUrl(message); } @@ -53,6 +55,10 @@ export default function SettingsScreen() { try { await saveSettings(); setHasChanges(false); + Toast.show({ + type: "success", + text1: "保存成功", + }); } catch { Alert.alert("错误", "保存设置失败"); } finally { @@ -66,12 +72,27 @@ export default function SettingsScreen() { const sections = [ { - component: setCurrentFocusIndex(0)} />, + component: ( + { + setCurrentFocusIndex(0); + setCurrentSection("remote"); + }} + /> + ), key: "remote", }, { component: ( - setCurrentFocusIndex(1)} /> + { + setCurrentFocusIndex(1); + setCurrentSection("api"); + }} + /> ), key: "api", }, @@ -80,14 +101,25 @@ export default function SettingsScreen() { setCurrentFocusIndex(2)} + onFocus={() => { + setCurrentFocusIndex(2); + setCurrentSection("livestream"); + }} /> ), key: "livestream", }, { - component: setCurrentFocusIndex(3)} />, - key: "playback", + component: ( + { + setCurrentFocusIndex(3); + setCurrentSection("videoSource"); + }} + /> + ), + key: "videoSource", }, ]; diff --git a/components/PlayerControls.tsx b/components/PlayerControls.tsx index 180ff10..cc9e863 100644 --- a/components/PlayerControls.tsx +++ b/components/PlayerControls.tsx @@ -1,18 +1,6 @@ -import React, { useCallback, useState } from "react"; -import { View, Text, StyleSheet, TouchableOpacity, Pressable } from "react-native"; -import { useRouter } from "expo-router"; -import { AVPlaybackStatus } from "expo-av"; -import { - Pause, - Play, - SkipForward, - List, - ChevronsRight, - ChevronsLeft, - Tv, - ArrowDownToDot, - ArrowUpFromDot, -} from "lucide-react-native"; +import React from "react"; +import { View, Text, StyleSheet, Pressable } from "react-native"; +import { Pause, Play, SkipForward, List, Tv, ArrowDownToDot, ArrowUpFromDot } from "lucide-react-native"; import { ThemedText } from "@/components/ThemedText"; import { MediaButton } from "@/components/MediaButton"; @@ -24,7 +12,6 @@ interface PlayerControlsProps { } export const PlayerControls: React.FC = ({ showControls, setShowControls }) => { - const router = useRouter(); const { detail, currentEpisodeIndex, @@ -33,7 +20,6 @@ export const PlayerControls: React.FC = ({ showControls, se isSeeking, seekPosition, progressPosition, - seek, togglePlayPause, playEpisode, setShowEpisodeModal, diff --git a/services/remoteControlService.ts b/services/remoteControlService.ts index 94f196a..6a3b1d4 100644 --- a/services/remoteControlService.ts +++ b/services/remoteControlService.ts @@ -18,9 +18,9 @@ const getRemotePageHTML = () => {
-

Send a message to TV

- - +

向电视发送文本

+ +