agora-appbuilder-core 4.0.0-beta.9 → 4.0.0-ms.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.
Files changed (64) hide show
  1. package/package.json +2 -2
  2. package/template/_package-lock.json +11 -0
  3. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +1 -0
  4. package/template/agora-rn-uikit/src/Rtc/Create.tsx +8 -2
  5. package/template/bridge/rtc/webNg/RtcEngine.ts +22 -2
  6. package/template/customization-implementation/createHook.ts +24 -6
  7. package/template/customization-implementation/index.ts +1 -1
  8. package/template/customization-implementation/useCustomization.tsx +5 -7
  9. package/template/global.d.ts +4 -0
  10. package/template/index.wsdk.tsx +8 -1
  11. package/template/package.json +1 -0
  12. package/template/react-native-toast-message/src/components/checkbox.js +7 -2
  13. package/template/src/App.tsx +4 -77
  14. package/template/src/AppRoutes.tsx +53 -0
  15. package/template/src/AppWrapper.tsx +28 -15
  16. package/template/src/SDKAppWrapper.tsx +68 -64
  17. package/template/src/assets/font-styles.css +3 -1
  18. package/template/src/auth/AuthProvider.tsx +269 -0
  19. package/template/src/auth/AuthRoute.tsx +76 -0
  20. package/template/src/auth/IDPAuth.tsx +16 -0
  21. package/template/src/auth/config.ts +45 -0
  22. package/template/src/auth/useIDPAuth.tsx +40 -0
  23. package/template/src/auth/useTokenAuth.tsx +153 -0
  24. package/template/src/components/DeviceConfigure.tsx +13 -4
  25. package/template/src/components/DeviceContext.tsx +6 -6
  26. package/template/src/components/GraphQLProvider.tsx +40 -12
  27. package/template/src/components/Navigation.sdk.tsx +32 -0
  28. package/template/src/components/OAuthConfig.ts +20 -10
  29. package/template/src/components/RTMConfigure.tsx +19 -2
  30. package/template/src/components/Router.electron.ts +1 -0
  31. package/template/src/components/Router.native.ts +1 -0
  32. package/template/src/components/Router.sdk.ts +1 -0
  33. package/template/src/components/Router.ts +1 -0
  34. package/template/src/components/SdkApiContext.tsx +161 -0
  35. package/template/src/components/SettingsView.tsx +3 -1
  36. package/template/src/components/StorageContext.tsx +2 -1
  37. package/template/src/components/StoreToken.tsx +5 -1
  38. package/template/src/components/meeting-info/useMeetingInfo.tsx +24 -0
  39. package/template/src/components/precall/joinCallBtn.native.tsx +3 -1
  40. package/template/src/components/precall/joinCallBtn.tsx +4 -0
  41. package/template/src/components/precall/usePreCall.tsx +25 -1
  42. package/template/src/components/useUserPreference.tsx +27 -0
  43. package/template/src/components/useVideoCall.tsx +20 -1
  44. package/template/src/pages/Create.tsx +2 -19
  45. package/template/src/pages/Login.tsx +45 -0
  46. package/template/src/pages/VideoCall.tsx +106 -15
  47. package/template/src/pages/video-call/ActionSheetContent.tsx +1 -1
  48. package/template/src/pages/video-call/VideoCallScreen.tsx +0 -27
  49. package/template/src/rtm/RTMEngine.ts +8 -0
  50. package/template/src/rtm-events-api/Events.ts +1 -0
  51. package/template/src/subComponents/Loading.tsx +47 -0
  52. package/template/src/subComponents/LocalEndCall.tsx +4 -0
  53. package/template/src/subComponents/LocalSwitchCamera.tsx +1 -4
  54. package/template/src/subComponents/LogoutButton.tsx +1 -1
  55. package/template/src/subComponents/SelectDevice.tsx +10 -10
  56. package/template/src/subComponents/recording/useRecording.tsx +14 -2
  57. package/template/src/utils/SdkEvents.ts +26 -14
  58. package/template/src/utils/SdkMethodEvents.ts +81 -0
  59. package/template/src/utils/common.tsx +2 -5
  60. package/template/src/utils/useCreateMeeting.ts +2 -11
  61. package/template/src/utils/useJoinMeeting.ts +14 -4
  62. package/template/web/index.html +2 -1
  63. package/template/webpack.rsdk.config.js +1 -2
  64. package/template/webpack.web.config.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0-ms.2",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "vercel-build": "npm run dev-setup && cd template && npm run web:build && cd .. && npm run copy-vercel",
