agora-appbuilder-core 1.0.9 → 2.0.2
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 +22754 -0
- package/template/agora-rn-uikit/.git/index +0 -0
- package/template/agora-rn-uikit/.git/logs/HEAD +2 -2
- package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -1
- package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -1
- package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -1
- package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx +0 -0
- package/template/agora-rn-uikit/.git/objects/pack/{pack-eb3b4c374d6e79553b5bbcc78b4399cc766e97cf.pack → pack-f379286d0537eb68377220b4929979324b8d5d1c.pack} +0 -0
- package/template/agora-rn-uikit/.git/packed-refs +6 -6
- package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -1
- package/template/agora-rn-uikit/.git/refs/heads/master +1 -1
- 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 +43 -23
- 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 +5 -3
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +58 -13
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +60 -13
- 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 +10 -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 +22754 -0
- package/template/package.json +5 -4
- 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 +20 -9
- package/template/src/components/Precall.tsx +37 -33
- 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/hooks/useImageDelay.tsx +28 -0
- package/template/src/pages/Authenticate.tsx +5 -4
- package/template/src/pages/Create.tsx +11 -4
- package/template/src/pages/Join.tsx +2 -1
- package/template/src/pages/VideoCall.tsx +126 -101
- 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/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/agora-rn-uikit/.git/objects/pack/pack-eb3b4c374d6e79553b5bbcc78b4399cc766e97cf.idx +0 -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 -561
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
StyleSheet,
|
|
20
20
|
Dimensions,
|
|
21
21
|
} from 'react-native';
|
|
22
|
-
// import {MinUidConsumer} from '../../agora-rn-uikit
|
|
23
|
-
// import PropsContext from '../../agora-rn-uikit
|
|
22
|
+
// import {MinUidConsumer} from '../../agora-rn-uikit';
|
|
23
|
+
// import {PropsContext} from '../../agora-rn-uikit';
|
|
24
24
|
import icons from '../assets/icons';
|
|
25
25
|
import Settings from './Settings';
|
|
26
26
|
import ColorContext from './ColorContext';
|
|
@@ -30,9 +30,8 @@ import {navHolder} from '../../theme.json';
|
|
|
30
30
|
import Layout from '../subComponents/LayoutEnum';
|
|
31
31
|
import ChatContext from '../components/ChatContext';
|
|
32
32
|
import mobileAndTabletCheck from '../utils/mobileWebTest';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
icons;
|
|
33
|
+
import {BtnTemplate} from '../../agora-rn-uikit';
|
|
34
|
+
import {ImageIcon} from '../../agora-rn-uikit';
|
|
36
35
|
|
|
37
36
|
const Navbar = (props: any) => {
|
|
38
37
|
const {primaryColor} = useContext(ColorContext);
|
|
@@ -64,34 +63,68 @@ const Navbar = (props: any) => {
|
|
|
64
63
|
return (
|
|
65
64
|
<View
|
|
66
65
|
onLayout={onLayout}
|
|
67
|
-
style={[
|
|
66
|
+
style={[
|
|
67
|
+
Platform.OS === 'web' ? style.navHolder : style.navHolderNative,
|
|
68
|
+
{backgroundColor: $config.SECONDARY_FONT_COLOR + 80},
|
|
69
|
+
Platform.OS === 'web'
|
|
70
|
+
? {
|
|
71
|
+
justifyContent: mobileAndTabletCheck()
|
|
72
|
+
? 'space-between'
|
|
73
|
+
: 'flex-end',
|
|
74
|
+
}
|
|
75
|
+
: {},
|
|
76
|
+
]}>
|
|
68
77
|
{recordingActive && !mobileAndTabletCheck() ? (
|
|
69
|
-
<View
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
<View
|
|
79
|
+
style={[
|
|
80
|
+
style.recordingView,
|
|
81
|
+
{backgroundColor: $config.SECONDARY_FONT_COLOR},
|
|
82
|
+
]}>
|
|
83
|
+
<ImageIcon
|
|
84
|
+
name={'recordingActiveIcon'}
|
|
85
|
+
style={{
|
|
86
|
+
width: 20,
|
|
87
|
+
height: 20,
|
|
88
|
+
margin: 1,
|
|
89
|
+
}}
|
|
90
|
+
color='#FD0845'
|
|
91
|
+
/>
|
|
75
92
|
<Text
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
style={{
|
|
94
|
+
fontSize: Platform.OS === 'web' ? 16 : 12,
|
|
95
|
+
color: '#FD0845',
|
|
96
|
+
fontWeight: '400',
|
|
97
|
+
alignSelf: 'center',
|
|
98
|
+
textAlign: 'center',
|
|
99
|
+
flex: 1,
|
|
100
|
+
}}>
|
|
101
|
+
Recording
|
|
102
|
+
</Text>
|
|
86
103
|
</View>
|
|
87
104
|
) : (
|
|
88
105
|
<></>
|
|
89
106
|
)}
|
|
90
|
-
<View
|
|
107
|
+
<View
|
|
108
|
+
style={[
|
|
109
|
+
style.roomNameContainer,
|
|
110
|
+
Platform.OS === 'web' && !mobileAndTabletCheck()
|
|
111
|
+
? {transform: [{translateX: '50%'}]}
|
|
112
|
+
: {},
|
|
113
|
+
]}>
|
|
91
114
|
{Platform.OS === 'web' ? (
|
|
92
115
|
<View
|
|
93
|
-
style={{
|
|
94
|
-
|
|
116
|
+
style={{
|
|
117
|
+
flexDirection: 'row',
|
|
118
|
+
justifyContent: 'flex-start',
|
|
119
|
+
paddingLeft: 5,
|
|
120
|
+
}}>
|
|
121
|
+
<Text style={style.roomNameText}>
|
|
122
|
+
{mobileAndTabletCheck()
|
|
123
|
+
? title.length > 13
|
|
124
|
+
? title.slice(0, 13) + '..'
|
|
125
|
+
: title
|
|
126
|
+
: title}
|
|
127
|
+
</Text>
|
|
95
128
|
<View
|
|
96
129
|
style={{
|
|
97
130
|
backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
|
|
@@ -100,12 +133,13 @@ const Navbar = (props: any) => {
|
|
|
100
133
|
marginHorizontal: 10,
|
|
101
134
|
}}
|
|
102
135
|
/>
|
|
103
|
-
<
|
|
136
|
+
<View style={{width: 30}}>
|
|
137
|
+
<CopyJoinInfo />
|
|
138
|
+
</View>
|
|
104
139
|
</View>
|
|
105
140
|
) : (
|
|
106
141
|
<Text style={style.roomNameText}>{title}</Text>
|
|
107
|
-
)}
|
|
108
|
-
|
|
142
|
+
)}
|
|
109
143
|
</View>
|
|
110
144
|
<View
|
|
111
145
|
style={{
|
|
@@ -125,37 +159,37 @@ const Navbar = (props: any) => {
|
|
|
125
159
|
Platform.OS === 'web'
|
|
126
160
|
? $config.SECONDARY_FONT_COLOR
|
|
127
161
|
: $config.SECONDARY_FONT_COLOR + '00',
|
|
128
|
-
|
|
162
|
+
paddingVertical: 4,
|
|
163
|
+
paddingHorizontal: mobileAndTabletCheck() ? 0 : 4,
|
|
129
164
|
minHeight: 35,
|
|
130
165
|
// height: 40,
|
|
131
166
|
// backgroundColor: '#f0f',
|
|
132
167
|
// paddingHorizontal: 16,
|
|
133
168
|
borderRadius: 10,
|
|
134
|
-
minWidth:
|
|
169
|
+
minWidth:
|
|
170
|
+
Platform.OS === 'web' && isDesktop
|
|
171
|
+
? 300
|
|
172
|
+
: mobileAndTabletCheck()
|
|
173
|
+
? 160
|
|
174
|
+
: 200,
|
|
135
175
|
// borderTopLeftRadius: 10,
|
|
136
176
|
// borderBottomLeftRadius: 10,
|
|
137
177
|
justifyContent: 'space-evenly',
|
|
138
178
|
}}>
|
|
139
179
|
<View style={{width: '20%', height: '100%'}}>
|
|
140
|
-
<
|
|
180
|
+
<BtnTemplate
|
|
141
181
|
onPress={() => {
|
|
142
182
|
sidePanel === SidePanelType.Participants
|
|
143
183
|
? setSidePanel(SidePanelType.None)
|
|
144
184
|
: setSidePanel(SidePanelType.Participants);
|
|
145
185
|
}}
|
|
146
|
-
style={style.btnHolder}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<Text style={[style.participantText, {color: primaryColor}]}>
|
|
154
|
-
{minUsers.length + 1}
|
|
155
|
-
</Text>
|
|
156
|
-
)}
|
|
157
|
-
</MinUidConsumer> */}
|
|
158
|
-
</TouchableOpacity>
|
|
186
|
+
style={style.btnHolder}
|
|
187
|
+
name={
|
|
188
|
+
sidePanel === SidePanelType.Participants
|
|
189
|
+
? 'participantFilledIcon'
|
|
190
|
+
: 'participantIcon'
|
|
191
|
+
}
|
|
192
|
+
/>
|
|
159
193
|
</View>
|
|
160
194
|
{$config.CHAT ? (
|
|
161
195
|
<>
|
|
@@ -173,44 +207,34 @@ const Navbar = (props: any) => {
|
|
|
173
207
|
) : (
|
|
174
208
|
<></>
|
|
175
209
|
)}
|
|
176
|
-
<View style={{width: '
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
? setSidePanel(SidePanelType.None)
|
|
185
|
-
: setSidePanel(SidePanelType.Chat);
|
|
186
|
-
}}>
|
|
187
|
-
{sidePanel !== SidePanelType.Chat &&
|
|
188
|
-
pendingMessageLength !== 0 ? (
|
|
189
|
-
<View style={style.chatNotification}>
|
|
190
|
-
<Text style={{color: $config.SECONDARY_FONT_COLOR}}>
|
|
191
|
-
{pendingMessageLength}
|
|
192
|
-
</Text>
|
|
193
|
-
</View>
|
|
194
|
-
) : (
|
|
195
|
-
<></>
|
|
196
|
-
)}
|
|
197
|
-
<Image
|
|
198
|
-
source={{
|
|
199
|
-
uri: sidePanel !== SidePanelType.Chat &&
|
|
200
|
-
pendingMessageLength !== 0 ? icons.chatIconFilled : icons.chatIcon
|
|
210
|
+
<View style={{width: '20%', height: '100%', position: 'relative'}}>
|
|
211
|
+
<BtnTemplate
|
|
212
|
+
style={style.btnHolder}
|
|
213
|
+
onPress={() => {
|
|
214
|
+
setLastCheckedPublicState(messageStore.length);
|
|
215
|
+
sidePanel === SidePanelType.Chat
|
|
216
|
+
? setSidePanel(SidePanelType.None)
|
|
217
|
+
: setSidePanel(SidePanelType.Chat);
|
|
201
218
|
}}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
tintColor: $config.PRIMARY_COLOR,
|
|
208
|
-
},
|
|
209
|
-
]}
|
|
219
|
+
name={
|
|
220
|
+
sidePanel === SidePanelType.Chat
|
|
221
|
+
? 'chatIconFilled'
|
|
222
|
+
: 'chatIcon'
|
|
223
|
+
}
|
|
210
224
|
/>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
225
|
+
<View style={{position: 'absolute', top: Platform.OS === 'web' ? 1 : -15, left: ( Platform.OS === 'web' && isDesktop) ? 10 : 1 }}>
|
|
226
|
+
{sidePanel !== SidePanelType.Chat &&
|
|
227
|
+
pendingMessageLength !== 0 ? (
|
|
228
|
+
<View style={style.chatNotification}>
|
|
229
|
+
<Text style={{color: $config.SECONDARY_FONT_COLOR}}>
|
|
230
|
+
{pendingMessageLength}
|
|
231
|
+
</Text>
|
|
232
|
+
</View>
|
|
233
|
+
) : (
|
|
234
|
+
<></>
|
|
235
|
+
)}
|
|
236
|
+
</View>
|
|
237
|
+
</View>
|
|
214
238
|
</>
|
|
215
239
|
) : (
|
|
216
240
|
<></>
|
|
@@ -229,40 +253,34 @@ const Navbar = (props: any) => {
|
|
|
229
253
|
) : (
|
|
230
254
|
<></>
|
|
231
255
|
)}
|
|
232
|
-
<View style={{width: '
|
|
233
|
-
|
|
234
|
-
<TouchableOpacity
|
|
256
|
+
<View style={{width: '20%', height: '100%'}}>
|
|
257
|
+
<BtnTemplate
|
|
235
258
|
style={style.btnHolder}
|
|
236
259
|
onPress={() => {
|
|
237
260
|
setLayout((l: Layout) =>
|
|
238
261
|
l === Layout.Pinned ? Layout.Grid : Layout.Pinned,
|
|
239
262
|
);
|
|
240
|
-
}}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
263
|
+
}}
|
|
264
|
+
name={layout ? 'pinnedLayoutIcon' : 'gridLayoutIcon'}
|
|
265
|
+
/>
|
|
266
|
+
</View>
|
|
267
|
+
{/** Show setting icon only in non native apps
|
|
268
|
+
* show in web/electron/mobile web
|
|
269
|
+
* hide in android/ios */}
|
|
270
|
+
{Platform.OS !== 'android' && Platform.OS !== 'ios' ? (
|
|
271
|
+
<>
|
|
272
|
+
{Platform.OS === 'web' && isDesktop && (
|
|
273
|
+
<View
|
|
245
274
|
style={{
|
|
246
|
-
|
|
275
|
+
backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
|
|
276
|
+
width: 1,
|
|
247
277
|
height: '100%',
|
|
248
|
-
|
|
278
|
+
marginHorizontal: 10,
|
|
279
|
+
alignSelf: 'center',
|
|
280
|
+
opacity: 0.8,
|
|
249
281
|
}}
|
|
250
282
|
/>
|
|
251
|
-
|
|
252
|
-
</View>
|
|
253
|
-
</View>
|
|
254
|
-
{Platform.OS === 'web' && isDesktop ? (
|
|
255
|
-
<>
|
|
256
|
-
<View
|
|
257
|
-
style={{
|
|
258
|
-
backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
|
|
259
|
-
width: 1,
|
|
260
|
-
height: '100%',
|
|
261
|
-
marginHorizontal: 10,
|
|
262
|
-
alignSelf: 'center',
|
|
263
|
-
opacity: 0.8,
|
|
264
|
-
}}
|
|
265
|
-
/>
|
|
283
|
+
)}
|
|
266
284
|
<View style={{width: '20%', height: '100%'}}>
|
|
267
285
|
<Settings
|
|
268
286
|
sidePanel={sidePanel}
|
|
@@ -316,7 +334,12 @@ const style = StyleSheet.create({
|
|
|
316
334
|
margin: 1,
|
|
317
335
|
resizeMode: 'contain',
|
|
318
336
|
},
|
|
319
|
-
btnHolder: {
|
|
337
|
+
btnHolder: {
|
|
338
|
+
marginHorizontal: mobileAndTabletCheck() ? 2 : 0,
|
|
339
|
+
width: '100%',
|
|
340
|
+
height: '100%',
|
|
341
|
+
resizeMode: 'contain',
|
|
342
|
+
},
|
|
320
343
|
// participantBtnHolder: {
|
|
321
344
|
// backgroundColor: '#fff',
|
|
322
345
|
// // flex: 0.5,
|
|
@@ -340,13 +363,13 @@ const style = StyleSheet.create({
|
|
|
340
363
|
// alignSelf: 'center',
|
|
341
364
|
// flex: 1,
|
|
342
365
|
// },
|
|
343
|
-
participantBtnIcon: {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
},
|
|
366
|
+
// participantBtnIcon: {
|
|
367
|
+
// height: '100%',
|
|
368
|
+
// width: '100%',
|
|
369
|
+
// // margin: 1,
|
|
370
|
+
// tintColor: $config.PRIMARY_COLOR,
|
|
371
|
+
// resizeMode: 'contain',
|
|
372
|
+
// },
|
|
350
373
|
// participantText: {
|
|
351
374
|
// fontSize: Platform.OS === 'web' ? 20 : 18,
|
|
352
375
|
// fontWeight: '400',
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/*
|
|
2
|
+
********************************************
|
|
3
|
+
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
+
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
+
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
+
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
+
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
+
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
+
information visit https://appbuilder.agora.io.
|
|
10
|
+
*********************************************
|
|
11
|
+
*/
|
|
12
|
+
import React, {createContext, useContext, useState} from 'react';
|
|
13
|
+
import {RtcContext} from '../../agora-rn-uikit';
|
|
14
|
+
import useMount from './useMount';
|
|
15
|
+
import icons from '../assets/icons';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Network Icons container object with color and string mapping to network quality stat [ 0 - 8]
|
|
19
|
+
* 0 - Unpublished
|
|
20
|
+
* 1 - Excellent
|
|
21
|
+
* 2 - Good
|
|
22
|
+
* 3 - Bad
|
|
23
|
+
* 4 - Bad
|
|
24
|
+
* 5 - Very Bad
|
|
25
|
+
* 6 - Very Bad
|
|
26
|
+
* 7 - Unsupported
|
|
27
|
+
* 8 - Loading
|
|
28
|
+
*/
|
|
29
|
+
export const networkIconsObject: {
|
|
30
|
+
[key: number]: {
|
|
31
|
+
icon: string;
|
|
32
|
+
tint: string;
|
|
33
|
+
text: string;
|
|
34
|
+
};
|
|
35
|
+
} = {
|
|
36
|
+
0: {
|
|
37
|
+
icon: icons.networkIcons['Unsupported'],
|
|
38
|
+
tint: 'primary',
|
|
39
|
+
text: 'Unknown',
|
|
40
|
+
},
|
|
41
|
+
1: {
|
|
42
|
+
icon: icons.networkIcons['Excellent'],
|
|
43
|
+
tint: '#2BD900',
|
|
44
|
+
text: 'Excellent',
|
|
45
|
+
},
|
|
46
|
+
2: {
|
|
47
|
+
icon: icons.networkIcons['Good'],
|
|
48
|
+
tint: '#FFEE00',
|
|
49
|
+
text: 'Good',
|
|
50
|
+
},
|
|
51
|
+
3: {
|
|
52
|
+
icon: icons.networkIcons['Bad'],
|
|
53
|
+
tint: '#F8AA00',
|
|
54
|
+
text: 'Bad',
|
|
55
|
+
},
|
|
56
|
+
4: {
|
|
57
|
+
icon: icons.networkIcons['Bad'],
|
|
58
|
+
tint: '#F8AA00',
|
|
59
|
+
text: 'Bad',
|
|
60
|
+
},
|
|
61
|
+
5: {
|
|
62
|
+
icon: icons.networkIcons['VeryBad'],
|
|
63
|
+
tint: 'red',
|
|
64
|
+
text: 'Very Bad',
|
|
65
|
+
},
|
|
66
|
+
6: {
|
|
67
|
+
icon: icons.networkIcons['VeryBad'],
|
|
68
|
+
tint: 'red',
|
|
69
|
+
text: 'Very Bad',
|
|
70
|
+
},
|
|
71
|
+
7: {
|
|
72
|
+
icon: icons.networkIcons['Unsupported'],
|
|
73
|
+
tint: 'primary',
|
|
74
|
+
text: 'Unpublished',
|
|
75
|
+
},
|
|
76
|
+
8: {
|
|
77
|
+
icon: icons.networkIcons['Loading'],
|
|
78
|
+
tint: 'primary',
|
|
79
|
+
text: 'Loading',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const initNewtorkQualityStats: {[key in string | number]: number} = {
|
|
84
|
+
local: 0,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const NetworkQualityContext = createContext(initNewtorkQualityStats);
|
|
88
|
+
|
|
89
|
+
export default NetworkQualityContext;
|
|
90
|
+
|
|
91
|
+
export const NetworkQualityConsumer = NetworkQualityContext.Consumer;
|
|
92
|
+
|
|
93
|
+
export const NetworkQualityProvider: React.FC = (props) => {
|
|
94
|
+
const [networkQualityStats, setNetworkQualityStats] = useState(
|
|
95
|
+
initNewtorkQualityStats,
|
|
96
|
+
);
|
|
97
|
+
const {RtcEngine} = useContext(RtcContext);
|
|
98
|
+
|
|
99
|
+
useMount(() => {
|
|
100
|
+
function handleNetworkQuality(
|
|
101
|
+
uid: number | string,
|
|
102
|
+
downlinkQuality: number,
|
|
103
|
+
// Currently unused , potential use might be to take weighted average
|
|
104
|
+
// of this alongside the downlink quality.
|
|
105
|
+
uplinkQuality: number,
|
|
106
|
+
) {
|
|
107
|
+
setNetworkQualityStats((prevNetworkQualityStats) => {
|
|
108
|
+
const updatedNetworkQualityStats = {...prevNetworkQualityStats};
|
|
109
|
+
if (uid === 0) {
|
|
110
|
+
const displayedNetworkQuality =
|
|
111
|
+
// check if either are unsupported (0)
|
|
112
|
+
// if not then display whichever is poorer
|
|
113
|
+
downlinkQuality * uplinkQuality !== 0
|
|
114
|
+
? downlinkQuality < uplinkQuality
|
|
115
|
+
? uplinkQuality
|
|
116
|
+
: downlinkQuality
|
|
117
|
+
: 0;
|
|
118
|
+
updatedNetworkQualityStats['local'] = displayedNetworkQuality;
|
|
119
|
+
} else {
|
|
120
|
+
updatedNetworkQualityStats[uid] = downlinkQuality;
|
|
121
|
+
}
|
|
122
|
+
return updatedNetworkQualityStats;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
RtcEngine.addListener('NetworkQuality', handleNetworkQuality);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<NetworkQualityContext.Provider value={networkQualityStats}>
|
|
131
|
+
{props.children}
|
|
132
|
+
</NetworkQualityContext.Provider>
|
|
133
|
+
);
|
|
134
|
+
};
|