agora-appbuilder-core 1.0.8 → 2.0.1
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/package.json +5 -2
- package/template/_package-lock.json +22850 -0
- package/template/agora-rn-uikit/.git/HEAD +1 -0
- package/template/agora-rn-uikit/.git/config +16 -0
- package/template/agora-rn-uikit/.git/description +1 -0
- package/template/agora-rn-uikit/.git/hooks/applypatch-msg.sample +15 -0
- package/template/agora-rn-uikit/.git/hooks/commit-msg.sample +24 -0
- package/template/agora-rn-uikit/.git/hooks/fsmonitor-watchman.sample +173 -0
- package/template/agora-rn-uikit/.git/hooks/post-update.sample +8 -0
- package/template/agora-rn-uikit/.git/hooks/pre-applypatch.sample +14 -0
- package/template/agora-rn-uikit/.git/hooks/pre-commit.sample +49 -0
- package/template/agora-rn-uikit/.git/hooks/pre-merge-commit.sample +13 -0
- package/template/agora-rn-uikit/.git/hooks/pre-push.sample +53 -0
- package/template/agora-rn-uikit/.git/hooks/pre-rebase.sample +169 -0
- package/template/agora-rn-uikit/.git/hooks/pre-receive.sample +24 -0
- package/template/agora-rn-uikit/.git/hooks/prepare-commit-msg.sample +42 -0
- package/template/agora-rn-uikit/.git/hooks/push-to-checkout.sample +78 -0
- package/template/agora-rn-uikit/.git/hooks/update.sample +128 -0
- package/template/agora-rn-uikit/.git/index +0 -0
- package/template/agora-rn-uikit/.git/info/exclude +6 -0
- package/template/agora-rn-uikit/.git/logs/HEAD +2 -0
- package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -0
- package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -0
- package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx +0 -0
- package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.pack +0 -0
- package/template/agora-rn-uikit/.git/packed-refs +12 -0
- package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -0
- package/template/agora-rn-uikit/.git/refs/heads/master +1 -0
- package/template/agora-rn-uikit/.git/refs/remotes/origin/HEAD +1 -0
- package/template/agora-rn-uikit/.gitignore +63 -0
- package/template/agora-rn-uikit/package-lock.json +7612 -0
- package/template/agora-rn-uikit/package.json +1 -0
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +8 -8
- package/template/agora-rn-uikit/src/{LocalUserContext.tsx → Contexts/LocalUserContext.tsx} +1 -1
- package/template/agora-rn-uikit/src/{MaxUidContext.tsx → Contexts/MaxUidContext.tsx} +0 -0
- package/template/agora-rn-uikit/src/{MinUidContext.tsx → Contexts/MinUidContext.tsx} +0 -0
- package/template/agora-rn-uikit/src/{PropsContext.tsx → Contexts/PropsContext.tsx} +34 -16
- package/template/agora-rn-uikit/src/{RtcContext.tsx → Contexts/RtcContext.tsx} +12 -21
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +25 -15
- package/template/agora-rn-uikit/src/Controls/Icons.ts +53 -3
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +53 -0
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +4 -3
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +58 -14
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +60 -14
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/Screenshare.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +9 -9
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +20 -17
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +8 -8
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +13 -8
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +1 -2
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +26 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +26 -0
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +46 -0
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +47 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +21 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +9 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +138 -0
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +100 -0
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +197 -0
- package/template/agora-rn-uikit/src/Style.ts +3 -3
- package/template/agora-rn-uikit/src/Utils/actionTypeGuard.tsx +9 -0
- package/template/agora-rn-uikit/src/{events.ts → Utils/events.ts} +0 -0
- package/template/agora-rn-uikit/src/{permission.ts → Utils/permission.ts} +0 -0
- package/template/agora-rn-uikit/src/{quality.tsx → Utils/quality.tsx} +0 -0
- package/template/agora-rn-uikit/src/{MaxVideoView.native.tsx → Views/MaxVideoView.native.tsx} +3 -4
- package/template/agora-rn-uikit/src/{MaxVideoView.tsx → Views/MaxVideoView.tsx} +3 -4
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +86 -0
- package/template/agora-rn-uikit/src/index.ts +67 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +23 -6
- package/template/package-lock.json +22850 -0
- package/template/package.json +6 -4
- package/template/react-native-toast-message/.gitignore +5 -0
- package/template/react-native-toast-message/.npmignore +5 -0
- package/template/react-native-toast-message/package-lock.json +10553 -0
- package/template/src/.DS_Store +0 -0
- package/template/src/assets/icons.ts +35 -6
- package/template/src/atoms/SecondaryButton.tsx +6 -5
- package/template/src/atoms/TextInput.tsx +6 -1
- package/template/src/components/Chat.tsx +50 -21
- package/template/src/components/ChatContext.ts +22 -1
- package/template/src/components/Controls.native.tsx +2 -2
- package/template/src/components/Controls.tsx +2 -2
- package/template/src/components/DeviceConfigure.tsx +1 -1
- package/template/src/components/GridVideo.tsx +69 -31
- package/template/src/components/Navbar.tsx +136 -113
- package/template/src/components/NetworkQualityContext.tsx +134 -0
- package/template/src/components/ParticipantsView.tsx +105 -49
- package/template/src/components/PinnedVideo.tsx +112 -71
- package/template/src/components/Precall.native.tsx +42 -23
- package/template/src/components/Precall.tsx +56 -51
- package/template/src/components/RTMConfigure.tsx +331 -181
- package/template/src/components/RTMEvents.tsx +84 -0
- package/template/src/components/Settings.tsx +19 -16
- package/template/src/components/Share.tsx +131 -62
- package/template/src/components/StorageContext.tsx +2 -0
- package/template/src/hooks/useImageDelay.tsx +28 -0
- package/template/src/pages/Authenticate.tsx +5 -4
- package/template/src/pages/Create.tsx +26 -16
- package/template/src/pages/Join.tsx +13 -30
- package/template/src/pages/VideoCall.tsx +181 -137
- package/template/src/subComponents/.DS_Store +0 -0
- package/template/src/subComponents/ChatContainer.tsx +40 -28
- package/template/src/subComponents/CopyJoinInfo.tsx +9 -12
- package/template/src/subComponents/LocalAudioMute.tsx +9 -9
- package/template/src/subComponents/LocalVideoMute.tsx +9 -9
- package/template/src/subComponents/LogoutButton.tsx +1 -1
- package/template/src/subComponents/NetworkQualityPill.tsx +161 -0
- package/template/src/subComponents/Recording.tsx +12 -16
- package/template/src/subComponents/RemoteAudioMute.tsx +23 -27
- package/template/src/subComponents/RemoteEndCall.tsx +7 -15
- package/template/src/subComponents/RemoteVideoMute.tsx +15 -28
- package/template/src/subComponents/ScreenShareNotice.tsx +61 -0
- package/template/src/subComponents/ScreenshareButton.tsx +76 -75
- package/template/src/subComponents/SelectOAuth.tsx +25 -12
- package/template/src/subComponents/SwitchCamera.tsx +5 -2
- package/template/src/subComponents/TextWithTooltip.native.tsx +128 -0
- package/template/src/subComponents/TextWithTooltip.tsx +44 -0
- package/template/src/subComponents/toastConfig.tsx +2 -2
- package/template/src/utils/hasBrandLogo.tsx +3 -0
- package/template/src/utils/isSafariBrowser.tsx +22 -0
- package/template/webpack.commons.js +1 -0
- package/template/agora-rn-uikit/Components.js +0 -35
- package/template/agora-rn-uikit/Contexts.js +0 -7
- package/template/agora-rn-uikit/index.js +0 -12
- package/template/agora-rn-uikit/src/MinVideoView.tsx +0 -87
- package/template/agora-rn-uikit/src/RTCConfigure.tsx +0 -516
|
@@ -10,15 +10,12 @@
|
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
12
|
import React, {useContext, useState} from 'react';
|
|
13
|
-
import {
|
|
14
|
-
View,
|
|
15
|
-
Text,
|
|
16
|
-
StyleSheet,
|
|
17
|
-
} from 'react-native';
|
|
13
|
+
import {View, Text, StyleSheet, ScrollView} from 'react-native';
|
|
18
14
|
import {useHistory} from '../components/Router';
|
|
19
15
|
import SessionContext from '../components/SessionContext';
|
|
20
16
|
// import OpenInNativeButton from '../subComponents/OpenInNativeButton';
|
|
21
17
|
import Logo from '../subComponents/Logo';
|
|
18
|
+
import hasBrandLogo from '../utils/hasBrandLogo';
|
|
22
19
|
import LogoutButton from '../subComponents/LogoutButton';
|
|
23
20
|
import ColorContext from '../components/ColorContext';
|
|
24
21
|
// import Illustration from '../subComponents/Illustration';
|
|
@@ -38,8 +35,9 @@ const Join = (props: joinProps) => {
|
|
|
38
35
|
const history = useHistory();
|
|
39
36
|
const {primaryColor} = useContext(ColorContext);
|
|
40
37
|
const {joinSession} = useContext(SessionContext);
|
|
41
|
-
const [error, setError] =
|
|
42
|
-
|
|
38
|
+
const [error, setError] = useState<null | {name: string; message: string}>(
|
|
39
|
+
null,
|
|
40
|
+
);
|
|
43
41
|
// const [dim, setDim] = useState([
|
|
44
42
|
// Dimensions.get('window').width,
|
|
45
43
|
// Dimensions.get('window').height,
|
|
@@ -57,18 +55,12 @@ const Join = (props: joinProps) => {
|
|
|
57
55
|
const startCall = async () => {
|
|
58
56
|
joinSession({phrase});
|
|
59
57
|
};
|
|
60
|
-
|
|
58
|
+
|
|
61
59
|
return (
|
|
62
|
-
|
|
63
|
-
// // onLayout={onLayout}
|
|
64
|
-
// style={style.full}
|
|
65
|
-
// resizeMode={'cover'}>
|
|
66
|
-
<View style={style.main}>
|
|
67
|
-
{/* <KeyboardAvoidingView behavior={'height'} style={style.main}> */}
|
|
60
|
+
<ScrollView contentContainerStyle={style.main}>
|
|
68
61
|
<View style={style.nav}>
|
|
69
|
-
<Logo />
|
|
62
|
+
{hasBrandLogo && <Logo />}
|
|
70
63
|
{error ? <Error error={error} /> : <></>}
|
|
71
|
-
{/* <OpenInNativeButton /> */}
|
|
72
64
|
</View>
|
|
73
65
|
<View style={style.content}>
|
|
74
66
|
<View style={style.leftContent}>
|
|
@@ -99,28 +91,19 @@ const Join = (props: joinProps) => {
|
|
|
99
91
|
)}
|
|
100
92
|
</View>
|
|
101
93
|
</View>
|
|
102
|
-
{/* {dim[0] > dim[1] + 150 ? (
|
|
103
|
-
<View style={style.full}>
|
|
104
|
-
<Illustration />
|
|
105
|
-
</View>
|
|
106
|
-
) : (
|
|
107
|
-
<></>
|
|
108
|
-
)} */}
|
|
109
94
|
</View>
|
|
110
|
-
|
|
111
|
-
</View>
|
|
112
|
-
// </ImageBackground>
|
|
95
|
+
</ScrollView>
|
|
113
96
|
);
|
|
114
97
|
};
|
|
115
98
|
|
|
116
99
|
const style = StyleSheet.create({
|
|
117
|
-
full: {flex: 1},
|
|
118
100
|
illustration: {flex: 1, alignSelf: 'flex-end'},
|
|
119
101
|
main: {
|
|
120
|
-
|
|
121
|
-
justifyContent: 'space-evenly',
|
|
102
|
+
paddingVertical: '8%',
|
|
122
103
|
marginHorizontal: '8%',
|
|
123
|
-
|
|
104
|
+
display: 'flex',
|
|
105
|
+
justifyContent: 'space-evenly',
|
|
106
|
+
flexGrow: 1,
|
|
124
107
|
},
|
|
125
108
|
nav: {
|
|
126
109
|
flex: 1,
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
import React, {useState, useContext, useEffect} from 'react';
|
|
13
13
|
import {View, StyleSheet, Text, Platform} from 'react-native';
|
|
14
14
|
|
|
15
|
-
import RtcConfigure from '../../agora-rn-uikit
|
|
16
|
-
import {PropsProvider} from '../../agora-rn-uikit
|
|
15
|
+
import {RtcConfigure} from '../../agora-rn-uikit';
|
|
16
|
+
import {PropsProvider} from '../../agora-rn-uikit';
|
|
17
17
|
import Navbar from '../components/Navbar';
|
|
18
18
|
import Precall from '../components/Precall';
|
|
19
19
|
import ParticipantsView from '../components/ParticipantsView';
|
|
@@ -30,25 +30,31 @@ import {gql, useQuery} from '@apollo/client';
|
|
|
30
30
|
// import Watermark from '../subComponents/Watermark';
|
|
31
31
|
import StorageContext from '../components/StorageContext';
|
|
32
32
|
import Logo from '../subComponents/Logo';
|
|
33
|
-
import
|
|
33
|
+
import hasBrandLogo from '../utils/hasBrandLogo';
|
|
34
|
+
import ChatContext, {
|
|
35
|
+
messageActionType,
|
|
36
|
+
messageChannelType,
|
|
37
|
+
} from '../components/ChatContext';
|
|
34
38
|
import {SidePanelType} from '../subComponents/SidePanelEnum';
|
|
35
39
|
import {videoView} from '../../theme.json';
|
|
36
40
|
import Layout from '../subComponents/LayoutEnum';
|
|
37
41
|
import Toast from '../../react-native-toast-message';
|
|
42
|
+
import {NetworkQualityProvider} from '../components/NetworkQualityContext';
|
|
38
43
|
|
|
39
44
|
const useChatNotification = (
|
|
40
45
|
messageStore: string | any[],
|
|
41
46
|
privateMessageStore: string | any[],
|
|
42
47
|
chatDisplayed: boolean,
|
|
48
|
+
isPrivateChatDisplayed: boolean
|
|
43
49
|
) => {
|
|
44
50
|
// store the last checked state from the messagestore, to identify unread messages
|
|
45
51
|
const [lastCheckedPublicState, setLastCheckedPublicState] = useState(0);
|
|
46
52
|
const [lastCheckedPrivateState, setLastCheckedPrivateState] = useState({});
|
|
47
53
|
useEffect(() => {
|
|
48
|
-
if (chatDisplayed) {
|
|
54
|
+
if (chatDisplayed && !isPrivateChatDisplayed) {
|
|
49
55
|
setLastCheckedPublicState(messageStore.length);
|
|
50
56
|
}
|
|
51
|
-
}, [messageStore]);
|
|
57
|
+
}, [messageStore,isPrivateChatDisplayed]);
|
|
52
58
|
|
|
53
59
|
const setPrivateMessageLastSeen = ({userId, lastSeenCount}) => {
|
|
54
60
|
setLastCheckedPrivateState((prevState) => {
|
|
@@ -64,22 +70,30 @@ const useChatNotification = (
|
|
|
64
70
|
];
|
|
65
71
|
};
|
|
66
72
|
|
|
67
|
-
const NotificationControl = ({children, chatDisplayed, setSidePanel}) => {
|
|
68
|
-
const {messageStore, privateMessageStore, userList, localUid} =
|
|
73
|
+
const NotificationControl = ({children, chatDisplayed, setSidePanel, isPrivateChatDisplayed}) => {
|
|
74
|
+
const {messageStore, privateMessageStore, userList, localUid, events} =
|
|
75
|
+
useContext(ChatContext);
|
|
69
76
|
const [
|
|
70
77
|
lastCheckedPublicState,
|
|
71
78
|
setLastCheckedPublicState,
|
|
72
79
|
lastCheckedPrivateState,
|
|
73
80
|
setLastCheckedPrivateState,
|
|
74
81
|
setPrivateMessageLastSeen,
|
|
75
|
-
] = useChatNotification(messageStore, privateMessageStore, chatDisplayed);
|
|
82
|
+
] = useChatNotification(messageStore, privateMessageStore, chatDisplayed, isPrivateChatDisplayed);
|
|
83
|
+
|
|
76
84
|
const pendingPublicNotification =
|
|
77
85
|
messageStore.length - lastCheckedPublicState;
|
|
78
86
|
const privateMessageCountMap = Object.keys(privateMessageStore).reduce(
|
|
79
87
|
(acc, curItem) => {
|
|
80
88
|
let individualPrivateMessageCount = privateMessageStore[curItem].reduce(
|
|
81
89
|
(total, item) => {
|
|
82
|
-
|
|
90
|
+
if (Platform.OS === 'android') {
|
|
91
|
+
//In template/src/components/RTMConfigure.tsx
|
|
92
|
+
//on messageReceived event - For android platform we are passing uid as number type. so checking == for android
|
|
93
|
+
return item.uid == curItem ? total + 1 : total;
|
|
94
|
+
} else {
|
|
95
|
+
return item.uid === curItem ? total + 1 : total;
|
|
96
|
+
}
|
|
83
97
|
},
|
|
84
98
|
0,
|
|
85
99
|
);
|
|
@@ -97,36 +111,45 @@ const NotificationControl = ({children, chatDisplayed, setSidePanel}) => {
|
|
|
97
111
|
);
|
|
98
112
|
const pendingPrivateNotification = totalPrivateMessage - totalPrivateLastSeen;
|
|
99
113
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
const showMessageNotification = (data: any) => {
|
|
116
|
+
if (data.type === messageActionType.Normal) {
|
|
117
|
+
const {uid, msg} = data;
|
|
118
|
+
Toast.show({
|
|
119
|
+
type: 'success',
|
|
120
|
+
text1: msg.length > 30 ? msg.slice(0, 30) + '...' : msg,
|
|
121
|
+
text2: userList[uid]?.name ? 'From: ' + userList[uid]?.name : '',
|
|
122
|
+
visibilityTime: 1000,
|
|
123
|
+
onPress: () => {
|
|
124
|
+
setSidePanel(SidePanelType.Chat);
|
|
125
|
+
setLastCheckedPublicState(messageStore.length);
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
events.on(
|
|
131
|
+
messageChannelType.Public,
|
|
132
|
+
'onPublicMessageReceived',
|
|
133
|
+
(data: any, error: any) => {
|
|
134
|
+
if (!data) return;
|
|
135
|
+
showMessageNotification(data);
|
|
136
|
+
},
|
|
137
|
+
);
|
|
138
|
+
events.on(
|
|
139
|
+
messageChannelType.Private,
|
|
140
|
+
'onPrivateMessageReceived',
|
|
141
|
+
(data: any, error: any) => {
|
|
142
|
+
if (!data) return;
|
|
143
|
+
if (data.uid === localUid) return;
|
|
144
|
+
showMessageNotification(data);
|
|
145
|
+
},
|
|
146
|
+
);
|
|
147
|
+
return () => {
|
|
148
|
+
// Cleanup the listeners
|
|
149
|
+
events.off(messageChannelType.Public, 'onPublicMessageReceived');
|
|
150
|
+
events.off(messageChannelType.Private, 'onPrivateMessageReceived');
|
|
151
|
+
};
|
|
152
|
+
}, [userList, messageStore]);
|
|
130
153
|
|
|
131
154
|
return children({
|
|
132
155
|
pendingPublicNotification,
|
|
@@ -212,8 +235,10 @@ enum RnEncryptionEnum {
|
|
|
212
235
|
}
|
|
213
236
|
|
|
214
237
|
const VideoCall: React.FC = () => {
|
|
215
|
-
const {store} = useContext(StorageContext);
|
|
216
|
-
const
|
|
238
|
+
const {store, setStore} = useContext(StorageContext);
|
|
239
|
+
const getInitialUsername = () =>
|
|
240
|
+
store?.displayName ? store.displayName : '';
|
|
241
|
+
const [username, setUsername] = useState(getInitialUsername);
|
|
217
242
|
const [participantsView, setParticipantsView] = useState(false);
|
|
218
243
|
const [callActive, setCallActive] = useState($config.PRECALL ? false : true);
|
|
219
244
|
const [layout, setLayout] = useState(Layout.Grid);
|
|
@@ -221,11 +246,12 @@ const VideoCall: React.FC = () => {
|
|
|
221
246
|
const [chatDisplayed, setChatDisplayed] = useState(false);
|
|
222
247
|
const [queryComplete, setQueryComplete] = useState(false);
|
|
223
248
|
const [sidePanel, setSidePanel] = useState<SidePanelType>(SidePanelType.None);
|
|
249
|
+
const [isPrivateChatDisplayed, setPrivateChatDisplayed] = useState(false)
|
|
224
250
|
const {phrase} = useParams();
|
|
225
251
|
const [errorMessage, setErrorMessage] = useState(null);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
252
|
+
const [isHost, setIsHost] = React.useState(false);
|
|
253
|
+
const [title, setTitle] = React.useState('');
|
|
254
|
+
const [rtcProps, setRtcProps] = React.useState({
|
|
229
255
|
appId: $config.APP_ID,
|
|
230
256
|
channel: null,
|
|
231
257
|
uid: null,
|
|
@@ -238,60 +264,59 @@ const VideoCall: React.FC = () => {
|
|
|
238
264
|
encryption: $config.ENCRYPTION_ENABLED
|
|
239
265
|
? {key: null, mode: RnEncryptionEnum.AES128XTS, screenKey: null}
|
|
240
266
|
: false,
|
|
241
|
-
};
|
|
242
|
-
let data, loading, error;
|
|
267
|
+
});
|
|
243
268
|
|
|
244
|
-
|
|
269
|
+
const {data, loading, error} = useQuery(
|
|
245
270
|
store.token === null
|
|
246
271
|
? JOIN_CHANNEL_PHRASE
|
|
247
272
|
: JOIN_CHANNEL_PHRASE_AND_GET_USER,
|
|
248
273
|
{
|
|
249
274
|
variables: {passphrase: phrase},
|
|
250
275
|
},
|
|
251
|
-
)
|
|
276
|
+
);
|
|
252
277
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
278
|
+
React.useEffect(() => {
|
|
279
|
+
if (error) {
|
|
280
|
+
console.log('error', error);
|
|
281
|
+
// console.log('error data', data);
|
|
282
|
+
if (!errorMessage) {
|
|
283
|
+
setErrorMessage(error);
|
|
284
|
+
}
|
|
285
|
+
return;
|
|
258
286
|
}
|
|
259
|
-
}
|
|
260
287
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
288
|
+
if (!loading && data) {
|
|
289
|
+
console.log('token:', rtcProps.token);
|
|
290
|
+
console.log('error', data.error);
|
|
291
|
+
setRtcProps({
|
|
292
|
+
appId: $config.APP_ID,
|
|
293
|
+
channel: data.joinChannel.channel,
|
|
294
|
+
uid: data.joinChannel.mainUser.uid,
|
|
295
|
+
token: data.joinChannel.mainUser.rtc,
|
|
296
|
+
rtm: data.joinChannel.mainUser.rtm,
|
|
297
|
+
dual: true,
|
|
298
|
+
profile: $config.PROFILE,
|
|
299
|
+
encryption: $config.ENCRYPTION_ENABLED
|
|
300
|
+
? {
|
|
301
|
+
key: data.joinChannel.secret,
|
|
302
|
+
mode: RnEncryptionEnum.AES128XTS,
|
|
303
|
+
screenKey: data.joinChannel.secret,
|
|
304
|
+
}
|
|
305
|
+
: false,
|
|
306
|
+
screenShareUid: data.joinChannel.screenShare.uid,
|
|
307
|
+
screenShareToken: data.joinChannel.screenShare.rtc,
|
|
308
|
+
});
|
|
309
|
+
setIsHost(data.joinChannel.isHost);
|
|
310
|
+
setTitle(data.joinChannel.title);
|
|
311
|
+
console.log('query done: ', data, queryComplete);
|
|
312
|
+
// 1. Store the display name from API
|
|
286
313
|
if (data.getUser) {
|
|
287
314
|
setUsername(data.getUser.name);
|
|
288
|
-
} else {
|
|
289
|
-
setUsername('');
|
|
290
315
|
}
|
|
316
|
+
console.log('token:', rtcProps.token);
|
|
317
|
+
queryComplete ? {} : setQueryComplete(true);
|
|
291
318
|
}
|
|
292
|
-
|
|
293
|
-
queryComplete ? {} : setQueryComplete(true);
|
|
294
|
-
}
|
|
319
|
+
}, [error, loading, data]);
|
|
295
320
|
|
|
296
321
|
const history = useHistory();
|
|
297
322
|
const callbacks = {
|
|
@@ -300,6 +325,14 @@ const VideoCall: React.FC = () => {
|
|
|
300
325
|
history.push('/');
|
|
301
326
|
}, 0),
|
|
302
327
|
};
|
|
328
|
+
|
|
329
|
+
React.useEffect(() => {
|
|
330
|
+
// Update the username in localstorage when username changes
|
|
331
|
+
if (setStore) {
|
|
332
|
+
setStore({token: store?.token || null, displayName: username});
|
|
333
|
+
}
|
|
334
|
+
}, [username]);
|
|
335
|
+
|
|
303
336
|
// throw new Error("My first Sentry error!");
|
|
304
337
|
return (
|
|
305
338
|
<>
|
|
@@ -307,11 +340,14 @@ const VideoCall: React.FC = () => {
|
|
|
307
340
|
<>
|
|
308
341
|
<PropsProvider
|
|
309
342
|
value={{
|
|
310
|
-
rtcProps
|
|
343
|
+
rtcProps: {
|
|
344
|
+
...rtcProps,
|
|
345
|
+
callActive,
|
|
346
|
+
},
|
|
311
347
|
callbacks,
|
|
312
348
|
styleProps,
|
|
313
349
|
}}>
|
|
314
|
-
<RtcConfigure
|
|
350
|
+
<RtcConfigure>
|
|
315
351
|
<DeviceConfigure>
|
|
316
352
|
<RtmConfigure
|
|
317
353
|
setRecordingActive={setRecordingActive}
|
|
@@ -321,7 +357,9 @@ const VideoCall: React.FC = () => {
|
|
|
321
357
|
<View style={style.full}>
|
|
322
358
|
<NotificationControl
|
|
323
359
|
setSidePanel={setSidePanel}
|
|
324
|
-
chatDisplayed={sidePanel === SidePanelType.Chat}
|
|
360
|
+
chatDisplayed={sidePanel === SidePanelType.Chat}
|
|
361
|
+
isPrivateChatDisplayed={isPrivateChatDisplayed}
|
|
362
|
+
>
|
|
325
363
|
{({
|
|
326
364
|
pendingPublicNotification,
|
|
327
365
|
pendingPrivateNotification,
|
|
@@ -350,56 +388,63 @@ const VideoCall: React.FC = () => {
|
|
|
350
388
|
setLastCheckedPublicState
|
|
351
389
|
}
|
|
352
390
|
/>
|
|
353
|
-
<
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
391
|
+
<NetworkQualityProvider>
|
|
392
|
+
<View
|
|
393
|
+
style={[
|
|
394
|
+
style.videoView,
|
|
395
|
+
{backgroundColor: '#ffffff00'},
|
|
396
|
+
]}>
|
|
397
|
+
{layout === Layout.Pinned ? (
|
|
398
|
+
<PinnedVideo />
|
|
399
|
+
) : (
|
|
400
|
+
<GridVideo setLayout={setLayout} />
|
|
401
|
+
)}
|
|
402
|
+
{sidePanel === SidePanelType.Participants ? (
|
|
403
|
+
<ParticipantsView
|
|
404
|
+
isHost={isHost}
|
|
405
|
+
// setParticipantsView={setParticipantsView}
|
|
406
|
+
setSidePanel={setSidePanel}
|
|
407
|
+
/>
|
|
408
|
+
) : (
|
|
409
|
+
<></>
|
|
410
|
+
)}
|
|
411
|
+
{sidePanel === SidePanelType.Chat ? (
|
|
412
|
+
$config.CHAT ? (
|
|
413
|
+
<Chat
|
|
414
|
+
setPrivateChatDisplayed={setPrivateChatDisplayed}
|
|
415
|
+
privateMessageCountMap={
|
|
416
|
+
privateMessageCountMap
|
|
417
|
+
}
|
|
418
|
+
pendingPublicNotification={
|
|
419
|
+
pendingPublicNotification
|
|
420
|
+
}
|
|
421
|
+
pendingPrivateNotification={
|
|
422
|
+
pendingPrivateNotification
|
|
423
|
+
}
|
|
424
|
+
setPrivateMessageLastSeen={
|
|
425
|
+
setPrivateMessageLastSeen
|
|
426
|
+
}
|
|
427
|
+
lastCheckedPrivateState={
|
|
428
|
+
lastCheckedPrivateState
|
|
429
|
+
}
|
|
430
|
+
/>
|
|
431
|
+
) : (
|
|
432
|
+
<></>
|
|
433
|
+
)
|
|
434
|
+
) : (
|
|
435
|
+
<></>
|
|
436
|
+
)}
|
|
437
|
+
{sidePanel === SidePanelType.Settings ? (
|
|
438
|
+
<SettingsView
|
|
439
|
+
isHost={isHost}
|
|
440
|
+
// setParticipantsView={setParticipantsView}
|
|
441
|
+
setSidePanel={setSidePanel}
|
|
386
442
|
/>
|
|
387
443
|
) : (
|
|
388
444
|
<></>
|
|
389
|
-
)
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
)}
|
|
393
|
-
{sidePanel === SidePanelType.Settings ? (
|
|
394
|
-
<SettingsView
|
|
395
|
-
isHost={isHost}
|
|
396
|
-
// setParticipantsView={setParticipantsView}
|
|
397
|
-
setSidePanel={setSidePanel}
|
|
398
|
-
/>
|
|
399
|
-
) : (
|
|
400
|
-
<></>
|
|
401
|
-
)}
|
|
402
|
-
</View>
|
|
445
|
+
)}
|
|
446
|
+
</View>
|
|
447
|
+
</NetworkQualityProvider>
|
|
403
448
|
{Platform.OS !== 'web' &&
|
|
404
449
|
sidePanel === SidePanelType.Chat ? (
|
|
405
450
|
<></>
|
|
@@ -435,6 +480,7 @@ const VideoCall: React.FC = () => {
|
|
|
435
480
|
setUsername={setUsername}
|
|
436
481
|
setCallActive={setCallActive}
|
|
437
482
|
queryComplete={queryComplete}
|
|
483
|
+
title={title}
|
|
438
484
|
/>
|
|
439
485
|
) : (
|
|
440
486
|
<></>
|
|
@@ -446,9 +492,7 @@ const VideoCall: React.FC = () => {
|
|
|
446
492
|
</>
|
|
447
493
|
) : (
|
|
448
494
|
<View style={style.loader}>
|
|
449
|
-
<View style={style.loaderLogo}>
|
|
450
|
-
<Logo />
|
|
451
|
-
</View>
|
|
495
|
+
<View style={style.loaderLogo}>{hasBrandLogo && <Logo />}</View>
|
|
452
496
|
<Text style={style.loaderText}>Starting Call. Just a second.</Text>
|
|
453
497
|
</View>
|
|
454
498
|
)}
|
|
Binary file
|
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
StyleSheet,
|
|
19
19
|
Image,
|
|
20
20
|
Platform,
|
|
21
|
+
useWindowDimensions
|
|
21
22
|
} from 'react-native';
|
|
23
|
+
import {RFValue} from 'react-native-responsive-fontsize';
|
|
22
24
|
import ChatBubble from './ChatBubble';
|
|
23
25
|
import ChatContext from '../components/ChatContext';
|
|
24
|
-
import
|
|
26
|
+
import {BtnTemplate} from '../../agora-rn-uikit';
|
|
27
|
+
import TextWithTooltip from './TextWithTooltip';
|
|
25
28
|
|
|
26
29
|
/**
|
|
27
30
|
* Chat container is the component which renders all the chat messages
|
|
@@ -29,33 +32,34 @@ import icons from '../assets/icons';
|
|
|
29
32
|
* and maps it to a ChatBubble
|
|
30
33
|
*/
|
|
31
34
|
const ChatContainer = (props: any) => {
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
setPrivateActive,
|
|
36
|
-
selectedUsername,
|
|
37
|
-
} = props;
|
|
35
|
+
const {height, width} = useWindowDimensions();
|
|
36
|
+
const {selectedUser, privateActive, setPrivateActive, selectedUsername} =
|
|
37
|
+
props;
|
|
38
38
|
const {messageStore, localUid, privateMessageStore} = useContext(ChatContext);
|
|
39
39
|
const scrollViewRef = useRef<ScrollView>(null);
|
|
40
40
|
return (
|
|
41
41
|
<View style={style.containerView}>
|
|
42
42
|
{privateActive ? (
|
|
43
43
|
<View style={style.row}>
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
style={style.backIcon}
|
|
50
|
-
source={{uri: icons.backBtn}}
|
|
44
|
+
<View style={style.backButton}>
|
|
45
|
+
<BtnTemplate
|
|
46
|
+
style={[style.backIcon]}
|
|
47
|
+
onPress={() => setPrivateActive(false)}
|
|
48
|
+
name={'backBtn'}
|
|
51
49
|
/>
|
|
52
|
-
</
|
|
53
|
-
<
|
|
50
|
+
</View>
|
|
51
|
+
<View style={{flex:1}}>
|
|
52
|
+
<TextWithTooltip style={[style.name, {flexShrink: 1,fontSize: RFValue(16, height > width ? height : width)}]} value={selectedUsername} />
|
|
53
|
+
</View>
|
|
54
54
|
</View>
|
|
55
55
|
) : (
|
|
56
56
|
<></>
|
|
57
57
|
)}
|
|
58
|
-
<ScrollView
|
|
58
|
+
<ScrollView
|
|
59
|
+
ref={scrollViewRef}
|
|
60
|
+
onContentSizeChange={() => {
|
|
61
|
+
scrollViewRef.current?.scrollToEnd({animated: true});
|
|
62
|
+
}}>
|
|
59
63
|
{!privateActive ? (
|
|
60
64
|
messageStore.map((message: any) => {
|
|
61
65
|
return (
|
|
@@ -90,26 +94,34 @@ const ChatContainer = (props: any) => {
|
|
|
90
94
|
|
|
91
95
|
const style = StyleSheet.create({
|
|
92
96
|
containerView: {flex: 8},
|
|
93
|
-
row: {
|
|
94
|
-
|
|
97
|
+
row: {
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
marginTop: 2,
|
|
100
|
+
alignItems: 'center',
|
|
95
101
|
paddingVertical: 10,
|
|
96
|
-
|
|
102
|
+
...Platform.select({
|
|
103
|
+
android:{
|
|
104
|
+
height: 40
|
|
105
|
+
},
|
|
106
|
+
ios:{
|
|
107
|
+
height: 40
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
backButton: {
|
|
112
|
+
marginHorizontal: 10,
|
|
97
113
|
justifyContent: 'center',
|
|
98
|
-
alignSelf: '
|
|
114
|
+
alignSelf: 'flex-end',
|
|
99
115
|
},
|
|
100
116
|
name: {
|
|
101
|
-
fontSize: 18,
|
|
102
117
|
fontWeight: Platform.OS === 'web' ? '500' : '700',
|
|
103
|
-
marginLeft: 10,
|
|
104
118
|
color: $config.PRIMARY_FONT_COLOR,
|
|
105
|
-
|
|
119
|
+
textAlign: 'left',
|
|
120
|
+
marginRight: 10
|
|
106
121
|
},
|
|
107
122
|
backIcon: {
|
|
108
123
|
width: 20,
|
|
109
|
-
height:
|
|
110
|
-
alignSelf: 'center',
|
|
111
|
-
justifyContent: 'center',
|
|
112
|
-
tintColor: $config.PRIMARY_FONT_COLOR,
|
|
124
|
+
height: 20,
|
|
113
125
|
},
|
|
114
126
|
});
|
|
115
127
|
export default ChatContainer;
|