agora-appbuilder-core 1.0.7 → 2.0.0

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.
Files changed (50) hide show
  1. package/package.json +4 -2
  2. package/template/agora-rn-uikit/.git/HEAD +1 -0
  3. package/template/agora-rn-uikit/.git/config +16 -0
  4. package/template/agora-rn-uikit/.git/description +1 -0
  5. package/template/agora-rn-uikit/.git/hooks/applypatch-msg.sample +15 -0
  6. package/template/agora-rn-uikit/.git/hooks/commit-msg.sample +24 -0
  7. package/template/agora-rn-uikit/.git/hooks/fsmonitor-watchman.sample +173 -0
  8. package/template/agora-rn-uikit/.git/hooks/post-update.sample +8 -0
  9. package/template/agora-rn-uikit/.git/hooks/pre-applypatch.sample +14 -0
  10. package/template/agora-rn-uikit/.git/hooks/pre-commit.sample +49 -0
  11. package/template/agora-rn-uikit/.git/hooks/pre-merge-commit.sample +13 -0
  12. package/template/agora-rn-uikit/.git/hooks/pre-push.sample +53 -0
  13. package/template/agora-rn-uikit/.git/hooks/pre-rebase.sample +169 -0
  14. package/template/agora-rn-uikit/.git/hooks/pre-receive.sample +24 -0
  15. package/template/agora-rn-uikit/.git/hooks/prepare-commit-msg.sample +42 -0
  16. package/template/agora-rn-uikit/.git/hooks/push-to-checkout.sample +78 -0
  17. package/template/agora-rn-uikit/.git/hooks/update.sample +128 -0
  18. package/template/agora-rn-uikit/.git/index +0 -0
  19. package/template/agora-rn-uikit/.git/info/exclude +6 -0
  20. package/template/agora-rn-uikit/.git/logs/HEAD +3 -0
  21. package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -0
  22. package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -0
  23. package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -0
  24. package/template/agora-rn-uikit/.git/objects/pack/pack-19a65e0782e617d79275088a06e668496d6e2d73.idx +0 -0
  25. package/template/agora-rn-uikit/.git/objects/pack/pack-19a65e0782e617d79275088a06e668496d6e2d73.pack +0 -0
  26. package/template/agora-rn-uikit/.git/packed-refs +11 -0
  27. package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -0
  28. package/template/agora-rn-uikit/.git/refs/heads/master +1 -0
  29. package/template/agora-rn-uikit/.git/refs/remotes/origin/HEAD +1 -0
  30. package/template/agora-rn-uikit/.gitignore +63 -0
  31. package/template/agora-rn-uikit/package-lock.json +7612 -0
  32. package/template/agora-rn-uikit/src/RTCConfigure.tsx +6 -2
  33. package/template/package.json +4 -3
  34. package/template/react-native-toast-message/.gitignore +5 -0
  35. package/template/react-native-toast-message/.npmignore +5 -0
  36. package/template/react-native-toast-message/package-lock.json +10553 -0
  37. package/template/src/.DS_Store +0 -0
  38. package/template/src/components/Precall.native.tsx +22 -14
  39. package/template/src/components/Precall.tsx +21 -19
  40. package/template/src/components/StorageContext.tsx +2 -0
  41. package/template/src/pages/Authenticate.tsx +5 -4
  42. package/template/src/pages/Create.tsx +19 -15
  43. package/template/src/pages/Join.tsx +13 -30
  44. package/template/src/pages/VideoCall.tsx +70 -52
  45. package/template/src/subComponents/.DS_Store +0 -0
  46. package/template/src/subComponents/LogoutButton.tsx +1 -1
  47. package/template/src/subComponents/ScreenshareButton.tsx +7 -5
  48. package/template/src/subComponents/SelectOAuth.tsx +25 -12
  49. package/template/src/utils/hasBrandLogo.tsx +3 -0
  50. package/template/webpack.commons.js +1 -0