12
- "uikit": "rm -rf template/agora-rn-uikit && git clone https://github.com/AgoraIO-Community/ReactNative-UIKit.git template/agora-rn-uikit && cd template/agora-rn-uikit && git checkout feature/redesign/ui-kit",
12
+ "uikit": "rm -rf template/agora-rn-uikit && git clone https://github.com/AgoraIO-Community/ReactNative-UIKit.git template/agora-rn-uikit && cd template/agora-rn-uikit && git checkout feature/redesign/ui-kit-v1",
13
13
  "deps": "cd template && npm i",
14
14
  "dev-setup": "npm run uikit && npm run deps && node devSetup.js",
15
15
  "web-build": "cd template && npm run web:build && cd .. && npm run copy-vercel",
@@ -25,6 +25,7 @@
25
25
  "electron-updater": "4.3.9",
26
26
  "exponential-backoff": "3.1.0",
27
27
  "graphql": "15.5.0",
28
+ "jwt-decode": "3.1.2",
28
29
  "nanoevents": "7.0.1",
29
30
  "nanoid": "4.0.0",
30
31
  "nosleep.js": "0.12.0",
@@ -19419,6 +19420,11 @@
19419
19420
  "integrity": "sha512-qpcRocdkUmf+UTNBYx5w6dexX5J31AKK1OmPwH630a83DdVVUIngk55RSAiIGpQyoH0dlr872VHfPjnQnK1qDQ==",
19420
19421
  "dev": true
19421
19422
  },
19423
+ "node_modules/jwt-decode": {
19424
+ "version": "3.1.2",
19425
+ "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz",
19426
+ "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A=="
19427
+ },
19422
19428
  "node_modules/keyv": {
19423
19429
  "version": "3.1.0",
19424
19430
  "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
@@ -44616,6 +44622,11 @@
44616
44622
  "integrity": "sha512-qpcRocdkUmf+UTNBYx5w6dexX5J31AKK1OmPwH630a83DdVVUIngk55RSAiIGpQyoH0dlr872VHfPjnQnK1qDQ==",
44617
44623
  "dev": true
44618
44624
  },
