@cometchat/chat-uikit-react-native 4.3.8 → 4.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/CometChatAddMembers/CometChatAddMembers.tsx +2 -1
- package/src/CometChatBannedMembers/CometChatBannedMembers.tsx +3 -0
- package/src/CometChatConversations/CometChatConversations.tsx +180 -29
- package/src/CometChatConversations/ConversationsConfiguration.ts +16 -6
- package/src/CometChatDetails/CometChatDetails.tsx +13 -9
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +19 -3
- package/src/CometChatGroupMembers/GroupMemberConfiguration.ts +26 -2
- package/src/CometChatGroupsWithMessages/CometChatGroupsWithMessages.tsx +4 -2
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +12 -3
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +32 -5
- package/src/CometChatMessageList/MessageListConfiguration.ts +14 -2
- package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +1 -0
- package/src/CometChatUsersWithMessages/CometChatUsersWithMessages.tsx +5 -3
- package/src/calls/CallEvents.ts +1 -1
- package/src/calls/CallingExtentionDecorator.tsx +2 -1
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -1
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +1 -1
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +1 -1
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -2
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -0
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -0
- package/src/extensions/Polls/PollsDecorator.tsx +23 -26
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +5 -0
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +1 -1
- package/src/index.ts +10 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +33 -13
- package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -5
- package/src/shared/constants/UIKitConstants.ts +2 -2
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +3 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -4
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +4 -1
- package/src/shared/formatters/CometChatTextFormatter.ts +1 -1
- package/src/shared/framework/DataSource.ts +1 -2
- package/src/shared/framework/DataSourceDecorator.tsx +1 -2
- package/src/shared/framework/MessageDataSource.tsx +28 -6
- package/src/shared/index.ts +11 -3
- package/src/shared/libs/VideoPlayer/Video.js +4 -5
- package/src/shared/modals/CometChatMessageTemplate.ts +15 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +1 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +1 -2
- package/src/shared/modals/InteractiveData/index.ts +1 -0
- package/src/shared/modals/index.ts +3 -2
- package/src/shared/utils/MessageUtils.tsx +1 -0
- package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +1 -1
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +3 -5
- package/src/shared/views/CometChatList/CometChatList.tsx +44 -17
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +3 -5
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
- package/src/shared/views/index.ts +4 -0
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export interface CometChatAddMembersInterface
|
|
|
23
23
|
|
|
24
24
|
export const CometChatAddMembers = (props: CometChatAddMembersInterface) => {
|
|
25
25
|
const userListenerId = 'userlist_' + new Date().getTime();
|
|
26
|
-
const { group, ...newProps } = props;
|
|
26
|
+
const { group, addMembersStyle, ...newProps } = props;
|
|
27
27
|
const userRef = useRef<CometChatUsersActionsInterface>(null);
|
|
28
28
|
const loggedInUser = useRef(null);
|
|
29
29
|
const addMembersToGroup = (res: any) => {
|
|
@@ -93,6 +93,7 @@ export const CometChatAddMembers = (props: CometChatAddMembersInterface) => {
|
|
|
93
93
|
title={localize('ADD_MEMBERS')}
|
|
94
94
|
showBackButton
|
|
95
95
|
selectionMode="multiple"
|
|
96
|
+
usersStyle={addMembersStyle}
|
|
96
97
|
{...newProps}
|
|
97
98
|
/>
|
|
98
99
|
</View>
|
|
@@ -27,6 +27,9 @@ export interface CometChatBannedMembersInterface
|
|
|
27
27
|
bannedMemberStyle?: CometChatListStylesInterface;
|
|
28
28
|
unbanIcon?: ImageType;
|
|
29
29
|
title?: string;
|
|
30
|
+
onSelection?: (list: CometChat.User[]) => void;
|
|
31
|
+
onItemPress?: (user: CometChat.User) => void;
|
|
32
|
+
onItemLongPress?: (user: CometChat.User) => void;
|
|
30
33
|
/**
|
|
31
34
|
*
|
|
32
35
|
*
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
MentionTextStyle,
|
|
15
15
|
CometChatListActionsInterface,
|
|
16
16
|
localize,
|
|
17
|
-
CometChatUIKit
|
|
17
|
+
CometChatUIKit,
|
|
18
|
+
CometChatUiKitConstants
|
|
18
19
|
} from "../shared";
|
|
19
20
|
import { Style } from "./style";
|
|
20
21
|
import {
|
|
@@ -436,13 +437,58 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
436
437
|
|
|
437
438
|
}
|
|
438
439
|
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Check if last message/unread count should be updated
|
|
443
|
+
*
|
|
444
|
+
* @param newMessage message object
|
|
445
|
+
*/
|
|
446
|
+
const shouldUpdateLastMessageAndUnreadCount = (message : CometChat.BaseMessage) => {
|
|
447
|
+
|
|
448
|
+
/****Start: Should Threaded Messages Update Conversation? */
|
|
449
|
+
if(message.getParentMessageId() && !CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnMessageReplies()) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
/****END: Should Threaded Messages Update Conversation? */
|
|
453
|
+
|
|
454
|
+
/****Start: Should Custom Message Update Conversation? */
|
|
455
|
+
if(message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.custom) {
|
|
456
|
+
let customMessage = message as CometChat.CustomMessage;
|
|
457
|
+
if (!customMessage.willUpdateConversation() &&
|
|
458
|
+
!(customMessage.getMetadata() && (customMessage.getMetadata() as any)["incrementUnreadCount"]) &&
|
|
459
|
+
!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCustomMessages()) {
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/****End: Should Custom Message Update Conversation? */
|
|
464
|
+
|
|
465
|
+
/****Start: Should Group Actions sent update conversation? */
|
|
466
|
+
if(message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.action
|
|
467
|
+
&& message.getReceiverType() == CometChatUiKitConstants.ReceiverTypeConstants.group
|
|
468
|
+
) {
|
|
469
|
+
return CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions();
|
|
470
|
+
}
|
|
471
|
+
/****End: Should Group Actions sent update conversation? */
|
|
472
|
+
|
|
473
|
+
/****Start: Should Call Actions sent Update Conversation? */
|
|
474
|
+
if(message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.call
|
|
475
|
+
&& !CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()
|
|
476
|
+
) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
/****End: Should Call Actions sent Update Conversation */
|
|
480
|
+
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
|
|
439
484
|
/**
|
|
440
485
|
* Find conversation from state and udpate its last message object.
|
|
441
486
|
* Also remove from the current location and put it to 1st location.
|
|
442
487
|
*
|
|
443
488
|
* @param newMessage message object
|
|
444
489
|
*/
|
|
445
|
-
const updateLastMessage = (newMessage) => {
|
|
490
|
+
const updateLastMessage = (newMessage: CometChat.BaseMessage) => {
|
|
491
|
+
|
|
446
492
|
CometChat.CometChatHelper.getConversationFromMessage(newMessage)
|
|
447
493
|
.then(conversation => {
|
|
448
494
|
if (newMessage.getCategory() === MessageCategoryConstants.interactive) {
|
|
@@ -510,26 +556,31 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
510
556
|
* callback handler for group Add / Kicked / Banned / Scope Change
|
|
511
557
|
* @param {obj} message
|
|
512
558
|
*/
|
|
513
|
-
const groupHandler = (message, action?: string) => {
|
|
514
|
-
let conversation = conversationListRef.current.getListItem(message['conversationId'])
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
if (action === 'kicked' || action === 'banned')
|
|
559
|
+
const groupHandler = (message, otherDetails: {action?: string, actionOn?: CometChat.User, actionBy?: CometChat.User, group?: CometChat.Group} = {}) => {
|
|
560
|
+
let conversation : CometChat.Conversation = (conversationListRef.current.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
|
|
561
|
+
let {action, actionOn, actionBy, group} = otherDetails;
|
|
562
|
+
if (conversation) {
|
|
563
|
+
if ((["kicked", "banned", "left"].includes(action)) && (actionOn.getUid() == loggedInUser.current.getUid())){
|
|
519
564
|
conversationListRef.current.removeItemFromList(message.conversationId);
|
|
520
|
-
|
|
565
|
+
return;
|
|
566
|
+
} else {
|
|
567
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
conversation.setLastMessage(message);
|
|
521
571
|
conversationListRef.current.updateList(conversation);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
575
|
+
.then(newConversation => {
|
|
576
|
+
const conversation : CometChat.Conversation = (conversationListRef.current.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
|
|
577
|
+
if (conversation) {
|
|
578
|
+
groupHandler(message);
|
|
579
|
+
} else {
|
|
580
|
+
conversationListRef.current.addItemToList(newConversation, 0);
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
533
584
|
}
|
|
534
585
|
|
|
535
586
|
const conversationClicked = (conversation) => {
|
|
@@ -768,6 +819,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
768
819
|
}
|
|
769
820
|
|
|
770
821
|
const updateConversationLastMessage = (message) => {
|
|
822
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
771
825
|
try {
|
|
772
826
|
let conversation: CometChat.Conversation = conversationListRef.current?.getListItem(message.conversationId)
|
|
773
827
|
conversation.lastMessage = message
|
|
@@ -777,6 +831,16 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
777
831
|
}
|
|
778
832
|
}
|
|
779
833
|
|
|
834
|
+
const updateUnreadMessageCount = (conversation: CometChat.Conversation) => {
|
|
835
|
+
const oldConversation: CometChat.Conversation = (conversationListRef.current.getListItem(conversation['conversationId']) as unknown as CometChat.Conversation);
|
|
836
|
+
if (oldConversation == undefined) {
|
|
837
|
+
conversation.setUnreadMessageCount(1);
|
|
838
|
+
return conversation;
|
|
839
|
+
}
|
|
840
|
+
oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
|
|
841
|
+
return oldConversation;
|
|
842
|
+
}
|
|
843
|
+
|
|
780
844
|
React.useEffect(() => {
|
|
781
845
|
CometChat.getLoggedinUser()
|
|
782
846
|
.then(u => { loggedInUser.current = u })
|
|
@@ -802,6 +866,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
802
866
|
onIncomingCallReceived: (call) => {
|
|
803
867
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
804
868
|
.then((conversation) => {
|
|
869
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
873
|
+
conversation.setLastMessage(call);
|
|
805
874
|
conversationListRef.current.updateList(conversation);
|
|
806
875
|
})
|
|
807
876
|
.catch((e) => {
|
|
@@ -811,6 +880,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
811
880
|
onOutgoingCallAccepted: (call) => {
|
|
812
881
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
813
882
|
.then((conversation) => {
|
|
883
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
887
|
+
conversation.setLastMessage(call);
|
|
814
888
|
conversationListRef.current.updateList(conversation);
|
|
815
889
|
})
|
|
816
890
|
.catch((e) => {
|
|
@@ -820,6 +894,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
820
894
|
onOutgoingCallRejected: (call) => {
|
|
821
895
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
822
896
|
.then((conversation) => {
|
|
897
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
901
|
+
conversation.setLastMessage(call);
|
|
823
902
|
conversationListRef.current.updateList(conversation);
|
|
824
903
|
})
|
|
825
904
|
.catch((e) => {
|
|
@@ -829,6 +908,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
829
908
|
onIncomingCallCancelled: (call) => {
|
|
830
909
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
831
910
|
.then((conversation) => {
|
|
911
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
915
|
+
conversation.setLastMessage(call);
|
|
832
916
|
conversationListRef.current.updateList(conversation);
|
|
833
917
|
})
|
|
834
918
|
.catch((e) => {
|
|
@@ -846,31 +930,46 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
846
930
|
message
|
|
847
931
|
);
|
|
848
932
|
},
|
|
849
|
-
onGroupMemberKicked: (
|
|
933
|
+
onGroupMemberKicked: (
|
|
934
|
+
message: CometChat.Action,
|
|
935
|
+
kickedUser: CometChat.User,
|
|
936
|
+
kickedBy: CometChat.User,
|
|
937
|
+
kickedFrom: CometChat.Group) => {
|
|
850
938
|
groupHandler(
|
|
851
939
|
message,
|
|
852
|
-
'kicked'
|
|
940
|
+
{action: 'kicked', actionOn: kickedUser, actionBy: kickedBy, group: kickedFrom}
|
|
853
941
|
);
|
|
854
942
|
},
|
|
855
|
-
onGroupMemberLeft: (message) => {
|
|
856
|
-
groupHandler(message
|
|
943
|
+
onGroupMemberLeft: (message: CometChat.Action, leavingUser: CometChat.User, group: CometChat.Group) => {
|
|
944
|
+
groupHandler(message,
|
|
945
|
+
{action: 'left', actionOn: leavingUser, group}
|
|
946
|
+
);
|
|
857
947
|
},
|
|
858
948
|
onGroupMemberUnbanned: (message) => {
|
|
859
949
|
groupHandler(message);
|
|
860
950
|
},
|
|
861
|
-
onGroupMemberBanned: (
|
|
951
|
+
onGroupMemberBanned: (
|
|
952
|
+
message: CometChat.Action,
|
|
953
|
+
bannedUser: CometChat.User,
|
|
954
|
+
bannedBy: CometChat.User,
|
|
955
|
+
bannedFrom: CometChat.Group) => {
|
|
862
956
|
groupHandler(
|
|
863
957
|
message,
|
|
864
|
-
'banned'
|
|
958
|
+
{action: 'banned', actionOn: bannedUser, actionBy: bannedBy, group: bannedFrom}
|
|
865
959
|
);
|
|
866
960
|
},
|
|
867
|
-
onMemberAddedToGroup: (
|
|
961
|
+
onMemberAddedToGroup: (
|
|
962
|
+
message: CometChat.Action,
|
|
963
|
+
userAdded: CometChat.User,
|
|
964
|
+
userAddedBy: CometChat.User,
|
|
965
|
+
userAddedIn: CometChat.Group) => {
|
|
868
966
|
if (onMemberAddedToGroupDebounceTimer.current) {
|
|
869
967
|
clearTimeout(onMemberAddedToGroupDebounceTimer.current);
|
|
870
968
|
}
|
|
871
969
|
onMemberAddedToGroupDebounceTimer.current = setTimeout(() => {
|
|
872
970
|
groupHandler(
|
|
873
|
-
message
|
|
971
|
+
message,
|
|
972
|
+
{action: 'joined', actionOn: userAdded, actionBy: userAddedBy, group: userAddedIn}
|
|
874
973
|
);
|
|
875
974
|
}, 50)
|
|
876
975
|
},
|
|
@@ -903,6 +1002,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
903
1002
|
{
|
|
904
1003
|
ccMessageSent: ({ message, status }) => {
|
|
905
1004
|
if (status == MessageStatusConstants.success) {
|
|
1005
|
+
if(!shouldUpdateLastMessageAndUnreadCount(message)) {
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
906
1008
|
updateLastMessage(message);
|
|
907
1009
|
}
|
|
908
1010
|
},
|
|
@@ -916,14 +1018,23 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
916
1018
|
checkAndUpdateLastMessage(message)
|
|
917
1019
|
},
|
|
918
1020
|
onTextMessageReceived: (textMessage) => {
|
|
1021
|
+
if(!shouldUpdateLastMessageAndUnreadCount(textMessage)) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
919
1024
|
messageEventHandler(textMessage);
|
|
920
1025
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
921
1026
|
},
|
|
922
1027
|
onMediaMessageReceived: (mediaMessage) => {
|
|
1028
|
+
if(!shouldUpdateLastMessageAndUnreadCount(mediaMessage)) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
923
1031
|
messageEventHandler(mediaMessage);
|
|
924
1032
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
925
1033
|
},
|
|
926
1034
|
onCustomMessageReceived: (customMessage) => {
|
|
1035
|
+
if(!shouldUpdateLastMessageAndUnreadCount(customMessage)) {
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
927
1038
|
messageEventHandler(customMessage);
|
|
928
1039
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
929
1040
|
},
|
|
@@ -946,18 +1057,30 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
946
1057
|
typingEventHandler(typingIndicator, false);
|
|
947
1058
|
},
|
|
948
1059
|
onFormMessageReceived: (formMessage) => {
|
|
1060
|
+
if(!shouldUpdateLastMessageAndUnreadCount(formMessage)) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
949
1063
|
messageEventHandler(formMessage);
|
|
950
1064
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
951
1065
|
},
|
|
952
1066
|
onCardMessageReceived: (cardMessage) => {
|
|
1067
|
+
if(!shouldUpdateLastMessageAndUnreadCount(cardMessage)) {
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
953
1070
|
messageEventHandler(cardMessage);
|
|
954
1071
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
955
1072
|
},
|
|
956
1073
|
onSchedulerMessageReceived: (schedulerMessage) => {
|
|
1074
|
+
if(!shouldUpdateLastMessageAndUnreadCount(schedulerMessage)) {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
957
1077
|
messageEventHandler(schedulerMessage);
|
|
958
1078
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
959
1079
|
},
|
|
960
1080
|
onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
|
|
1081
|
+
if(!shouldUpdateLastMessageAndUnreadCount(customInteractiveMessage)) {
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
961
1084
|
messageEventHandler(customInteractiveMessage);
|
|
962
1085
|
!disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
|
|
963
1086
|
}
|
|
@@ -975,15 +1098,27 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
975
1098
|
removeItemFromSelectionList(leftGroup['conversationId'])
|
|
976
1099
|
},
|
|
977
1100
|
ccGroupMemberKicked: ({ message, kickedFrom }: { message: CometChat.BaseMessage, kickedFrom: CometChat.Group }) => {
|
|
1101
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
978
1104
|
updateConversationLastMessage(message)
|
|
979
1105
|
},
|
|
980
1106
|
ccGroupMemberBanned: ({ message }) => {
|
|
1107
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
981
1110
|
groupHandler(message);
|
|
982
1111
|
},
|
|
983
1112
|
ccGroupMemberUnBanned: ({ message }) => {
|
|
1113
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
984
1116
|
groupHandler(message)
|
|
985
1117
|
},
|
|
986
1118
|
ccOwnershipChanged: ({ message }) => {
|
|
1119
|
+
if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
987
1122
|
CometChat.CometChatHelper.getConversationFromMessage(message)
|
|
988
1123
|
.then(conversation => {
|
|
989
1124
|
conversationListRef.current?.updateList(conversation);
|
|
@@ -1014,6 +1149,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1014
1149
|
ccOutgoingCall: ({ call }) => {
|
|
1015
1150
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1016
1151
|
.then((conversation) => {
|
|
1152
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1017
1156
|
conversationListRef.current.updateList(conversation);
|
|
1018
1157
|
})
|
|
1019
1158
|
.catch((e) => {
|
|
@@ -1023,6 +1162,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1023
1162
|
ccCallAccepted: ({ call }) => {
|
|
1024
1163
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1025
1164
|
.then((conversation) => {
|
|
1165
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1026
1169
|
conversationListRef.current.updateList(conversation);
|
|
1027
1170
|
})
|
|
1028
1171
|
.catch((e) => {
|
|
@@ -1032,6 +1175,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1032
1175
|
ccCallRejected: ({ call }) => {
|
|
1033
1176
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1034
1177
|
.then((conversation) => {
|
|
1178
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1035
1182
|
conversationListRef.current.updateList(conversation);
|
|
1036
1183
|
})
|
|
1037
1184
|
.catch((e) => {
|
|
@@ -1041,6 +1188,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1041
1188
|
ccCallEnded: ({ call }) => {
|
|
1042
1189
|
CometChat.CometChatHelper.getConversationFromMessage(call)
|
|
1043
1190
|
.then((conversation) => {
|
|
1191
|
+
if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
conversation = updateUnreadMessageCount(conversation);
|
|
1044
1195
|
conversationListRef.current.updateList(conversation);
|
|
1045
1196
|
})
|
|
1046
1197
|
.catch((e) => {
|
|
@@ -1102,7 +1253,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1102
1253
|
listItemStyle={_listItemStyle}
|
|
1103
1254
|
TailView={() => <TailView
|
|
1104
1255
|
customPattern={() => datePattern && props.datePattern(conversation)}
|
|
1105
|
-
timestamp={lastMessage && lastMessage['
|
|
1256
|
+
timestamp={lastMessage && lastMessage['sentAt'] || conversationWith['createdAt']}
|
|
1106
1257
|
unreadCount={conversation.unreadMessageCount}
|
|
1107
1258
|
/>}
|
|
1108
1259
|
avatarStyle={_avatarStyle}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AvatarStyleInterface, CometChatMentionsFormatter, CometChatTextFormatter, CometChatUrlsFormatter, ListItemStyleInterface, localize } from "../shared";
|
|
2
2
|
import { ImageType } from "../shared";
|
|
3
|
-
import { DatePattern,SelectionMode } from "../shared/base/Types";
|
|
3
|
+
import { DatePattern, SelectionMode } from "../shared/base/Types";
|
|
4
4
|
import { CometChatOptions } from "../shared";
|
|
5
5
|
// import { ConversationListConfiguration } from "../CometChatConversationList/ConversationListConfiguration";
|
|
6
6
|
import { ConversationsStyleInterface } from "./ConversationsStyle";
|
|
@@ -176,7 +176,9 @@ export class ConversationsConfiguration implements ConversationsConfigurationInt
|
|
|
176
176
|
this.backButtonIcon = backButtonIcon;
|
|
177
177
|
this.showBackButton = showBackButton;
|
|
178
178
|
this.selectionMode = selectionMode;
|
|
179
|
-
|
|
179
|
+
if (onSelection) {
|
|
180
|
+
this.onSelection = onSelection;
|
|
181
|
+
}
|
|
180
182
|
this.selectedConversations = selectedConversations;
|
|
181
183
|
this.searchBoxIcon = searchBoxIcon;
|
|
182
184
|
this.hideSearch = hideSearch;
|
|
@@ -185,10 +187,18 @@ export class ConversationsConfiguration implements ConversationsConfigurationInt
|
|
|
185
187
|
this.LoadingStateView = LoadingStateView;
|
|
186
188
|
this.conversationsRequestBuilder = conversationsRequestBuilder;
|
|
187
189
|
this.SubtitleView = SubtitleView;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
if (onItemPress) {
|
|
191
|
+
this.onItemPress = onItemPress;
|
|
192
|
+
}
|
|
193
|
+
if (onItemLongPress) {
|
|
194
|
+
this.onItemLongPress = onItemLongPress;
|
|
195
|
+
}
|
|
196
|
+
if (onError) {
|
|
197
|
+
this.onError = onError;
|
|
198
|
+
}
|
|
199
|
+
if (onBack) {
|
|
200
|
+
this.onBack = onBack;
|
|
201
|
+
}
|
|
192
202
|
this.statusIndicatorStyle = statusIndicatorStyle
|
|
193
203
|
this.avatarStyle = avatarStyle
|
|
194
204
|
this.receiptStyle = receiptStyle
|
|
@@ -747,19 +747,23 @@ export const CometChatDetails = (props: CometChatDetailsInterface) => {
|
|
|
747
747
|
};
|
|
748
748
|
|
|
749
749
|
useEffect(() => {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
750
|
+
if(user) {
|
|
751
|
+
listners.addListener.userListener({
|
|
752
|
+
userStatusListenerId,
|
|
753
|
+
handleUserStatus,
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
if(group) {
|
|
757
|
+
listners.addListener.groupListener({
|
|
758
|
+
groupListenerId,
|
|
759
|
+
handleGroupListener,
|
|
760
|
+
});
|
|
761
|
+
}
|
|
758
762
|
return () => {
|
|
759
763
|
listners.removeListner.removeUserListener({ userStatusListenerId });
|
|
760
764
|
listners.removeListner.removeGroupListener({ groupListenerId });
|
|
761
765
|
};
|
|
762
|
-
}, []);
|
|
766
|
+
}, [user, group]);
|
|
763
767
|
|
|
764
768
|
const handleGroupMemberKicked = ({
|
|
765
769
|
message,
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { View, Text, Alert, TouchableOpacity, Image, Modal } from "react-native";
|
|
3
3
|
import { kickIcon, banIcon, downArrowIcon, checkIcon } from "./resources";
|
|
4
4
|
import { CometChatOptions } from "../shared/modals/CometChatOptions";
|
|
5
|
-
import { AvatarStyle, AvatarStyleInterface, CometChatContext, ListItemStyle, ListItemStyleInterface, StatusIndicatorStyle } from "../shared";
|
|
5
|
+
import { AvatarStyle, AvatarStyleInterface, CometChatContext, CometChatUiKitConstants, ListItemStyle, ListItemStyleInterface, StatusIndicatorStyle } from "../shared";
|
|
6
6
|
import { GroupMembersStyle, GroupMembersStyleInterface } from "./GroupMemberStyle";
|
|
7
7
|
//@ts-ignore
|
|
8
8
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
@@ -331,9 +331,25 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
function getStatusIndicatorColor(
|
|
335
|
+
groupMember: CometChat.GroupMember
|
|
336
|
+
): string | null {
|
|
337
|
+
if (
|
|
338
|
+
props.disableUsersPresence ||
|
|
339
|
+
groupMember.getStatus() === CometChatUiKitConstants.UserStatusConstants.offline
|
|
340
|
+
) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
return (
|
|
344
|
+
groupMemberStyle?.onlineStatusColor ||
|
|
345
|
+
theme.palette.getSuccess() ||
|
|
346
|
+
null
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
334
350
|
const ItemView = ({ item: member, ...props }) => {
|
|
335
351
|
if (ListItemView)
|
|
336
|
-
return
|
|
352
|
+
return ListItemView(member);
|
|
337
353
|
|
|
338
354
|
let image, backgroundColor
|
|
339
355
|
if (selecting) {
|
|
@@ -351,7 +367,7 @@ export const CometChatGroupsMembers = (props: CometChatGroupsMembersInterface) =
|
|
|
351
367
|
onLongPress={itemLongPress.bind(this, member)}
|
|
352
368
|
SubtitleView={SubtitleView ? () => <SubtitleView {...member} /> : null} //Note: should return prop to SubtitleView
|
|
353
369
|
statusIndicatorIcon={image}
|
|
354
|
-
statusIndicatorColor={
|
|
370
|
+
statusIndicatorColor={getStatusIndicatorColor(member)}
|
|
355
371
|
title={member.uid == loggedInUser.current.uid ? "You" : member.name}
|
|
356
372
|
avatarName={member.name}
|
|
357
373
|
avatarURL={member.avatar}
|
|
@@ -5,12 +5,24 @@ import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
|
5
5
|
|
|
6
6
|
export interface GroupMemberConfigurationInterface {
|
|
7
7
|
SubtitleView?: (groupMember: CometChat.GroupMember) => JSX.Element,
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*
|
|
11
|
+
* This property is deprecated as of version 4.3.10 due to newer property 'disableUsersPresence'. It will be removed in subsequent versions.
|
|
12
|
+
*/
|
|
8
13
|
disableUserPresence?: boolean,
|
|
14
|
+
disableUsersPresence?: boolean,
|
|
9
15
|
ListItemView?: (groupMember: CometChat.GroupMember) => JSX.Element,
|
|
10
16
|
AppBarOptions?: () => JSX.Element,
|
|
11
17
|
options?: (groupMember: CometChat.GroupMember) => CometChatOptions[],
|
|
12
18
|
hideSeperator?: boolean,
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
*
|
|
22
|
+
* This property is deprecated as of version 4.3.10 due to newer property 'searchPlaceholderText'. It will be removed in subsequent versions.
|
|
23
|
+
*/
|
|
13
24
|
searchPlaceHolder?: string,
|
|
25
|
+
searchPlaceholderText?: string,
|
|
14
26
|
backButtonIcon?: ImageType,
|
|
15
27
|
showBackButton?: boolean,
|
|
16
28
|
selectionMode?: "none" | "single" | "multiple",
|
|
@@ -35,12 +47,24 @@ export interface GroupMemberConfigurationInterface {
|
|
|
35
47
|
|
|
36
48
|
export class GroupMemberConfiguration implements GroupMemberConfigurationInterface {
|
|
37
49
|
SubtitleView?: (groupMember: CometChat.GroupMember) => JSX.Element;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated
|
|
52
|
+
*
|
|
53
|
+
* This property is deprecated as of version 4.3.10 due to newer property 'disableUsersPresence'. It will be removed in subsequent versions.
|
|
54
|
+
*/
|
|
38
55
|
disableUserPresence?: boolean;
|
|
56
|
+
disableUsersPresence?: boolean;
|
|
39
57
|
ListItemView?: (groupMember: CometChat.GroupMember) => JSX.Element;
|
|
40
58
|
AppBarOptions?: () => JSX.Element;
|
|
41
59
|
options?: (groupMember: CometChat.GroupMember) => CometChatOptions[];
|
|
42
60
|
hideSeperator?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
*
|
|
64
|
+
* This property is deprecated as of version 4.3.10 due to newer property 'searchPlaceholderText'. It will be removed in subsequent versions.
|
|
65
|
+
*/
|
|
43
66
|
searchPlaceHolder?: string;
|
|
67
|
+
searchPlaceholderText?: string;
|
|
44
68
|
backButtonIcon?: ImageType;
|
|
45
69
|
showBackButton?: boolean;
|
|
46
70
|
selectionMode?: "none" | "single" | "multiple";
|
|
@@ -64,12 +88,12 @@ export class GroupMemberConfiguration implements GroupMemberConfigurationInterfa
|
|
|
64
88
|
|
|
65
89
|
constructor(params: GroupMemberConfigurationInterface) {
|
|
66
90
|
this.SubtitleView = params.SubtitleView;
|
|
67
|
-
this.
|
|
91
|
+
this.disableUsersPresence = [false, true].includes(params.disableUsersPresence) ? params.disableUsersPresence : params.disableUserPresence;
|
|
68
92
|
this.ListItemView = params.ListItemView;
|
|
69
93
|
this.AppBarOptions = params.AppBarOptions;
|
|
70
94
|
this.options = params.options;
|
|
71
95
|
this.hideSeperator = params.hideSeperator;
|
|
72
|
-
this.
|
|
96
|
+
this.searchPlaceholderText = params.searchPlaceholderText ?? params.searchPlaceHolder;
|
|
73
97
|
this.backButtonIcon = params.backButtonIcon;
|
|
74
98
|
this.showBackButton = params.showBackButton;
|
|
75
99
|
this.selectionMode = params.selectionMode;
|
|
@@ -41,11 +41,13 @@ export const CometChatGroupsWithMessages = (props: CometChatGroupsWithMessagesIn
|
|
|
41
41
|
|
|
42
42
|
const {theme} = useContext(CometChatContext);
|
|
43
43
|
|
|
44
|
-
const [showComponent, setShowComponent] = useState(
|
|
44
|
+
const [showComponent, setShowComponent] = useState(
|
|
45
|
+
group && group instanceof CometChat.Group ? ComponentNames.Messages : ComponentNames.GroupsList
|
|
46
|
+
);
|
|
45
47
|
const [joinProtectedGroup, setJoinProtectedGroup] = useState(false);
|
|
46
48
|
// const [showForwarding, setShowForwarding] = useState(false);
|
|
47
49
|
|
|
48
|
-
const selectedGroup= useRef(group);
|
|
50
|
+
const selectedGroup= useRef(group && group instanceof CometChat.Group ? group : undefined);
|
|
49
51
|
const selectedUser = useRef();
|
|
50
52
|
|
|
51
53
|
const _createGroupConfig = new CreateGroupConfiguration({...createGroupConfiguration});
|