agora-appbuilder-core 2.0.1 → 2.0.3-rc2

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 (79) hide show
  1. package/Readme.md +2 -1
  2. package/package.json +1 -1
  3. package/template/_package-lock.json +8853 -8806
  4. package/template/agora-rn-uikit/.git/index +0 -0
  5. package/template/agora-rn-uikit/.git/logs/HEAD +2 -2
  6. package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -1
  7. package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -1
  8. package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -1
  9. package/template/agora-rn-uikit/.git/objects/pack/pack-2a0122bf5a3199f941e5a52535f43881623f752c.idx +0 -0
  10. package/template/agora-rn-uikit/.git/objects/pack/{pack-f379286d0537eb68377220b4929979324b8d5d1c.pack → pack-2a0122bf5a3199f941e5a52535f43881623f752c.pack} +0 -0
  11. package/template/agora-rn-uikit/.git/packed-refs +4 -2
  12. package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -1
  13. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +21 -0
  14. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +22 -14
  15. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +17 -13
  16. package/template/agora-rn-uikit/src/Controls/types.ts +4 -0
  17. package/template/agora-rn-uikit/src/Rtc/Create.tsx +117 -19
  18. package/template/agora-rn-uikit/src/RtcConfigure.tsx +24 -13
  19. package/template/{src/utils/isSafariBrowser.tsx → agora-rn-uikit/src/Utils/isSafariBrowser.ts} +3 -0
  20. package/template/{src → agora-rn-uikit/src}/hooks/useImageDelay.tsx +5 -2
  21. package/template/agora-rn-uikit/src/index.ts +2 -0
  22. package/template/bridge/rtc/webNg/RtcEngine.ts +73 -70
  23. package/template/bridge/rtc/webNg/Types.ts +59 -5
  24. package/template/bridge/rtm/web/Types.ts +13 -0
  25. package/template/bridge/rtm/web/index.ts +78 -1
  26. package/template/global.d.ts +2 -0
  27. package/template/package-lock.json +8853 -8806
  28. package/template/package.json +3 -4
  29. package/template/react-native-toast-message/src/components/base/styles.js +4 -2
  30. package/template/src/assets/icons.ts +41 -28
  31. package/template/src/components/Chat.tsx +70 -184
  32. package/template/src/components/ChatContext.ts +13 -2
  33. package/template/src/components/Controls.native.tsx +37 -76
  34. package/template/src/components/Controls.tsx +50 -158
  35. package/template/src/components/DeviceConfigure.native.tsx +5 -1
  36. package/template/src/components/DeviceConfigure.tsx +38 -20
  37. package/template/src/components/Navbar.tsx +185 -226
  38. package/template/src/components/ParticipantsView.tsx +176 -184
  39. package/template/src/components/Precall.native.tsx +83 -69
  40. package/template/src/components/Precall.tsx +174 -191
  41. package/template/src/components/RTMConfigure.tsx +264 -78
  42. package/template/src/components/SettingsView.tsx +9 -19
  43. package/template/src/components/livestream/LiveStreamContext.tsx +411 -0
  44. package/template/src/components/livestream/Types.ts +69 -0
  45. package/template/src/components/livestream/index.ts +9 -0
  46. package/template/src/components/livestream/views/LiveStreamControls.tsx +27 -0
  47. package/template/src/components/participants/AllAudienceParticipants.tsx +53 -0
  48. package/template/src/components/participants/AllHostParticipants.tsx +65 -0
  49. package/template/src/components/participants/MeParticipant.tsx +37 -0
  50. package/template/src/components/participants/ParticipantName.tsx +47 -0
  51. package/template/src/components/participants/ParticipantSectionTitle.tsx +29 -0
  52. package/template/src/components/participants/RemoteParticipants.tsx +69 -0
  53. package/template/src/components/participants/ScreenshareParticipants.tsx +28 -0
  54. package/template/src/components/participants/context/ParticipantContext.tsx +97 -0
  55. package/template/src/components/styles.ts +13 -0
  56. package/template/src/pages/Create.tsx +25 -14
  57. package/template/src/pages/VideoCall.tsx +197 -159
  58. package/template/src/subComponents/ChatBubble.tsx +4 -1
  59. package/template/src/subComponents/ChatContainer.tsx +44 -20
  60. package/template/src/subComponents/ChatInput.tsx +4 -12
  61. package/template/src/subComponents/Checkbox.native.tsx +6 -5
  62. package/template/src/subComponents/Checkbox.tsx +1 -0
  63. package/template/src/subComponents/Recording.tsx +23 -9
  64. package/template/src/subComponents/RemoteVideoMute.tsx +2 -3
  65. package/template/src/subComponents/SelectDevice.tsx +70 -35
  66. package/template/src/subComponents/chat/ChatParticipants.tsx +121 -0
  67. package/template/src/subComponents/livestream/ApprovedLiveStreamControlsView.tsx +23 -0
  68. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +70 -0
  69. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +57 -0
  70. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +24 -0
  71. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +38 -0
  72. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +37 -0
  73. package/template/src/subComponents/livestream/index.ts +18 -0
  74. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +80 -0
  75. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +24 -0
  76. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +200 -0
  77. package/template/src/subComponents/screenshare/ScreenshareContext.tsx +21 -0
  78. package/template/src/utils/index.tsx +48 -0
  79. package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx +0 -0
