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
@@ -9,31 +9,26 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useState, useContext, useEffect} from 'react';
13
- import {
14
- View,
15
- Dimensions,
16
- Platform,
17
- StyleSheet,
18
- Text,
19
- } from 'react-native';
12
+ import React, {useState, useContext} from 'react';
13
+ import {View, Dimensions, Platform, StyleSheet} from 'react-native';
20
14
  import {LocalUserContext} from '../../agora-rn-uikit';
21
15
  import {
22
16
  LocalAudioMute,
23
17
  LocalVideoMute,
24
18
  Endcall,
19
+ PropsContext,
25
20
  } from '../../agora-rn-uikit';
26
21
  import Recording from '../subComponents/Recording';
27
22
  import SwitchCamera from '../subComponents/SwitchCamera';
28
- // import icons from '../assets/icons';
29
- import ScreenshareButton from '../subComponents/ScreenshareButton';
30
- // import ColorContext from './ColorContext';
31
- // import ChatContext from '../components/ChatContext';
32
- // import {SidePanelType} from '../subComponents/SidePanelEnum';
23
+ import ScreenshareButton from '../subComponents/screenshare/ScreenshareButton';
33
24
  import {controlsHolder} from '../../theme.json';
34
25
  import mobileAndTabletCheck from '../utils/mobileWebTest';
26
+ import {ClientRole} from '../../agora-rn-uikit';
27
+ import LiveStreamControls from './livestream/views/LiveStreamControls';
35
28
 
36
29
  const Controls = (props: any) => {
30
+ const {rtcProps} = useContext(PropsContext);
31
+
37
32
  let onLayout = (e: any) => {
38
33
  setDim([e.nativeEvent.layout.width, e.nativeEvent.layout.height]);
39
34
  };
@@ -43,164 +38,63 @@ const Controls = (props: any) => {
43
38
  Dimensions.get('window').width > Dimensions.get('window').height,
44
39
  ]);
45
40
  const isDesktop = dim[0] > 1224;
46
- // const {primaryColor} = useContext(ColorContext);
47
- // const {messageStore} = useContext(ChatContext);
48
- const [screenshareActive, setScreenshareActive] = useState(false);
49
- const {
50
- // participantsView,
51
- // setParticipantsView,
52
- setRecordingActive,
53
- recordingActive,
54
- // setChatDisplayed,
55
- // chatDisplayed,
56
- // sidePanel,
57
- // setSidePanel,
58
- isHost,
59
- // pendingMessageLength,
60
- // setLastCheckedPublicState,
61
- setLayout,
62
- } = props;
41
+ const {setRecordingActive, recordingActive, isHost} = props;
63
42
 
