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.
- package/Readme.md +0 -6
- package/package.json +2 -2
- package/template/_package-lock.json +4979 -7086
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +0 -4
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +0 -18
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +0 -2
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +26 -30
- package/template/agora-rn-uikit/src/Controls/Icons.ts +83 -30
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +0 -2
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/index.ts +0 -3
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +1 -89
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +2 -39
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +5 -15
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +9 -15
- package/template/agora-rn-uikit/src/index.ts +1 -3
- package/template/android/app/build.gradle +0 -1
- package/template/android/app/src/main/AndroidManifest.xml +15 -22
- package/template/android/app/src/main/java/com/helloworld/MainActivity.java +0 -50
- package/template/android/build.gradle +3 -3
- package/template/babel.config.js +0 -1
- package/template/bridge/rtc/webNg/RtcEngine.ts +17 -110
- package/template/customization-api/sub-components.ts +1 -1
- package/template/customization-api/typeDefinition.ts +1 -2
- package/template/electron/index.html +27 -27
- package/template/electron/renderer/index.js +0 -1
- package/template/global.d.ts +4 -26
- package/template/index.js +0 -4
- package/template/index.rsdk.tsx +0 -1
- package/template/index.web.js +1 -7
- package/template/index.wsdk.tsx +1 -1
- package/template/ios/HelloWorld/Info.plist +1 -14
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +0 -17
- package/template/metro.config.js +1 -1
- package/template/package.json +7 -21
- package/template/react-native-toast-message/index.d.ts +43 -43
- package/template/react-native-toast-message/src/colors/index.js +2 -3
- package/template/react-native-toast-message/src/components/base/index.js +59 -46
- package/template/react-native-toast-message/src/components/base/styles.js +32 -16
- package/template/react-native-toast-message/src/components/error.js +2 -3
- package/template/react-native-toast-message/src/components/info.js +2 -3
- package/template/react-native-toast-message/src/components/success.js +2 -3
- package/template/react-native-toast-message/src/index.js +31 -122
- package/template/react-native-toast-message/src/index.sdk.tsx +35 -125
- package/template/react-native-toast-message/src/styles.js +4 -3
- package/template/react-native-toast-message/src/styles.sdk.ts +4 -3
- package/template/src/App.tsx +0 -6
- package/template/src/AppWrapper.tsx +28 -63
- package/template/src/assets/icons.ts +102 -0
- package/template/src/atoms/HorizontalRule.tsx +1 -3
- package/template/src/atoms/PrimaryButton.tsx +26 -51
- package/template/src/atoms/SecondaryButton.tsx +5 -8
- package/template/src/atoms/TextInput.tsx +14 -12
- package/template/src/components/Chat.tsx +214 -86
- package/template/src/components/ChatContext.ts +1 -8
- package/template/src/components/ColorConfigure.tsx +1 -1
- package/template/src/components/ColorContext.ts +1 -1
- package/template/src/components/{Controls1.native.tsx → Controls.native.tsx} +4 -6
- package/template/src/components/Controls.tsx +42 -342
- package/template/src/components/DeviceConfigure.tsx +101 -461
- package/template/src/components/DeviceContext.tsx +4 -8
- package/template/src/components/EventsConfigure.tsx +7 -144
- package/template/src/components/GraphQLProvider.tsx +1 -1
- package/template/src/components/GridVideo.tsx +44 -59
- package/template/src/components/HostControlView.tsx +35 -114
- package/template/src/components/Navbar.tsx +398 -216
- package/template/src/components/NetworkQualityContext.tsx +20 -20
- package/template/src/components/ParticipantsView.tsx +154 -177
- package/template/src/components/PinnedVideo.tsx +120 -207
- package/template/src/components/Precall.native.tsx +119 -358
- package/template/src/components/Precall.tsx +135 -269
- package/template/src/components/RTMConfigure.tsx +4 -27
- package/template/src/components/Router.electron.ts +0 -1
- package/template/src/components/Router.native.ts +0 -1
- package/template/src/components/Router.sdk.ts +0 -1
- package/template/src/components/Router.ts +0 -1
- package/template/src/components/Settings.tsx +95 -26
- package/template/src/components/SettingsView.tsx +56 -251
- package/template/src/components/Share.tsx +273 -302
- package/template/src/components/StorageContext.tsx +3 -30
- package/template/src/components/chat-messages/useChatMessages.tsx +23 -69
- package/template/src/components/chat-ui/useChatUIControl.tsx +0 -7
- package/template/src/components/common/Error.tsx +6 -20
- package/template/src/components/common/Logo.tsx +15 -16
- package/template/src/components/contexts/LiveStreamDataContext.tsx +5 -10
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +7 -37
- package/template/src/components/livestream/LiveStreamContext.tsx +36 -270
- package/template/src/components/livestream/Types.ts +14 -39
- package/template/src/components/livestream/index.ts +0 -1
- package/template/src/components/livestream/views/LiveStreamControls.tsx +4 -12
- package/template/src/components/participants/AllAudienceParticipants.tsx +30 -101
- package/template/src/components/participants/AllHostParticipants.tsx +34 -103
- package/template/src/components/participants/MeParticipant.tsx +38 -0
- package/template/src/components/participants/ParticipantName.tsx +7 -13
- package/template/src/components/participants/ParticipantSectionTitle.tsx +10 -35
- package/template/src/components/participants/RemoteParticipants.tsx +71 -0
- package/template/src/components/participants/ScreenshareParticipants.tsx +12 -144
- package/template/src/components/precall/{LocalMute1.native.tsx → LocalMute.native.tsx} +5 -21
- package/template/src/components/precall/LocalMute.tsx +14 -84
- package/template/src/components/precall/VideoPreview.native.tsx +3 -48
- package/template/src/components/precall/VideoPreview.tsx +7 -163
- package/template/src/components/precall/joinCallBtn.tsx +2 -15
- package/template/src/components/precall/meetingTitle.tsx +12 -15
- package/template/src/components/precall/selectDevice.tsx +21 -1
- package/template/src/components/precall/textInput.tsx +4 -32
- package/template/src/components/precall/usePreCall.tsx +0 -16
- package/template/src/components/styles.ts +21 -42
- package/template/src/components/useShareLink.tsx +14 -12
- package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
- package/template/src/pages/Authenticate.tsx +15 -5
- package/template/src/pages/Create.tsx +165 -293
- package/template/src/pages/Join.tsx +67 -93
- package/template/src/pages/VideoCall.tsx +64 -89
- package/template/src/pages/video-call/DefaultLayouts.ts +4 -4
- package/template/src/pages/video-call/NameWithMicIcon.tsx +44 -120
- package/template/src/pages/video-call/RenderComponent.tsx +2 -3
- package/template/src/pages/video-call/VideoCallScreen.tsx +9 -45
- package/template/src/pages/video-call/VideoComponent.tsx +3 -18
- package/template/src/pages/video-call/VideoRenderer.tsx +60 -218
- package/template/src/rtm-events/constants.ts +0 -2
- package/template/src/subComponents/ChatBubble.tsx +83 -123
- package/template/src/subComponents/ChatContainer.tsx +84 -257
- package/template/src/subComponents/ChatInput.tsx +46 -61
- package/template/src/subComponents/Checkbox.native.tsx +5 -16
- package/template/src/subComponents/Checkbox.tsx +2 -2
- package/template/src/subComponents/CopyJoinInfo.tsx +58 -36
- package/template/src/subComponents/FallbackLogo.tsx +40 -122
- package/template/src/subComponents/LanguageSelector.tsx +1 -1
- package/template/src/subComponents/{LayoutIconDropdown1.native.tsx → LayoutIconDropdown.native.tsx} +18 -4
- package/template/src/subComponents/LayoutIconDropdown.tsx +134 -131
- package/template/src/subComponents/LocalAudioMute.tsx +27 -119
- package/template/src/subComponents/LocalEndCall.tsx +33 -71
- package/template/src/subComponents/LocalSwitchCamera.tsx +30 -17
- package/template/src/subComponents/LocalVideoMute.tsx +27 -117
- package/template/src/subComponents/Logo.tsx +4 -3
- package/template/src/subComponents/LogoutButton.tsx +1 -1
- package/template/src/subComponents/NetworkQualityPill.tsx +63 -60
- package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
- package/template/src/subComponents/Recording.tsx +29 -28
- package/template/src/subComponents/RemoteAudioMute.tsx +29 -83
- package/template/src/subComponents/RemoteEndCall.tsx +5 -8
- package/template/src/subComponents/RemoteVideoMute.tsx +21 -74
- package/template/src/subComponents/ScreenShareNotice.tsx +8 -83
- package/template/src/subComponents/SelectDevice.tsx +61 -404
- package/template/src/subComponents/SelectOAuth.tsx +8 -9
- package/template/src/subComponents/ToastConfig.tsx +10 -150
- package/template/src/subComponents/chat/ChatParticipants.tsx +78 -187
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +32 -95
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +33 -29
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +6 -6
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +11 -24
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +10 -17
- package/template/src/subComponents/recording/useRecording.tsx +27 -79
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +70 -52
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +2 -11
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +4 -26
- package/template/src/utils/common.tsx +1 -155
- package/template/src/utils/index.tsx +0 -19
- package/template/src/utils/isMobileOrTablet.ts +2 -7
- package/template/src/utils/useButtonTemplate.tsx +0 -1
- package/template/src/utils/useMuteToggleLocal.ts +3 -54
- package/template/web/index.html +0 -5
- package/template/webpack.commons.js +8 -13
- package/template/webpack.web.config.js +0 -1
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +0 -11
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +0 -24
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +0 -11
- package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
- package/template/android/app/src/main/res/values/colors.xml +0 -7
- package/template/react-native-toast-message/src/components/checkbox.js +0 -178
- package/template/react-native.config.js +0 -7
- package/template/src/assets/font-styles.css +0 -329
- package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/src/assets/fonts/icomoon.ttf +0 -0
- package/template/src/assets/permission.png +0 -0
- package/template/src/assets/selection.json +0 -1
- package/template/src/atoms/ActionMenu.tsx +0 -236
- package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +0 -71
- package/template/src/atoms/AnimatedActiveSpeaker.tsx +0 -84
- package/template/src/atoms/AnimatedRings.native.tsx +0 -68
- package/template/src/atoms/AnimatedRings.tsx +0 -70
- package/template/src/atoms/Card.tsx +0 -61
- package/template/src/atoms/CircularProgress.native.tsx +0 -121
- package/template/src/atoms/CircularProgress.tsx +0 -102
- package/template/src/atoms/CustomIcon.tsx +0 -88
- package/template/src/atoms/CustomSwitch.tsx +0 -287
- package/template/src/atoms/Dropdown.tsx +0 -306
- package/template/src/atoms/IconButton.tsx +0 -162
- package/template/src/atoms/ImageIcon.tsx +0 -98
- package/template/src/atoms/InfoBubble.tsx +0 -291
- package/template/src/atoms/Input.tsx +0 -87
- package/template/src/atoms/InviteInfo.tsx +0 -166
- package/template/src/atoms/LinkButton.tsx +0 -28
- package/template/src/atoms/OutlineButton.tsx +0 -61
- package/template/src/atoms/ParticipantsCount.tsx +0 -73
- package/template/src/atoms/Popup.tsx +0 -147
- package/template/src/atoms/RecordingInfo.tsx +0 -49
- package/template/src/atoms/Spacer.tsx +0 -22
- package/template/src/atoms/TertiaryButton.tsx +0 -78
- package/template/src/atoms/Toggle.tsx +0 -47
- package/template/src/atoms/Tooltip.native.tsx +0 -65
- package/template/src/atoms/Tooltip.tsx +0 -94
- package/template/src/atoms/UserAvatar.tsx +0 -60
- package/template/src/components/CommonStyles.ts +0 -44
- package/template/src/components/ToastComponent.tsx +0 -8
- package/template/src/components/participants/Participant.tsx +0 -302
- package/template/src/components/participants/UserActionMenuOptions.tsx +0 -398
- package/template/src/components/popups/InvitePopup.tsx +0 -115
- package/template/src/components/popups/StopRecordingPopup.tsx +0 -114
- package/template/src/components/precall/PermissionHelper.native.tsx +0 -5
- package/template/src/components/precall/PermissionHelper.tsx +0 -126
- package/template/src/components/precall/PreCallSettings.tsx +0 -52
- package/template/src/components/useToast.tsx +0 -41
- package/template/src/components/useVideoCall.tsx +0 -65
- package/template/src/pages/Endcall.tsx +0 -148
- package/template/src/pages/video-call/ActionSheet.native.tsx +0 -215
- package/template/src/pages/video-call/ActionSheet.tsx +0 -226
- package/template/src/pages/video-call/ActionSheetContent.tsx +0 -479
- package/template/src/pages/video-call/ActionSheetHandle.tsx +0 -38
- package/template/src/pages/video-call/ActionSheetStyles.css +0 -138
- package/template/src/pages/video-call/SidePanelHeader.tsx +0 -190
- package/template/src/pages/video-call/VideoCallMobileView.tsx +0 -139
- package/template/src/pages/video-call/VideoCallScreen.native.tsx +0 -37
- package/template/src/subComponents/ChatInput.ios.tsx +0 -237
- package/template/src/subComponents/EndcallPopup.tsx +0 -107
- package/template/src/subComponents/LayoutIconButton.tsx +0 -201
- package/template/src/subComponents/RemoteMutePopup.tsx +0 -193
- package/template/src/subComponents/RemoveMeetingPopup.tsx +0 -109
- package/template/src/subComponents/RemoveScreensharePopup.tsx +0 -109
- package/template/src/subComponents/SelectDeviceSettings.backup.tsx +0 -207
- package/template/src/subComponents/SidePanelHeader.tsx +0 -112
- package/template/src/theme/index.ts +0 -46
- package/template/src/utils/PlatformWrapper.tsx +0 -21
- package/template/src/utils/hexadecimalTransparency.ts +0 -108
- package/template/src/utils/pendingStateUpdateHelper.ts +0 -19
- package/template/src/utils/useFocus.tsx +0 -46
- package/template/src/utils/useIsActiveSpeaker.ts +0 -27
- package/template/src/utils/useIsHandRaised.ts +0 -13
- package/template/src/utils/useRemoteEndScreenshare.ts +0 -26
- 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 {
|
|
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 =
|
|
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
|
-
{
|
|
66
|
-
<Text
|
|
67
|
-
|
|
68
|
-
|
|
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
|
|
67
|
+
isLocal
|
|
68
|
+
? [style.chatBubbleLocal, {backgroundColor: primaryColor}]
|
|
69
|
+
: style.chatBubble
|
|
82
70
|
}>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
143
|
-
backgroundColor: $config.
|
|
144
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
166
|
-
|
|
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:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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, {
|
|
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 {
|
|
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
|
|
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 &&
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
<
|
|
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
|
|
118
|
+
<ScrollView
|
|
119
|
+
ref={scrollViewRef}
|
|
120
|
+
onContentSizeChange={() => {
|
|
121
|
+
scrollViewRef.current?.scrollToEnd({animated: true});
|
|
122
|
+
}}>
|
|
192
123
|
{!privateActive ? (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
<
|
|
196
|
-
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
-
|
|
299
|
-
|
|
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
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
180
|
+
backButton: {
|
|
181
|
+
marginHorizontal: 10,
|
|
182
|
+
justifyContent: 'center',
|
|
183
|
+
alignSelf: 'flex-end',
|
|
357
184
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
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
|
-
|
|
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.
|
|
200
|
+
color: $config.PRIMARY_FONT_COLOR + '60',
|
|
374
201
|
fontWeight: '500',
|
|
375
202
|
fontSize: 14,
|
|
376
203
|
flex: 1,
|