44625
+ "jwt-decode": {
44626
+ "version": "3.1.2",
44627
+ "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz",
44628
+ "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A=="
44629
+ },
44619
44630
  "keyv": {
44620
44631
  "version": "3.1.0",
44621
44632
  "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
@@ -120,6 +120,7 @@ export interface RtcPropsInterface {
120
120
  // };
121
121
  geoFencing?: boolean;
122
122
  audioRoom?: boolean;
123
+ activeSpeaker?: boolean;
123
124
  }
124
125
 
125
126
  export interface CallbacksInterface {
@@ -25,7 +25,11 @@ const Create = ({
25
25
  }) => {
26
26
  const [ready, setReady] = useState(false);
27
27
  const {callbacks, rtcProps, mode} = useContext(PropsContext);
28
- const {geoFencing = true, audioRoom = false} = rtcProps || {};
28
+ const {
29
+ geoFencing = true,
30
+ audioRoom = false,
31
+ activeSpeaker = false,
32
+ } = rtcProps || {};
29
33
  let engine = useRef<RtcEngine>({} as RtcEngine);
30
34
  // commented for v1 release
31
35
  // const beforeCreate = rtcProps?.lifecycle?.useBeforeCreate
@@ -228,7 +232,9 @@ const Create = ({
228
232
  } else {
229
233
  await engine.current.setChannelProfile(ChannelProfile.Communication);
230
234
  }
231
- await engine.current.enableAudioVolumeIndication(500, 3, true);
235
+ if (activeSpeaker) {
236
+ await engine.current.enableAudioVolumeIndication(500, 3, true);
237
+ }
232
238
  if (!audioRoom) {
233
239
  if (rtcProps.profile) {
234
240
  if (Platform.OS === 'web') {
@@ -192,8 +192,8 @@ export default class RtcEngine {
192
192
  private inScreenshare: Boolean = false;
193
193
  private videoProfile: VideoProfile = '480p_9';
194
194
  private isPublished = false;
195
- private isAudioEnabled = true;
196
- private isVideoEnabled = true;
195
+ private isAudioEnabled = false;
196
+ private isVideoEnabled = false;
197
197
  private isAudioPublished = false;
198
198
  private isVideoPublished = false;
199
199
  private isJoined = false;
@@ -229,6 +229,10 @@ export default class RtcEngine {
229
229
  try {
230
230
  let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
231
231
  this.localStream.audio = localAudio;
232
+ this.audioDeviceId = localAudio
233
+ ?.getMediaStreamTrack()
234
+ .getSettings().deviceId;
235
+ this.isAudioEnabled = true;
232
236
  } catch (e) {
233
237
  let audioError = e;
234
238
  e.status = {audioError};
@@ -262,6 +266,14 @@ export default class RtcEngine {
262
266
  );
263
267
  this.localStream.audio = localAudio;
264
268
  this.localStream.video = localVideo;
269
+ this.audioDeviceId = localAudio
270
+ ?.getMediaStreamTrack()
271
+ .getSettings().deviceId;
272
+ this.videoDeviceId = localVideo
273
+ ?.getMediaStreamTrack()
274
+ .getSettings().deviceId;
275
+ this.isVideoEnabled = true;
276
+ this.isAudioEnabled = true;
265
277
  } catch (e) {
266
278
  let audioError = false;
267
279
  let videoError = false;
@@ -269,12 +281,20 @@ export default class RtcEngine {
269
281
  let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
270
282
 
271
283
  this.localStream.audio = localAudio;
284
+ this.audioDeviceId = localAudio
285
+ ?.getMediaStreamTrack()
286
+ .getSettings().deviceId;
287
+ this.isAudioEnabled = true;
272
288
  } catch (error) {
273
289
  audioError = error;
274
290
  }
275
291
  try {
276
292
  let localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
277
293
  this.localStream.video = localVideo;
294
+ this.videoDeviceId = localVideo
295
+ ?.getMediaStreamTrack()
296
+ .getSettings().deviceId;
297
+ this.isVideoEnabled = true;
278
298
  } catch (error) {
279
299
  videoError = error;
280
300
  }
@@ -9,25 +9,43 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, { useContext } from 'react';
12
+ import React, {useContext} from 'react';
13
13
  /**
14
- *
14
+ *
15
15
  * @param context - any context data which we want to extract the data.
16
16
  * @returns useContextWithSelector in which we can pass selector function to extract data from the context that we passed.
17
17
  */
18
18
  function createHook<T>(context: React.Context<T>) {
19
-
20
19
  function useContextWithSelector<U>(contextSelector: (data: T) => U): U;
21
20
  function useContextWithSelector(): T;
22
21
  /**
23
- *
22
+ *
24
23
  * @param contextSelector is used to pass callback function used to select data from the context data
25
24
  * @returns the data selected from the context
26
25
  */
27
26
  function useContextWithSelector<U>(contextSelector?: (data: T) => U): U | T {
28
27
  const data = useContext(context);
29
- return contextSelector ? contextSelector(data) : data
28
+ return contextSelector ? contextSelector(data) : data;
30
29
  }
31
30
  return useContextWithSelector;
32
31
  }
33
- export default createHook;
32
+
33
+ export function createConcealedHook<T, V>(
34
+ context: React.Context<T>,
35
+ preselect: (data: T) => V,
36
+ ) {
37
+ function useContextWithSelector<U>(contextSelector: (data: V) => U): U;
38
+ function useContextWithSelector(): V;
39
+ /**
40
+ *
41
+ * @param contextSelector is used to pass callback function used to select data from the context data
42
+ * @returns the data selected from the context
43
+ */
44
+ function useContextWithSelector<U>(contextSelector?: (data: V) => U): U | V {
45
+ const data = useContext(context);
46
+ return contextSelector ? contextSelector(preselect(data)) : preselect(data);
47
+ }
48
+ return useContextWithSelector;
49
+ }
50
+
51
+ export default createHook;
@@ -1,4 +1,4 @@
1
- export {default as createHook} from './createHook';
1
+ export {default as createHook, createConcealedHook} from './createHook';
2
2
  export {CustomizationProvider, useCustomization} from './useCustomization';
3
3
  export type {CustomizationProviderProps} from './useCustomization';
4
4
  export {default as customizationConfig} from 'customization';
@@ -9,22 +9,20 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React from 'react';
12
+ import React, {useContext} from 'react';
13
13
  import {CustomizationApiInterface} from 'customization-api';
14
14
  import customizationConfig from 'customization';
15
15
  import createHook from './createHook';
16
+ import {SdkApiContext} from '../src/components/SdkApiContext';
16
17
 
17
18
  const CustomizationContext: React.Context<CustomizationApiInterface> =
18
19
  React.createContext(customizationConfig);
19
20
 
20
- export interface CustomizationProviderProps {
21
- children: React.ReactNode;
22
- value: CustomizationApiInterface;
23
- }
21
+ const CustomizationProvider: React.FC = (props) => {
22
+ const {customize: userCustomization} = useContext(SdkApiContext);
24
23
 
25
- const CustomizationProvider = (props: CustomizationProviderProps) => {
26
24
  return (
27
- <CustomizationContext.Provider value={props.value}>
25
+ <CustomizationContext.Provider value={userCustomization.customization}>
28
26
  {props.children}
29
27
  </CustomizationContext.Provider>
30
28
  );
@@ -97,6 +97,10 @@ interface ConfigInterface {
97
97
  ICON_TEXT: boolean;
98
98
  ICON_BG_COLOR: string;
99
99
  TOOLBAR_COLOR: string;
100
+ ACTIVE_SPEAKER: boolean;
101
+ ENABLE_TOKEN_AUTH: boolean;
102
+ ENABLE_IDP_AUTH: boolean;
103
+ PROJECT_ID: string;
100
104
  }
101
105
  declare var $config: ConfigInterface;
102
106
  declare module 'customization' {
@@ -12,12 +12,19 @@ export * from 'customization-implementation';
12
12
 
13
13
  interface AppBuilderWebSdkInterface extends AppBuilderSdkApiInterface {}
14
14
 
15
+ const clearEvent = {
16
+ clear: () => {},
17
+ };
18
+
15
19
  const AppBuilderWebSdkApi: AppBuilderWebSdkInterface = {
16
20
  ...AppBuilderSdkApi,
17
21
  // Override customize function for web-sdk
18
22
  customize: (customization) => {
19
- SDKEvents.on('addFpeInit', () => {
23
+ SDKEvents.emit('addFpe', customization);
24
+ clearEvent.clear = SDKEvents.on('addFpeInit', () => {
25
+ console.log('addFpeInit called');
20
26
  SDKEvents.emit('addFpe', customization);
27
+ clearEvent.clear();
21
28
  });
22
29
  },
23
30
  };
@@ -65,6 +65,7 @@
65
65
  "electron-updater": "4.3.9",
66
66
  "exponential-backoff": "3.1.0",
67
67
  "graphql": "15.5.0",
68
+ "jwt-decode": "3.1.2",
68
69
  "nanoevents": "7.0.1",
69
70
  "nanoid": "4.0.0",
70
71
  "nosleep.js": "0.12.0",
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import { View, TouchableOpacity, Text, Pressable } from 'react-native';
3
3
  import PropTypes from 'prop-types';
4
4
  import { stylePropType } from '../utils/prop-types';
@@ -115,6 +115,7 @@ function BaseToast({
115
115
  {...primaryBtn}
116
116
  onPress={(e) => {
117
117
  primaryBtn.onPress(checked, e);
118
+ setChecked(false);
118
119
  }}
119
120
  />
120
121
  )}
@@ -127,6 +128,10 @@ function BaseToast({
127
128
  paddingVertical: 0
128
129
  }}
129
130
  {...secondaryBtn}
131
+ onPress={(e) => {
132
+ secondaryBtn.onPress(checked, e);
133
+ setChecked(false);
134
+ }}
130
135
  />
131
136
  )}
132
137
  </View>
@@ -144,7 +149,7 @@ BaseToast.propTypes = {
144
149
  leadingIcon: PropTypes.node,
145
150
  trailingIcon: PropTypes.node,
146
151
  text1: PropTypes.string,
147
- text2: PropTypes.string || PropTypes.element,
152
+ text2: PropTypes.string || PropTypes.element || PropTypes.any,
148
153
  onPress: PropTypes.func,
149
154
  style: stylePropType,
150
155
  contentContainerStyle: stylePropType,
@@ -9,20 +9,9 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useState} from 'react';
12
+ import React, {useState, useContext} from 'react';
13
13
  import {Platform} from 'react-native';
14
- import Join from './pages/Join';
15
- import VideoCall from './pages/VideoCall';
16
- import Create from './pages/Create';
17
- import {Route, Switch, Redirect} from './components/Router';
18
- import PrivateRoute from './components/PrivateRoute';
19
- import OAuth from './components/OAuth';
20
- import StoreToken from './components/StoreToken';
21
- import {shouldAuthenticate} from './utils/common';
22
14
  import KeyboardManager from 'react-native-keyboard-manager';
23
- // commented for v1 release
24
- //import {CustomRoutesInterface, CUSTOM_ROUTES_PREFIX} from 'customization-api';
25
- //import {useCustomization} from 'customization-implementation';
26
15
  import AppWrapper from './AppWrapper';
27
16
  import {
28
17
  MeetingInfoContextInterface,
@@ -31,9 +20,9 @@ import {
31
20
  } from './components/meeting-info/useMeetingInfo';
32
21
  import {SetMeetingInfoProvider} from './components/meeting-info/useSetMeetingInfo';
33
22
  import {ShareLinkProvider} from './components/useShareLink';
34
- import Endcall from './pages/Endcall';
23
+ import AppRoutes from './AppRoutes';
35
24
 
36
- //hook can't be used in the outside react function calls. so directly checking the platform.
25
+ // hook can't be used in the outside react function calls. so directly checking the platform.
37
26
  if (Platform.OS === 'ios') {
38
27
  KeyboardManager.setEnable(true);
39
28
  KeyboardManager.setEnableAutoToolbar(false);
@@ -56,35 +45,6 @@ declare module 'agora-rn-uikit' {
56
45
  }
57
46
 
58
47
  const App: React.FC = () => {
59
- //commented for v1 release
60
- //const CustomRoutes = useCustomization((data) => data?.customRoutes);
61
- // const RenderCustomRoutes = () => {
62
- // try {
63
- // return (
64
- // CustomRoutes &&
65
- // Array.isArray(CustomRoutes) &&
66
- // CustomRoutes.length &&
67
- // CustomRoutes?.map((item: CustomRoutesInterface, i: number) => {
68
- // let RouteComponent = item?.isPrivateRoute ? PrivateRoute : Route;
69
- // return (
70
- // <RouteComponent
71
- // path={CUSTOM_ROUTES_PREFIX + item.path}
72
- // exact={item.exact}
73
- // key={i}
74
- // failureRedirectTo={
75
- // item.failureRedirectTo ? item.failureRedirectTo : '/'
76
- // }
77
- // {...item.routeProps}>
78
- // <item.component {...item.componentProps} />
79
- // </RouteComponent>
80
- // );
81
- // })
82
- // );
83
- // } catch (error) {
84
- // console.error('Error on rendering the custom routes');
85
- // return null;
86
- // }
87
- // };
88
48
  const [meetingInfo, setMeetingInfo] = useState<MeetingInfoContextInterface>(
89
49
  MeetingInfoDefaultValue,
90
50
  );
@@ -94,40 +54,7 @@ const App: React.FC = () => {
94
54
  <SetMeetingInfoProvider value={{setMeetingInfo}}>
95
55
  <MeetingInfoProvider value={{...meetingInfo}}>
96
56
  <ShareLinkProvider>
97
- <Switch>
98
- {/* commented for v1 release */}
99
- {/* {RenderCustomRoutes()} */}
100
- <Route exact path={'/'}>
101
- <Redirect to={'/create'} />
102
- </Route>
103
- <Route exact path={'/authenticate'}>
104
- {shouldAuthenticate ? <OAuth /> : <Redirect to={'/'} />}
105
- </Route>
106
- <Route path={'/auth-token/:token'}>
107
- <StoreToken />
108
- </Route>
109
- <Route exact path={'/join'}>
110
- <Join />
111
- </Route>
112
- {/* Will be used in the future
113
- <Route exact path={'/leave'}>
114
- <Endcall />
115
- </Route> */}
116
- {shouldAuthenticate ? (
117
- <PrivateRoute
118
- path={'/create'}
119
- failureRedirectTo={'/authenticate'}>
120
- <Create />
121
- </PrivateRoute>
122
- ) : (
123
- <Route path={'/create'}>
124
- <Create />
125
- </Route>
126
- )}
127
- <Route path={'/:phrase'}>
128
- <VideoCall />
129
- </Route>
130
- </Switch>
57
+ <AppRoutes />
131
58
  </ShareLinkProvider>
132
59
  </MeetingInfoProvider>
133
60
  </SetMeetingInfoProvider>
@@ -0,0 +1,53 @@
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 from 'react';
13
+ import Join from './pages/Join';
14
+ import VideoCall from './pages/VideoCall';
15
+ import Create from './pages/Create';
16
+ import {Route, Switch, Redirect} from './components/Router';
17
+ import AuthRoute from './auth/AuthRoute';
18
+ import StoreToken from './components/StoreToken';
19
+ import {IDPAuth} from './auth/IDPAuth';
20
+ import Login from './pages/Login';
21
+ import {Text} from 'react-native';
22
+
23
+ function AppRoutes() {
24
+ return (
25
+ <Switch>
26
+ <Route exact path={'/login'}>
27
+ <Login />
28
+ </Route>
29
+ <Route exact path={'/'}>
30
+ <Redirect to={'/create'} />
31
+ </Route>
32
+ {/* <Route exact path={'/authorize/:token'}>
33
+ <StoreToken />
34
+ </Route> */}
35
+ <Route exact path={'/authorize'}>
36
+ <IDPAuth />
37
+ </Route>
38
+ <AuthRoute exact path={'/join'}>
39
+ <Join />
40
+ </AuthRoute>
41
+ <AuthRoute exact path={'/create'}>
42
+ <Create />
43
+ </AuthRoute>
44
+ <AuthRoute path={'/:phrase'}>
45
+ <VideoCall />
46
+ </AuthRoute>
47
+ <Route path="*">
48
+ <Text>Page not found</Text>
49
+ </Route>
50
+ </Switch>
51
+ );
52
+ }
53
+ export default AppRoutes;
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React from 'react';
12
+ import React, {useContext} from 'react';
13
13
  import {Router} from './components/Router';
14
14
  import Navigation from './components/Navigation';
15
15
  import {StorageProvider} from './components/StorageContext';
@@ -29,9 +29,12 @@ import Error from './components/common/Error';
29
29
  import {ErrorProvider} from './components/common';
30
30
  import {useCustomization} from 'customization-implementation';
31
31
  import {LanguageProvider} from './language/useLanguage';
32
+ import {AuthProvider} from './auth/AuthProvider';
32
33
  import {PropsConsumer} from 'agora-rn-uikit';
33
34
  import ToastComponent from './components/ToastComponent';
34
35
  import {ToastContext, ToastProvider} from './components/useToast';
36
+ import {SdkApiContext} from './components/SdkApiContext';
37
+ import isSDK from './utils/isSDK';
35
38
 
36
39
  interface AppWrapperProps {
37
40
  children: React.ReactNode;
@@ -73,6 +76,8 @@ const AppWrapper = (props: AppWrapperProps) => {
73
76
  return React.Fragment;
74
77
  });
75
78
 
79
+ const {join: SdkJoinState} = useContext(SdkApiContext);
80
+
76
81
  return (
77
82
  <AppRoot>
78
83
  <ImageBackgroundComp bg={$config.BG} color={$config.BACKGROUND_COLOR}>
@@ -88,20 +93,28 @@ const AppWrapper = (props: AppWrapperProps) => {
88
93
  </ToastContext.Consumer>
89
94
  <StorageProvider>
90
95
  <GraphQLProvider>
91
- <Router>
92
- <SessionProvider>
93
- <ColorConfigure>
94
- <DimensionProvider>
95
- <LanguageProvider>
96
- <ErrorProvider>
97
- <Error />
98
- <Navigation />
99
- {props.children}
100
- </ErrorProvider>
101
- </LanguageProvider>
102
- </DimensionProvider>
103
- </ColorConfigure>
104
- </SessionProvider>
96
+ <Router
97
+ /*@ts-ignore Router will be memory Router in sdk*/
98
+ initialEntries={[
99
+ isSDK && SdkJoinState.phrase
100
+ ? `/${SdkJoinState.phrase}`
101
+ : '',
102
+ ]}>
103
+ <AuthProvider>
104
+ <SessionProvider>
105
+ <ColorConfigure>
106
+ <DimensionProvider>
107
+ <LanguageProvider>
108
+ <ErrorProvider>
109
+ <Error />
110
+ <Navigation />
111
+ {props.children}
112
+ </ErrorProvider>
113
+ </LanguageProvider>
114
+ </DimensionProvider>
115
+ </ColorConfigure>
116
+ </SessionProvider>
117
+ </AuthProvider>
105
118
  </Router>
106
119
  </GraphQLProvider>
107
120
  </StorageProvider>