64
43
  return (
65
44
  <LocalUserContext>
66
45
  <View
67
46
  style={[
68
47
  style.controlsHolder,
69
- {paddingHorizontal: isDesktop ? '25%' : '1%', backgroundColor: $config.SECONDARY_FONT_COLOR + 80},
48
+ {
49
+ paddingHorizontal: isDesktop ? '25%' : '1%',
50
+ backgroundColor: $config.SECONDARY_FONT_COLOR + 80,
51
+ },
70
52
  ]}
71
53
  onLayout={onLayout}>
72
- <View style={{alignSelf: 'center'}}>
73
- <LocalAudioMute />
74
- {/* <Text
75
- style={{
76
- textAlign: 'center',
77
- marginTop: 5,
78
- color: $config.PRIMARY_COLOR,
79
- }}>
80
- Audio
81
- </Text> */}
82
- </View>
83
- <View style={{alignSelf: 'center'}}>
84
- <LocalVideoMute />
85
- {/* <Text
86
- style={{
87
- textAlign: 'center',
88
- marginTop: 5,
89
- color: $config.PRIMARY_COLOR,
90
- }}>
91
- Video
92
- </Text> */}
93
- </View>
94
- {mobileAndTabletCheck() ? (
95
- <View style={{alignSelf: 'center'}}>
96
- <SwitchCamera />
97
- {/* <Text
98
- style={{
99
- textAlign: 'center',
100
- marginTop: 5,
101
- color: $config.PRIMARY_COLOR,
102
- }}>
103
- Switch
104
- </Text> */}
105
- </View>
106
- ) : (<></>)}
107
- {$config.SCREEN_SHARING ? (
108
- !mobileAndTabletCheck() ? (
109
- <View style={{alignSelf: 'center'}}>
110
- <ScreenshareButton
111
- screenshareActive={screenshareActive}
112
- setScreenshareActive={setScreenshareActive}
113
- setLayout={setLayout}
114
- recordingActive={recordingActive}
54
+ {$config.EVENT_MODE && rtcProps.role == ClientRole.Audience ? (
55
+ <LiveStreamControls showControls={true} />
56
+ ) : (
57
+ <>
58
+ {/**
59
+ * In event mode when raise hand feature is active
60
+ * and audience is promoted to host, the audience can also
61
+ * demote himself
62
+ */}
63
+ {$config.EVENT_MODE && (
64
+ <LiveStreamControls
65
+ showControls={
66
+ rtcProps?.role == ClientRole.Broadcaster && !isHost
67
+ }
115
68
  />
116
- {/* <Text style={{color: '#fff'}}>{(dim[0] +":"+ dim[1]) + ''}</Text> */}
117
- {/* <Text
118
- style={{
119
- textAlign: 'center',
120
- marginTop: 5,
121
- color: $config.PRIMARY_COLOR,
122
- }}>
123
- Share
124
- </Text> */}
69
+ )}
70
+ <View style={{alignSelf: 'center'}}>
71
+ <LocalAudioMute />
125
72
  </View>
126
- ) : (
127
- <></>
128
- )
129
- ) : (
130
- <></>
131
- )}
132
- {isHost ? (
133
- $config.CLOUD_RECORDING ? (
134
73
  <View style={{alignSelf: 'center'}}>
135
- <Recording
136
- recordingActive={recordingActive}
137
- setRecordingActive={setRecordingActive}
138
- />
139
- {/* <Text
140
- style={{
141
- textAlign: 'center',
142
- marginTop: 5,
143
- color: recordingActive ? '#FD0845' : $config.PRIMARY_COLOR,
144
- }}>
145
- {recordingActive ? 'Recording' : 'Record'}
146
- </Text> */}
74
+ <LocalVideoMute />
147
75
  </View>
148
- ) : (
149
- <></>
150
- )
151
- ) : (
152
- <></>
76
+ {mobileAndTabletCheck() && (
77
+ <View style={{alignSelf: 'center'}}>
78
+ <SwitchCamera />
79
+ </View>
80
+ )}
81
+ {$config.SCREEN_SHARING && !mobileAndTabletCheck() && (
82
+ <View style={{alignSelf: 'center'}}>
83
+ <ScreenshareButton />
84
+ </View>
85
+ )}
86
+ {isHost && $config.CLOUD_RECORDING && (
87
+ <View style={{alignSelf: 'center'}}>
88
+ <Recording
89
+ recordingActive={recordingActive}
90
+ setRecordingActive={setRecordingActive}
91
+ />
92
+ </View>
93
+ )}
94
+ </>
153
95
  )}
154
- {/* {$config.CHAT ? (
155
- <View style={{alignSelf: 'center'}}>
156
- <TouchableOpacity
157
- style={[style.localButton, {borderColor: primaryColor}]}
158
- onPress={() => {
159
- setLastCheckedPublicState(messageStore.length);
160
- sidePanel === SidePanelType.Chat
161
- ? setSidePanel(SidePanelType.None)
162
- : setSidePanel(SidePanelType.Chat);
163
- }}>
164
- {sidePanel !== SidePanelType.Chat &&
165
- pendingMessageLength !== 0 ? (
166
- <View style={style.chatNotification}>
167
- {pendingMessageLength}
168
- </View>
169
- ) : (
170
- <></>
171
- )}
172
- <Image
173
- source={{uri: icons.chatIcon}}
174
- style={[style.buttonIcon, {tintColor: primaryColor}]}
175
- />
176
- </TouchableOpacity>
177
- <Text
178
- style={{
179
- textAlign: 'center',
180
- marginTop: 5,
181
- color: $config.PRIMARY_COLOR,
182
- }}>
183
- Chat
184
- </Text>
185
- </View>
186
- ) : (
187
- <></>
188
- )} */}
189
- {/* {isDesktop ? <View
190
- style={{
191
- backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
192
- width: 1,
193
- height: '70%',
194
- marginHorizontal: -20,
195
- alignSelf: 'center',
196
- opacity: 0.8,
197
- }}
198
- />:<></>} */}
199
96
  <View style={{alignSelf: 'center'}}>
200
97
  <Endcall />
201
- {/* <Text style={{textAlign: 'center', marginTop: 5, color: '#FD0845'}}>
202
- Hang Up
203
- </Text> */}
204
98
  </View>
205
99
  </View>
206
100
  </LocalUserContext>
@@ -226,8 +120,6 @@ const style = StyleSheet.create({
226
120
  left: 25,
227
121
  top: -10,
228
122
  },
229
- // localButton: localButton,
230
- // buttonIcon: buttonIcon,
231
123
  });
232
124
 
233
125
  export default Controls;
@@ -11,8 +11,12 @@
11
11
  */
12
12
  import React from 'react';
13
13
  import KeepAwake from 'react-native-keep-awake';
14
+ import {ClientRole} from '../../agora-rn-uikit';
14
15
 
15
- const DeviceConfigure: React.FC = (props: any) => {
16
+ interface Props {
17
+ userRole: ClientRole;
18
+ }
19
+ const DeviceConfigure: React.FC<Props> = (props: any) => {
16
20
  return (
17
21
  <>
18
22
  {props.children}
@@ -9,35 +9,38 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useState, useContext, useEffect} from 'react';
13
- import {RtcContext} from '../../agora-rn-uikit';
12
+ import React, {useState, useContext, useEffect, useCallback} from 'react';
13
+ import {RtcContext, ClientRole} from '../../agora-rn-uikit';
14
14
  import DeviceContext from './DeviceContext';
15
15
 
16
- const DeviceConfigure: React.FC = (props: any) => {
16
+ interface Props {
17
+ userRole: ClientRole;
18
+ }
19
+
20
+ const DeviceConfigure: React.FC<Props> = (props: any) => {
17
21
  const [selectedCam, setSelectedCam] = useState('');
18
22
  const [selectedMic, setSelectedMic] = useState('');
19
23
  const [deviceList, setDeviceList] = useState([]);
20
24
  const rtc = useContext(RtcContext);
21
25
 
22
- useEffect(() => {
23
- if (deviceList.length === 0) {
24
- rtc.RtcEngine.getDevices(function (devices: any) {
25
- setDeviceList(devices);
26
- for (const i in devices) {
27
- if (devices[i].kind === 'videoinput') {
28
- setSelectedCam(devices[i].deviceId);
29
- break;
30
- }
26
+ const refreshDevices = useCallback(async () => {
27
+ rtc.RtcEngine.getDevices(function (devices: any) {
28
+ console.log('set devices');
29
+ setDeviceList(devices);
30
+ for (const i in devices) {
31
+ if (devices[i].kind === 'videoinput') {
32
+ setSelectedCam(devices[i].deviceId);
33
+ break;
31
34
  }
32
- for (const i in devices) {
33
- if (devices[i].kind === 'audioinput') {
34
- setSelectedMic(devices[i].deviceId);
35
- break;
36
- }
35
+ }
36
+ for (const i in devices) {
37
+ if (devices[i].kind === 'audioinput') {
38
+ setSelectedMic(devices[i].deviceId);
39
+ break;
37
40
  }
38
- });
39
- }
40
- });
41
+ }
42
+ });
43
+ }, []);
41
44
 
42
45
  useEffect(() => {
43
46
  if (selectedCam.length !== 0) {
@@ -61,6 +64,21 @@ const DeviceConfigure: React.FC = (props: any) => {
61
64
  // eslint-disable-next-line react-hooks/exhaustive-deps
62
65
  }, [selectedMic]);
63
66
 
67
+ useEffect(() => {
68
+ // See if device is empty
69
+ const deviceIdIsEmpty = deviceList.find(
70
+ (device) => device?.deviceId === '',
71
+ );
72
+ // If stream exists and deviceIds are empty, check for devices again
73
+ if (
74
+ rtc?.RtcEngine?.localStream &&
75
+ Object.keys(rtc?.RtcEngine?.localStream).length !== 0 &&
76
+ (deviceIdIsEmpty || deviceList.length === 0)
77
+ ) {
78
+ refreshDevices();
79
+ }
80
+ }, [rtc]);
81
+
64
82
  return (
65
83
  <DeviceContext.Provider
66
84
  value={{