@@ -13,170 +13,178 @@ import React, {useState, useContext, useEffect} from 'react';
13
13
  import {View, Text, StyleSheet, Dimensions, Platform} from 'react-native';
14
14
  import TextInput from '../atoms/TextInput';
15
15
  import PrimaryButton from '../atoms/PrimaryButton';
16
-
17
16
  import {
18
17
  MaxUidConsumer,
19
18
  MaxVideoView,
20
19
  LocalAudioMute,
21
20
  LocalVideoMute,
22
21
  LocalUserContext,
22
+ PropsContext,
23
+ ClientRole,
23
24
  } from '../../agora-rn-uikit';
24
-
25
25
  import SelectDevice from '../subComponents/SelectDevice';
26
26
  import Logo from '../subComponents/Logo';
27
27
  import hasBrandLogo from '../utils/hasBrandLogo';
28
28
  import ColorContext from './ColorContext';
29
29
  import Error from '../subComponents/Error';
30
30
 
31
+ const JoinRoomInputView = (props: any) => {
32
+ const {
33
+ username,
34
+ setUsername,
35
+ queryComplete,
36
+ setCallActive,
37
+ buttonText,
38
+ error,
39
+ } = props;
40
+
41
+ return (
42
+ <View style={style.btnContainer}>
43
+ <TextInput
44
+ value={username}
45
+ onChangeText={(text) => {
46
+ setUsername(text);
47
+ }}
48
+ onSubmitEditing={() => {}}
49
+ placeholder={queryComplete ? 'Display name*' : 'Getting name...'}
50
+ editable={queryComplete && !error}
51
+ />
52
+ <View style={{height: 20}} />
53
+ <PrimaryButton
54
+ onPress={() => setCallActive(true)}
55
+ disabled={!queryComplete || username.trim() === '' || error}
56
+ text={queryComplete ? buttonText : 'Loading...'}
57
+ />
58
+ </View>
59
+ );
60
+ };
61
+
31
62
  const Precall = (props: any) => {
32
63
  const {primaryColor} = useContext(ColorContext);
33
- const {setCallActive, queryComplete, username, setUsername, error, title} = props;
34
- const [dim, setDim] = useState([
64
+ const {rtcProps} = useContext(PropsContext);
65
+
66
+ const {queryComplete, error, title} = props;
67
+ const [buttonText, setButtonText] = React.useState('Join Room');
68
+
69
+ const [dim, setDim] = useState<[number, number]>([
35
70
  Dimensions.get('window').width,
36
71
  Dimensions.get('window').height,
37
- Dimensions.get('window').width > Dimensions.get('window').height,
38
72
  ]);
39
73
 
40
74
  let onLayout = (e: any) => {
41
75
  setDim([e.nativeEvent.layout.width, e.nativeEvent.layout.height]);
42
76
  };
43
77
 
44
- useEffect(()=>{
45
- if(Platform.OS === 'web'){
46
- if(title){
47
- document.title = title + ' | ' + $config.APP_NAME
78
+ useEffect(() => {
79
+ if (Platform.OS === 'web') {
80
+ if (title) {
81
+ document.title = title + ' | ' + $config.APP_NAME;
48
82
  }
49
83
  }
50
- })
84
+ });
85
+
86
+ useEffect(() => {
87
+ let clientRole = '';
88
+ if (rtcProps?.role == 1) {
89
+ clientRole = 'Host';
90
+ }
91
+ if (rtcProps?.role == 2) {
92
+ clientRole = 'Audience';
93
+ }
94
+ setButtonText(
95
+ $config.EVENT_MODE ? `Join Room as ${clientRole}` : `Join Room`,
96
+ );
97
+ }, [rtcProps?.role]);
98
+
99
+ const isMobileView = () => dim[0] < dim[1] + 150;
100
+
101
+ if (!queryComplete) return <Text style={style.titleFont}>Loading..</Text>;
102
+
103
+ const brandHolder = () => (
104
+ <View style={style.nav}>
105
+ {hasBrandLogo && <Logo />}
106
+ {error && <Error error={error} showBack={true} />}
107
+ </View>
108
+ );
109
+
110
+ const meetingTitle = () => (
111
+ <>
112
+ <Text style={[style.titleHeading, {color: $config.PRIMARY_COLOR}]}>
113
+ {title}
114
+ </Text>
115
+ <View style={{height: 50}} />
116
+ </>
117
+ );
51
118
 
52
119
  return (
53
- // <ImageBackground
54
- // onLayout={onLayout}
55
- // style={style.full}
56
- // resizeMode={'cover'}>
57
120
  <View style={style.main} onLayout={onLayout}>
58
- <View style={style.nav}>
59
- {hasBrandLogo && <Logo />}
60
- {error ? <Error error={error} showBack={true} /> : <></>}
61
- {/* <OpenInNativeButton /> */}
62
- </View>
63
- <View style={style.content}>
64
- <View style={style.leftContent}>
65
- <MaxUidConsumer>
66
- {(maxUsers) => (
67
- <View style={{borderRadius: 10, flex: 1}}>
68
- <MaxVideoView user={maxUsers[0]} key={maxUsers[0].uid} />
69
- </View>
70
- )}
71
- </MaxUidConsumer>
72
- <View style={style.precallControls}>
73
- <LocalUserContext>
74
- <View style={{alignSelf: 'center'}}>
75
- <LocalVideoMute />
76
- </View>
77
- <View style={{alignSelf: 'center'}}>
78
- <LocalAudioMute />
79
- </View>
80
- </LocalUserContext>
81
- </View>
82
- {dim[0] < dim[1] + 150 ? (
83
- <View style={[style.margin5Btm, {alignItems: 'center'}]}>
84
- <TextInput
85
- value={username}
86
- onChangeText={(text) => {
87
- setUsername(text);
88
- }}
89
- onSubmitEditing={() => {}}
90
- placeholder={
91
- queryComplete ? 'Display name*' : 'Getting name...'
92
- }
93
- editable={queryComplete}
94
- />
95
- <View style={style.margin5Btm} />
96
- <PrimaryButton
97
- onPress={() => setCallActive(true)}
98
- disabled={!queryComplete || username.trim() === ''}
99
- text={queryComplete ? 'Join Room' : 'Loading...'}
100
- />
101
- </View>
102
- ) : (
103
- <></>
104
- )}
121
+ {/* Precall screen only changes for audience in Live Stream event */}
122
+ {$config.EVENT_MODE && rtcProps.role == ClientRole.Audience ? (
123
+ <View style={style.preCallContainer}>
124
+ {brandHolder()}
125
+ {meetingTitle()}
126
+ <JoinRoomInputView {...props} buttonText={buttonText} />
105
127
  </View>
106
- {dim[0] >= dim[1] + 150 ? (
107
- // <View style={[style.full]}>
108
- <View
109
- style={{
110
- flex: 1,
111
- backgroundColor: $config.SECONDARY_FONT_COLOR + '25',
112
- marginLeft: 50,
113
- padding: 20,
114
- borderRadius: 10,
115
- alignItems: 'center',
116
- borderWidth: 1,
117
- borderStyle: 'solid',
118
- borderColor: $config.PRIMARY_COLOR,
119
- height: '70%',
120
- minHeight: 340,
121
- minWidth: 380,
122
- alignSelf: 'center',
123
- justifyContent: 'center',
124
- marginBottom: '10%',
125
- }}>
126
- <Text style={[style.titleHeading, {color: $config.PRIMARY_COLOR}]}>
127
- {title}
128
- </Text>
129
- <View style={{height: 20}} />
130
- <View style={[{shadowColor: primaryColor}, style.precallPickers]}>
131
- {/* <View style={{flex: 1}}> */}
132
- <Text
133
- style={[style.subHeading, {color: $config.PRIMARY_FONT_COLOR}]}>
134
- Select Input Device
135
- </Text>
136
- {/* </View> */}
137
- <View style={{height: 20}} />
138
- <View
139
- style={{
140
- flex: 1,
141
- maxWidth: Platform.OS === 'web' ? '25vw' : 'auto',
142
- }}>
143
- <SelectDevice />
144
- </View>
128
+ ) : (
129
+ <>
130
+ {brandHolder()}
131
+ <View style={style.content}>
132
+ <View style={style.upperContainer}>
145
133
  <View
146
- style={{
147
- flex: 1,
148
- width: 350,
149
- justifyContent: 'center',
150
- alignItems: 'center',
151
- marginTop: 50,
152
- }}>
153
- <TextInput
154
- value={username}
155
- onChangeText={(text) => {
156
- setUsername(text);
157
- }}
158
- onSubmitEditing={() => {}}
159
- placeholder={
160
- queryComplete ? 'Display name*' : 'Getting name...'
161
- }
162
- editable={queryComplete}
163
- />
164
- <View style={{height: 20}} />
165
- <PrimaryButton
166
- onPress={() => setCallActive(true)}
167
- disabled={!queryComplete || username.trim() === ''}
168
- text={queryComplete ? 'Join Room' : 'Loading...'}
169
- />
134
+ style={[
135
+ style.leftContent,
136
+ isMobileView() ? {paddingRight: 0} : {paddingRight: 40},
137
+ ]}>
138
+ <MaxUidConsumer>
139
+ {(maxUsers) => (
140
+ <View style={{borderRadius: 10, flex: 1}}>
141
+ <MaxVideoView user={maxUsers[0]} key={maxUsers[0].uid} />
142
+ </View>
143
+ )}
144
+ </MaxUidConsumer>
145
+ <View style={style.precallControls}>
146
+ <LocalUserContext>
147
+ <View style={{alignSelf: 'center'}}>
148
+ <LocalVideoMute />
149
+ </View>
150
+ <View style={{alignSelf: 'center'}}>
151
+ <LocalAudioMute />
152
+ </View>
153
+ </LocalUserContext>
154
+ </View>
155
+ <View style={{marginBottom: '10%'}}>
156
+ {/* This view is visible only on MOBILE view */}
157
+ {isMobileView() && (
158
+ <JoinRoomInputView {...props} buttonText={buttonText} />
159
+ )}
160
+ </View>
170
161
  </View>
162
+ {/* This view is visible only on WEB view */}
163
+ {!isMobileView() && (
164
+ <View style={style.rightContent}>
165
+ {meetingTitle()}
166
+ <View
167
+ style={[{shadowColor: primaryColor}, style.precallPickers]}>
168
+ <Text style={style.subHeading}>Select Input Device</Text>
169
+ <View
170
+ style={{
171
+ flex: 1,
172
+ maxWidth: Platform.OS === 'web' ? '25vw' : 'auto',
173
+ marginVertical: 30,
174
+ }}>
175
+ <SelectDevice />
176
+ </View>
177
+ <View style={{width: '100%'}}>
178
+ <JoinRoomInputView {...props} buttonText={buttonText} />
179
+ </View>
180
+ </View>
181
+ </View>
182
+ )}
171
183
  </View>
172
184
  </View>
173
- ) : (
174
- // </View>
175
- <></>
176
- )}
177
- </View>
185
+ </>
186
+ )}
178
187
  </View>
179
- // </ImageBackground>
180
188
  );
181
189
  };
182
190
 
@@ -184,10 +192,17 @@ const style = StyleSheet.create({
184
192
  full: {flex: 1},
185
193
  main: {
186
194
  flex: 2,
187
- justifyContent: 'space-evenly',
195
+ // justifyContent: 'space-evenly',
188
196
  marginHorizontal: '10%',
189
197
  minHeight: 500,
190
198
  },
199
+ preCallContainer: {
200
+ display: 'flex',
201
+ flexDirection: 'column',
202
+ minHeight: 350,
203
+ justifyContent: 'space-between',
204
+ marginTop: '15%',
205
+ },
191
206
  nav: {
192
207
  flex: 1,
193
208
  width: '100%',
@@ -195,79 +210,50 @@ const style = StyleSheet.create({
195
210
  alignItems: 'center',
196
211
  justifyContent: 'center',
197
212
  },
198
- content: {flex: 6, flexDirection: 'row'},
213
+ content: {flex: 6, flexDirection: 'column'},
199
214
  leftContent: {
200
- width: '100%',
201
215
  flex: 1.3,
202
- justifyContent: 'space-evenly',
203
- marginTop: '2.5%',
204
- marginBottom: '1%',
205
- // marginRight: '5%',
216
+ height: '100%',
217
+ },
218
+ upperContainer: {
219
+ display: 'flex',
220
+ flexDirection: 'row',
221
+ alignItems: 'flex-start',
222
+ flex: 3,
223
+ },
224
+ rightContent: {
225
+ flex: 1,
226
+ height: '70%',
227
+ backgroundColor: $config.SECONDARY_FONT_COLOR + '25',
228
+ paddingLeft: 20,
229
+ borderRadius: 10,
230
+ alignItems: 'center',
231
+ borderWidth: 1,
232
+ borderStyle: 'solid',
233
+ borderColor: $config.PRIMARY_COLOR,
234
+ justifyContent: 'center',
235
+ },
236
+ titleFont: {
237
+ textAlign: 'center',
238
+ fontSize: 20,
239
+ color: $config.PRIMARY_FONT_COLOR,
206
240
  },
207
241
  titleHeading: {
208
242
  fontSize: 28,
209
243
  fontWeight: '700',
244
+ textAlign: 'center',
210
245
  color: $config.SECONDARY_FONT_COLOR,
211
246
  },
212
247
  subHeading: {
213
248
  fontSize: 18,
214
249
  fontWeight: '700',
215
- color: $config.SECONDARY_FONT_COLOR,
216
- },
217
- headline: {
218
- fontSize: 20,
219
- fontWeight: '400',
220
250
  color: $config.PRIMARY_FONT_COLOR,
221
- marginBottom: 20,
222
251
  },
223
- inputs: {
252
+ btnContainer: {
224
253
  flex: 1,
225
254
  width: '100%',
226
- alignSelf: 'flex-start',
255
+ justifyContent: 'center',
227
256
  alignItems: 'center',
228
- justifyContent: 'space-evenly',
229
- },
230
- textInput: {
231
- width: '100%',
232
- paddingLeft: 8,
233
- borderColor: $config.PRIMARY_COLOR,
234
- borderWidth: 2,
235
- color: $config.PRIMARY_FONT_COLOR,
236
- fontSize: 16,
237
- marginBottom: 15,
238
- maxWidth: 400,
239
- minHeight: 45,
240
- alignSelf: 'center',
241
- },
242
- primaryBtn: {
243
- width: '60%',
244
- backgroundColor: $config.PRIMARY_COLOR,
245
- maxWidth: 400,
246
- minHeight: 45,
247
- alignSelf: 'center',
248
- },
249
- primaryBtnDisabled: {
250
- width: '60%',
251
- backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
252
- maxWidth: 400,
253
- minHeight: 45,
254
- minWidth: 200,
255
- alignSelf: 'center',
256
- },
257
- primaryBtnText: {
258
- width: '100%',
259
- height: 45,
260
- lineHeight: 45,
261
- fontSize: 16,
262
- textAlign: 'center',
263
- textAlignVertical: 'center',
264
- color: $config.SECONDARY_FONT_COLOR,
265
- },
266
- ruler: {
267
- borderBottomColor: '#ccc',
268
- borderBottomWidth: 1,
269
- width: '100%',
270
- maxWidth: 200,
271
257
  },
272
258
  precallControls: {
273
259
  flexDirection: 'row',
@@ -280,14 +266,11 @@ const style = StyleSheet.create({
280
266
  precallPickers: {
281
267
  alignItems: 'center',
282
268
  alignSelf: 'center',
283
- // alignContent: 'space-around',
284
269
  justifyContent: 'space-around',
285
- // flex: 1,
286
270
  marginBottom: '10%',
287
271
  height: '35%',
288
272
  minHeight: 280,
289
273
  },
290
- margin5Btm: {marginBottom: '5%'},
291
274
  });
292
275
 
293
276
  export default Precall;