@applicaster/zapp-react-native-ui-components 15.0.0-rc.61 → 15.0.0-rc.62
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.
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
PlayerNativeSendCommand,
|
|
62
62
|
} from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
|
|
63
63
|
import { useAppData } from "@applicaster/zapp-react-native-redux";
|
|
64
|
+
import { useRestrictMobilePlayback } from "./useRestrictMobilePlayback";
|
|
64
65
|
|
|
65
66
|
type Props = {
|
|
66
67
|
Player: React.ComponentType<any>;
|
|
@@ -264,7 +265,21 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
264
265
|
|
|
265
266
|
showNavBar(true);
|
|
266
267
|
navigator.goBack();
|
|
267
|
-
}, [isModal,
|
|
268
|
+
}, [isModal, state.playerId, showNavBar, navigator]);
|
|
269
|
+
|
|
270
|
+
const pluginConfiguration = React.useMemo(() => {
|
|
271
|
+
return (
|
|
272
|
+
playerManager.getPluginConfiguration() ||
|
|
273
|
+
R.prop("__plugin_configuration", Player)
|
|
274
|
+
);
|
|
275
|
+
}, [playerManager.isRegistered()]);
|
|
276
|
+
|
|
277
|
+
const { isRestricted } = useRestrictMobilePlayback({
|
|
278
|
+
player,
|
|
279
|
+
entry: item,
|
|
280
|
+
pluginConfiguration,
|
|
281
|
+
close,
|
|
282
|
+
});
|
|
268
283
|
|
|
269
284
|
const playEntry = (entry) => navigator.replaceTop(entry, { mode });
|
|
270
285
|
|
|
@@ -456,13 +471,6 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
456
471
|
}
|
|
457
472
|
}, []);
|
|
458
473
|
|
|
459
|
-
const pluginConfiguration = React.useMemo(() => {
|
|
460
|
-
return (
|
|
461
|
-
playerManager.getPluginConfiguration() ||
|
|
462
|
-
R.prop("__plugin_configuration", Player)
|
|
463
|
-
);
|
|
464
|
-
}, [playerManager.isRegistered()]);
|
|
465
|
-
|
|
466
474
|
const disableMiniPlayer = React.useMemo(() => {
|
|
467
475
|
return pluginConfiguration?.disable_mini_player_when_inline;
|
|
468
476
|
}, [pluginConfiguration]);
|
|
@@ -662,36 +670,38 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
662
670
|
<PlayerFocusableWrapperView
|
|
663
671
|
nextFocusDown={context.bottomFocusableId}
|
|
664
672
|
>
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
setNextVideoPreloadThresholdPercentage
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
673
|
+
{isRestricted ? null : (
|
|
674
|
+
<Player
|
|
675
|
+
source={{
|
|
676
|
+
uri,
|
|
677
|
+
entry: item,
|
|
678
|
+
}}
|
|
679
|
+
focused={isInlineTV ? true : undefined}
|
|
680
|
+
autoplay={true}
|
|
681
|
+
controls={false}
|
|
682
|
+
disableCastAction={disableCastAction}
|
|
683
|
+
docked={navigator.isVideoModalDocked()}
|
|
684
|
+
entry={item}
|
|
685
|
+
fullscreen={mode === VideoModalMode.FULLSCREEN}
|
|
686
|
+
inline={inline}
|
|
687
|
+
isModal={isModal}
|
|
688
|
+
isTabletPortrait={isTabletPortrait}
|
|
689
|
+
muted={false}
|
|
690
|
+
playableItem={item}
|
|
691
|
+
playerEvent={playerEvent}
|
|
692
|
+
playerId={state.playerId}
|
|
693
|
+
pluginConfiguration={pluginConfiguration}
|
|
694
|
+
ref={playerRef}
|
|
695
|
+
toggleFullscreen={toggleFullscreen}
|
|
696
|
+
style={videoStyle}
|
|
697
|
+
playNextData={playNextData}
|
|
698
|
+
setNextVideoPreloadThresholdPercentage={
|
|
699
|
+
setNextVideoPreloadThresholdPercentage
|
|
700
|
+
}
|
|
701
|
+
>
|
|
702
|
+
{renderApplePlayer(applePlayerProps)}
|
|
703
|
+
</Player>
|
|
704
|
+
)}
|
|
695
705
|
</PlayerFocusableWrapperView>
|
|
696
706
|
|
|
697
707
|
{state.error ? <ErrorDisplay error={state.error} /> : null}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Player } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/player";
|
|
2
|
+
import NetInfo from "@react-native-community/netinfo";
|
|
3
|
+
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { showAlertDialog } from "@applicaster/zapp-react-native-utils/alertUtils";
|
|
6
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
7
|
+
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
8
|
+
import { log_info } from "./logger";
|
|
9
|
+
|
|
10
|
+
type RestrictMobilePlaybackProps = {
|
|
11
|
+
player?: Player;
|
|
12
|
+
entry?: ZappEntry;
|
|
13
|
+
pluginConfiguration?: Record<string, string>;
|
|
14
|
+
close: () => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const useRestrictMobilePlayback = ({
|
|
18
|
+
player,
|
|
19
|
+
entry,
|
|
20
|
+
pluginConfiguration,
|
|
21
|
+
close,
|
|
22
|
+
}: RestrictMobilePlaybackProps): { isRestricted: boolean } => {
|
|
23
|
+
const dialogVisibleRef = useRef<boolean>(false);
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
return () => {
|
|
28
|
+
if (isTV()) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
dialogVisibleRef.current = false;
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
36
|
+
const isConnectionRestricted = useMemo(() => {
|
|
37
|
+
if (isTV()) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return player && entry?.extensions?.connection_restricted;
|
|
42
|
+
}, [player, entry]);
|
|
43
|
+
|
|
44
|
+
const [isRestricted, setIsRestricted] = useState<boolean>(
|
|
45
|
+
isConnectionRestricted
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!isConnectionRestricted) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const stopPlayer = () => {
|
|
54
|
+
log_info(
|
|
55
|
+
"Stopping player due to mobile restriction, connection_restricted: true"
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
player?.close();
|
|
59
|
+
|
|
60
|
+
dialogVisibleRef.current = true;
|
|
61
|
+
|
|
62
|
+
showAlertDialog({
|
|
63
|
+
title:
|
|
64
|
+
pluginConfiguration?.mobile_connection_restricted_alert_title ||
|
|
65
|
+
"Restricted Connection Type",
|
|
66
|
+
message:
|
|
67
|
+
pluginConfiguration?.mobile_connection_restricted_alert_message ||
|
|
68
|
+
"This content can only be viewed over a Wi-Fi or LAN network.",
|
|
69
|
+
okButtonText: theme.ok_button || "OK",
|
|
70
|
+
completion: () => {
|
|
71
|
+
dialogVisibleRef.current = false;
|
|
72
|
+
|
|
73
|
+
close();
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return NetInfo.addEventListener((state) => {
|
|
79
|
+
if (state.type === "cellular") {
|
|
80
|
+
setIsRestricted(true);
|
|
81
|
+
|
|
82
|
+
if (dialogVisibleRef.current) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
stopPlayer();
|
|
87
|
+
} else {
|
|
88
|
+
setIsRestricted(false);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}, [
|
|
92
|
+
close,
|
|
93
|
+
entry?.extensions?.connection_restricted,
|
|
94
|
+
pluginConfiguration,
|
|
95
|
+
player,
|
|
96
|
+
theme.ok_button,
|
|
97
|
+
isConnectionRestricted,
|
|
98
|
+
]);
|
|
99
|
+
|
|
100
|
+
return { isRestricted };
|
|
101
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.62",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-rc.62",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.62",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-rc.62",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-rc.62",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|