agora-appbuilder-core 3.0.10 → 3.0.12

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 (249) hide show
  1. package/Readme.md +0 -6
  2. package/package.json +2 -2
  3. package/template/_package-lock.json +4979 -7086
  4. package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +0 -4
  5. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +0 -18
  6. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +0 -2
  7. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +26 -30
  8. package/template/agora-rn-uikit/src/Controls/Icons.ts +83 -30
  9. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
  10. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +0 -1
  11. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +0 -1
  12. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +0 -1
  13. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +0 -1
  14. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +0 -1
  15. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +0 -2
  16. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +0 -1
  17. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +0 -1
  18. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +0 -1
  19. package/template/agora-rn-uikit/src/Reducer/index.ts +0 -3
  20. package/template/agora-rn-uikit/src/Rtc/Create.tsx +1 -89
  21. package/template/agora-rn-uikit/src/RtcConfigure.tsx +2 -39
  22. package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +5 -15
  23. package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +9 -15
  24. package/template/agora-rn-uikit/src/index.ts +1 -3
  25. package/template/android/app/build.gradle +0 -1
  26. package/template/android/app/src/main/AndroidManifest.xml +15 -22
  27. package/template/android/app/src/main/java/com/helloworld/MainActivity.java +0 -50
  28. package/template/android/build.gradle +3 -3
  29. package/template/babel.config.js +0 -1
  30. package/template/bridge/rtc/webNg/RtcEngine.ts +17 -110
  31. package/template/customization-api/sub-components.ts +1 -1
  32. package/template/customization-api/typeDefinition.ts +1 -2
  33. package/template/electron/index.html +27 -27
  34. package/template/electron/renderer/index.js +0 -1
  35. package/template/global.d.ts +4 -26
  36. package/template/index.js +0 -4
  37. package/template/index.rsdk.tsx +0 -1
  38. package/template/index.web.js +1 -7
  39. package/template/index.wsdk.tsx +1 -1
  40. package/template/ios/HelloWorld/Info.plist +1 -14
  41. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +0 -17
  42. package/template/metro.config.js +1 -1
  43. package/template/package.json +7 -21
  44. package/template/react-native-toast-message/index.d.ts +43 -43
  45. package/template/react-native-toast-message/src/colors/index.js +2 -3
  46. package/template/react-native-toast-message/src/components/base/index.js +59 -46
  47. package/template/react-native-toast-message/src/components/base/styles.js +32 -16
  48. package/template/react-native-toast-message/src/components/error.js +2 -3
  49. package/template/react-native-toast-message/src/components/info.js +2 -3
  50. package/template/react-native-toast-message/src/components/success.js +2 -3
  51. package/template/react-native-toast-message/src/index.js +31 -122
  52. package/template/react-native-toast-message/src/index.sdk.tsx +35 -125
  53. package/template/react-native-toast-message/src/styles.js +4 -3
  54. package/template/react-native-toast-message/src/styles.sdk.ts +4 -3
  55. package/template/src/App.tsx +0 -6
  56. package/template/src/AppWrapper.tsx +28 -63
  57. package/template/src/assets/icons.ts +102 -0
  58. package/template/src/atoms/HorizontalRule.tsx +1 -3
  59. package/template/src/atoms/PrimaryButton.tsx +26 -51
  60. package/template/src/atoms/SecondaryButton.tsx +5 -8
  61. package/template/src/atoms/TextInput.tsx +14 -12
  62. package/template/src/components/Chat.tsx +214 -86
  63. package/template/src/components/ChatContext.ts +1 -8
  64. package/template/src/components/ColorConfigure.tsx +1 -1
  65. package/template/src/components/ColorContext.ts +1 -1
  66. package/template/src/components/{Controls1.native.tsx → Controls.native.tsx} +4 -6
  67. package/template/src/components/Controls.tsx +42 -342
  68. package/template/src/components/DeviceConfigure.tsx +101 -461
  69. package/template/src/components/DeviceContext.tsx +4 -8
  70. package/template/src/components/EventsConfigure.tsx +7 -144
  71. package/template/src/components/GraphQLProvider.tsx +1 -1
  72. package/template/src/components/GridVideo.tsx +44 -59
  73. package/template/src/components/HostControlView.tsx +35 -114
  74. package/template/src/components/Navbar.tsx +398 -216
  75. package/template/src/components/NetworkQualityContext.tsx +20 -20
  76. package/template/src/components/ParticipantsView.tsx +154 -177
  77. package/template/src/components/PinnedVideo.tsx +120 -207
  78. package/template/src/components/Precall.native.tsx +119 -358
  79. package/template/src/components/Precall.tsx +135 -269
  80. package/template/src/components/RTMConfigure.tsx +4 -27
  81. package/template/src/components/Router.electron.ts +0 -1
  82. package/template/src/components/Router.native.ts +0 -1
  83. package/template/src/components/Router.sdk.ts +0 -1
  84. package/template/src/components/Router.ts +0 -1
  85. package/template/src/components/Settings.tsx +95 -26
  86. package/template/src/components/SettingsView.tsx +56 -251
  87. package/template/src/components/Share.tsx +273 -302
  88. package/template/src/components/StorageContext.tsx +3 -30
  89. package/template/src/components/chat-messages/useChatMessages.tsx +23 -69
  90. package/template/src/components/chat-ui/useChatUIControl.tsx +0 -7
  91. package/template/src/components/common/Error.tsx +6 -20
  92. package/template/src/components/common/Logo.tsx +15 -16
  93. package/template/src/components/contexts/LiveStreamDataContext.tsx +5 -10
  94. package/template/src/components/contexts/VideoMeetingDataContext.tsx +7 -37
  95. package/template/src/components/livestream/LiveStreamContext.tsx +36 -270
  96. package/template/src/components/livestream/Types.ts +14 -39
  97. package/template/src/components/livestream/index.ts +0 -1
  98. package/template/src/components/livestream/views/LiveStreamControls.tsx +4 -12
  99. package/template/src/components/participants/AllAudienceParticipants.tsx +30 -101
  100. package/template/src/components/participants/AllHostParticipants.tsx +34 -103
  101. package/template/src/components/participants/MeParticipant.tsx +38 -0
  102. package/template/src/components/participants/ParticipantName.tsx +7 -13
  103. package/template/src/components/participants/ParticipantSectionTitle.tsx +10 -35
  104. package/template/src/components/participants/RemoteParticipants.tsx +71 -0
  105. package/template/src/components/participants/ScreenshareParticipants.tsx +12 -144
  106. package/template/src/components/precall/{LocalMute1.native.tsx → LocalMute.native.tsx} +5 -21
  107. package/template/src/components/precall/LocalMute.tsx +14 -84
  108. package/template/src/components/precall/VideoPreview.native.tsx +3 -48
  109. package/template/src/components/precall/VideoPreview.tsx +7 -163
  110. package/template/src/components/precall/joinCallBtn.tsx +2 -15
  111. package/template/src/components/precall/meetingTitle.tsx +12 -15
  112. package/template/src/components/precall/selectDevice.tsx +21 -1
  113. package/template/src/components/precall/textInput.tsx +4 -32
  114. package/template/src/components/precall/usePreCall.tsx +0 -16
  115. package/template/src/components/styles.ts +21 -42
  116. package/template/src/components/useShareLink.tsx +14 -12
  117. package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
  118. package/template/src/pages/Authenticate.tsx +15 -5
  119. package/template/src/pages/Create.tsx +165 -293
  120. package/template/src/pages/Join.tsx +67 -93
  121. package/template/src/pages/VideoCall.tsx +64 -89
  122. package/template/src/pages/video-call/DefaultLayouts.ts +4 -4
  123. package/template/src/pages/video-call/NameWithMicIcon.tsx +44 -120
  124. package/template/src/pages/video-call/RenderComponent.tsx +2 -3
  125. package/template/src/pages/video-call/VideoCallScreen.tsx +9 -45
  126. package/template/src/pages/video-call/VideoComponent.tsx +3 -18
  127. package/template/src/pages/video-call/VideoRenderer.tsx +60 -218
  128. package/template/src/rtm-events/constants.ts +0 -2
  129. package/template/src/subComponents/ChatBubble.tsx +83 -123
  130. package/template/src/subComponents/ChatContainer.tsx +84 -257
  131. package/template/src/subComponents/ChatInput.tsx +46 -61
  132. package/template/src/subComponents/Checkbox.native.tsx +5 -16
  133. package/template/src/subComponents/Checkbox.tsx +2 -2
  134. package/template/src/subComponents/CopyJoinInfo.tsx +58 -36
  135. package/template/src/subComponents/FallbackLogo.tsx +40 -122
  136. package/template/src/subComponents/LanguageSelector.tsx +1 -1
  137. package/template/src/subComponents/{LayoutIconDropdown1.native.tsx → LayoutIconDropdown.native.tsx} +18 -4
  138. package/template/src/subComponents/LayoutIconDropdown.tsx +134 -131
  139. package/template/src/subComponents/LocalAudioMute.tsx +27 -119
  140. package/template/src/subComponents/LocalEndCall.tsx +33 -71
  141. package/template/src/subComponents/LocalSwitchCamera.tsx +30 -17
  142. package/template/src/subComponents/LocalVideoMute.tsx +27 -117
  143. package/template/src/subComponents/Logo.tsx +4 -3
  144. package/template/src/subComponents/LogoutButton.tsx +1 -1
  145. package/template/src/subComponents/NetworkQualityPill.tsx +63 -60
  146. package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
  147. package/template/src/subComponents/Recording.tsx +29 -28
  148. package/template/src/subComponents/RemoteAudioMute.tsx +29 -83
  149. package/template/src/subComponents/RemoteEndCall.tsx +5 -8
  150. package/template/src/subComponents/RemoteVideoMute.tsx +21 -74
  151. package/template/src/subComponents/ScreenShareNotice.tsx +8 -83
  152. package/template/src/subComponents/SelectDevice.tsx +61 -404
  153. package/template/src/subComponents/SelectOAuth.tsx +8 -9
  154. package/template/src/subComponents/ToastConfig.tsx +10 -150
  155. package/template/src/subComponents/chat/ChatParticipants.tsx +78 -187
  156. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +32 -95
  157. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +33 -29
  158. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +6 -6
  159. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +11 -24
  160. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +10 -17
  161. package/template/src/subComponents/recording/useRecording.tsx +27 -79
  162. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +70 -52
  163. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +2 -11
  164. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +4 -26
  165. package/template/src/utils/common.tsx +1 -155
  166. package/template/src/utils/index.tsx +0 -19
  167. package/template/src/utils/isMobileOrTablet.ts +2 -7
  168. package/template/src/utils/useButtonTemplate.tsx +0 -1
  169. package/template/src/utils/useMuteToggleLocal.ts +3 -54
  170. package/template/web/index.html +0 -5
  171. package/template/webpack.commons.js +8 -13
  172. package/template/webpack.web.config.js +0 -1
  173. package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +0 -11
  174. package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +0 -24
  175. package/template/agora-rn-uikit/src/Reducer/UserPin.ts +0 -11
  176. package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  177. package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
  178. package/template/android/app/src/main/res/values/colors.xml +0 -7
  179. package/template/react-native-toast-message/src/components/checkbox.js +0 -178
  180. package/template/react-native.config.js +0 -7
  181. package/template/src/assets/font-styles.css +0 -329
  182. package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  183. package/template/src/assets/fonts/icomoon.ttf +0 -0
  184. package/template/src/assets/permission.png +0 -0
  185. package/template/src/assets/selection.json +0 -1
  186. package/template/src/atoms/ActionMenu.tsx +0 -236
  187. package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +0 -71
  188. package/template/src/atoms/AnimatedActiveSpeaker.tsx +0 -84
  189. package/template/src/atoms/AnimatedRings.native.tsx +0 -68
  190. package/template/src/atoms/AnimatedRings.tsx +0 -70
  191. package/template/src/atoms/Card.tsx +0 -61
  192. package/template/src/atoms/CircularProgress.native.tsx +0 -121
  193. package/template/src/atoms/CircularProgress.tsx +0 -102
  194. package/template/src/atoms/CustomIcon.tsx +0 -88
  195. package/template/src/atoms/CustomSwitch.tsx +0 -287
  196. package/template/src/atoms/Dropdown.tsx +0 -306
  197. package/template/src/atoms/IconButton.tsx +0 -162
  198. package/template/src/atoms/ImageIcon.tsx +0 -98
  199. package/template/src/atoms/InfoBubble.tsx +0 -291
  200. package/template/src/atoms/Input.tsx +0 -87
  201. package/template/src/atoms/InviteInfo.tsx +0 -166
  202. package/template/src/atoms/LinkButton.tsx +0 -28
  203. package/template/src/atoms/OutlineButton.tsx +0 -61
  204. package/template/src/atoms/ParticipantsCount.tsx +0 -73
  205. package/template/src/atoms/Popup.tsx +0 -147
  206. package/template/src/atoms/RecordingInfo.tsx +0 -49
  207. package/template/src/atoms/Spacer.tsx +0 -22
  208. package/template/src/atoms/TertiaryButton.tsx +0 -78
  209. package/template/src/atoms/Toggle.tsx +0 -47
  210. package/template/src/atoms/Tooltip.native.tsx +0 -65
  211. package/template/src/atoms/Tooltip.tsx +0 -94
  212. package/template/src/atoms/UserAvatar.tsx +0 -60
  213. package/template/src/components/CommonStyles.ts +0 -44
  214. package/template/src/components/ToastComponent.tsx +0 -8
  215. package/template/src/components/participants/Participant.tsx +0 -302
  216. package/template/src/components/participants/UserActionMenuOptions.tsx +0 -398
  217. package/template/src/components/popups/InvitePopup.tsx +0 -115
  218. package/template/src/components/popups/StopRecordingPopup.tsx +0 -114
  219. package/template/src/components/precall/PermissionHelper.native.tsx +0 -5
  220. package/template/src/components/precall/PermissionHelper.tsx +0 -126
  221. package/template/src/components/precall/PreCallSettings.tsx +0 -52
  222. package/template/src/components/useToast.tsx +0 -41
  223. package/template/src/components/useVideoCall.tsx +0 -65
  224. package/template/src/pages/Endcall.tsx +0 -148
  225. package/template/src/pages/video-call/ActionSheet.native.tsx +0 -215
  226. package/template/src/pages/video-call/ActionSheet.tsx +0 -226
  227. package/template/src/pages/video-call/ActionSheetContent.tsx +0 -479
  228. package/template/src/pages/video-call/ActionSheetHandle.tsx +0 -38
  229. package/template/src/pages/video-call/ActionSheetStyles.css +0 -138
  230. package/template/src/pages/video-call/SidePanelHeader.tsx +0 -190
  231. package/template/src/pages/video-call/VideoCallMobileView.tsx +0 -139
  232. package/template/src/pages/video-call/VideoCallScreen.native.tsx +0 -37
  233. package/template/src/subComponents/ChatInput.ios.tsx +0 -237
  234. package/template/src/subComponents/EndcallPopup.tsx +0 -107
  235. package/template/src/subComponents/LayoutIconButton.tsx +0 -201
  236. package/template/src/subComponents/RemoteMutePopup.tsx +0 -193
  237. package/template/src/subComponents/RemoveMeetingPopup.tsx +0 -109
  238. package/template/src/subComponents/RemoveScreensharePopup.tsx +0 -109
  239. package/template/src/subComponents/SelectDeviceSettings.backup.tsx +0 -207
  240. package/template/src/subComponents/SidePanelHeader.tsx +0 -112
  241. package/template/src/theme/index.ts +0 -46
  242. package/template/src/utils/PlatformWrapper.tsx +0 -21
  243. package/template/src/utils/hexadecimalTransparency.ts +0 -108
  244. package/template/src/utils/pendingStateUpdateHelper.ts +0 -19
  245. package/template/src/utils/useFocus.tsx +0 -46
  246. package/template/src/utils/useIsActiveSpeaker.ts +0 -27
  247. package/template/src/utils/useIsHandRaised.ts +0 -13
  248. package/template/src/utils/useRemoteEndScreenshare.ts +0 -26
  249. package/template/src/utils/useRemoteRequest.ts +0 -84
