Enhance MetadataScreen by adding haptic feedback for season changes and updating episode selection logic; replace direct season change handler with a new function for improved user experience. Remove haptic feedback from episode selection for a cleaner interaction.

This commit is contained in:
tapframe 2025-05-02 16:43:30 +05:30
parent 94c49a2767
commit 0202c2da2d

View file

@ -279,6 +279,17 @@ const MetadataScreen = () => {
toggleLibrary();
}, [inLibrary, toggleLibrary]);
// Add wrapper for season change with distinctive haptic feedback
const handleSeasonChangeWithHaptics = useCallback((seasonNumber: number) => {
// Change to Light impact for a more subtle feedback
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
// Wait a tiny bit before changing season, making the feedback more noticeable
setTimeout(() => {
handleSeasonChange(seasonNumber);
}, 10);
}, [handleSeasonChange]);
// Add new animated value for watch progress
const watchProgressOpacity = useSharedValue(0);
const watchProgressScaleY = useSharedValue(0);
@ -674,13 +685,15 @@ const MetadataScreen = () => {
}, []); // Empty dependency array as it doesn't depend on component state/props currently
const handleEpisodeSelect = useCallback((episode: Episode) => {
// Removed haptic feedback
const episodeId = episode.stremioId || `${id}:${episode.season_number}:${episode.episode_number}`;
navigation.navigate('Streams', {
id,
type,
episodeId
});
}, [navigation, id, type]); // Added dependencies
}, [navigation, id, type]);
// Animated styles
const containerAnimatedStyle = useAnimatedStyle(() => ({
@ -1312,7 +1325,7 @@ const MetadataScreen = () => {
episodes={episodes}
selectedSeason={selectedSeason}
loadingSeasons={loadingSeasons}
onSeasonChange={handleSeasonChange}
onSeasonChange={handleSeasonChangeWithHaptics}
onSelectEpisode={handleEpisodeSelect}
groupedEpisodes={groupedEpisodes}
metadata={metadata}