agora-appbuilder-core 1.0.8 → 2.0.1

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 (134) hide show
  1. package/package.json +5 -2
  2. package/template/_package-lock.json +22850 -0
  3. package/template/agora-rn-uikit/.git/HEAD +1 -0
  4. package/template/agora-rn-uikit/.git/config +16 -0
  5. package/template/agora-rn-uikit/.git/description +1 -0
  6. package/template/agora-rn-uikit/.git/hooks/applypatch-msg.sample +15 -0
  7. package/template/agora-rn-uikit/.git/hooks/commit-msg.sample +24 -0
  8. package/template/agora-rn-uikit/.git/hooks/fsmonitor-watchman.sample +173 -0
  9. package/template/agora-rn-uikit/.git/hooks/post-update.sample +8 -0
  10. package/template/agora-rn-uikit/.git/hooks/pre-applypatch.sample +14 -0
  11. package/template/agora-rn-uikit/.git/hooks/pre-commit.sample +49 -0
  12. package/template/agora-rn-uikit/.git/hooks/pre-merge-commit.sample +13 -0
  13. package/template/agora-rn-uikit/.git/hooks/pre-push.sample +53 -0
  14. package/template/agora-rn-uikit/.git/hooks/pre-rebase.sample +169 -0
  15. package/template/agora-rn-uikit/.git/hooks/pre-receive.sample +24 -0
  16. package/template/agora-rn-uikit/.git/hooks/prepare-commit-msg.sample +42 -0
  17. package/template/agora-rn-uikit/.git/hooks/push-to-checkout.sample +78 -0
  18. package/template/agora-rn-uikit/.git/hooks/update.sample +128 -0
  19. package/template/agora-rn-uikit/.git/index +0 -0
  20. package/template/agora-rn-uikit/.git/info/exclude +6 -0
  21. package/template/agora-rn-uikit/.git/logs/HEAD +2 -0
  22. package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -0
  23. package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -0
  24. package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -0
  25. package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx +0 -0
  26. package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.pack +0 -0
  27. package/template/agora-rn-uikit/.git/packed-refs +12 -0
  28. package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -0
  29. package/template/agora-rn-uikit/.git/refs/heads/master +1 -0
  30. package/template/agora-rn-uikit/.git/refs/remotes/origin/HEAD +1 -0
  31. package/template/agora-rn-uikit/.gitignore +63 -0
  32. package/template/agora-rn-uikit/package-lock.json +7612 -0
  33. package/template/agora-rn-uikit/package.json +1 -0
  34. package/template/agora-rn-uikit/src/AgoraUIKit.tsx +8 -8
  35. package/template/agora-rn-uikit/src/{LocalUserContext.tsx → Contexts/LocalUserContext.tsx} +1 -1
  36. package/template/agora-rn-uikit/src/{MaxUidContext.tsx → Contexts/MaxUidContext.tsx} +0 -0
  37. package/template/agora-rn-uikit/src/{MinUidContext.tsx → Contexts/MinUidContext.tsx} +0 -0
  38. package/template/agora-rn-uikit/src/{PropsContext.tsx → Contexts/PropsContext.tsx} +34 -16
  39. package/template/agora-rn-uikit/src/{RtcContext.tsx → Contexts/RtcContext.tsx} +12 -21
  40. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +25 -15
  41. package/template/agora-rn-uikit/src/Controls/Icons.ts +53 -3
  42. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +53 -0
  43. package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +4 -3
  44. package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +3 -3
  45. package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +58 -14
  46. package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +60 -14
  47. package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +2 -2
  48. package/template/agora-rn-uikit/src/Controls/Local/Screenshare.tsx +2 -2
  49. package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +9 -9
  50. package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +20 -17
  51. package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +8 -8
  52. package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +3 -3
  53. package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +13 -8
  54. package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +1 -2
  55. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +20 -0
  56. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +20 -0
  57. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +26 -0
  58. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +26 -0
  59. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +46 -0
  60. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +47 -0
  61. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +20 -0
  62. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +20 -0
  63. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +21 -0
  64. package/template/agora-rn-uikit/src/Reducer/index.ts +9 -0
  65. package/template/agora-rn-uikit/src/Rtc/Create.tsx +138 -0
  66. package/template/agora-rn-uikit/src/Rtc/Join.tsx +100 -0
  67. package/template/agora-rn-uikit/src/RtcConfigure.tsx +197 -0
  68. package/template/agora-rn-uikit/src/Style.ts +3 -3
  69. package/template/agora-rn-uikit/src/Utils/actionTypeGuard.tsx +9 -0
  70. package/template/agora-rn-uikit/src/{events.ts → Utils/events.ts} +0 -0
  71. package/template/agora-rn-uikit/src/{permission.ts → Utils/permission.ts} +0 -0
  72. package/template/agora-rn-uikit/src/{quality.tsx → Utils/quality.tsx} +0 -0
  73. package/template/agora-rn-uikit/src/{MaxVideoView.native.tsx → Views/MaxVideoView.native.tsx} +3 -4
  74. package/template/agora-rn-uikit/src/{MaxVideoView.tsx → Views/MaxVideoView.tsx} +3 -4
  75. package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +86 -0
  76. package/template/agora-rn-uikit/src/index.ts +67 -0
  77. package/template/bridge/rtc/webNg/RtcEngine.ts +23 -6
  78. package/template/package-lock.json +22850 -0
  79. package/template/package.json +6 -4
  80. package/template/react-native-toast-message/.gitignore +5 -0
  81. package/template/react-native-toast-message/.npmignore +5 -0
  82. package/template/react-native-toast-message/package-lock.json +10553 -0
  83. package/template/src/.DS_Store +0 -0
  84. package/template/src/assets/icons.ts +35 -6
  85. package/template/src/atoms/SecondaryButton.tsx +6 -5
  86. package/template/src/atoms/TextInput.tsx +6 -1
  87. package/template/src/components/Chat.tsx +50 -21
  88. package/template/src/components/ChatContext.ts +22 -1
  89. package/template/src/components/Controls.native.tsx +2 -2
  90. package/template/src/components/Controls.tsx +2 -2
  91. package/template/src/components/DeviceConfigure.tsx +1 -1
  92. package/template/src/components/GridVideo.tsx +69 -31
  93. package/template/src/components/Navbar.tsx +136 -113
  94. package/template/src/components/NetworkQualityContext.tsx +134 -0
  95. package/template/src/components/ParticipantsView.tsx +105 -49
  96. package/template/src/components/PinnedVideo.tsx +112 -71
  97. package/template/src/components/Precall.native.tsx +42 -23
  98. package/template/src/components/Precall.tsx +56 -51
  99. package/template/src/components/RTMConfigure.tsx +331 -181
  100. package/template/src/components/RTMEvents.tsx +84 -0
  101. package/template/src/components/Settings.tsx +19 -16
  102. package/template/src/components/Share.tsx +131 -62
  103. package/template/src/components/StorageContext.tsx +2 -0
  104. package/template/src/hooks/useImageDelay.tsx +28 -0
  105. package/template/src/pages/Authenticate.tsx +5 -4
  106. package/template/src/pages/Create.tsx +26 -16
  107. package/template/src/pages/Join.tsx +13 -30
  108. package/template/src/pages/VideoCall.tsx +181 -137
  109. package/template/src/subComponents/.DS_Store +0 -0
  110. package/template/src/subComponents/ChatContainer.tsx +40 -28
  111. package/template/src/subComponents/CopyJoinInfo.tsx +9 -12
  112. package/template/src/subComponents/LocalAudioMute.tsx +9 -9
  113. package/template/src/subComponents/LocalVideoMute.tsx +9 -9
  114. package/template/src/subComponents/LogoutButton.tsx +1 -1
  115. package/template/src/subComponents/NetworkQualityPill.tsx +161 -0
  116. package/template/src/subComponents/Recording.tsx +12 -16
  117. package/template/src/subComponents/RemoteAudioMute.tsx +23 -27
  118. package/template/src/subComponents/RemoteEndCall.tsx +7 -15
  119. package/template/src/subComponents/RemoteVideoMute.tsx +15 -28
  120. package/template/src/subComponents/ScreenShareNotice.tsx +61 -0
  121. package/template/src/subComponents/ScreenshareButton.tsx +76 -75
  122. package/template/src/subComponents/SelectOAuth.tsx +25 -12
  123. package/template/src/subComponents/SwitchCamera.tsx +5 -2
  124. package/template/src/subComponents/TextWithTooltip.native.tsx +128 -0
  125. package/template/src/subComponents/TextWithTooltip.tsx +44 -0
  126. package/template/src/subComponents/toastConfig.tsx +2 -2
  127. package/template/src/utils/hasBrandLogo.tsx +3 -0
  128. package/template/src/utils/isSafariBrowser.tsx +22 -0
  129. package/template/webpack.commons.js +1 -0
  130. package/template/agora-rn-uikit/Components.js +0 -35
  131. package/template/agora-rn-uikit/Contexts.js +0 -7
  132. package/template/agora-rn-uikit/index.js +0 -12
  133. package/template/agora-rn-uikit/src/MinVideoView.tsx +0 -87
  134. package/template/agora-rn-uikit/src/RTCConfigure.tsx +0 -516
