mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-15 12:24:44 +08:00
feat: implement user authentication and logout functionality
- Added login/logout buttons to the HomeScreen and SettingsScreen. - Integrated authentication state management using Zustand and cookies. - Updated API to support username and password for login. - Enhanced PlayScreen to handle video playback based on user authentication. - Created a new detailStore to manage video details and sources. - Refactored playerStore to utilize detailStore for episode management. - Added sourceStore to manage video source toggling. - Updated settingsStore to fetch server configuration. - Improved error handling and user feedback with Toast notifications. - Cleaned up unused code and optimized imports across components.
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import React from "react";
|
||||
import { View, Text, StyleSheet, Modal, FlatList } from "react-native";
|
||||
import { StyledButton } from "./StyledButton";
|
||||
import useDetailStore from "@/stores/detailStore";
|
||||
import usePlayerStore from "@/stores/playerStore";
|
||||
|
||||
export const SourceSelectionModal: React.FC = () => {
|
||||
const { showSourceModal, sources, currentSourceIndex, switchSource, setShowSourceModal } = usePlayerStore();
|
||||
const { showSourceModal, setShowSourceModal } = usePlayerStore();
|
||||
const { searchResults, detail, setDetail } = useDetailStore();
|
||||
|
||||
const onSelectSource = (index: number) => {
|
||||
if (index !== currentSourceIndex) {
|
||||
switchSource(index);
|
||||
if (searchResults[index].source !== detail?.source) {
|
||||
setDetail(searchResults[index]);
|
||||
}
|
||||
setShowSourceModal(false);
|
||||
};
|
||||
@@ -23,16 +25,16 @@ export const SourceSelectionModal: React.FC = () => {
|
||||
<View style={styles.modalContent}>
|
||||
<Text style={styles.modalTitle}>选择播放源</Text>
|
||||
<FlatList
|
||||
data={sources}
|
||||
data={searchResults}
|
||||
numColumns={3}
|
||||
contentContainerStyle={styles.sourceList}
|
||||
keyExtractor={(item, index) => `source-${item.source}-${item.id}-${index}`}
|
||||
keyExtractor={(item, index) => `source-${item.source}-${index}`}
|
||||
renderItem={({ item, index }) => (
|
||||
<StyledButton
|
||||
text={item.source_name}
|
||||
onPress={() => onSelectSource(index)}
|
||||
isSelected={currentSourceIndex === index}
|
||||
hasTVPreferredFocus={currentSourceIndex === index}
|
||||
isSelected={detail?.source === item.source}
|
||||
hasTVPreferredFocus={detail?.source === item.source}
|
||||
style={styles.sourceItem}
|
||||
textStyle={styles.sourceItemText}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user