@@ -4,7 +4,7 @@ import { RootStackParams } from "../../app/_layout";
44import { ROUTES } from "../../types" ;
55import { useGetVideoCaptionsQuery , useGetVideoQuery } from "../../api" ;
66import { useCallback , useEffect , useMemo , useState } from "react" ;
7- import { Loader , FocusWrapper , FullScreenModal , ErrorTextWithRetry , Button } from "../../components" ;
7+ import { Loader , FocusWrapper , FullScreenModal , ErrorTextWithRetry , Button , Typography } from "../../components" ;
88import { useViewHistory } from "../../hooks" ;
99import { StatusBar } from "expo-status-bar" ;
1010import { Settings } from "../../components/VideoControlsOverlay/components/modals" ;
@@ -15,6 +15,8 @@ import useFullScreenVideoPlayback from "../../hooks/useFullScreenVideoPlayback";
1515import Share from "../../components/VideoControlsOverlay/components/modals/Share" ;
1616import VideoDetails from "../../components/VideoControlsOverlay/components/modals/VideoDetails" ;
1717import { colorSchemes , spacing } from "../../theme" ;
18+ import { useTheme } from "@react-navigation/native" ;
19+ import { ErrorUnavailableLogo } from "../../components/Svg" ;
1820
1921export const VideoScreen = ( ) => {
2022 const { t } = useTranslation ( ) ;
@@ -26,8 +28,10 @@ export const VideoScreen = () => {
2628 const { isFullscreen, toggleFullscreen } = useFullScreenVideoPlayback ( ) ;
2729 const { top } = useSafeAreaInsets ( ) ;
2830 const [ quality , setQuality ] = useState ( "auto" ) ;
31+ const { colors } = useTheme ( ) ;
2932
3033 const isWaitingForLive = data ?. state ?. id === 4 ;
34+ const isPremiumVideo = [ true , "true" ] . includes ( data ?. pluginData ?. [ "is-premium-content" ] ) ;
3135
3236 useEffect ( ( ) => {
3337 if ( data && params ?. backend ) {
@@ -116,6 +120,18 @@ export const VideoScreen = () => {
116120 ) ;
117121 }
118122
123+ if ( isPremiumVideo ) {
124+ return (
125+ < View style = { [ { paddingTop : top , backgroundColor : colors . theme50 } , styles . flex1 ] } >
126+ < Button onPress = { handleBackButtonPress } contrast = "low" icon = "Arrow-Left" style = { styles . backButton } />
127+ < View style = { styles . premiumRestrictionContainer } >
128+ < ErrorUnavailableLogo />
129+ < Typography style = { styles . premiumRestrictionText } > { t ( "premiumVideoUnavailable" ) } </ Typography >
130+ </ View >
131+ </ View >
132+ ) ;
133+ }
134+
119135 if ( ! uri && ! isWaitingForLive ) {
120136 return null ;
121137 }
@@ -176,6 +192,14 @@ const styles = StyleSheet.create({
176192 backButton : { alignSelf : "flex-start" , height : 48 , margin : spacing . sm , width : 48 } ,
177193 errorContainer : { alignItems : "center" , flex : 1 , height : "100%" , justifyContent : "center" , width : "100%" } ,
178194 flex1 : { flex : 1 } ,
195+ premiumRestrictionContainer : {
196+ alignItems : "center" ,
197+ flex : 1 ,
198+ gap : spacing . xl ,
199+ justifyContent : "center" ,
200+ paddingHorizontal : spacing . xl ,
201+ } ,
202+ premiumRestrictionText : { textAlign : "center" } ,
179203 statusBarUnderlay : { backgroundColor : colorSchemes . dark . colors . black100 , width : "100%" } ,
180204 videoContainer : { minHeight : "100%" , minWidth : "100%" } ,
181205} ) ;
0 commit comments