mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-04 08:49:52 +00:00
fix: resolve syntax/type errors and player navigation issue
This commit is contained in:
parent
764b4cccf2
commit
00b9b73170
9 changed files with 35 additions and 58 deletions
|
|
@ -13,17 +13,12 @@ import { useTranslation } from 'react-i18next';
|
|||
import { format, addMonths, subMonths, startOfMonth, endOfMonth, eachDayOfInterval, isSameMonth, isToday, isSameDay } from 'date-fns';
|
||||
import Animated, { FadeIn } from 'react-native-reanimated';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
import { CalendarEpisode } from '../../types/calendar';
|
||||
|
||||
const { width } = Dimensions.get('window');
|
||||
const COLUMN_COUNT = 7; // 7 days in a week
|
||||
const DAY_ITEM_SIZE = (width - 32 - 56) / 7; // Slightly smaller than 1/7 to fit all days
|
||||
|
||||
interface CalendarEpisode {
|
||||
id: string;
|
||||
releaseDate: string;
|
||||
// Other properties can be included but aren't needed for the calendar
|
||||
}
|
||||
|
||||
interface DayItemProps {
|
||||
date: Date;
|
||||
isCurrentMonth: boolean;
|
||||
|
|
@ -45,8 +40,7 @@ const DayItem = ({
|
|||
isSelected,
|
||||
hasEvents,
|
||||
onPress
|
||||
}: DayItemProps) => {
|
||||
const { currentTheme } = useTheme();
|
||||
}: DayItemProps) => { const { currentTheme } = useTheme();
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={[
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import Animated, { FadeIn, Layout } from 'react-native-reanimated';
|
|||
import { useCalendarData } from '../../hooks/useCalendarData';
|
||||
import { memoryManager } from '../../utils/memoryManager';
|
||||
import { tmdbService } from '../../services/tmdbService';
|
||||
import { CalendarEpisode } from '../../types/calendar';
|
||||
|
||||
// Compute base sizes; actual tablet sizes will be adjusted inside component for responsiveness
|
||||
const { width } = Dimensions.get('window');
|
||||
|
|
@ -43,7 +44,7 @@ interface ThisWeekEpisode {
|
|||
seriesName: string;
|
||||
title: string;
|
||||
poster: string;
|
||||
releaseDate: string;
|
||||
releaseDate: string | null;
|
||||
season: number;
|
||||
episode: number;
|
||||
isReleased: boolean;
|
||||
|
|
|
|||
|
|
@ -8,27 +8,7 @@ import { logger } from '../utils/logger';
|
|||
import { memoryManager } from '../utils/memoryManager';
|
||||
import { parseISO, isBefore, isAfter, startOfToday, addWeeks, isThisWeek } from 'date-fns';
|
||||
import { StreamingContent } from '../services/catalogService';
|
||||
|
||||
interface CalendarEpisode {
|
||||
id: string;
|
||||
seriesId: string;
|
||||
title: string;
|
||||
seriesName: string;
|
||||
poster: string;
|
||||
releaseDate: string;
|
||||
season: number;
|
||||
episode: number;
|
||||
overview: string;
|
||||
vote_average: number;
|
||||
still_path: string | null;
|
||||
season_poster_path: string | null;
|
||||
addonId?: string;
|
||||
}
|
||||
|
||||
interface CalendarSection {
|
||||
title: string;
|
||||
data: CalendarEpisode[];
|
||||
}
|
||||
import { CalendarEpisode, CalendarSection } from '../types/calendar';
|
||||
|
||||
interface UseCalendarDataReturn {
|
||||
calendarData: CalendarSection[];
|
||||
|
|
@ -303,6 +283,8 @@ export const useCalendarData = (): UseCalendarDataReturn => {
|
|||
// Sort episodes by release date with error handling
|
||||
allEpisodes.sort((a, b) => {
|
||||
try {
|
||||
if (!a.releaseDate) return 1;
|
||||
if (!b.releaseDate) return -1;
|
||||
const dateA = new Date(a.releaseDate).getTime();
|
||||
const dateB = new Date(b.releaseDate).getTime();
|
||||
return dateA - dateB;
|
||||
|
|
|
|||
|
|
@ -33,34 +33,11 @@ import { memoryManager } from '../utils/memoryManager';
|
|||
import { useCalendarData } from '../hooks/useCalendarData';
|
||||
import { AniListService } from '../services/anilist/AniListService';
|
||||
import { AniListAiringSchedule } from '../services/anilist/types';
|
||||
import { CalendarEpisode, CalendarSection } from '../types/calendar';
|
||||
|
||||
const { width } = Dimensions.get('window');
|
||||
const ANDROID_STATUSBAR_HEIGHT = StatusBar.currentHeight || 0;
|
||||
|
||||
interface CalendarEpisode {
|
||||
id: string;
|
||||
seriesId: string;
|
||||
title: string;
|
||||
seriesName: string;
|
||||
poster: string;
|
||||
releaseDate: string | null;
|
||||
season: number;
|
||||
episode: number;
|
||||
overview: string;
|
||||
vote_average: number;
|
||||
still_path: string | null;
|
||||
season_poster_path: string | null;
|
||||
// MAL specific
|
||||
day?: string;
|
||||
time?: string;
|
||||
genres?: string[];
|
||||
}
|
||||
|
||||
interface CalendarSection {
|
||||
title: string;
|
||||
data: CalendarEpisode[];
|
||||
}
|
||||
|
||||
const CalendarScreen = () => {
|
||||
const { t } = useTranslation();
|
||||
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ const MalSettingsScreen: React.FC = () => {
|
|||
Auto Episode Update
|
||||
</Text>
|
||||
<Text style={[styles.settingDescription, { color: currentTheme.colors.mediumEmphasis }]}>
|
||||
Automatically update your progress on MAL when you finish watching an episode (>=90% completion).
|
||||
Automatically update your progress on MAL when you finish watching an episode (>=90% completion).
|
||||
</Text>
|
||||
</View>
|
||||
<Switch
|
||||
|
|
|
|||
|
|
@ -360,6 +360,7 @@ export const useStreamsScreen = () => {
|
|||
const streamsToPass = selectedEpisode ? episodeStreams : groupedStreams;
|
||||
const streamName = stream.name || stream.title || 'Unnamed Stream';
|
||||
const streamProvider = stream.addonId || stream.addonName || stream.name;
|
||||
const releaseDate = type === 'movie' ? metadata?.released : currentEpisode?.air_date;
|
||||
|
||||
// Save stream to cache
|
||||
try {
|
||||
|
|
@ -367,7 +368,6 @@ export const useStreamsScreen = () => {
|
|||
const season = (type === 'series' || type === 'other') ? currentEpisode?.season_number : undefined;
|
||||
const episode = (type === 'series' || type === 'other') ? currentEpisode?.episode_number : undefined;
|
||||
const episodeTitle = (type === 'series' || type === 'other') ? currentEpisode?.name : undefined;
|
||||
const releaseDate = type === 'movie' ? metadata?.released : currentEpisode?.air_date;
|
||||
|
||||
await streamCacheService.saveStreamToCache(
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export const MalApiService = {
|
|||
}
|
||||
},
|
||||
|
||||
getMyListStatus: async (malId: number): Promise<{ list_status?: any; num_episodes: number }> => {
|
||||
getMyListStatus: async (malId: number): Promise<{ my_list_status?: any; num_episodes: number }> => {
|
||||
try {
|
||||
const response = await api.get(`/anime/${malId}`, {
|
||||
params: { fields: 'my_list_status,num_episodes' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mmkvStorage } from '../mmkvStorage';
|
||||
import { MalApiService } from './MalApi';
|
||||
import { MalListStatus } from '../../types/mal';
|
||||
import { MalListStatus, MalAnimeNode } from '../../types/mal';
|
||||
import { catalogService } from '../catalogService';
|
||||
import { ArmSyncService } from './ArmSyncService';
|
||||
import axios from 'axios';
|
||||
|
|
|
|||
23
src/types/calendar.ts
Normal file
23
src/types/calendar.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
export interface CalendarEpisode {
|
||||
id: string;
|
||||
seriesId: string;
|
||||
title: string;
|
||||
seriesName: string;
|
||||
poster: string;
|
||||
releaseDate: string | null;
|
||||
season: number;
|
||||
episode: number;
|
||||
overview: string;
|
||||
vote_average: number;
|
||||
still_path: string | null;
|
||||
season_poster_path: string | null;
|
||||
// MAL specific
|
||||
day?: string;
|
||||
time?: string;
|
||||
genres?: string[];
|
||||
}
|
||||
|
||||
export interface CalendarSection {
|
||||
title: string;
|
||||
data: CalendarEpisode[];
|
||||
}
|
||||
Loading…
Reference in a new issue