@@ -5,6 +5,7 @@
5
5
  "name": "Vineeth Srinivasn",
6
6
  "email": "vineeth@agora.io"
7
7
  },
8
+ "main": "./src/index.ts",
8
9
  "description": "Agora react native UI KIT. Rapidly integrate video calling into your React Native application with built in UI Elements.",
9
10
  "scripts": {
10
11
  "android": "react-native run-android",
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import {ScrollView, View} from 'react-native';
3
- import RtcConfigure from './RTCConfigure';
4
- import MaxVideoView from './MaxVideoView';
5
- import MinVideoView from './MinVideoView';
6
- import {MinUidConsumer} from './MinUidContext';
7
- import {MaxUidConsumer} from './MaxUidContext';
8
- import {PropsProvider, PropsInterface} from './PropsContext';
3
+ import RtcConfigure from './RtcConfigure';
4
+ import MaxVideoView from './Views/MaxVideoView';
5
+ import MinVideoView from './Views/MinVideoView';
6
+ import {MinUidConsumer} from './Contexts/MinUidContext';
7
+ import {MaxUidConsumer} from './Contexts/MaxUidContext';
8
+ import {PropsProvider, PropsInterface} from './Contexts/PropsContext';
9
9
 
10
10
  import styles from './Style';
11
11
  import LocalControls from './Controls/LocalControls';
@@ -15,7 +15,7 @@ import LocalControls from './Controls/LocalControls';
15
15
  const AgoraUIKit: React.FC<PropsInterface> = (props) => {
16
16
  return (
17
17
  <PropsProvider value={props}>
18
- <View>
18
+ <View style={{backgroundColor: '#000', flex: 1}}>
19
19
  <RtcConfigure>
20
20
  <MaxUidConsumer>
21
21
  {(maxUsers) => (
@@ -30,7 +30,7 @@ const AgoraUIKit: React.FC<PropsInterface> = (props) => {
30
30
  <MinUidConsumer>
31
31
  {(minUsers) =>
32
32
  minUsers.map((user) => (
33
- <MinVideoView user={user} key={user.uid} />
33
+ <MinVideoView showOverlay user={user} key={user.uid} />
34
34
  ))
35
35
  }
36
36
  </MinUidConsumer>
@@ -1,7 +1,7 @@
1
1
  import React, {useContext, createContext} from 'react';
2
2
  import MaxUidContext from './MaxUidContext';
3
3
  import MinUidContext from './MinUidContext';
4
- import {UidInterface} from './RtcContext';
4
+ import {UidInterface} from './PropsContext';
5
5
 
6
6
  export const LocalContext = createContext<UidInterface>({} as UidInterface);
7
7
  export const LocalProvider = LocalContext.Provider;
@@ -1,13 +1,27 @@
1
1
  import React from 'react';
2
2
  import {StyleProp, ViewStyle} from 'react-native';
3
- import {RtcEngineEvents} from 'react-native-agora/lib/RtcEvents';
3
+ import {RtcEngineEvents} from 'react-native-agora/lib/typescript/src/common/RtcEvents';
4
4
  import {EncryptionMode} from 'react-native-agora';
5
- import {VideoProfile} from './quality';
6
- interface UidInterface {
5
+ import {VideoProfile} from '../Utils/quality';
6
+
7
+ // disabled is intentionally kept as the 1st item in the enum.
8
+ // This way, it evaluates to a falsy value in a if statement
9
+ export enum ToggleState {
10
+ disabled,
11
+ enabled,
12
+ disabling, // enabled -> disabling -> disabled
13
+ enabling, // disabled -> enabling -> enabled
14
+ }
15
+
16
+ export const toggleHelper = (state: ToggleState) =>
17
+ state === ToggleState.enabled ? ToggleState.disabled : ToggleState.enabled;
18
+
19
+ export interface UidInterface {
7
20
  // TODO: refactor local to 0 and remove string.
8
21
  uid: number | string;
9
- audio: boolean;
10
- video: boolean;
22
+ audio: ToggleState;
23
+ video: ToggleState;
24
+ streamType: 'high' | 'low';
11
25
  }
12
26
 
13
27
  interface remoteBtnStylesInterface {
@@ -49,7 +63,8 @@ export interface RtcPropsInterface {
49
63
  token?: string | null;
50
64
  dual?: boolean | null;
51
65
  profile?: VideoProfile;
52
- initialDualStreamMode: DualStreamMode;
66
+ initialDualStreamMode?: DualStreamMode;
67
+ callActive?: boolean;
53
68
  encryption?: {
54
69
  key: string;
55
70
  mode:
@@ -59,21 +74,24 @@ export interface RtcPropsInterface {
59
74
  };
60
75
  }
61
76
 
62
- export interface CustomCallbacksInterface {
63
- EndCall(): void;
64
- FullScreen(): void;
65
- SwitchCamera(): void;
77
+ export interface CallbacksInterface {
78
+ EndCall(): void; //?
79
+ FullScreen(): void; //?
80
+ SwitchCamera(): void; //Not in reducer
81
+ UpdateDualStreamMode(mode: DualStreamMode): void;
82
+ UserJoined: RtcEngineEvents['UserJoined'];
83
+ UserOffline: RtcEngineEvents['UserOffline'];
66
84
  SwapVideo(user: UidInterface): void;
67
85
  UserMuteRemoteAudio(user: UidInterface, muted: UidInterface['audio']): void;
68
86
  UserMuteRemoteVideo(user: UidInterface, muted: UidInterface['video']): void;
69
- LocalMuteAudio(muted: boolean): void;
70
- LocalMuteVideo(muted: boolean): void;
71
- UpdateDualStreamMode(mode: DualStreamMode): void;
87
+ LocalMuteAudio(muted: ToggleState): void;
88
+ LocalMuteVideo(muted: ToggleState): void;
89
+ RemoteAudioStateChanged: RtcEngineEvents['RemoteAudioStateChanged'];
90
+ RemoteVideoStateChanged: RtcEngineEvents['RemoteVideoStateChanged'];
91
+ JoinChannelSuccess: RtcEngineEvents['JoinChannelSuccess'];
72
92
  }
73
93
 
74
- export interface CallbacksInterface
75
- extends RtcEngineEvents,
76
- CustomCallbacksInterface {}
94
+ export type CustomCallbacksInterface = CallbacksInterface;
77
95
 
78
96
  export interface PropsInterface {
79
97
  rtcProps: RtcPropsInterface;
@@ -1,40 +1,31 @@
1
1
  import React, {Dispatch} from 'react';
2
2
  import {CallbacksInterface} from './PropsContext';
3
3
  import RtcEngine from 'react-native-agora';
4
- import type {DualStreamMode} from './PropsContext';
5
- export interface UidInterface {
6
- // TODO: refactor local to 0 and remove string.
7
- uid: number | string;
8
- audio: boolean;
9
- video: boolean;
10
- streamType: 'high' | 'low';
11
- }
4
+ import type {DualStreamMode, UidInterface} from './PropsContext';
12
5
 
13
6
  export interface UidStateInterface {
14
7
  min: Array<UidInterface>;
15
8
  max: Array<UidInterface>;
16
9
  }
17
10
 
18
- export interface ActionInterface<
19
- T extends keyof CallbacksInterface,
20
- K extends CallbacksInterface
21
- > {
11
+ export interface ActionInterface<T extends keyof CallbacksInterface> {
22
12
  type: T;
23
- value: Parameters<K[T]>;
13
+ value: Parameters<CallbacksInterface[T]>;
24
14
  }
25
15
 
26
- export type DispatchType<T extends keyof CallbacksInterface> = Dispatch<
27
- ActionInterface<T, CallbacksInterface>
28
- >;
16
+ export type DispatchType = <
17
+ T extends keyof CallbacksInterface,
18
+ V extends Parameters<CallbacksInterface[T]>,
19
+ >(action: {
20
+ type: T;
21
+ value: V;
22
+ }) => void;
29
23
 
30
- export type ActionType<T extends keyof CallbacksInterface> = ActionInterface<
31
- T,
32
- CallbacksInterface
33
- >;
24
+ export type ActionType<T extends keyof CallbacksInterface> = ActionInterface<T>;
34
25
 
35
26
  export interface RtcContextInterface {
36
27
  RtcEngine: RtcEngine;
37
- dispatch: DispatchType<keyof CallbacksInterface>;
28
+ dispatch: DispatchType;
38
29
  setDualStreamMode: React.Dispatch<React.SetStateAction<DualStreamMode>>;
39
30
  }
40
31
 
@@ -8,9 +8,11 @@ import {
8
8
  Text,
9
9
  View,
10
10
  } from 'react-native';
11
- import PropsContext from './../PropsContext';
11
+ import PropsContext from '../Contexts/PropsContext';
12
12
  import styles from '../Style';
13
13
  import icons, {IconsInterface} from './Icons';
14
+ import useImageDelay from '../../../src/hooks/useImageDelay';
15
+ import isSafariBrowser from '../../../src/utils/isSafariBrowser';
14
16
 
15
17
  interface BtnTemplateInterface {
16
18
  name: keyof IconsInterface;
@@ -18,28 +20,38 @@ interface BtnTemplateInterface {
18
20
  onPress?: TouchableOpacityProps['onPress'];
19
21
  style?: StyleProp<ViewStyle>;
20
22
  btnText?: string;
23
+ disabled?: boolean;
21
24
  }
22
25
 
23
26
  const BtnTemplate: React.FC<BtnTemplateInterface> = (props) => {
27
+ const {disabled = false} = props;
24
28
  const {styleProps} = useContext(PropsContext);
25
29
  const {BtnTemplateStyles, theme} = styleProps || {};
26
30
 
31
+ const imageRef = React.useRef(null);
32
+
33
+ if (isSafariBrowser()) {
34
+ // This fixes the tint issue in safari browser
35
+ useImageDelay(imageRef, 10, '');
36
+ }
37
+
27
38
  return (
28
- <TouchableOpacity onPress={props.onPress}>
39
+ <TouchableOpacity
40
+ style={{width: '100%', height: '100%'}}
41
+ disabled={disabled}
42
+ onPress={props.onPress}>
29
43
  <View
30
- style={{
31
- ...styles.controlBtn,
32
- ...(BtnTemplateStyles as object),
33
- ...(props.style as object),
34
- }}>
44
+ style={[
45
+ {...styles.controlBtn, ...(BtnTemplateStyles as object)},
46
+ props.style as object,
47
+ ]}>
35
48
  <Image
49
+ ref={imageRef}
36
50
  style={{
37
51
  width: '100%',
38
52
  height: '100%',
39
- tintColor:
40
- props.name !== 'callEnd'
41
- ? theme || props.color || '#fff'
42
- : '#FD0845',
53
+ opacity: disabled ? 0.4 : 1,
54
+ tintColor: disabled ? 'grey' : ( props.color || theme || '#fff')
43
55
  }}
44
56
  resizeMode={'contain'}
45
57
  source={{uri: icons[props.name]}}
@@ -49,10 +61,8 @@ const BtnTemplate: React.FC<BtnTemplateInterface> = (props) => {
49
61
  style={{
50
62
  textAlign: 'center',
51
63
  marginTop: 5,
52
- color:
53
- props.name !== 'callEnd'
54
- ? theme || props.color || '#fff'
55
- : '#FD0845',
64
+ color: disabled ? 'grey' : (props.color || theme || '#fff'),
65
+ opacity: disabled ? 0.4 : 1
56
66
  }}>
57
67
  {props.btnText}
58
68
  </Text>