@@ -16,19 +16,13 @@ import {useString} from '../utils/useString';
16
16
  import {ChatBubbleProps} from '../components/ChatContext';
17
17
  import ColorContext from '../components/ColorContext';
18
18
  import {isWebInternal} from '../utils/common';
19
- import {useChatUIControl, useRender} from 'customization-api';
20
- import ThemeConfig from '../theme';
21
- import hexadecimalTransparency from '../utils/hexadecimalTransparency';
22
- import Spacer from '../atoms/Spacer';
23
- import {formatAMPM} from '../utils';
19
+ import {useRender} from 'customization-api';
24
20
 
25
21
  const ChatBubble = (props: ChatBubbleProps) => {
26
22
  const {renderList} = useRender();
27
23
  const {primaryColor} = useContext(ColorContext);
28
- const {privateActive, selectedChatUserId} = useChatUIControl();
29
24
  let {
30
25
  isLocal,
31
- isSameUser,
32
26
  message,
33
27
  createdTimestamp,
34
28
  uid,
@@ -36,8 +30,10 @@ const ChatBubble = (props: ChatBubbleProps) => {
36
30
  msgId,
37
31
  updatedTimestamp,
38
32
  } = props;
39
- let time = formatAMPM(new Date(parseInt(createdTimestamp)));
40
-
33
+ let time =
34
+ new Date(parseInt(createdTimestamp)).getHours() +
35
+ ':' +
36
+ new Date(parseInt(createdTimestamp)).getMinutes();
41
37
  const handleUrl = (url: string) => {
42
38
  if (isWebInternal()) {
43
39
  window.open(url, '_blank');
@@ -48,7 +44,6 @@ const ChatBubble = (props: ChatBubbleProps) => {
48
44
  //commented for v1 release
49
45
  //const remoteUserDefaultLabel = useString('remoteUserDefaultLabel')();
50
46
  const remoteUserDefaultLabel = 'User';
51
-
52
47
  return props?.render ? (
53
48
  props.render(
54
49
  isLocal,
@@ -58,141 +53,106 @@ const ChatBubble = (props: ChatBubbleProps) => {
58
53
  msgId,
59
54
  isDeleted,
60
55
  updatedTimestamp,
61
- isSameUser,
62
56
  )
63
57
  ) : (
64
- <>
65
- {!isSameUser && !(privateActive && selectedChatUserId) ? (
66
- <Text
67
- style={
68
- isLocal ? style.localUsernameStyle : style.remoteUsernameStyle
69
- }>
70
- {isLocal
71
- ? 'You'
72
- : renderList[uid]
73
- ? renderList[uid].name
74
- : remoteUserDefaultLabel}
58
+ <View>
59
+ <View style={isLocal ? style.chatSenderViewLocal : style.chatSenderView}>
60
+ <Text style={isLocal ? style.timestampTextLocal : style.timestampText}>
61
+ {renderList[uid] ? renderList[uid].name : remoteUserDefaultLabel} |{' '}
62
+ {time + ' '}
75
63
  </Text>
76
- ) : (
77
- <></>
78
- )}
64
+ </View>
79
65
  <View
80
66
  style={
81
- isLocal ? style.chatBubbleLocalView : style.chatBubbleRemoteView
67
+ isLocal
68
+ ? [style.chatBubbleLocal, {backgroundColor: primaryColor}]
69
+ : style.chatBubble
82
70
  }>
83
- <View
84
- style={
85
- isLocal
86
- ? style.chatBubbleLocalViewLayer2
87
- : style.chatBubbleRemoteViewLayer2
88
- }>
89
- <Hyperlink
90
- onPress={handleUrl}
91
- linkStyle={{
92
- color: $config.FONT_COLOR,
93
- textDecorationLine: 'underline',
94
- }}>
95
- <Text style={style.messageStyle} selectable={true}>
96
- {message}
97
- </Text>
98
- </Hyperlink>
99
- {/* <Spacer size={5} /> */}
100
- <Text style={style.timestampStyle}>{time}</Text>
101
- </View>
71
+ <Hyperlink
72
+ onPress={handleUrl}
73
+ linkStyle={{
74
+ color: !isLocal
75
+ ? $config.PRIMARY_FONT_COLOR
76
+ : $config.SECONDARY_FONT_COLOR,
77
+ textDecorationLine: 'underline',
78
+ }}>
79
+ <Text
80
+ style={isLocal ? style.whiteText : style.blackText}
81
+ selectable={true}>
82
+ {message}
83
+ </Text>
84
+ </Hyperlink>
102
85
  </View>
103
- </>
86
+ </View>
104
87
  );
105
88
  };
106
89
 
107
90
  const style = StyleSheet.create({
108
- remoteUsernameStyle: {
109
- fontFamily: ThemeConfig.FontFamily.sansPro,
110
- fontWeight: '600',
111
- fontSize: ThemeConfig.FontSize.small,
112
- textAlign: 'left',
113
- color: $config.FONT_COLOR + ThemeConfig.EmphasisPlus.medium,
114
- alignSelf: 'flex-start',
115
- marginTop: 20,
116
- marginBottom: 8,
117
- marginHorizontal: 20,
91
+ full: {
92
+ flex: 1,
93
+ },
94
+ chatSenderViewLocal: {
95
+ // flex: 2,
96
+ marginVertical: 2,
97
+ flexDirection: 'row',
98
+ marginRight: 15,
99
+ // marginLeft: 30,
100
+ justifyContent: 'flex-end',
118
101
  },
119
- localUsernameStyle: {
120
- fontFamily: ThemeConfig.FontFamily.sansPro,
121
- fontWeight: '600',
122
- fontSize: ThemeConfig.FontSize.small,
102
+ chatSenderView: {
103
+ // flex: 2,
104
+ marginVertical: 2,
105
+ flexDirection: 'row',
106
+ marginRight: 30,
107
+ marginLeft: 15,
108
+ },
109
+ timestampText: {
110
+ color: $config.PRIMARY_FONT_COLOR + '60',
111
+ fontWeight: '500',
112
+ fontSize: 12,
113
+ flex: 1,
123
114
  textAlign: 'left',
124
- color: $config.FONT_COLOR + ThemeConfig.EmphasisPlus.medium,
125
- alignSelf: 'flex-end',
126
- marginTop: 20,
127
- marginBottom: 8,
128
- marginHorizontal: 20,
129
115
  },
130
- timestampStyle: {
131
- // position: 'absolute',
132
- // bottom: 0,
133
- // right: 12,
134
- fontFamily: ThemeConfig.FontFamily.sansPro,
135
- fontWeight: '400',
136
- fontSize: ThemeConfig.FontSize.tiny,
116
+ timestampTextLocal: {
117
+ color: $config.PRIMARY_FONT_COLOR + '60',
118
+ fontWeight: '500',
119
+ fontSize: 12,
120
+ flex: 1,
137
121
  textAlign: 'right',
138
- color: $config.FONT_COLOR + ThemeConfig.EmphasisPlus.disabled,
139
- marginTop: 4,
140
- marginBottom: 6,
141
122
  },
142
- chatBubbleRemoteView: {
143
- backgroundColor: $config.CARD_LAYER_2_COLOR,
144
- minWidth: '30%',
123
+ chatBubble: {
124
+ backgroundColor: $config.PRIMARY_FONT_COLOR + '20',
125
+ flex: 1,
126
+ // width: 'max-content',
145
127
  maxWidth: '80%',
146
128
  alignSelf: 'flex-start',
147
- marginVertical: 2,
148
- marginHorizontal: 20,
149
- borderBottomLeftRadius: 12,
150
- borderBottomRightRadius: 12,
151
- borderTopLeftRadius: 0,
152
- borderTopRightRadius: 12,
153
- },
154
- chatBubbleRemoteViewLayer2: {
155
- backgroundColor: 'transparent',
156
- // width: '100%',
157
- // height: '100%',
158
- paddingVertical: 8,
159
- paddingHorizontal: 12,
160
- borderBottomLeftRadius: 12,
161
- borderBottomRightRadius: 12,
162
- borderTopLeftRadius: 12,
163
- borderTopRightRadius: 0,
129
+ display: 'flex',
130
+ marginVertical: 5,
131
+ padding: 8,
132
+ marginRight: 30,
133
+ marginLeft: 15,
134
+ borderRadius: 10,
164
135
  },
165
- chatBubbleLocalViewLayer2: {
166
- //width: '100%',
167
- //height: '100%',
168
- paddingVertical: 8,
169
- paddingHorizontal: 12,
170
- borderBottomLeftRadius: 12,
171
- borderBottomRightRadius: 12,
172
- borderTopLeftRadius: 12,
173
- borderTopRightRadius: 0,
174
- backgroundColor:
175
- $config.PRIMARY_ACTION_BRAND_COLOR + hexadecimalTransparency['10%'],
176
- },
177
- chatBubbleLocalView: {
178
- backgroundColor:
179
- $config.CARD_LAYER_5_COLOR + hexadecimalTransparency['20%'],
180
- minWidth: '30%',
136
+ chatBubbleLocal: {
137
+ backgroundColor: $config.PRIMARY_COLOR,
181
138
  maxWidth: '80%',
139
+ flex: 1,
140
+ display: 'flex',
182
141
  alignSelf: 'flex-end',
183
- marginVertical: 2,
184
- marginHorizontal: 20,
185
- borderBottomLeftRadius: 12,
186
- borderBottomRightRadius: 12,
187
- borderTopLeftRadius: 12,
188
- borderTopRightRadius: 0,
142
+ marginVertical: 5,
143
+ padding: 8,
144
+ marginRight: 15,
145
+ marginLeft: 30,
146
+ borderRadius: 10,
147
+ },
148
+ whiteText: {
149
+ color: $config.SECONDARY_FONT_COLOR,
150
+ fontWeight: '500',
189
151
  },
190
- messageStyle: {
191
- fontFamily: ThemeConfig.FontFamily.sansPro,
192
- fontWeight: '400',
193
- fontSize: ThemeConfig.FontSize.small,
194
- lineHeight: ThemeConfig.FontSize.small * 1.4,
195
- color: $config.FONT_COLOR,
152
+ blackText: {
153
+ color: $config.PRIMARY_FONT_COLOR,
154
+ opacity: 1,
155
+ fontWeight: '500',
196
156
  },
197
157
  });
198
158
 
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useCallback, useEffect, useRef, useState} from 'react';
12
+ import React, {useRef} from 'react';
13
13
  import {
14
14
  View,
15
15
  ScrollView,
@@ -22,19 +22,15 @@ import {
22
22
  import {RFValue} from 'react-native-responsive-fontsize';
23
23
  import ChatBubble from './ChatBubble';
24
24
  import {ChatBubbleProps} from '../components/ChatContext';
25
- import {RenderInterface, useLocalUid} from '../../agora-rn-uikit';
25
+ import {useLocalUid} from '../../agora-rn-uikit';
26
+ import {ImageIcon} from '../../agora-rn-uikit';
26
27
  import TextWithTooltip from './TextWithTooltip';
27
28
  import {useCustomization} from 'customization-implementation';
28
29
  import {isValidReactComponent, isWebInternal} from '../utils/common';
29
30
  import {useString} from '../utils/useString';
30
31
  import {useChatUIControl} from '../components/chat-ui/useChatUIControl';
31
- import {useRender, useRtc} from 'customization-api';
32
+ import {useRender} from 'customization-api';
32
33
  import {useChatMessages} from '../components/chat-messages/useChatMessages';
33
- import hexadecimalTransparency from '../utils/hexadecimalTransparency';
34
- import ThemeConfig from '../theme';
35
- import UserAvatar from '../atoms/UserAvatar';
36
- import Spacer from '../atoms/Spacer';
37
- import {useChatNotification} from '../components/chat-notification/useChatNotification';
38
34
 
39
35
  /**
40
36
  * Chat container is the component which renders all the chat messages
@@ -44,65 +40,20 @@ import {useChatNotification} from '../components/chat-notification/useChatNotifi
44
40
  const ChatContainer = (props?: {
45
41
  chatBubble?: React.ComponentType<ChatBubbleProps>;
46
42
  }) => {
47
- const [scrollToEnd, setScrollToEnd] = useState(false);
48
- const {dispatch} = useRtc();
49
- const [grpUnreadCount, setGrpUnreadCount] = useState(0);
50
- const [privateUnreadCount, setPrivateUnreadCount] = useState(0);
51
43
  const {renderList} = useRender();
52
44
  const {messageStore, privateMessageStore} = useChatMessages();
53
- const messageStoreLengthRef = useRef(messageStore.length);
54
45
  const {height, width} = useWindowDimensions();
55
46
  const {
56
- groupActive,
57
47
  privateActive,
58
48
  selectedChatUserId: selectedUserID,
59
49
  setPrivateActive,
60
- inputActive,
61
50
  } = useChatUIControl();
62
- const privateMessageStoreRef = useRef(
63
- privateMessageStore[selectedUserID]?.length,
64
- );
65
- const {
66
- setUnreadGroupMessageCount,
67
- unreadGroupMessageCount,
68
- unreadIndividualMessageCount,
69
- setUnreadIndividualMessageCount,
70
- } = useChatNotification();
71
51
  const localUid = useLocalUid();
72
52
  //commented for v1 release
73
53
  //const remoteUserDefaultLabel = useString('remoteUserDefaultLabel')();
74
54
  const remoteUserDefaultLabel = 'User';
75
55
  const scrollViewRef = useRef<ScrollView>(null);
76
56
 
77
- useEffect(() => {
78
- if (groupActive) {
79
- setGrpUnreadCount(unreadGroupMessageCount);
80
- setUnreadGroupMessageCount(0);
81
- }
82
- }, [groupActive]);
83
-
84
- useEffect(() => {
85
- if (selectedUserID) {
86
- setPrivateUnreadCount(unreadIndividualMessageCount[selectedUserID]);
87
- setUnreadIndividualMessageCount((prevState) => {
88
- return {
89
- ...prevState,
90
- [selectedUserID]: 0,
91
- };
92
- });
93
- //Once message is seen, reset lastMessageTimeStamp.
94
- //so whoever has unread count will show in the top of participant list
95
- updateRenderListState(selectedUserID, {lastMessageTimeStamp: 0});
96
- }
97
- }, [selectedUserID]);
98
-
99
- const updateRenderListState = (
100
- uid: number,
101
- data: Partial<RenderInterface>,
102
- ) => {
103
- dispatch({type: 'UpdateRenderList', value: [uid, data]});
104
- };
105
-
106
57
  const {ChatBubbleComponent} = useCustomization((data) => {
107
58
  let components: {
108
59
  ChatBubbleComponent: React.ComponentType<ChatBubbleProps>;
@@ -137,150 +88,66 @@ const ChatContainer = (props?: {
137
88
  //commented for v1 release
138
89
  //const userOfflineLabel = useString('userOfflineLabel')();
139
90
  const userOfflineLabel = 'User is offline';
140
-
141
- //if we don't have unread count then enable scroll to end
142
- useEffect(() => {
143
- if (!privateActive && !grpUnreadCount) {
144
- setScrollToEnd(true);
145
- } else if (privateActive && !privateUnreadCount) {
146
- setScrollToEnd(true);
147
- }
148
- }, [privateActive, grpUnreadCount, privateUnreadCount]);
149
-
150
- const onContentSizeChange = useCallback(() => {
151
- if (scrollToEnd) {
152
- scrollViewRef.current?.scrollToEnd({animated: false});
153
- }
154
- }, [scrollToEnd]);
155
-
156
- //if we have unread container then scrollTo that container and scrollToEnd will be disabled since its has unread count
157
- const unreadViewOnLayout = ({
158
- nativeEvent: {
159
- layout: {y},
160
- },
161
- }) => {
162
- //scroll to unread message label
163
- if (y) {
164
- scrollViewRef.current?.scrollTo({y, animated: false});
165
- }
166
- };
167
-
168
91
  return (
169
92
  <View style={style.containerView}>
170
- {privateActive && selectedUserID ? (
171
- <>
172
- <View style={style.participantContainer}>
173
- <View style={style.bgContainerStyle}>
174
- <UserAvatar
175
- name={renderList[selectedUserID].name}
176
- containerStyle={style.userAvatarContainer}
177
- textStyle={style.userAvatarText}
178
- />
179
- </View>
180
- <View style={style.participantTextContainer}>
181
- <Text style={[style.participantText]} numberOfLines={1}>
182
- {renderList[selectedUserID].name}
183
- </Text>
184
- </View>
93
+ {privateActive && (
94
+ <TouchableOpacity
95
+ style={style.row}
96
+ onPress={() => setPrivateActive(false)}>
97
+ <View style={style.backButton}>
98
+ <ImageIcon style={[style.backIcon]} name={'backBtn'} />
185
99
  </View>
186
- <Spacer size={10} />
187
- </>
188
- ) : (
189
- <></>
100
+ <View style={{flex: 1}}>
101
+ <TextWithTooltip
102
+ style={[
103
+ style.name,
104
+ {
105
+ flexShrink: 1,
106
+ fontSize: RFValue(16, height > width ? height : width),
107
+ },
108
+ ]}
109
+ value={
110
+ renderList[selectedUserID]
111
+ ? renderList[selectedUserID]?.name + ' '
112
+ : remoteUserDefaultLabel + ' '
113
+ }
114
+ />
115
+ </View>
116
+ </TouchableOpacity>
190
117
  )}
191
- <ScrollView ref={scrollViewRef} onContentSizeChange={onContentSizeChange}>
118
+ <ScrollView
119
+ ref={scrollViewRef}
120
+ onContentSizeChange={() => {
121
+ scrollViewRef.current?.scrollToEnd({animated: true});
122
+ }}>
192
123
  {!privateActive ? (
193
- <>
194
- <View style={style.defaultMessageContainer}>
195
- <Text style={style.defaultMessageText}>
196
- {!messageStore?.length
197
- ? `Welcome to Chat! \nAll messages are deleted when call ends.`
198
- : 'All messages are deleted when call ends.'}
199
- </Text>
200
- </View>
201
- {messageStore.map((message: any, index) => (
202
- <>
203
- {messageStoreLengthRef.current === messageStore.length &&
204
- grpUnreadCount &&
205
- messageStore.length - grpUnreadCount === index ? (
206
- <View
207
- style={style.unreadMessageContainer}
208
- onLayout={unreadViewOnLayout}>
209
- <Text style={style.unreadMessageText}>
210
- {grpUnreadCount} Unread Message
211
- </Text>
212
- </View>
213
- ) : (
214
- <></>
215
- )}
216
- <ChatBubbleComponent
217
- isLocal={localUid === message.uid}
218
- isSameUser={
219
- index !== 0 && messageStore[index - 1].uid === message.uid
220
- ? true
221
- : false
222
- }
223
- message={message.msg}
224
- createdTimestamp={message.createdTimestamp}
225
- updatedTimestamp={message.updatedTimestamp}
226
- uid={message.uid}
227
- key={message.ts}
228
- msgId={message.msgId}
229
- isDeleted={message.isDeleted}
230
- />
231
- {messageStore?.length - 1 === index ? (
232
- <Spacer size={10} />
233
- ) : (
234
- <></>
235
- )}
236
- </>
237
- ))}
238
- </>
124
+ messageStore.map((message: any) => (
125
+ <>
126
+ <ChatBubbleComponent
127
+ isLocal={localUid === message.uid}
128
+ message={message.msg}
129
+ createdTimestamp={message.createdTimestamp}
130
+ updatedTimestamp={message.updatedTimestamp}
131
+ uid={message.uid}
132
+ key={message.ts}
133
+ msgId={message.msgId}
134
+ isDeleted={message.isDeleted}
135
+ />
136
+ </>
137
+ ))
239
138
  ) : privateMessageStore[selectedUserID] ? (
240
- <>
241
- {privateMessageStore[selectedUserID].map((message: any, index) => (
242
- <>
243
- {privateMessageStoreRef.current ===
244
- privateMessageStore[selectedUserID]?.length &&
245
- privateUnreadCount &&
246
- privateMessageStore[selectedUserID]?.length -
247
- privateUnreadCount ===
248
- index ? (
249
- <View
250
- style={style.unreadMessageContainer}
251
- onLayout={unreadViewOnLayout}>
252
- <Text style={style.unreadMessageText}>
253
- {privateUnreadCount} Unread Message
254
- </Text>
255
- </View>
256
- ) : (
257
- <></>
258
- )}
259
- <ChatBubbleComponent
260
- isLocal={localUid === message.uid}
261
- isSameUser={
262
- index !== 0 &&
263
- privateMessageStore[selectedUserID][index - 1].uid ===
264
- message.uid
265
- ? true
266
- : false
267
- }
268
- message={message.msg}
269
- createdTimestamp={message.createdTimestamp}
270
- updatedTimestamp={message.updatedTimestamp}
271
- uid={message.uid}
272
- key={message.ts}
273
- msgId={message.msgId}
274
- isDeleted={message.isDeleted}
275
- />
276
- {privateMessageStore[selectedUserID]?.length - 1 === index ? (
277
- <Spacer size={10} />
278
- ) : (
279
- <></>
280
- )}
281
- </>
282
- ))}
283
- </>
139
+ privateMessageStore[selectedUserID].map((message: any) => (
140
+ <ChatBubbleComponent
141
+ isLocal={localUid === message.uid}
142
+ message={message.msg}
143
+ createdTimestamp={message.createdTimestamp}
144
+ updatedTimestamp={message.updatedTimestamp}
145
+ uid={message.uid}
146
+ key={message.ts}
147
+ msgId={message.msgId}
148
+ isDeleted={message.isDeleted}
149
+ />
150
+ ))
284
151
  ) : (
285
152
  <></>
286
153
  )}
@@ -295,82 +162,42 @@ const ChatContainer = (props?: {
295
162
  };
296
163
 
297
164
  const style = StyleSheet.create({
298
- unreadMessageContainer: {
299
- backgroundColor: $config.CARD_LAYER_2_COLOR,
300
- padding: 8,
301
- marginVertical: 20,
302
- },
303
- unreadMessageText: {
304
- fontFamily: ThemeConfig.FontFamily.sansPro,
305
- fontWeight: '600',
306
- fontSize: 12,
307
- color: $config.FONT_COLOR,
308
- textAlign: 'center',
309
- },
310
- defaultMessageContainer: {
311
- backgroundColor: $config.CARD_LAYER_2_COLOR,
312
- borderRadius: 8,
313
- padding: 12,
314
- marginTop: 20,
315
- marginHorizontal: 20,
316
- marginBottom: 0,
317
- },
318
- defaultMessageText: {
319
- fontFamily: ThemeConfig.FontFamily.sansPro,
320
- fontWeight: '400',
321
- fontSize: 12,
322
- color: $config.FONT_COLOR + hexadecimalTransparency['40%'],
323
- },
324
- bgContainerStyle: {
325
- backgroundColor: $config.VIDEO_AUDIO_TILE_AVATAR_COLOR,
326
- width: 36,
327
- height: 36,
328
- borderRadius: 18,
329
- marginRight: 8,
330
- marginLeft: 20,
331
- marginVertical: 8,
332
- },
333
- userAvatarContainer: {
334
- backgroundColor:
335
- $config.PRIMARY_ACTION_BRAND_COLOR + hexadecimalTransparency['10%'],
336
- width: 36,
337
- height: 36,
338
- borderRadius: 18,
339
- },
340
- userAvatarText: {
341
- fontSize: ThemeConfig.FontSize.tiny,
342
- lineHeight: 12,
343
- fontWeight: '400',
344
- color: $config.CARD_LAYER_1_COLOR,
345
- },
346
- participantContainer: {
165
+ containerView: {flex: 8},
166
+ row: {
347
167
  flexDirection: 'row',
348
- overflow: 'hidden',
349
- justifyContent: 'space-between',
350
- backgroundColor:
351
- $config.HARD_CODED_BLACK_COLOR + hexadecimalTransparency['10%'],
168
+ marginTop: 2,
169
+ alignItems: 'baseline',
170
+ paddingVertical: 10,
171
+ ...Platform.select({
172
+ android: {
173
+ height: 40,
174
+ },
175
+ ios: {
176
+ height: 40,
177
+ },
178
+ }),
352
179
  },
353
- participantTextContainer: {
354
- flex: 1,
355
- alignSelf: 'center',
356
- marginRight: 8,
180
+ backButton: {
181
+ marginHorizontal: 10,
182
+ justifyContent: 'center',
183
+ alignSelf: 'flex-end',
357
184
  },
358
- participantText: {
359
- // flex: 1,
360
- fontFamily: ThemeConfig.FontFamily.sansPro,
361
- fontWeight: '600',
362
- fontSize: 14,
363
- color: $config.FONT_COLOR,
185
+ name: {
186
+ fontWeight: isWebInternal() ? '500' : '700',
187
+ color: $config.PRIMARY_FONT_COLOR,
364
188
  textAlign: 'left',
365
- flexShrink: 1,
189
+ marginRight: 10,
190
+ },
191
+ backIcon: {
192
+ width: 20,
193
+ height: 20,
366
194
  },
367
- containerView: {flex: 8},
368
195
  infoTextView: {
369
196
  marginVertical: 2,
370
197
  flexDirection: 'row',
371
198
  },
372
199
  infoText: {
373
- color: $config.FONT_COLOR + hexadecimalTransparency['60%'],
200
+ color: $config.PRIMARY_FONT_COLOR + '60',
374
201
  fontWeight: '500',
375
202
  fontSize: 14,
376
203
  flex: 1,