Binary file
@@ -46,24 +46,29 @@ const Precall = (props: any) => {
46
46
  <View style={style.heading}>
47
47
  <Text style={style.headingText}>Precall </Text>
48
48
  </View>
49
- <View style={{zIndex: 50, position: 'absolute', width: '100%', left: '18%', top: 10, alignSelf: 'center'}}>
49
+ <View
50
+ style={{
51
+ zIndex: 50,
52
+ position: 'absolute',
53
+ width: '100%',
54
+ left: '18%',
55
+ top: 10,
56
+ alignSelf: 'center',
57
+ }}>
50
58
  {error ? <Error error={error} showBack={true} /> : <></>}
51
59
  </View>
52
60
  <View style={style.full}>
53
61
  <MaxVideoView user={maxUsers[0]} key={maxUsers[0].uid} />
54
62
  </View>
55
63
  {Platform.OS === 'ios' ? (
56
- <View
57
- style={style.textInputHolder}>
64
+ <View style={style.textInputHolder}>
58
65
  <TextInput
59
66
  value={username}
60
67
  onChangeText={(text) => {
61
- if (username !== 'Getting name...') {
62
- setUsername(text);
63
- }
68
+ setUsername(text);
64
69
  }}
65
70
  onSubmitEditing={() => {}}
66
- placeholder="Display Name"
71
+ placeholder={queryComplete ? 'Display name*' : 'Getting name...'}
67
72
  />
68
73
  </View>
69
74
  ) : (
@@ -71,12 +76,11 @@ const Precall = (props: any) => {
71
76
  <TextInput
72
77
  value={username}
73
78
  onChangeText={(text) => {
74
- if (username !== 'Getting name...') {
75
- setUsername(text);
76
- }
79
+ setUsername(text);
77
80
  }}
78
81
  onSubmitEditing={() => {}}
79
- placeholder="Display Name"
82
+ placeholder={queryComplete ? 'Display name*' : 'Getting name...'}
83
+ editable={queryComplete}
80
84
  />
81
85
  </View>
82
86
  )}
@@ -95,10 +99,14 @@ const Precall = (props: any) => {
95
99
  // disabled={!queryComplete}
96
100
  style={{marginBottom: 50}}>
97
101
  {/* <Text style={style.buttonText}> */}
98
- {/* {queryComplete ? 'Join Room' : 'Loading...'} */}
102
+ {/* {queryComplete ? 'Join Room' : 'Loading...'} */}
99
103
  {/* </Text> */}
100
- {/* </TouchableOpacity> */}
101
- <PrimaryButton text={"Join Room"} disabled={!queryComplete} onPress={() => setCallActive(true)} />
104
+ {/* </TouchableOpacity> */}
105
+ <PrimaryButton
106
+ text={'Join Room'}
107
+ disabled={!queryComplete || username.trim() === ''}
108
+ onPress={() => setCallActive(true)}
109
+ />
102
110
  </View>
103
111
  {/* </ImageBackground> */}
104
112
  </View>
@@ -10,13 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {useState, useContext} from 'react';
13
- import {
14
- View,
15
- Text,
16
- StyleSheet,
17
- Dimensions,
18
- Platform,
19
- } from 'react-native';
13
+ import {View, Text, StyleSheet, Dimensions, Platform} from 'react-native';
20
14
  import TextInput from '../atoms/TextInput';
21
15
  import PrimaryButton from '../atoms/PrimaryButton';
22
16
  import {MaxUidConsumer} from '../../agora-rn-uikit/src/MaxUidContext';
@@ -25,6 +19,7 @@ import {LocalAudioMute, LocalVideoMute} from '../../agora-rn-uikit/Components';
25
19
  import LocalUserContext from '../../agora-rn-uikit/src/LocalUserContext';
26
20
  import SelectDevice from '../subComponents/SelectDevice';
27
21
  import Logo from '../subComponents/Logo';
22
+ import hasBrandLogo from '../utils/hasBrandLogo';
28
23
  // import OpenInNativeButton from '../subComponents/OpenInNativeButton';
29
24
  import ColorContext from './ColorContext';
30
25
  // import {useHistory} from './Router';
@@ -39,6 +34,7 @@ const Precall = (props: any) => {
39
34
  Dimensions.get('window').height,
40
35
  Dimensions.get('window').width > Dimensions.get('window').height,
41
36
  ]);
37
+
42
38
  let onLayout = (e: any) => {
43
39
  setDim([e.nativeEvent.layout.width, e.nativeEvent.layout.height]);
44
40
  };
@@ -50,7 +46,7 @@ const Precall = (props: any) => {
50
46
  // resizeMode={'cover'}>
51
47
  <View style={style.main} onLayout={onLayout}>
52
48
  <View style={style.nav}>
53
- <Logo />
49
+ {hasBrandLogo && <Logo />}
54
50
  {error ? <Error error={error} showBack={true} /> : <></>}
55
51
  {/* <OpenInNativeButton /> */}
56
52
  </View>
@@ -94,17 +90,18 @@ const Precall = (props: any) => {
94
90
  <TextInput
95
91
  value={username}
96
92
  onChangeText={(text) => {
97
- if (username !== 'Getting name...') {
98
- setUsername(text);
99
- }
93
+ setUsername(text);
100
94
  }}
101
95
  onSubmitEditing={() => {}}
102
- placeholder="Display Name"
96
+ placeholder={
97
+ queryComplete ? 'Display name*' : 'Getting name...'
98
+ }
99
+ editable={queryComplete}
103
100
  />
104
101
  <View style={style.margin5Btm} />
105
102
  <PrimaryButton
106
103
  onPress={() => setCallActive(true)}
107
- disabled={!queryComplete}
104
+ disabled={!queryComplete || username.trim() === ''}
108
105
  text={queryComplete ? 'Join Room' : 'Loading...'}
109
106
  />
110
107
  </View>
@@ -140,7 +137,11 @@ const Precall = (props: any) => {
140
137
  </Text>
141
138
  {/* </View> */}
142
139
  <View style={{height: 20}} />
143
- <View style={{flex: 1, maxWidth: Platform.OS === 'web'? '25vw' : 'auto'}}>
140
+ <View
141
+ style={{
142
+ flex: 1,
143
+ maxWidth: Platform.OS === 'web' ? '25vw' : 'auto',
144
+ }}>
144
145
  <SelectDevice />
145
146
  </View>
146
147
  <View
@@ -154,17 +155,18 @@ const Precall = (props: any) => {
154
155
  <TextInput
155
156
  value={username}
156
157
  onChangeText={(text) => {
157
- if (username !== 'Getting name...') {
158
- setUsername(text);
159
- }
158
+ setUsername(text);
160
159
  }}
161
160
  onSubmitEditing={() => {}}
162
- placeholder="Display Name"
161
+ placeholder={
162
+ queryComplete ? 'Display name*' : 'Getting name...'
163
+ }
164
+ editable={queryComplete}
163
165
  />
164
166
  <View style={{height: 20}} />
165
167
  <PrimaryButton
166
168
  onPress={() => setCallActive(true)}
167
- disabled={!queryComplete}
169
+ disabled={!queryComplete || username.trim() === ''}
168
170
  text={queryComplete ? 'Join Room' : 'Loading...'}
169
171
  />
170
172
  </View>
@@ -15,6 +15,7 @@ import useMount from './useMount';
15
15
 
16
16
  interface StoreInterface {
17
17
  token: null | string;
18
+ displayName: null | string;
18
19
  }
19
20
 
20
21
  interface StorageContextInterface {
@@ -24,6 +25,7 @@ interface StorageContextInterface {
24
25
 
25
26
  const initStoreValue: StoreInterface = {
26
27
  token: null,
28
+ displayName: '',
27
29
  };
28
30
 
29
31
  const initStorageContextValue = {
@@ -20,6 +20,7 @@ import {
20
20
  import Logo from '../subComponents/Logo';
21
21
  import OAuth from '../components/OAuth';
22
22
  import Illustration from '../subComponents/Illustration';
23
+ import hasBrandLogo from '../utils/hasBrandLogo';
23
24
 
24
25
  const Authenticate = () => {
25
26
  const [dim, setDim] = useState([
@@ -37,13 +38,13 @@ const Authenticate = () => {
37
38
  style={style.full}
38
39
  resizeMode={'cover'}>
39
40
  <View style={style.main}>
40
- <View style={style.nav}>
41
- <Logo />
42
- </View>
41
+ <View style={style.nav}>{hasBrandLogo && <Logo />}</View>
43
42
  <View style={style.content}>
44
43
  <View style={style.leftContent}>
45
44
  <Text style={style.heading}>Login using OAuth</Text>
46
- <Text style={style.headline}>Please select an OAuth provider to login.</Text>
45
+ <Text style={style.headline}>
46
+ Please select an OAuth provider to login.
47
+ </Text>
47
48
  <OAuth />
48
49
  </View>
49
50
  {dim[0] > dim[1] + 150 ? (
@@ -10,12 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {useState} from 'react';
13
- import {
14
- View,
15
- Text,
16
- StyleSheet,
17
- Dimensions,
18
- } from 'react-native';
13
+ import {View, Text, StyleSheet, Dimensions, ScrollView} from 'react-native';
19
14
  import {useHistory} from '../components/Router';
20
15
  import Checkbox from '../subComponents/Checkbox';
21
16
  import {gql, useMutation} from '@apollo/client';
@@ -31,6 +26,7 @@ import HorizontalRule from '../atoms/HorizontalRule';
31
26
  import TextInput from '../atoms/TextInput';
32
27
  import Error from '../subComponents/Error';
33
28
  import Toast from '../../react-native-toast-message';
29
+ import hasBrandLogo from '../utils/hasBrandLogo';
34
30
 
35
31
  type PasswordInput = {
36
32
  host: string;
@@ -38,8 +34,16 @@ type PasswordInput = {
38
34
  };
39
35
 
40
36
  const CREATE_CHANNEL = gql`
41
- mutation CreateChannel($title: String!, $backendURL: String!, $enablePSTN: Boolean) {
42
- createChannel(title: $title, backendURL: $backendURL, enablePSTN: $enablePSTN) {
37
+ mutation CreateChannel(
38
+ $title: String!
39
+ $backendURL: String!
40
+ $enablePSTN: Boolean
41
+ ) {
42
+ createChannel(
43
+ title: $title
44
+ backendURL: $backendURL
45
+ enablePSTN: $enablePSTN
46
+ ) {
43
47
  passphrase {
44
48
  host
45
49
  view
@@ -111,9 +115,9 @@ const Create = () => {
111
115
  // style={style.full}
112
116
  // resizeMode={'cover'}>
113
117
  // <KeyboardAvoidingView behavior={'height'} style={style.main}>
114
- <View style={style.main}>
118
+ <ScrollView contentContainerStyle={style.main}>
115
119
  <View style={style.nav}>
116
- <Logo />
120
+ {hasBrandLogo && <Logo />}
117
121
  {error ? <Error error={error} /> : <></>}
118
122
  {/* <OpenInNativeButton /> */}
119
123
  </View>
@@ -179,17 +183,17 @@ const Create = () => {
179
183
  roomTitle={roomTitle}
180
184
  />
181
185
  )}
182
- </View>
186
+ </ScrollView>
183
187
  );
184
188
  };
185
189
 
186
190
  const style = StyleSheet.create({
187
- full: {flex: 1},
188
191
  main: {
189
- flex: 2,
190
- justifyContent: 'space-evenly',
192
+ paddingVertical: '8%',
191
193
  marginHorizontal: '8%',
192
- marginVertical: '2%',
194
+ display: 'flex',
195
+ justifyContent: 'space-evenly',
196
+ flexGrow: 1,
193
197
  },
194
198
  nav: {
195
199
  flex: 1,
@@ -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
- useState<null | {name: string; message: string}>(null);
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
- // throw new Error("My first Sentry error!");
58
+
61
59
  return (
62
- // <ImageBackground
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
- {/* </KeyboardAvoidingView> */}
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
- flex: 2,
121
- justifyContent: 'space-evenly',
102
+ paddingVertical: '8%',
122
103
  marginHorizontal: '8%',
123
- marginVertical: '2%',
104
+ display: 'flex',
105
+ justifyContent: 'space-evenly',
106
+ flexGrow: 1,
124
107
  },
125
108
  nav: {
126
109
  flex: 1,
@@ -30,6 +30,7 @@ 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 hasBrandLogo from '../utils/hasBrandLogo';
33
34
  import ChatContext from '../components/ChatContext';
34
35
  import {SidePanelType} from '../subComponents/SidePanelEnum';
35
36
  import {videoView} from '../../theme.json';
@@ -65,7 +66,8 @@ const useChatNotification = (
65
66
  };
66
67
 
67
68
  const NotificationControl = ({children, chatDisplayed, setSidePanel}) => {
68
- const {messageStore, privateMessageStore, userList, localUid} = useContext(ChatContext);
69
+ const {messageStore, privateMessageStore, userList, localUid} =
70
+ useContext(ChatContext);
69
71
  const [
70
72
  lastCheckedPublicState,
71
73
  setLastCheckedPublicState,
@@ -116,8 +118,13 @@ const NotificationControl = ({children, chatDisplayed, setSidePanel}) => {
116
118
  messageStore[messageStore.length - 1]?.uid !== localUid
117
119
  ) {
118
120
  Toast.show({
119
- text1: messageStore[messageStore.length - 1]?.msg.length > 50 ? messageStore[messageStore.length - 1]?.msg.slice(1, 50) + '...' : messageStore[messageStore.length - 1]?.msg.slice(1),
120
- text2: userList[messageStore[messageStore.length - 1]?.uid] ? 'From: ' + userList[messageStore[messageStore.length - 1]?.uid].name : '',
121
+ text1:
122
+ messageStore[messageStore.length - 1]?.msg.length > 50
123
+ ? messageStore[messageStore.length - 1]?.msg.slice(1, 50) + '...'
124
+ : messageStore[messageStore.length - 1]?.msg.slice(1),
125
+ text2: userList[messageStore[messageStore.length - 1]?.uid]
126
+ ? 'From: ' + userList[messageStore[messageStore.length - 1]?.uid].name
127
+ : '',
121
128
  visibilityTime: 1000,
122
129
  onPress: () => {
123
130
  setSidePanel(SidePanelType.Chat);
@@ -212,8 +219,10 @@ enum RnEncryptionEnum {
212
219
  }
213
220
 
214
221
  const VideoCall: React.FC = () => {
215
- const {store} = useContext(StorageContext);
216
- const [username, setUsername] = useState('Getting name...');
222
+ const {store, setStore} = useContext(StorageContext);
223
+ const getInitialUsername = () =>
224
+ store?.displayName ? store.displayName : '';
225
+ const [username, setUsername] = useState(getInitialUsername);
217
226
  const [participantsView, setParticipantsView] = useState(false);
218
227
  const [callActive, setCallActive] = useState($config.PRECALL ? false : true);
219
228
  const [layout, setLayout] = useState(Layout.Grid);
@@ -223,9 +232,9 @@ const VideoCall: React.FC = () => {
223
232
  const [sidePanel, setSidePanel] = useState<SidePanelType>(SidePanelType.None);
224
233
  const {phrase} = useParams();
225
234
  const [errorMessage, setErrorMessage] = useState(null);
226
- let isHost = true; //change to false by default after testing
227
- let title = null;
228
- let rtcProps = {
235
+ const [isHost, setIsHost] = React.useState(false);
236
+ const [title, setTitle] = React.useState('');
237
+ const [rtcProps, setRtcProps] = React.useState({
229
238
  appId: $config.APP_ID,
230
239
  channel: null,
231
240
  uid: null,
@@ -238,60 +247,59 @@ const VideoCall: React.FC = () => {
238
247
  encryption: $config.ENCRYPTION_ENABLED
239
248
  ? {key: null, mode: RnEncryptionEnum.AES128XTS, screenKey: null}
240
249
  : false,
241
- };
242
- let data, loading, error;
250
+ });
243
251
 
244
- ({data, loading, error} = useQuery(
252
+ const {data, loading, error} = useQuery(
245
253
  store.token === null
246
254
  ? JOIN_CHANNEL_PHRASE
247
255
  : JOIN_CHANNEL_PHRASE_AND_GET_USER,
248
256
  {
249
257
  variables: {passphrase: phrase},
250
258
  },
251
- ));
259
+ );
252
260
 
253
- if (error) {
254
- console.log('error', error);
255
- // console.log('error data', data);
256
- if (!errorMessage) {
257
- setErrorMessage(error);
261
+ React.useEffect(() => {
262
+ if (error) {
263
+ console.log('error', error);
264
+ // console.log('error data', data);
265
+ if (!errorMessage) {
266
+ setErrorMessage(error);
267
+ }
268
+ return;
258
269
  }
259
- }
260
270
 
261
- if (!loading && data) {
262
- console.log('token:', rtcProps.token);
263
- console.log('error', data.error);
264
- rtcProps = {
265
- appId: $config.APP_ID,
266
- channel: data.joinChannel.channel,
267
- uid: data.joinChannel.mainUser.uid,
268
- token: data.joinChannel.mainUser.rtc,
269
- rtm: data.joinChannel.mainUser.rtm,
270
- dual: true,
271
- profile: $config.PROFILE,
272
- encryption: $config.ENCRYPTION_ENABLED
273
- ? {
274
- key: data.joinChannel.secret,
275
- mode: RnEncryptionEnum.AES128XTS,
276
- screenKey: data.joinChannel.secret,
277
- }
278
- : false,
279
- screenShareUid: data.joinChannel.screenShare.uid,
280
- screenShareToken: data.joinChannel.screenShare.rtc,
281
- };
282
- isHost = data.joinChannel.isHost;
283
- title = data.joinChannel.title;
284
- console.log('query done: ', data, queryComplete);
285
- if (username === 'Getting name...') {
271
+ if (!loading && data) {
272
+ console.log('token:', rtcProps.token);
273
+ console.log('error', data.error);
274
+ setRtcProps({
275
+ appId: $config.APP_ID,
276
+ channel: data.joinChannel.channel,
277
+ uid: data.joinChannel.mainUser.uid,
278
+ token: data.joinChannel.mainUser.rtc,
279
+ rtm: data.joinChannel.mainUser.rtm,
280
+ dual: true,
281
+ profile: $config.PROFILE,
282
+ encryption: $config.ENCRYPTION_ENABLED
283
+ ? {
284
+ key: data.joinChannel.secret,
285
+ mode: RnEncryptionEnum.AES128XTS,
286
+ screenKey: data.joinChannel.secret,
287
+ }
288
+ : false,
289
+ screenShareUid: data.joinChannel.screenShare.uid,
290
+ screenShareToken: data.joinChannel.screenShare.rtc,
291
+ });
292
+ setIsHost(data.joinChannel.isHost);
293
+ setTitle(data.joinChannel.title);
294
+ console.log('query done: ', data, queryComplete);
295
+ // 1. Store the display name from API
286
296
  if (data.getUser) {
287
297
  setUsername(data.getUser.name);
288
- } else {
289
- setUsername('');
290
298
  }
299
+ console.log('token:', rtcProps.token);
300
+ queryComplete ? {} : setQueryComplete(true);
291
301
  }
292
- console.log('token:', rtcProps.token);
293
- queryComplete ? {} : setQueryComplete(true);
294
- }
302
+ }, [error, loading, data]);
295
303
 
296
304
  const history = useHistory();
297
305
  const callbacks = {
@@ -300,6 +308,14 @@ const VideoCall: React.FC = () => {
300
308
  history.push('/');
301
309
  }, 0),
302
310
  };
311
+
312
+ React.useEffect(() => {
313
+ // Update the username in localstorage when username changes
314
+ if (setStore) {
315
+ setStore({token: store?.token || null, displayName: username});
316
+ }
317
+ }, [username]);
318
+
303
319
  // throw new Error("My first Sentry error!");
304
320
  return (
305
321
  <>
@@ -350,7 +366,11 @@ const VideoCall: React.FC = () => {
350
366
  setLastCheckedPublicState
351
367
  }
352
368
  />
353
- <View style={[style.videoView, {backgroundColor: '#ffffff00'}]}>
369
+ <View
370
+ style={[
371
+ style.videoView,
372
+ {backgroundColor: '#ffffff00'},
373
+ ]}>
354
374
  {layout === Layout.Pinned ? (
355
375
  <PinnedVideo />
356
376
  ) : (
@@ -446,9 +466,7 @@ const VideoCall: React.FC = () => {
446
466
  </>
447
467
  ) : (
448
468
  <View style={style.loader}>
449
- <View style={style.loaderLogo}>
450
- <Logo />
451
- </View>
469
+ <View style={style.loaderLogo}>{hasBrandLogo && <Logo />}</View>
452
470
  <Text style={style.loaderText}>Starting Call. Just a second.</Text>
453
471
  </View>
454
472
  )}
@@ -31,7 +31,7 @@ const LogoutButton = () => {
31
31
 
32
32
  const logout = () => {
33
33
  if (setStore) {
34
- setStore({token: null});
34
+ setStore({token: null, displayName: ''});
35
35
  }
36
36
  logoutQuery({variables: {token}}).catch((e) => {
37
37
  console.log(e);
@@ -109,11 +109,13 @@ const ScreenshareButton = (props: ScreenSharingProps) => {
109
109
  value: [joinedUser[0]],
110
110
  });
111
111
  setLayout(Layout.Pinned);
112
- }else if(newUserUid === 1){
113
- dispatch({
114
- type: 'SwapVideo',
115
- value: [joinedUser[0]],
116
- });
112
+ } else if (newUserUid === 1) {
113
+ if (newUserUid !== users[0].uid){
114
+ dispatch({
115
+ type: 'SwapVideo',
116
+ value: [joinedUser[0]],
117
+ });
118
+ }
117
119
  setLayout(Layout.Pinned);
118
120
  }
119
121
  }