111 lines
3.8 KiB
TypeScript
111 lines
3.8 KiB
TypeScript
// Metro module 8140 (f8141).
|
|
import { memo, forwardRef, useEffect, useCallback } from "react";
|
|
import { ActivityIndicator, View } from "react-native";
|
|
import { isIOS } from "../../../../utils/PlatformUtils";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
|
|
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
|
|
import Linking from "../../../../lib/native/Linking";
|
|
import Module6759 from "../../../../_bundle/Module6759";
|
|
let c5170_8 = isIOS() ? "\n window.addEventListener('click', function(event) {\n window.ReactNativeWebView.postMessage(JSON.stringify({event: 'click'}));\n });\n" : "";
|
|
let c5170_9 = {
|
|
UNREADY: 0,
|
|
0: "UNREADY",
|
|
READY: 1,
|
|
1: "READY",
|
|
ERRORED: 2,
|
|
2: "ERRORED",
|
|
UNSTARTED: 3,
|
|
3: "UNSTARTED",
|
|
ENDED: 4,
|
|
4: "ENDED",
|
|
PLAYING: 5,
|
|
5: "PLAYING",
|
|
PAUSED: 6,
|
|
6: "PAUSED",
|
|
BUFFERING: 7,
|
|
7: "BUFFERING",
|
|
VIDEO_CUED: 8,
|
|
8: "VIDEO_CUED"
|
|
};
|
|
const useStyles = createStyles({
|
|
loading: {
|
|
top: 0,
|
|
left: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
position: "absolute",
|
|
alignItems: "center",
|
|
justifyContent: "center"
|
|
}
|
|
});
|
|
const __initData = {
|
|
code: "function MediaModalWebViewTsx1(){const{withTiming,webviewOpacity}=this.__closure;return{opacity:withTiming(webviewOpacity.get())};}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function MediaModalWebViewTsx2(){const{withTiming,loaderOpacity}=this.__closure;return{opacity:withTiming(loaderOpacity.get())};}"
|
|
};
|
|
const r59 = memo(forwardRef(function({ style, playerState, onDataReceived, baseURL, injectedJavaScript, panGestureConfig, ...props }, a1) {
|
|
const styles = useStyles();
|
|
const sharedValue = useSharedValue(1);
|
|
const sharedValue2 = useSharedValue(0);
|
|
const f = function f() {
|
|
return {
|
|
opacity: _timing.withTiming(sharedValue2.get())
|
|
};
|
|
};
|
|
f.__closure = {
|
|
withTiming: _timing.withTiming,
|
|
webviewOpacity: sharedValue2
|
|
};
|
|
f.__workletHash = 2179142865986;
|
|
f.__initData = __initData;
|
|
const animatedStyle = useAnimatedStyle(f);
|
|
const S = function S() {
|
|
return {
|
|
opacity: _timing.withTiming(sharedValue.get())
|
|
};
|
|
};
|
|
S.__closure = {
|
|
withTiming: _timing.withTiming,
|
|
loaderOpacity: sharedValue
|
|
};
|
|
S.__workletHash = 7752174298017;
|
|
S.__initData = __initData2;
|
|
const animatedStyle2 = useAnimatedStyle(S);
|
|
useEffect(() => {
|
|
if (!(playerState !== c5170_9.BUFFERING && playerState !== c5170_9.PLAYING && playerState !== c5170_9.ERRORED)) {
|
|
sharedValue.set(0);
|
|
sharedValue2.set(1);
|
|
}
|
|
}, [playerState, sharedValue, sharedValue2]);
|
|
return <View style={style}>
|
|
<ReanimatedRexport.View style={[animatedStyle, {
|
|
flex: 1
|
|
}]}>
|
|
<Module6759 {...props} injectedJavaScript={`${injectedJavaScript}
|
|
${c5170_8}`} bounces={false} ref={a1} scrollEnabled={false} javaScriptEnabled onMessage={useCallback((a0) => {
|
|
const r8 = JSON.parse(a0.nativeEvent.data);
|
|
if (r8 != null && r8.event === "click") {
|
|
panGestureConfig.overlayEnabled.set(!panGestureConfig.overlayEnabled.get());
|
|
} else {
|
|
onDataReceived(a0.nativeEvent.data);
|
|
}
|
|
}, [onDataReceived, panGestureConfig])} allowsInlineMediaPlayback mediaPlaybackRequiresUserAction={false} onShouldStartLoadWithRequest={useCallback((a0) => {
|
|
const r7 = a0.url !== "about:blank" && !a0.url.startsWith(baseURL) && (a0.isTopFrame == null || a0.isTopFrame);
|
|
let r13 = !r7;
|
|
if (r7) {
|
|
Linking.openURL(a0.url);
|
|
r13 = false;
|
|
}
|
|
return r13;
|
|
}, [baseURL])} />
|
|
</ReanimatedRexport.View>
|
|
{playerState !== c5170_9.PLAYING && playerState !== c5170_9.PAUSED && <ReanimatedRexport.View style={[animatedStyle2, styles.loading]}>
|
|
<ActivityIndicator color="white" size="large" />
|
|
</ReanimatedRexport.View>}
|
|
</View>;
|
|
}));
|
|
export default r59;
|
|
export { c5170_9 as PlayerState };
|