@cometchat/chat-uikit-react-native 4.3.9 → 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/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 +18 -2
- package/src/CometChatGroupMembers/GroupMemberConfiguration.ts +26 -2
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +6 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +17 -9
- package/src/CometChatMessageList/MessageListConfiguration.ts +14 -2
- package/src/calls/CallEvents.ts +1 -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/Stickers/StickersExtensionDecorator.tsx +2 -0
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +1 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +32 -11
- package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -5
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +3 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -4
- package/src/shared/views/CometChatList/CometChatList.tsx +2 -2
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
package/package.json
CHANGED
|
@@ -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,6 +331,22 @@ 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
352
|
return ListItemView(member);
|
|
@@ -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;
|
|
@@ -875,6 +875,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
875
875
|
textMessage.setReceiver(chatWith.current);
|
|
876
876
|
textMessage.setText(finalTextInput);
|
|
877
877
|
textMessage.setMuid(String(getUnixTimestamp()));
|
|
878
|
+
textMessage.setSentAt(getUnixTimestamp());
|
|
878
879
|
parentMessageId && textMessage.setParentMessageId(parentMessageId as number);
|
|
879
880
|
|
|
880
881
|
allFormatters.current.forEach(item => {
|
|
@@ -985,6 +986,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
985
986
|
mediaMessage['_id'] = '_' + Math.random().toString(36).substr(2, 9);
|
|
986
987
|
mediaMessage.setId(mediaMessage['_id']);
|
|
987
988
|
mediaMessage.setMuid(String(getUnixTimestamp()));
|
|
989
|
+
mediaMessage.setSentAt(getUnixTimestamp());
|
|
988
990
|
mediaMessage.setData({
|
|
989
991
|
type: messageType,
|
|
990
992
|
category: CometChat.CATEGORY_MESSAGE,
|
|
@@ -1009,6 +1011,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1009
1011
|
localMessage['_id'] = '_' + Math.random().toString(36).substr(2, 9);
|
|
1010
1012
|
localMessage.setId(localMessage['_id']);
|
|
1011
1013
|
localMessage.setMuid(String(getUnixTimestamp()));
|
|
1014
|
+
localMessage.setSentAt(getUnixTimestamp());
|
|
1012
1015
|
localMessage.setData({
|
|
1013
1016
|
type: messageType,
|
|
1014
1017
|
category: CometChat.CATEGORY_MESSAGE,
|
|
@@ -1253,11 +1256,13 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1253
1256
|
mentionsFormatter.setUser(user);
|
|
1254
1257
|
mentionsFormatter.setGroup(group);
|
|
1255
1258
|
|
|
1256
|
-
_formatter.
|
|
1259
|
+
_formatter.unshift(mentionsFormatter)
|
|
1257
1260
|
}
|
|
1258
1261
|
|
|
1259
1262
|
_formatter.forEach((formatter) => {
|
|
1260
1263
|
formatter.setComposerId(id);
|
|
1264
|
+
formatter.setUser(user);
|
|
1265
|
+
formatter.setGroup(group);
|
|
1261
1266
|
let trackingCharacter = formatter.getTrackingCharacter();
|
|
1262
1267
|
trackingCharacters.current.push(trackingCharacter);
|
|
1263
1268
|
|
|
@@ -59,7 +59,13 @@ export interface CometChatMessageListProps {
|
|
|
59
59
|
errorIcon?: ImageType,
|
|
60
60
|
alignment?: MessageListAlignmentType,
|
|
61
61
|
showAvatar?: boolean,
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* This function returns a string for custom date representation based on the provided message object.
|
|
64
|
+
*
|
|
65
|
+
* @param baseMessage - The message object.
|
|
66
|
+
* @returns The string for custom date representation.
|
|
67
|
+
*/
|
|
68
|
+
datePattern?: (message: CometChat.BaseMessage) => string,
|
|
63
69
|
timeStampAlignment?: MessageTimeAlignmentType,
|
|
64
70
|
dateSeparatorPattern?: (date: number) => string,
|
|
65
71
|
templates?: Array<CometChatMessageTemplate>,
|
|
@@ -1123,12 +1129,14 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1123
1129
|
});
|
|
1124
1130
|
|
|
1125
1131
|
const onKeyboardVisibiltyChange = (isVisible: boolean, keyboardHeight?: number | undefined) => {
|
|
1126
|
-
if (
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
+
if (messageListRef.current) {
|
|
1133
|
+
if (isVisible) {
|
|
1134
|
+
Keyboard_Height = keyboardHeight;
|
|
1135
|
+
scrollPos = (currentScrollPosition.current.y + Keyboard_Height) - (commonVars.safeAreaInsets.top / 2);
|
|
1136
|
+
messageListRef.current.scrollTo({ y: scrollPos, animated: false })
|
|
1137
|
+
} else {
|
|
1138
|
+
messageListRef.current.scrollTo({ y: scrollPos - Keyboard_Height + (commonVars.safeAreaInsets.top / 2), animated: false })
|
|
1139
|
+
}
|
|
1132
1140
|
}
|
|
1133
1141
|
}
|
|
1134
1142
|
|
|
@@ -1623,7 +1631,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1623
1631
|
ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
|
|
1624
1632
|
ThreadView={() => !isThreaded && !message.getDeletedBy() && getThreadView(message, bubbleAlignment)}
|
|
1625
1633
|
BottomView={hasTemplate.BottomView && hasTemplate.BottomView?.bind(this, message, bubbleAlignment)}
|
|
1626
|
-
StatusInfoView={() => getStatusInfoView(message, bubbleAlignment)}
|
|
1634
|
+
StatusInfoView={hasTemplate.StatusInfoView ? hasTemplate.StatusInfoView?.bind(this, message, bubbleAlignment) : () => getStatusInfoView(message, bubbleAlignment)}
|
|
1627
1635
|
style={getStyle(message)}
|
|
1628
1636
|
/>
|
|
1629
1637
|
</TouchableOpacity>
|
|
@@ -1790,7 +1798,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1790
1798
|
|
|
1791
1799
|
const getLoadingStateView = useCallback(() => {
|
|
1792
1800
|
if (LoadingStateView)
|
|
1793
|
-
return <LoadingStateView/>;
|
|
1801
|
+
return <LoadingStateView />;
|
|
1794
1802
|
|
|
1795
1803
|
return (
|
|
1796
1804
|
<View style={Style.msgContainerStyle}>
|
|
@@ -36,7 +36,13 @@ export interface MessageListConfigurationInterface {
|
|
|
36
36
|
errorIcon?: ImageType;
|
|
37
37
|
alignment?: MessageListAlignmentType;
|
|
38
38
|
showAvatar?: boolean;
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
|
+
* This function returns a string for custom date representation based on the provided message object.
|
|
41
|
+
*
|
|
42
|
+
* @param baseMessage - The message object.
|
|
43
|
+
* @returns The string for custom date representation.
|
|
44
|
+
*/
|
|
45
|
+
datePattern?: (baseMessage: CometChat.BaseMessage) => string;
|
|
40
46
|
timestampAlignment?: MessageTimeAlignmentType;
|
|
41
47
|
templates?: CometChatMessageTemplate[];
|
|
42
48
|
messageRequestBuilder?: CometChat.MessagesRequestBuilder;
|
|
@@ -114,7 +120,13 @@ export class MessageListConfiguration
|
|
|
114
120
|
errorIcon: ImageType;
|
|
115
121
|
alignment: MessageListAlignmentType;
|
|
116
122
|
showAvatar: boolean;
|
|
117
|
-
|
|
123
|
+
/**
|
|
124
|
+
* This function returns a string for custom date representation based on the provided message object.
|
|
125
|
+
*
|
|
126
|
+
* @param baseMessage - The message object.
|
|
127
|
+
* @returns The string for custom date representation.
|
|
128
|
+
*/
|
|
129
|
+
datePattern: (baseMessage: CometChat.BaseMessage) => string;
|
|
118
130
|
timestampAlignment: MessageTimeAlignmentType;
|
|
119
131
|
templates: CometChatMessageTemplate[];
|
|
120
132
|
messageRequestBuilder: CometChat.MessagesRequestBuilder;
|
package/src/calls/CallEvents.ts
CHANGED
|
@@ -163,6 +163,8 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface) => {
|
|
|
163
163
|
"incrementUnreadCount": true,
|
|
164
164
|
"pushNotification": MessageTypeConstants.meeting,
|
|
165
165
|
})
|
|
166
|
+
customMessage.shouldUpdateConversation(true);
|
|
167
|
+
customMessage.setMetadata({ incrementUnreadCount: true });
|
|
166
168
|
customMessage.setCustomData(customData);
|
|
167
169
|
CometChatUIKit.sendCustomMessage(
|
|
168
170
|
customMessage)
|
|
@@ -191,7 +193,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface) => {
|
|
|
191
193
|
},
|
|
192
194
|
error => {
|
|
193
195
|
console.log("Call initialization failed with exception:", error);
|
|
194
|
-
CometChatUIEventHandler.emitCallEvent(CallUIEvents.
|
|
196
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallFailed, { call });
|
|
195
197
|
onError && onError(error);
|
|
196
198
|
}
|
|
197
199
|
);
|
|
@@ -293,7 +293,7 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
|
|
|
293
293
|
},
|
|
294
294
|
error => {
|
|
295
295
|
console.log("Call initialization failed with exception:", error);
|
|
296
|
-
CometChatUIEventHandler.emitCallEvent(CallUIEvents.
|
|
296
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallFailed, { call });
|
|
297
297
|
onError && onError(error);
|
|
298
298
|
}
|
|
299
299
|
);
|
|
@@ -195,7 +195,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface) =>
|
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
197
|
onError: (error) => {
|
|
198
|
-
CometChatUIEventHandler.emitCallEvent(CallUIEvents.
|
|
198
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallFailed, { error });
|
|
199
199
|
onError && onError(error);
|
|
200
200
|
}
|
|
201
201
|
});
|
|
@@ -163,7 +163,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface) =>
|
|
|
163
163
|
);
|
|
164
164
|
|
|
165
165
|
CometChatUIEventHandler.addCallListener(listenerId, {
|
|
166
|
-
|
|
166
|
+
ccCallFailed: () => {
|
|
167
167
|
setCallConnected(false);
|
|
168
168
|
}
|
|
169
169
|
});
|
|
@@ -197,7 +197,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface) =>
|
|
|
197
197
|
endCallIfRequired();
|
|
198
198
|
},
|
|
199
199
|
onError: (error) => {
|
|
200
|
-
CometChatUIEventHandler.emitCallEvent(CallUIEvents.
|
|
200
|
+
CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallFailed, { error });
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
|
|
@@ -91,6 +91,8 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
|
|
|
91
91
|
customMessage.setMuid(new Date().getTime().toString());
|
|
92
92
|
customMessage.setSender(loggedInUser.current);
|
|
93
93
|
customMessage.setReceiver(user || group);
|
|
94
|
+
customMessage.shouldUpdateConversation(true);
|
|
95
|
+
customMessage.setMetadata({ incrementUnreadCount: true });
|
|
94
96
|
CometChatUIKit.sendCustomMessage(customMessage).then((res) => null).catch(err => null);
|
|
95
97
|
}
|
|
96
98
|
|
|
@@ -45,7 +45,7 @@ export class ThumbnailGenerationExtensionDecorator extends DataSourceDecorator {
|
|
|
45
45
|
image = message.getType() === "image" ? message?.data?.url : Empty; //default image for type video
|
|
46
46
|
} else {
|
|
47
47
|
let attachmentData = thumbnailData['attachments'];
|
|
48
|
-
if (attachmentData.length
|
|
48
|
+
if (attachmentData.length) {
|
|
49
49
|
let dataObj = attachmentData[0];
|
|
50
50
|
|
|
51
51
|
if (!dataObj['error']) {
|
|
@@ -28,12 +28,13 @@ import { AIAssistBotExtension } from "../../AI/AIAssistBot/AIAssistBotExtension"
|
|
|
28
28
|
import { permissionUtil } from "../utils/PermissionUtil";
|
|
29
29
|
import {
|
|
30
30
|
getUnixTimestamp,
|
|
31
|
-
|
|
31
|
+
} from '../../shared/utils/CometChatMessageHelper';
|
|
32
32
|
|
|
33
33
|
export class CometChatUIKit {
|
|
34
34
|
static uiKitSettings: UIKitSettings;
|
|
35
35
|
static aiFeatures: AIExtensionDataSource[]
|
|
36
36
|
static loggedInUser: null | CometChat.User = null;
|
|
37
|
+
static conversationUpdateSettings : CometChat.ConversationUpdateSettings = new CometChat.ConversationUpdateSettings();
|
|
37
38
|
private static loginListenerID: string = ``;
|
|
38
39
|
private static isLoginListenerAttached: boolean = false;
|
|
39
40
|
static init(uiKitSettings: UIKitSettings): Promise<boolean> {
|
|
@@ -43,7 +44,6 @@ export class CometChatUIKit {
|
|
|
43
44
|
...uiKitSettings
|
|
44
45
|
};
|
|
45
46
|
var appSetting = new CometChat.AppSettingsBuilder()
|
|
46
|
-
.subscribePresenceForAllUsers()
|
|
47
47
|
.autoEstablishSocketConnection(uiKitSettings.autoEstablishSocketConnection)
|
|
48
48
|
.overrideAdminHost(uiKitSettings?.overrideAdminHost)
|
|
49
49
|
.overrideClientHost(uiKitSettings?.overrideClientHost)
|
|
@@ -52,6 +52,10 @@ export class CometChatUIKit {
|
|
|
52
52
|
|
|
53
53
|
appSetting.subscriptionType = uiKitSettings.subscriptionType;
|
|
54
54
|
|
|
55
|
+
if (appSetting.subscriptionType === "ROLES" && Array.isArray(uiKitSettings.roles) && uiKitSettings.roles.length > 0) {
|
|
56
|
+
appSetting.roles = uiKitSettings.roles;
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
CometChatUIKit.attachListener();
|
|
56
60
|
|
|
57
61
|
return CometChat.init(uiKitSettings.appId, appSetting.build()).then(
|
|
@@ -66,6 +70,10 @@ export class CometChatUIKit {
|
|
|
66
70
|
if (user) {
|
|
67
71
|
this.enableExtensions();
|
|
68
72
|
}
|
|
73
|
+
CometChat.getConversationUpdateSettings()
|
|
74
|
+
.then((conversationUpdateSettings: CometChat.ConversationUpdateSettings) => {
|
|
75
|
+
CometChatUIKit.setConversationUpdateSettings(conversationUpdateSettings);
|
|
76
|
+
})
|
|
69
77
|
})
|
|
70
78
|
.catch(error => {
|
|
71
79
|
// CometChatUIKit.setLoggedInUser(null);
|
|
@@ -114,6 +122,10 @@ export class CometChatUIKit {
|
|
|
114
122
|
new CometChat.LoginListener({
|
|
115
123
|
onLoggedIn: (user: CometChat.User) => {
|
|
116
124
|
CometChatUIKit.setLoggedInUser(user);
|
|
125
|
+
CometChat.getConversationUpdateSettings()
|
|
126
|
+
.then((conversationUpdateSettings: CometChat.ConversationUpdateSettings) => {
|
|
127
|
+
CometChatUIKit.setConversationUpdateSettings(conversationUpdateSettings);
|
|
128
|
+
})
|
|
117
129
|
},
|
|
118
130
|
onLoggedOut: () => {
|
|
119
131
|
CometChatUIKit.removeLoggedInUser();
|
|
@@ -152,7 +164,7 @@ export class CometChatUIKit {
|
|
|
152
164
|
if (CometChatUIKit.checkAuthSettings(Promise.reject)) null
|
|
153
165
|
let user = await CometChat.getLoggedinUser().catch((e) => Promise.reject(e))
|
|
154
166
|
if (user == null) {
|
|
155
|
-
throw(new CometChat.CometChatException({ code: "NOT_FOUND", message: "Login user not found" }));
|
|
167
|
+
throw (new CometChat.CometChatException({ code: "NOT_FOUND", message: "Login user not found" }));
|
|
156
168
|
} else {
|
|
157
169
|
this.enableExtensions()
|
|
158
170
|
}
|
|
@@ -163,6 +175,14 @@ export class CometChatUIKit {
|
|
|
163
175
|
this.loggedInUser = user;
|
|
164
176
|
}
|
|
165
177
|
|
|
178
|
+
private static setConversationUpdateSettings(conversationUpdateSettings: CometChat.ConversationUpdateSettings) {
|
|
179
|
+
this.conversationUpdateSettings = conversationUpdateSettings;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
static getConversationUpdateSettings(): CometChat.ConversationUpdateSettings {
|
|
183
|
+
return this.conversationUpdateSettings
|
|
184
|
+
}
|
|
185
|
+
|
|
166
186
|
private static removeLoggedInUser() {
|
|
167
187
|
this.loggedInUser = null;
|
|
168
188
|
}
|
|
@@ -179,7 +199,8 @@ export class CometChatUIKit {
|
|
|
179
199
|
if (CometChatUIKit.checkAuthSettings(Promise.reject)) null
|
|
180
200
|
if (uid) {
|
|
181
201
|
let user = await CometChat.login(uid, CometChatUIKit.uiKitSettings?.authKey).catch(e => Promise.reject(e));
|
|
182
|
-
CometChatUIKit.setLoggedInUser(user)
|
|
202
|
+
CometChatUIKit.setLoggedInUser(user);
|
|
203
|
+
CometChatUIKit.setConversationUpdateSettings(await CometChat.getConversationUpdateSettings());
|
|
183
204
|
this.enableExtensions()
|
|
184
205
|
return user;
|
|
185
206
|
}
|
|
@@ -244,7 +265,7 @@ export class CometChatUIKit {
|
|
|
244
265
|
message.setMuid(String(getUnixTimestamp()));
|
|
245
266
|
}
|
|
246
267
|
|
|
247
|
-
if(!message.getSender()){
|
|
268
|
+
if (!message.getSender()) {
|
|
248
269
|
message.setSender(this.loggedInUser);
|
|
249
270
|
}
|
|
250
271
|
|
|
@@ -273,7 +294,7 @@ export class CometChatUIKit {
|
|
|
273
294
|
message.setMuid(String(getUnixTimestamp()));
|
|
274
295
|
}
|
|
275
296
|
|
|
276
|
-
if(!message.getSender()){
|
|
297
|
+
if (!message.getSender()) {
|
|
277
298
|
message.setSender(this.loggedInUser);
|
|
278
299
|
}
|
|
279
300
|
|
|
@@ -325,7 +346,7 @@ export class CometChatUIKit {
|
|
|
325
346
|
message.setMuid(String(getUnixTimestamp()));
|
|
326
347
|
}
|
|
327
348
|
|
|
328
|
-
if(!message?.getSender()){
|
|
349
|
+
if (!message?.getSender()) {
|
|
329
350
|
message.setSender(this.loggedInUser);
|
|
330
351
|
}
|
|
331
352
|
|
|
@@ -358,7 +379,7 @@ export class CometChatUIKit {
|
|
|
358
379
|
message.setMuid(String(getUnixTimestamp()));
|
|
359
380
|
}
|
|
360
381
|
|
|
361
|
-
if(!message.getSender()){
|
|
382
|
+
if (!message.getSender()) {
|
|
362
383
|
message.setSender(this.loggedInUser);
|
|
363
384
|
}
|
|
364
385
|
if (!disableLocalEvents) {
|
|
@@ -395,7 +416,7 @@ export class CometChatUIKit {
|
|
|
395
416
|
message.setMuid(String(getUnixTimestamp()));
|
|
396
417
|
}
|
|
397
418
|
|
|
398
|
-
if(!message.getSender()){
|
|
419
|
+
if (!message.getSender()) {
|
|
399
420
|
message.setSender(this.loggedInUser);
|
|
400
421
|
}
|
|
401
422
|
|
|
@@ -434,7 +455,7 @@ export class CometChatUIKit {
|
|
|
434
455
|
message.setMuid(String(getUnixTimestamp()));
|
|
435
456
|
}
|
|
436
457
|
|
|
437
|
-
if(!message.getSender()){
|
|
458
|
+
if (!message.getSender()) {
|
|
438
459
|
message.setSender(this.loggedInUser);
|
|
439
460
|
}
|
|
440
461
|
if (!disableLocalEvents) {
|
|
@@ -473,7 +494,7 @@ export class CometChatUIKit {
|
|
|
473
494
|
message.setMuid(String(getUnixTimestamp()));
|
|
474
495
|
}
|
|
475
496
|
|
|
476
|
-
if(!message.getSender()){
|
|
497
|
+
if (!message.getSender()) {
|
|
477
498
|
message.setSender(this.loggedInUser);
|
|
478
499
|
}
|
|
479
500
|
|
|
@@ -4,8 +4,8 @@ import { ExtensionsDataSource } from "../framework"
|
|
|
4
4
|
export type UIKitSettings = {
|
|
5
5
|
appId: string,
|
|
6
6
|
region: string,
|
|
7
|
-
authKey
|
|
8
|
-
subscriptionType?:
|
|
7
|
+
authKey?: string,
|
|
8
|
+
subscriptionType?: "NONE" | "ALL_USERS" | "ROLES" | "FRIENDS",
|
|
9
9
|
autoEstablishSocketConnection?: boolean,
|
|
10
10
|
overrideAdminHost?: string,
|
|
11
11
|
overrideClientHost?: string,
|
|
@@ -13,7 +13,8 @@ export type UIKitSettings = {
|
|
|
13
13
|
googleApiKey?: string,
|
|
14
14
|
disableCalling?: boolean,
|
|
15
15
|
aiFeatures?:AIExtensionDataSource[],
|
|
16
|
-
extensions?:ExtensionsDataSource[]
|
|
16
|
+
extensions?:ExtensionsDataSource[],
|
|
17
|
+
roles?: string[]
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export function UIKitSettings({
|
|
@@ -28,7 +29,8 @@ export function UIKitSettings({
|
|
|
28
29
|
googleApiKey,
|
|
29
30
|
disableCalling,
|
|
30
31
|
aiFeatures,
|
|
31
|
-
extensions
|
|
32
|
+
extensions,
|
|
33
|
+
roles
|
|
32
34
|
}: UIKitSettings): UIKitSettings {
|
|
33
35
|
return {
|
|
34
36
|
appId,
|
|
@@ -42,6 +44,7 @@ export function UIKitSettings({
|
|
|
42
44
|
googleApiKey,
|
|
43
45
|
disableCalling,
|
|
44
46
|
aiFeatures,
|
|
45
|
-
extensions
|
|
47
|
+
extensions,
|
|
48
|
+
roles
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -76,6 +76,9 @@ export class CometChatUIEventHandler {
|
|
|
76
76
|
case listener._eventListener.ccShowOngoingCall?.name:
|
|
77
77
|
listener._eventListener.ccShowOngoingCall(param);
|
|
78
78
|
break;
|
|
79
|
+
case listener._eventListener.ccCallFailed?.name:
|
|
80
|
+
listener._eventListener.ccCallFailed(param);
|
|
81
|
+
break;
|
|
79
82
|
}
|
|
80
83
|
});
|
|
81
84
|
}
|
|
@@ -135,7 +135,7 @@ type CallUIEvents = {
|
|
|
135
135
|
ccOutgoingCallCancelled?: Function,
|
|
136
136
|
ccCallEnded?: Function,
|
|
137
137
|
ccCallInitiated?: Function,
|
|
138
|
-
|
|
138
|
+
ccCallFailed?: Function,
|
|
139
139
|
ccShowOngoingCall?: (CometChatOngoingComponent) => void,
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -166,7 +166,7 @@ export class CallUIEventListener {
|
|
|
166
166
|
ccCallRejected?: Function = undefined;
|
|
167
167
|
ccCallEnded?: Function = undefined;
|
|
168
168
|
ccOutgoingCallCancelled?: Function = undefined;
|
|
169
|
-
|
|
169
|
+
ccCallFailed?: Function = undefined;
|
|
170
170
|
ccCallInitiated?: Function = undefined;
|
|
171
171
|
ccShowOngoingCall?: (CometChatOngoingComponent) => void;
|
|
172
172
|
|
|
@@ -180,11 +180,11 @@ export class CallUIEventListener {
|
|
|
180
180
|
ccCallRejected,
|
|
181
181
|
ccCallEnded,
|
|
182
182
|
ccOutgoingCallCancelled,
|
|
183
|
-
|
|
183
|
+
ccCallFailed,
|
|
184
184
|
ccCallInitiated,
|
|
185
185
|
ccShowOngoingCall,
|
|
186
186
|
}: CallUIEvents) {
|
|
187
|
-
if (!isFalsy(
|
|
187
|
+
if (!isFalsy(ccCallFailed)) this.ccCallFailed = ccCallFailed;
|
|
188
188
|
if (!isFalsy(ccCallInitiated)) this.ccCallInitiated = ccCallInitiated;
|
|
189
189
|
if (!isFalsy(ccOutgoingCall)) this.ccOutgoingCall = ccOutgoingCall;
|
|
190
190
|
if (!isFalsy(ccCallAccepted)) this.ccCallAccepted = ccCallAccepted;
|
|
@@ -537,9 +537,9 @@ export const CometChatList = React.forwardRef<
|
|
|
537
537
|
Object.keys(selectedItems).includes(item.value[listItemKey]) && ICONS.CHECK
|
|
538
538
|
}
|
|
539
539
|
SubtitleView={
|
|
540
|
-
SubtitleView ? () =>
|
|
540
|
+
SubtitleView ? () => SubtitleView(item.value) : null
|
|
541
541
|
}
|
|
542
|
-
TailView={TailView ? () =>
|
|
542
|
+
TailView={TailView ? () => TailView(item.value) : null}
|
|
543
543
|
statusIndicatorStyle={
|
|
544
544
|
selectedItems[item.value[listItemKey]] === true
|
|
545
545
|
? {
|
|
@@ -167,7 +167,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
167
167
|
volumeIcon={playerVolumeIcon}
|
|
168
168
|
volumeIconColor={style.playerVolumeIconColor}
|
|
169
169
|
/>
|
|
170
|
-
<ImageBackground source={(typeof thumbnailUrl === "object" ? thumbnailUrl?.uri : thumbnailUrl) || placeholderImage || defaultThumbnail} resizeMode={"cover"} style={{ backgroundColor, ...border, borderRadius, height, width, overflow: "hidden" }}>
|
|
170
|
+
<ImageBackground source={(typeof thumbnailUrl === "object" ? { uri: thumbnailUrl?.uri } : thumbnailUrl) || placeholderImage || defaultThumbnail} resizeMode={"cover"} style={{ backgroundColor, ...border, borderRadius, height, width, overflow: "hidden" }}>
|
|
171
171
|
<View
|
|
172
172
|
onTouchStart={handleTouchStart}
|
|
173
173
|
onTouchEnd={handleTouchEnd}
|