@zezosoft/zezo-ott-react-native-ui-kit 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -36
- package/package.json +1 -3
- package/src/assets/animations/135037-payment-processing-error.json +0 -1347
- package/src/assets/animations/7227-vui-animation.json +0 -3377
- package/src/assets/animations/Failed.json +0 -2103
- package/src/assets/animations/Pending.json +0 -522
- package/src/assets/animations/Successful.json +0 -2289
- package/src/assets/animations/heart.json +0 -788
- package/src/assets/animations/succesfull-payment.json +0 -2379
- package/src/assets/animations/voice-icon.json +0 -542
- package/src/assets/img/back.png +0 -0
- package/src/assets/img/bottom-panel.png +0 -0
- package/src/assets/img/camera.png +0 -0
- package/src/assets/img/camera2.png +0 -0
- package/src/assets/img/home.png +0 -0
- package/src/assets/img/lock.png +0 -0
- package/src/assets/img/play.png +0 -0
- package/src/assets/img/profile.jpg +0 -0
- package/src/assets/img/qr-code.png +0 -0
- package/src/assets/img/shadow.png +0 -0
- package/src/assets/img/shadow2.png +0 -0
- package/src/assets/img/user.png +0 -0
- package/src/assets/svg/Account.svg +0 -4
- package/src/assets/svg/Favourite.svg +0 -14
- package/src/assets/svg/Upcoming.svg +0 -4
- package/src/assets/svg/content-error.svg +0 -28
- package/src/assets/svg/download.svg +0 -3
- package/src/assets/svg/eye-off.svg +0 -10
- package/src/assets/svg/favorites.svg +0 -3
- package/src/assets/svg/h.svg +0 -4
- package/src/assets/svg/home.svg +0 -5
- package/src/assets/svg/home1.svg +0 -3
- package/src/assets/svg/menu-bar.svg +0 -4
- package/src/assets/svg/my-space.svg +0 -14
- package/src/assets/svg/play-icon-with-bg.svg +0 -5
- package/src/assets/svg/profile.svg +0 -4
- package/src/assets/svg/search.svg +0 -5
- package/src/assets/svg/search1.svg +0 -4
- package/src/assets/svg/server-error.svg +0 -139
- package/src/components/Account/Account.tsx +0 -354
- package/src/components/Account/index.ts +0 -6
- package/src/components/Alert/AlertDialog.tsx +0 -253
- package/src/components/Alert/UAAlert.tsx +0 -176
- package/src/components/Alert/index.ts +0 -7
- package/src/components/Auth/AuthProvider/AuthProvider.tsx +0 -412
- package/src/components/Auth/One/ForgotPassword/ForgotPassword.tsx +0 -333
- package/src/components/Auth/One/Login/LoginWithEmail.tsx +0 -449
- package/src/components/Auth/One/Login/LoginWithPhone.tsx +0 -309
- package/src/components/Auth/One/OTP/OTP.tsx +0 -539
- package/src/components/Auth/One/QrLogin/QrLogin.tsx +0 -329
- package/src/components/Auth/One/QrLogin/components/index.ts +0 -8
- package/src/components/Auth/One/QrLogin/components/qr-scanner-fallback.tsx +0 -158
- package/src/components/Auth/One/QrLogin/components/qr-scanner-frame.tsx +0 -207
- package/src/components/Auth/One/QrLogin/components/qr-scanner-header.tsx +0 -65
- package/src/components/Auth/One/QrLogin/components/qr-scanner-intro.tsx +0 -255
- package/src/components/Auth/One/QrLogin/components/qr-scanner-overlay.tsx +0 -291
- package/src/components/Auth/One/SignUp/SignUp.tsx +0 -470
- package/src/components/Auth/One/SplashScreen/SplashScreen.tsx +0 -229
- package/src/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.tsx +0 -92
- package/src/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.tsx +0 -129
- package/src/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.tsx +0 -172
- package/src/components/Auth/One/SplashScreen/utils/splashUtils.ts +0 -23
- package/src/components/Auth/One/index.ts +0 -24
- package/src/components/Auth/Two/AuthHeader/AuthHeader.tsx +0 -130
- package/src/components/Auth/Two/ForgotPassword/ForgotPassword.tsx +0 -331
- package/src/components/Auth/Two/Login/EmailOrPhoneLogin.tsx +0 -612
- package/src/components/Auth/Two/OTP/OTP.tsx +0 -504
- package/src/components/Auth/Two/SignUp/SignUp.tsx +0 -439
- package/src/components/Auth/Two/index.ts +0 -20
- package/src/components/Auth/index.ts +0 -16
- package/src/components/BackgroundLayout/One/One.tsx +0 -184
- package/src/components/BackgroundLayout/Two/Two.tsx +0 -65
- package/src/components/BackgroundLayout/index.ts +0 -14
- package/src/components/BlogView/BlogView.tsx +0 -282
- package/src/components/BlogView/index.ts +0 -8
- package/src/components/BlurView/BlurView.tsx +0 -199
- package/src/components/BlurView/index.ts +0 -7
- package/src/components/BottomSheet/BottomSheet.tsx +0 -204
- package/src/components/BottomSheet/BottomSheetOne.tsx +0 -223
- package/src/components/BottomSheet/index.ts +0 -9
- package/src/components/Button/BackBtn.tsx +0 -149
- package/src/components/Button/MenuBtn.tsx +0 -220
- package/src/components/Button/PrimaryBtn.tsx +0 -123
- package/src/components/Button/SecondaryBtn.tsx +0 -123
- package/src/components/Button/TextButton.tsx +0 -150
- package/src/components/Button/index.ts +0 -18
- package/src/components/Button/types.ts +0 -33
- package/src/components/Content/Card/Category/Category.tsx +0 -436
- package/src/components/Content/Card/Category/CategroyTwo.tsx +0 -429
- package/src/components/Content/Card/NowWatching/NowWatching.tsx +0 -607
- package/src/components/Content/Card/Sliders/Styles/One.tsx +0 -490
- package/src/components/Content/Card/Sliders/Styles/Three.tsx +0 -1017
- package/src/components/Content/Card/Sliders/Styles/Two.tsx +0 -395
- package/src/components/Content/Card/Sliders/index.ts +0 -18
- package/src/components/Content/Card/Styles/Five.tsx +0 -367
- package/src/components/Content/Card/Styles/Four.tsx +0 -366
- package/src/components/Content/Card/Styles/One.tsx +0 -372
- package/src/components/Content/Card/Styles/RotateInOut.tsx +0 -413
- package/src/components/Content/Card/Styles/Six.tsx +0 -378
- package/src/components/Content/Card/Styles/Three.tsx +0 -312
- package/src/components/Content/Card/Styles/TopTen.tsx +0 -402
- package/src/components/Content/Card/Styles/Two.tsx +0 -404
- package/src/components/Content/Card/components/AdsPoster.tsx +0 -207
- package/src/components/Content/Card/components/CardPoster.tsx +0 -377
- package/src/components/Content/Card/components/LiveBadge.tsx +0 -125
- package/src/components/Content/Card/components/NavigateToMore.tsx +0 -97
- package/src/components/Content/Card/components/RentOrBuyIcon.tsx +0 -134
- package/src/components/Content/Card/components/ShowAllButton.tsx +0 -92
- package/src/components/Content/Card/components/ThumbnailCard.tsx +0 -219
- package/src/components/Content/Card/components/index.ts +0 -12
- package/src/components/Content/Card/index.ts +0 -31
- package/src/components/Content/Content.tsx +0 -338
- package/src/components/Content/Sections.tsx +0 -239
- package/src/components/Content/types.ts +0 -180
- package/src/components/ContentView/MoreContentList.tsx +0 -330
- package/src/components/ContentView/One/ContentViewOne.tsx +0 -251
- package/src/components/ContentView/One/components/CastCard.tsx +0 -266
- package/src/components/ContentView/One/components/HeroBanner.tsx +0 -413
- package/src/components/ContentView/One/components/MiniInfo.tsx +0 -343
- package/src/components/ContentView/One/components/Title.tsx +0 -149
- package/src/components/ContentView/Two/ContentViewTwo.tsx +0 -332
- package/src/components/ContentView/Two/components/Details.tsx +0 -196
- package/src/components/ContentView/Two/components/HeroBanner.tsx +0 -267
- package/src/components/ContentView/Two/components/LikeShareActions.tsx +0 -125
- package/src/components/ContentView/Two/components/MoreLikeThisContentList .tsx +0 -308
- package/src/components/ContentView/Two/components/PlayOrTrailer.tsx +0 -162
- package/src/components/ContentView/Two/components/SectionTabs.tsx +0 -181
- package/src/components/ContentView/Two/components/Title.tsx +0 -229
- package/src/components/ContentView/Two/components/index.ts +0 -12
- package/src/components/ContentView/index.ts +0 -13
- package/src/components/ContentView/shared/AboutSection.tsx +0 -226
- package/src/components/ContentView/shared/EpisodeCard.tsx +0 -600
- package/src/components/ContentView/shared/GenreTags.tsx +0 -189
- package/src/components/ContentView/shared/PlayButton.tsx +0 -52
- package/src/components/ContentView/shared/TrailerButton.tsx +0 -76
- package/src/components/Fallbacks/NoContentFallback.tsx +0 -175
- package/src/components/Fallbacks/NotFoundFallback.tsx +0 -94
- package/src/components/Fallbacks/index.ts +0 -7
- package/src/components/Headers/AppHeader.tsx +0 -151
- package/src/components/Headers/Four.tsx +0 -84
- package/src/components/Headers/One.tsx +0 -115
- package/src/components/Headers/Three.tsx +0 -137
- package/src/components/Headers/Two.tsx +0 -101
- package/src/components/Headers/index.ts +0 -34
- package/src/components/Input/Input.ts +0 -18
- package/src/components/Input/InputOne.tsx +0 -265
- package/src/components/Input/InputThree.tsx +0 -205
- package/src/components/Input/InputTwo.tsx +0 -217
- package/src/components/Input/PhoneInput/One/One.tsx +0 -415
- package/src/components/Input/PhoneInput/Two/Two.tsx +0 -406
- package/src/components/Input/PhoneInput/index.ts +0 -14
- package/src/components/Keyboard/HideKeyboard.tsx +0 -91
- package/src/components/Loader/Loader.tsx +0 -49
- package/src/components/Logo/Logo.tsx +0 -150
- package/src/components/NewRelease/NewReleaseSheet.tsx +0 -260
- package/src/components/NewRelease/index.ts +0 -6
- package/src/components/Reels/ReelsSeries/MediaControls/BottomControls.tsx +0 -226
- package/src/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.tsx +0 -324
- package/src/components/Reels/ReelsSeries/MediaControls/MiddleControls.tsx +0 -201
- package/src/components/Reels/ReelsSeries/MediaControls/RightControls.tsx +0 -100
- package/src/components/Reels/ReelsSeries/MediaControls/TopControls.tsx +0 -168
- package/src/components/Reels/ReelsSeries/Model/DetailsModal.tsx +0 -207
- package/src/components/Reels/ReelsSeries/Model/SettingModal.tsx +0 -151
- package/src/components/Reels/ReelsSeries/Model/UnlockModal.tsx +0 -159
- package/src/components/Reels/ReelsSeries/ReelsSeries.tsx +0 -278
- package/src/components/Reels/ReelsSeries/ReelsSeriesItem.tsx +0 -569
- package/src/components/Reels/ReelsSeries/components/AnimatedThreeLines.tsx +0 -189
- package/src/components/Reels/ReelsSeries/components/Episodes.tsx +0 -159
- package/src/components/Reels/ReelsSeries/components/GradientOverlay.tsx +0 -46
- package/src/components/Reels/ReelsSeries/components/Like.tsx +0 -45
- package/src/components/Reels/ReelsSeries/components/RotatingLoader.tsx +0 -84
- package/src/components/Reels/ReelsSeries/components/Synopsis.tsx +0 -338
- package/src/components/Reels/ReelsSeries/components/VideoControls/QualityControl.tsx +0 -185
- package/src/components/Reels/ReelsSeries/components/VideoControls/SpeedControl.tsx +0 -77
- package/src/components/Reels/ReelsSeries/components/VideoControls/index.ts +0 -7
- package/src/components/Reels/ReelsSeries/types.ts +0 -78
- package/src/components/Reels/ReelsSeries/useReelsWatchProgress.ts +0 -90
- package/src/components/Reels/ReelsSeries/utils/quality.ts +0 -72
- package/src/components/Reels/index.ts +0 -9
- package/src/components/Reels/utils/Controls/gestureUtils.ts +0 -46
- package/src/components/Reels/utils/Controls/index.ts +0 -9
- package/src/components/Reels/utils/Controls/overlayUtils.ts +0 -40
- package/src/components/Reels/utils/Controls/videoControlsConstants.ts +0 -30
- package/src/components/Reels/utils/Controls/videoRef.ts +0 -9
- package/src/components/Reels/utils/index.ts +0 -6
- package/src/components/Reels/utils/timeoutUtils.ts +0 -34
- package/src/components/Search/One.tsx +0 -262
- package/src/components/Search/components/RecentSearchesSection.tsx +0 -181
- package/src/components/Search/components/SearchCard.tsx +0 -285
- package/src/components/Search/index.ts +0 -16
- package/src/components/Settings/AppSettings.tsx +0 -442
- package/src/components/Settings/index.ts +0 -6
- package/src/components/Subscription/SubOne.tsx +0 -423
- package/src/components/Subscription/components/SubsDetailsModal.tsx +0 -347
- package/src/components/Subscription/components/SubscriptionCard.tsx +0 -342
- package/src/components/Subscription/index.ts +0 -12
- package/src/components/TabBar/One.tsx +0 -145
- package/src/components/TabBar/Three.tsx +0 -162
- package/src/components/TabBar/Two.tsx +0 -179
- package/src/components/TabBar/index.ts +0 -20
- package/src/components/Text/Text.tsx +0 -90
- package/src/components/Text/index.ts +0 -6
- package/src/components/User/DeviceSessions/DeviceSessions.tsx +0 -468
- package/src/components/User/ProfileUpdate/ProfileUpdate.tsx +0 -293
- package/src/components/User/PurchaseHistory/PurchaseHistory.tsx +0 -504
- package/src/components/User/WatchHistory/WatchHistory.tsx +0 -214
- package/src/components/User/WatchLater/WatchLater.tsx +0 -400
- package/src/components/User/components/UserAvatar.tsx +0 -121
- package/src/components/User/components/UserSection.tsx +0 -218
- package/src/components/User/index.ts +0 -18
- package/src/components/View/View.tsx +0 -38
- package/src/components/View/index.ts +0 -6
- package/src/components/common/AppStatusBar.tsx +0 -57
- package/src/components/common/index.ts +0 -1
- package/src/components/index.ts +0 -30
- package/src/components/layout/SafeAreaWrapper.tsx +0 -50
- package/src/components/layout/index.ts +0 -6
- package/src/constants/dummySections.ts +0 -103
- package/src/hooks/Images/index.ts +0 -6
- package/src/hooks/Images/useImageLoader.ts +0 -209
- package/src/hooks/index.ts +0 -16
- package/src/hooks/useAdTracking.ts +0 -354
- package/src/hooks/useCards.ts +0 -247
- package/src/hooks/useDebounce.ts +0 -40
- package/src/hooks/useKeyboard.ts +0 -43
- package/src/hooks/useNavigationMode.ts +0 -48
- package/src/hooks/usePaginatedSection.ts +0 -108
- package/src/hooks/usePrevious.ts +0 -28
- package/src/hooks/useSafeCallback.ts +0 -29
- package/src/hooks/useSkeletonItems.ts +0 -30
- package/src/hooks/useSplashCache.ts +0 -245
- package/src/index.tsx +0 -9
- package/src/store/RecentSearchesStore.ts +0 -72
- package/src/store/splashStore.ts +0 -86
- package/src/store/storage.ts +0 -29
- package/src/theme/ThemeContext.ts +0 -19
- package/src/theme/ThemeProvider.tsx +0 -87
- package/src/theme/hooks/index.ts +0 -6
- package/src/theme/hooks/useTheme.ts +0 -118
- package/src/theme/index.ts +0 -8
- package/src/theme/store/theme.ts +0 -50
- package/src/theme/themes.ts +0 -262
- package/src/theme/utils/cleanColors.ts +0 -71
- package/src/theme/utils/toRgba.ts +0 -150
- package/src/types/content/content-view.types.ts +0 -209
- package/src/types/hook/index.ts +0 -6
- package/src/types/hook/usePaginatedSection.ts +0 -20
- package/src/types/index.ts +0 -10
- package/src/types/navigation.ts +0 -17
- package/src/types/sections/index.ts +0 -87
- package/src/types/user.ts +0 -18
- package/src/utils/Display.ts +0 -15
- package/src/utils/Formater.ts +0 -33
- package/src/utils/SizeMatters.ts +0 -8
- package/src/utils/Spacing.ts +0 -27
- package/src/utils/colorUtils.ts +0 -70
- package/src/utils/imageValidation.ts +0 -36
- package/src/utils/interaction.ts +0 -19
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @LastModified Mon 13 Jul 2026 at 10:13 AM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, {
|
|
7
|
-
useState,
|
|
8
|
-
useEffect,
|
|
9
|
-
useRef,
|
|
10
|
-
useCallback,
|
|
11
|
-
useMemo,
|
|
12
|
-
memo,
|
|
13
|
-
} from 'react';
|
|
14
|
-
import { View, Dimensions, StyleSheet } from 'react-native';
|
|
15
|
-
import {
|
|
16
|
-
SelectedVideoTrackType,
|
|
17
|
-
Video,
|
|
18
|
-
type OnProgressData,
|
|
19
|
-
} from 'react-native-video';
|
|
20
|
-
import {
|
|
21
|
-
GestureDetector,
|
|
22
|
-
GestureHandlerRootView,
|
|
23
|
-
} from 'react-native-gesture-handler';
|
|
24
|
-
|
|
25
|
-
import type {
|
|
26
|
-
ILikeMoreData,
|
|
27
|
-
IReelsWatchProgress,
|
|
28
|
-
ISeriesEpisode,
|
|
29
|
-
ISeriesItem,
|
|
30
|
-
ModalState,
|
|
31
|
-
OnVideoProgress,
|
|
32
|
-
OnVideoProgressCurrentTrack,
|
|
33
|
-
} from './types';
|
|
34
|
-
import type { ITheme } from '../../../theme';
|
|
35
|
-
import {
|
|
36
|
-
videoRef,
|
|
37
|
-
videoControlsStyles,
|
|
38
|
-
PAUSE_ICON_TIMEOUT,
|
|
39
|
-
LIKE_ANIM_TIMEOUT,
|
|
40
|
-
UNLOCK_MODAL_DELAY,
|
|
41
|
-
useOverlayThresholds,
|
|
42
|
-
useIsInOverlay,
|
|
43
|
-
useCreateTapGesture,
|
|
44
|
-
useCombinedGesture,
|
|
45
|
-
} from '../utils/Controls';
|
|
46
|
-
import { clearTimeoutSafely, setTimeoutSafely } from '../utils';
|
|
47
|
-
import MediaControlsProvider from './MediaControls/MediaControlsProvider';
|
|
48
|
-
import FastImage, { type ImageStyle } from 'react-native-fast-image';
|
|
49
|
-
import type { QualityOption } from './utils/quality';
|
|
50
|
-
|
|
51
|
-
const INITIAL_MODAL_STATE: ModalState = {
|
|
52
|
-
type: 'none',
|
|
53
|
-
isVisible: false,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const MIN_VIEW_DURATION_SEC = 5;
|
|
57
|
-
|
|
58
|
-
interface IReelItemProps {
|
|
59
|
-
reel: ISeriesEpisode;
|
|
60
|
-
data: ISeriesItem;
|
|
61
|
-
autoScroll?: boolean;
|
|
62
|
-
videoHeight: number;
|
|
63
|
-
onLikePress?: (data: { id: string; liked: boolean }) => void;
|
|
64
|
-
onEpisodesPress?: () => void;
|
|
65
|
-
onSharePress?: () => void;
|
|
66
|
-
isVisible: boolean;
|
|
67
|
-
preload: boolean;
|
|
68
|
-
activeEpisodeIndex: number;
|
|
69
|
-
isFullScreen: boolean;
|
|
70
|
-
onEpisodeSelect: (episode: ISeriesEpisode) => void;
|
|
71
|
-
theme: ITheme;
|
|
72
|
-
onBackPress?: () => void;
|
|
73
|
-
onSearchPress?: () => void;
|
|
74
|
-
onLikeMorePress?: (item: ILikeMoreData) => void;
|
|
75
|
-
onEpisodeUnlockPress?: (episode: ISeriesEpisode) => void;
|
|
76
|
-
onViewCount?: (data: { id: string }) => void;
|
|
77
|
-
onWatchProgress?: (data: IReelsWatchProgress) => void;
|
|
78
|
-
onAutoScrollNext?: () => void;
|
|
79
|
-
onVideoProgress?: (progress: OnVideoProgress) => void;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const ReelItem: React.FC<IReelItemProps> = ({
|
|
83
|
-
reel,
|
|
84
|
-
data,
|
|
85
|
-
autoScroll,
|
|
86
|
-
videoHeight,
|
|
87
|
-
onLikePress,
|
|
88
|
-
onSharePress,
|
|
89
|
-
onBackPress,
|
|
90
|
-
isVisible,
|
|
91
|
-
isFullScreen,
|
|
92
|
-
preload,
|
|
93
|
-
activeEpisodeIndex,
|
|
94
|
-
onEpisodeSelect,
|
|
95
|
-
onSearchPress,
|
|
96
|
-
onLikeMorePress,
|
|
97
|
-
onEpisodeUnlockPress,
|
|
98
|
-
onViewCount,
|
|
99
|
-
theme,
|
|
100
|
-
onWatchProgress,
|
|
101
|
-
onAutoScrollNext,
|
|
102
|
-
onVideoProgress,
|
|
103
|
-
}) => {
|
|
104
|
-
// State
|
|
105
|
-
const [buffering, setBuffering] = useState(true);
|
|
106
|
-
const [isPaused, setIsPaused] = useState(false);
|
|
107
|
-
const [showPauseIcon, setShowPauseIcon] = useState<boolean | null>(null);
|
|
108
|
-
const [modal, setModal] = useState<ModalState>(INITIAL_MODAL_STATE);
|
|
109
|
-
const [unlockModalVisible, setUnlockModalVisible] = useState(false);
|
|
110
|
-
const [unlockModalDismissed, setUnlockModalDismissed] = useState(false);
|
|
111
|
-
const [showLikeAnim, setShowLikeAnim] = useState(false);
|
|
112
|
-
const [currentTime, setCurrentTime] = useState(0);
|
|
113
|
-
const [duration, setDuration] = useState(0);
|
|
114
|
-
const [playbackRate, setPlaybackRate] = useState(1);
|
|
115
|
-
const [videoQuality, setVideoQuality] = useState<QualityOption>({
|
|
116
|
-
quality: 'Auto',
|
|
117
|
-
url: '',
|
|
118
|
-
});
|
|
119
|
-
const [isLiked, setIsLiked] = useState(() => Boolean(data.isLiked));
|
|
120
|
-
const [likesCount, setLikesCount] = useState(() => Number(data.likes) || 0);
|
|
121
|
-
const [hasError, setHasError] = useState(false);
|
|
122
|
-
const [activeResolution, setActiveResolution] = useState<string>('');
|
|
123
|
-
|
|
124
|
-
// Refs
|
|
125
|
-
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
126
|
-
const likeAnimTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
127
|
-
const viewCountedRef = useRef(false);
|
|
128
|
-
const autoScrolledRef = useRef(false);
|
|
129
|
-
|
|
130
|
-
// Constants
|
|
131
|
-
const isLocked = reel.isLocked;
|
|
132
|
-
const videoUri = useMemo(() => reel.videoUrl || '', [reel.videoUrl]);
|
|
133
|
-
const thumbnail = data.thumbnail;
|
|
134
|
-
|
|
135
|
-
// Overlay thresholds
|
|
136
|
-
const { rightThreshold, bottomThreshold } = useOverlayThresholds(videoHeight);
|
|
137
|
-
|
|
138
|
-
// Computed values
|
|
139
|
-
const finalPause = useMemo(
|
|
140
|
-
() => isLocked || !isVisible || modal.isVisible || isPaused || hasError,
|
|
141
|
-
[isLocked, isVisible, modal.isVisible, isPaused, hasError]
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const showCenterControls = useMemo(
|
|
145
|
-
() => showPauseIcon || buffering || isLocked || hasError,
|
|
146
|
-
[showPauseIcon, buffering, isLocked, hasError]
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
// Handlers
|
|
150
|
-
const closeUnlockModal = useCallback(() => {
|
|
151
|
-
setUnlockModalVisible(false);
|
|
152
|
-
setUnlockModalDismissed(true); // Prevent auto-open after manual close
|
|
153
|
-
}, []);
|
|
154
|
-
|
|
155
|
-
const closeAllModals = useCallback(() => {
|
|
156
|
-
setModal(INITIAL_MODAL_STATE);
|
|
157
|
-
closeUnlockModal();
|
|
158
|
-
}, [closeUnlockModal]);
|
|
159
|
-
|
|
160
|
-
const openUnlockModal = useCallback(() => {
|
|
161
|
-
setUnlockModalVisible(true);
|
|
162
|
-
}, []);
|
|
163
|
-
|
|
164
|
-
// Reset view-counted flag when episode changes
|
|
165
|
-
useEffect(() => {
|
|
166
|
-
viewCountedRef.current = false;
|
|
167
|
-
autoScrolledRef.current = false;
|
|
168
|
-
}, [reel.episodeId]);
|
|
169
|
-
|
|
170
|
-
// Reset video timing and quality state when episode changes
|
|
171
|
-
useEffect(() => {
|
|
172
|
-
setCurrentTime(0);
|
|
173
|
-
setDuration(0);
|
|
174
|
-
setBuffering(true);
|
|
175
|
-
setHasError(false);
|
|
176
|
-
setVideoQuality({
|
|
177
|
-
quality: 'Auto',
|
|
178
|
-
url: '',
|
|
179
|
-
});
|
|
180
|
-
setActiveResolution('');
|
|
181
|
-
}, [reel.episodeId]);
|
|
182
|
-
|
|
183
|
-
// Sync like state from parent when episode changes or parent updates data
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
setIsLiked(Boolean(data.isLiked));
|
|
186
|
-
setLikesCount(Number(data.likes) || 0);
|
|
187
|
-
}, [reel.episodeId, data.isLiked, data.likes]);
|
|
188
|
-
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
if (!isVisible) {
|
|
191
|
-
setShowPauseIcon(null);
|
|
192
|
-
setModal((prev) =>
|
|
193
|
-
prev.isVisible ? { ...prev, isVisible: false } : prev
|
|
194
|
-
);
|
|
195
|
-
setUnlockModalVisible(false);
|
|
196
|
-
setUnlockModalDismissed(false);
|
|
197
|
-
setHasError(false);
|
|
198
|
-
}
|
|
199
|
-
}, [isVisible]);
|
|
200
|
-
|
|
201
|
-
useEffect(() => {
|
|
202
|
-
if (isVisible && isLocked && !unlockModalVisible && !unlockModalDismissed) {
|
|
203
|
-
setIsPaused(true);
|
|
204
|
-
setUnlockModalDismissed(true);
|
|
205
|
-
}
|
|
206
|
-
}, [isVisible, isLocked, unlockModalVisible, unlockModalDismissed]);
|
|
207
|
-
|
|
208
|
-
useEffect(() => {
|
|
209
|
-
return () => {
|
|
210
|
-
clearTimeoutSafely(timeoutRef);
|
|
211
|
-
clearTimeoutSafely(likeAnimTimeoutRef);
|
|
212
|
-
};
|
|
213
|
-
}, []);
|
|
214
|
-
|
|
215
|
-
const handleLikePress = useCallback(() => {
|
|
216
|
-
const newLiked = !isLiked;
|
|
217
|
-
const count = Number(likesCount) || 0;
|
|
218
|
-
const newCount = newLiked ? count + 1 : Math.max(0, count - 1);
|
|
219
|
-
|
|
220
|
-
setIsLiked(newLiked);
|
|
221
|
-
setLikesCount(newCount);
|
|
222
|
-
|
|
223
|
-
if (newLiked) {
|
|
224
|
-
setShowLikeAnim(true);
|
|
225
|
-
setTimeoutSafely(
|
|
226
|
-
likeAnimTimeoutRef,
|
|
227
|
-
() => setShowLikeAnim(false),
|
|
228
|
-
LIKE_ANIM_TIMEOUT
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// Parent should update its data (e.g. in onLikePress) so that like state
|
|
233
|
-
// persists across scroll and re-mounts
|
|
234
|
-
onLikePress?.({ id: reel.episodeId, liked: newLiked });
|
|
235
|
-
}, [isLiked, likesCount, onLikePress, reel.episodeId]);
|
|
236
|
-
|
|
237
|
-
const handleTogglePlay = useCallback(() => {
|
|
238
|
-
setIsPaused((prev) => !prev);
|
|
239
|
-
setShowPauseIcon(true);
|
|
240
|
-
if (isPaused) {
|
|
241
|
-
setTimeoutSafely(
|
|
242
|
-
timeoutRef,
|
|
243
|
-
() => setShowPauseIcon(false),
|
|
244
|
-
PAUSE_ICON_TIMEOUT
|
|
245
|
-
);
|
|
246
|
-
} else {
|
|
247
|
-
setShowPauseIcon(true);
|
|
248
|
-
}
|
|
249
|
-
}, [isPaused]);
|
|
250
|
-
|
|
251
|
-
const handleEpisodeSelect = useCallback(
|
|
252
|
-
(episode: ISeriesEpisode) => {
|
|
253
|
-
closeAllModals();
|
|
254
|
-
if (episode.isLocked) {
|
|
255
|
-
setTimeout(() => openUnlockModal(), UNLOCK_MODAL_DELAY);
|
|
256
|
-
} else {
|
|
257
|
-
onEpisodeSelect(episode);
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
[closeAllModals, onEpisodeSelect, openUnlockModal]
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
// Gestures
|
|
264
|
-
const handleLockedTap = useCallback(() => {
|
|
265
|
-
closeAllModals();
|
|
266
|
-
openUnlockModal();
|
|
267
|
-
}, [closeAllModals, openUnlockModal]);
|
|
268
|
-
|
|
269
|
-
const isInOverlay = useIsInOverlay(rightThreshold, bottomThreshold);
|
|
270
|
-
const singleTap = useCreateTapGesture(
|
|
271
|
-
handleTogglePlay,
|
|
272
|
-
1,
|
|
273
|
-
isInOverlay,
|
|
274
|
-
isLocked,
|
|
275
|
-
handleLockedTap
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
const doubleTap = useCreateTapGesture(
|
|
279
|
-
handleLikePress,
|
|
280
|
-
2,
|
|
281
|
-
isInOverlay,
|
|
282
|
-
isLocked,
|
|
283
|
-
handleLockedTap
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
const combinedGesture = useCombinedGesture(singleTap, doubleTap);
|
|
287
|
-
|
|
288
|
-
// Memoized props objects
|
|
289
|
-
const unlockProps = useMemo(
|
|
290
|
-
() => ({
|
|
291
|
-
isVisible: unlockModalVisible,
|
|
292
|
-
onClose: closeUnlockModal,
|
|
293
|
-
}),
|
|
294
|
-
[unlockModalVisible, closeUnlockModal]
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
const contentProps = useMemo(
|
|
298
|
-
() => ({
|
|
299
|
-
series: data,
|
|
300
|
-
episode: reel,
|
|
301
|
-
activeIndex: activeEpisodeIndex,
|
|
302
|
-
}),
|
|
303
|
-
[data, reel, activeEpisodeIndex]
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
const videoProps = useMemo(
|
|
307
|
-
() => ({
|
|
308
|
-
currentTime,
|
|
309
|
-
duration,
|
|
310
|
-
paused: finalPause,
|
|
311
|
-
buffering,
|
|
312
|
-
showCenterControls,
|
|
313
|
-
isLocked,
|
|
314
|
-
hasError,
|
|
315
|
-
}),
|
|
316
|
-
[
|
|
317
|
-
currentTime,
|
|
318
|
-
duration,
|
|
319
|
-
finalPause,
|
|
320
|
-
buffering,
|
|
321
|
-
showCenterControls,
|
|
322
|
-
isLocked,
|
|
323
|
-
hasError,
|
|
324
|
-
]
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
const likesProps = useMemo(
|
|
328
|
-
() => ({
|
|
329
|
-
liked: isLiked,
|
|
330
|
-
count: likesCount,
|
|
331
|
-
showAnimation: showLikeAnim,
|
|
332
|
-
}),
|
|
333
|
-
[isLiked, likesCount, showLikeAnim]
|
|
334
|
-
);
|
|
335
|
-
|
|
336
|
-
const actionsProps = useMemo(
|
|
337
|
-
() => ({
|
|
338
|
-
onLike: handleLikePress,
|
|
339
|
-
onEpisodeSelect: handleEpisodeSelect,
|
|
340
|
-
onLikeMore: onLikeMorePress,
|
|
341
|
-
onShare: onSharePress,
|
|
342
|
-
onUnLock: openUnlockModal,
|
|
343
|
-
onUnlockPress: onEpisodeUnlockPress,
|
|
344
|
-
}),
|
|
345
|
-
[
|
|
346
|
-
handleLikePress,
|
|
347
|
-
handleEpisodeSelect,
|
|
348
|
-
onLikeMorePress,
|
|
349
|
-
onSharePress,
|
|
350
|
-
onEpisodeUnlockPress,
|
|
351
|
-
openUnlockModal,
|
|
352
|
-
]
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
const navigationProps = useMemo(
|
|
356
|
-
() => ({
|
|
357
|
-
onBack: onBackPress,
|
|
358
|
-
onSearch: onSearchPress,
|
|
359
|
-
}),
|
|
360
|
-
[onBackPress, onSearchPress]
|
|
361
|
-
);
|
|
362
|
-
|
|
363
|
-
const settingsProps = useMemo(
|
|
364
|
-
() => ({
|
|
365
|
-
playbackRate,
|
|
366
|
-
quality: videoQuality,
|
|
367
|
-
currentQuality: activeResolution,
|
|
368
|
-
onPlaybackRateChange: setPlaybackRate,
|
|
369
|
-
onQualityChange: (quality: QualityOption) => {
|
|
370
|
-
setVideoQuality(quality);
|
|
371
|
-
},
|
|
372
|
-
}),
|
|
373
|
-
[playbackRate, videoQuality, activeResolution]
|
|
374
|
-
);
|
|
375
|
-
|
|
376
|
-
const handleVideoEnd = useCallback(() => {
|
|
377
|
-
if (!autoScroll || isLocked || autoScrolledRef.current) {
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
autoScrolledRef.current = true;
|
|
381
|
-
onAutoScrollNext?.();
|
|
382
|
-
}, [autoScroll, isLocked, onAutoScrollNext]);
|
|
383
|
-
|
|
384
|
-
// ----------------------- RENDER -----------------------
|
|
385
|
-
return (
|
|
386
|
-
<View style={[styles.container, { height: videoHeight }]}>
|
|
387
|
-
<MediaControlsProvider
|
|
388
|
-
theme={theme}
|
|
389
|
-
modal={modal}
|
|
390
|
-
setModal={setModal}
|
|
391
|
-
unlock={unlockProps}
|
|
392
|
-
content={contentProps}
|
|
393
|
-
video={videoProps}
|
|
394
|
-
likes={likesProps}
|
|
395
|
-
actions={actionsProps}
|
|
396
|
-
isFullScreen={isFullScreen}
|
|
397
|
-
navigation={navigationProps}
|
|
398
|
-
settings={settingsProps}
|
|
399
|
-
>
|
|
400
|
-
<GestureHandlerRootView style={styles.flex1}>
|
|
401
|
-
<GestureDetector gesture={combinedGesture}>
|
|
402
|
-
<View style={styles.flex1}>
|
|
403
|
-
{(isVisible || preload) && (
|
|
404
|
-
<Video
|
|
405
|
-
ref={isVisible ? videoRef : undefined}
|
|
406
|
-
source={{ uri: videoUri }}
|
|
407
|
-
paused={finalPause}
|
|
408
|
-
repeat={!autoScroll}
|
|
409
|
-
resizeMode="cover"
|
|
410
|
-
poster={thumbnail}
|
|
411
|
-
posterResizeMode="cover"
|
|
412
|
-
rate={playbackRate}
|
|
413
|
-
onLoadStart={() => {
|
|
414
|
-
setBuffering(true);
|
|
415
|
-
setHasError(false);
|
|
416
|
-
}}
|
|
417
|
-
onBuffer={({ isBuffering }) => setBuffering(isBuffering)}
|
|
418
|
-
onReadyForDisplay={() => {
|
|
419
|
-
setBuffering(false);
|
|
420
|
-
setHasError(false);
|
|
421
|
-
}}
|
|
422
|
-
onLoad={(info) => {
|
|
423
|
-
if (
|
|
424
|
-
Number(info.duration) > 0 &&
|
|
425
|
-
Number(info.duration) < 100000
|
|
426
|
-
) {
|
|
427
|
-
setDuration(Number(info.duration));
|
|
428
|
-
}
|
|
429
|
-
setHasError(false);
|
|
430
|
-
|
|
431
|
-
// Get initial selected quality
|
|
432
|
-
const selectedTrack = info.videoTracks?.find(
|
|
433
|
-
(t: any) => t.selected
|
|
434
|
-
);
|
|
435
|
-
if (selectedTrack?.height) {
|
|
436
|
-
setActiveResolution(`${selectedTrack.height}p`);
|
|
437
|
-
}
|
|
438
|
-
}}
|
|
439
|
-
onVideoTracks={(e) => {
|
|
440
|
-
const selectedTrack = e.videoTracks?.find(
|
|
441
|
-
(t) => t.selected
|
|
442
|
-
);
|
|
443
|
-
if (selectedTrack?.height) {
|
|
444
|
-
setActiveResolution(`${selectedTrack.height}p`);
|
|
445
|
-
}
|
|
446
|
-
}}
|
|
447
|
-
onProgress={(p: OnProgressData) => {
|
|
448
|
-
const safeDuration =
|
|
449
|
-
duration > 0 ? duration : Number(p.seekableDuration) || 0;
|
|
450
|
-
|
|
451
|
-
if (isVisible) {
|
|
452
|
-
const currentTrack: OnVideoProgressCurrentTrack | null =
|
|
453
|
-
safeDuration > 0
|
|
454
|
-
? {
|
|
455
|
-
seriesId: data.id,
|
|
456
|
-
seriesTitle: data.title,
|
|
457
|
-
episodeId: reel.episodeId,
|
|
458
|
-
episodeNumber: reel.episodeNumber,
|
|
459
|
-
episodeName: reel.episodeName,
|
|
460
|
-
videoDuration: safeDuration,
|
|
461
|
-
}
|
|
462
|
-
: null;
|
|
463
|
-
|
|
464
|
-
const progress: OnVideoProgress = {
|
|
465
|
-
...p,
|
|
466
|
-
currentTrack,
|
|
467
|
-
};
|
|
468
|
-
onVideoProgress?.(progress);
|
|
469
|
-
}
|
|
470
|
-
setCurrentTime(p.currentTime);
|
|
471
|
-
if (isVisible) {
|
|
472
|
-
const totalWatchTime = p.currentTime;
|
|
473
|
-
const isVideoCompleted =
|
|
474
|
-
safeDuration > 0 &&
|
|
475
|
-
totalWatchTime >= safeDuration - 0.5;
|
|
476
|
-
|
|
477
|
-
onWatchProgress?.({
|
|
478
|
-
series: data,
|
|
479
|
-
episode: reel,
|
|
480
|
-
currentTime: p.currentTime,
|
|
481
|
-
duration: safeDuration,
|
|
482
|
-
isVideoCompleted,
|
|
483
|
-
totalWatchTime,
|
|
484
|
-
currentQuality: activeResolution,
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
if (
|
|
488
|
-
p.currentTime >= MIN_VIEW_DURATION_SEC &&
|
|
489
|
-
!viewCountedRef.current
|
|
490
|
-
) {
|
|
491
|
-
viewCountedRef.current = true;
|
|
492
|
-
onViewCount?.({ id: reel.episodeId });
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}}
|
|
496
|
-
onEnd={handleVideoEnd}
|
|
497
|
-
style={StyleSheet.absoluteFill}
|
|
498
|
-
controls={false}
|
|
499
|
-
controlsStyles={videoControlsStyles}
|
|
500
|
-
ignoreSilentSwitch="ignore"
|
|
501
|
-
selectedVideoTrack={{
|
|
502
|
-
type:
|
|
503
|
-
videoQuality.quality === 'Auto'
|
|
504
|
-
? SelectedVideoTrackType.AUTO
|
|
505
|
-
: SelectedVideoTrackType.RESOLUTION,
|
|
506
|
-
value:
|
|
507
|
-
videoQuality.quality === 'Auto'
|
|
508
|
-
? undefined
|
|
509
|
-
: Number(videoQuality.quality.replace('p', '')),
|
|
510
|
-
}}
|
|
511
|
-
playInBackground={false}
|
|
512
|
-
onError={() => {
|
|
513
|
-
setBuffering(false);
|
|
514
|
-
setHasError(true);
|
|
515
|
-
setIsPaused(true);
|
|
516
|
-
}}
|
|
517
|
-
/>
|
|
518
|
-
)}
|
|
519
|
-
{/* Thumbnail rendered AFTER Video so it sits on top while buffering */}
|
|
520
|
-
{buffering && (
|
|
521
|
-
<FastImage
|
|
522
|
-
source={{
|
|
523
|
-
uri: thumbnail,
|
|
524
|
-
priority: FastImage.priority.high,
|
|
525
|
-
}}
|
|
526
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
527
|
-
defaultSource={require('../../../assets/img/play.png')}
|
|
528
|
-
style={StyleSheet.absoluteFill as ImageStyle}
|
|
529
|
-
/>
|
|
530
|
-
)}
|
|
531
|
-
</View>
|
|
532
|
-
</GestureDetector>
|
|
533
|
-
</GestureHandlerRootView>
|
|
534
|
-
</MediaControlsProvider>
|
|
535
|
-
</View>
|
|
536
|
-
);
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
// Memo comparison – compare likes numerically so string/number don't cause extra re-renders
|
|
540
|
-
const areEqual = (prev: IReelItemProps, next: IReelItemProps) => {
|
|
541
|
-
const prevLikes = Number(prev.data.likes) || 0;
|
|
542
|
-
const nextLikes = Number(next.data.likes) || 0;
|
|
543
|
-
return (
|
|
544
|
-
prev.reel.episodeId === next.reel.episodeId &&
|
|
545
|
-
prev.isVisible === next.isVisible &&
|
|
546
|
-
prev.preload === next.preload &&
|
|
547
|
-
prev.activeEpisodeIndex === next.activeEpisodeIndex &&
|
|
548
|
-
prev.videoHeight === next.videoHeight &&
|
|
549
|
-
Boolean(prev.data.isLiked) === Boolean(next.data.isLiked) &&
|
|
550
|
-
prevLikes === nextLikes &&
|
|
551
|
-
prev.reel.isLocked === next.reel.isLocked &&
|
|
552
|
-
prev.reel.videoUrl === next.reel.videoUrl &&
|
|
553
|
-
prev.isVisible === next.isVisible
|
|
554
|
-
);
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
export default memo(ReelItem, areEqual);
|
|
558
|
-
|
|
559
|
-
const { width } = Dimensions.get('window');
|
|
560
|
-
|
|
561
|
-
const styles = StyleSheet.create({
|
|
562
|
-
container: {
|
|
563
|
-
width,
|
|
564
|
-
overflow: 'hidden',
|
|
565
|
-
},
|
|
566
|
-
flex1: {
|
|
567
|
-
flex: 1,
|
|
568
|
-
},
|
|
569
|
-
});
|