Skip to content

Commit 802f778

Browse files
v4.3.20
1 parent a0d76b2 commit 802f778

File tree

41 files changed

+407
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+407
-211
lines changed

android/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
<uses-permission android:name="android.permission.INTERNET" />
55
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
66
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7+
<queries>
8+
<intent>
9+
<action android:name="android.intent.action.VIEW" />
10+
<data android:scheme="https" android:host="*" />
11+
</intent>
12+
</queries>
713
<application android:requestLegacyExternalStorage="true"
814
android:largeHeap="true" >
915
<activity

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cometchat/chat-uikit-react-native",
3-
"version": "4.3.19",
3+
"version": "4.3.20",
44
"description": "Ready-to-use Chat UI Components for React Native",
55
"main": "src/index",
66
"module": "src/index",

src/CometChatConversations/CometChatConversations.tsx

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
367367
const userEventHandler = (...args: any[]) => {
368368
const { uid, blockedByMe, status } = args[0];
369369
if (!blockedByMe) {
370-
let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`);
370+
let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) as unknown as CometChat.Conversation || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`) as unknown as CometChat.Conversation;
371371
if (item) {
372372
let updatedConversation = CommonUtils.clone(item);
373373
updatedConversation.setConversationWith(args[0]);
374-
conversationListRef.current.updateList(updatedConversation);
374+
conversationListRef.current?.updateList(updatedConversation);
375375
}
376376
}
377377
}
@@ -566,18 +566,18 @@ export const CometChatConversations = (props: ConversationInterface) => {
566566
}
567567

568568
const updateMessageReceipt = (receipt: CometChat.MessageReceipt) => {
569-
const conv: CometChat.Conversation =
569+
const conv: CometChat.Conversation | boolean =
570570
receipt?.getReceiverType() === ReceiverTypeConstants.user
571-
? conversationListRef.current.getListItem(
571+
? conversationListRef.current?.getListItem(
572572
`${receipt?.getReceiver()}_user_${receipt?.getSender().getUid()}`
573-
) ||
574-
conversationListRef.current.getListItem(
573+
) as unknown as CometChat.Conversation ||
574+
conversationListRef.current?.getListItem(
575575
`${receipt?.getSender()?.getUid()}_user_${receipt?.getReceiver()}`
576-
)
576+
) as unknown as CometChat.Conversation
577577
: [receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT, receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT].includes(receipt?.getReceiptType()) &&
578-
conversationListRef.current.getListItem(
578+
conversationListRef.current?.getListItem(
579579
`group_${receipt?.getReceiver()}`
580-
);
580+
) as unknown as CometChat.Conversation;
581581

582582
if (
583583
conv &&
@@ -590,17 +590,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
590590
if (
591591
conv &&
592592
conv?.getLastMessage &&
593-
(conv.getLastMessage().id == receipt['messageId'] ||
594-
conv.getLastMessage().messageId == receipt['messageId'])
593+
(conv.getLastMessage().id == receipt.getMessageId() ||
594+
conv.getLastMessage().messageId == receipt.getMessageId())
595595
) {
596596
let newConversation = CommonUtils.clone(conv);
597-
if (receipt['readAt']) {
598-
newConversation.getLastMessage().setReadAt(receipt['readAt']);
597+
if (receipt.getReadAt()) {
598+
newConversation.getLastMessage().setReadAt(receipt.getReadAt());
599599
}
600-
if (receipt['deliveredAt']) {
601-
newConversation.getLastMessage().setDeliveredAt(receipt['deliveredAt']);
600+
if (receipt.getDeliveredAt()) {
601+
newConversation.getLastMessage().setDeliveredAt(receipt.getDeliveredAt());
602602
}
603-
conversationListRef.current.updateList(newConversation);
603+
conversationListRef.current?.updateList(newConversation);
604604
}
605605
};
606606

@@ -749,7 +749,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
749749

750750
function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
751751
let messageTextTmp = subtitle;
752-
let allFormatters = [...(textFormatters || [])] || [];
752+
let allFormatters = [...(textFormatters ?? [])];
753753

754754
if (!disableMentions && message.getMentionedUsers().length) {
755755
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
@@ -1057,14 +1057,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
10571057
{
10581058
ccConversationDeleted:
10591059
({ conversation }: { conversation: CometChat.Conversation | any }) => {
1060-
CometChat.deleteConversation(conversation.getConversationId(), conversation.getConversationType())
1061-
.then((res: any) => {
1062-
conversationListRef.current?.removeItemFromList(conversation);
1063-
removeItemFromSelectionList(conversation.getConversationId())
1064-
})
1065-
.catch((err: any) => {
1066-
console.log("Error", err);
1067-
});
1060+
conversationListRef.current?.removeItemFromList(conversation.getConversationId());
1061+
removeItemFromSelectionList(conversation.getConversationId())
10681062
}
10691063
}
10701064
);

src/CometChatGroups/CometChatGroups.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useState, useRef } from "react";
33
//@ts-ignore
44
import { Text, TextStyle, View, ViewProps } from "react-native";
55
import {
6-
backIcon, searchIcon,
6+
backIcon,
77
passwordGroupIcon, privateGroupIcon,
88
checkIcon,
99
} from "./resources";
@@ -595,7 +595,7 @@ CometChatGroups.defaultProps = {
595595
title: localize("GROUPS"),
596596
searchPlaceHolderText: localize("SEARCH"),
597597
showBackButton: false,
598-
searchBoxIcon: searchIcon,
598+
searchBoxIcon: undefined,
599599
hideSearch: false,
600600
listItemStyle: undefined,
601601
avatarStyle: undefined,

src/CometChatGroups/GroupsConfiguration.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
import { GroupsStyle, GroupsStyleInterface } from './GroupsStyle';
1010
import {
1111
backIcon,
12-
searchIcon,
1312
passwordGroupIcon,
1413
privateGroupIcon,
1514
} from './resources';
@@ -60,23 +59,23 @@ export class GroupsConfiguration implements GroupsConfigurationInterface {
6059
ListItemView!: (item: CometChat.Group) => JSX.Element;
6160
AppBarOption!: () => JSX.Element;
6261
options!: (item: CometChat.Group) => CometChatOptions[];
63-
hideSeparator: boolean;
64-
searchPlaceholderText: string;
65-
backButton: ImageType;
66-
showBackButton: boolean;
67-
selectionMode: 'none' | 'single' | 'multiple';
62+
hideSeparator?: boolean;
63+
searchPlaceholderText?: string;
64+
backButton?: ImageType;
65+
showBackButton?: boolean;
66+
selectionMode?: 'none' | 'single' | 'multiple';
6867
onSelection!: (items: Array<CometChat.Group>) => void;
69-
searchBoxIcon: ImageType;
70-
hideSearch: boolean;
71-
title: string;
68+
searchBoxIcon?: ImageType;
69+
hideSearch?: boolean;
70+
title?: string;
7271
EmptyStateView!: () => JSX.Element;
7372
ErrorStateView!: () => JSX.Element;
7473
LoadingStateView!: () => JSX.Element;
7574
groupsRequestBuilder: CometChat.GroupsRequestBuilder | undefined;
76-
searchKeyword: string;
77-
privateGroupIcon: ImageType;
78-
passwordGroupIcon: ImageType;
79-
hideError: boolean;
75+
searchKeyword?: string;
76+
privateGroupIcon?: ImageType;
77+
passwordGroupIcon?: ImageType;
78+
hideError?: boolean;
8079
onItemPress?: (item: CometChat.Group) => void;
8180
onItemLongPress?: (item: CometChat.Group) => void;
8281
onError?: (e: CometChat.CometChatException) => void;
@@ -89,8 +88,6 @@ export class GroupsConfiguration implements GroupsConfigurationInterface {
8988

9089
constructor(props: GroupsConfigurationInterface) {
9190
if (props)
92-
for (const [key, value] of Object.entries(props)) {
93-
this[key] = value;
94-
}
91+
Object.assign(this, props);
9592
}
9693
}

src/CometChatGroups/resources/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import backIcon from "./back.png";
33
//@ts-ignore
44
import createIcon from "./create.png";
55
//@ts-ignore
6-
import searchIcon from "./search.png";
7-
//@ts-ignore
86
import passwordGroupIcon from "./password.png";
97
//@ts-ignore
108
import privateGroupIcon from "./private.png";
@@ -22,7 +20,6 @@ import checkIcon from './check.png';
2220
export {
2321
backIcon,
2422
createIcon,
25-
searchIcon,
2623
passwordGroupIcon,
2724
privateGroupIcon,
2825
loadingIcon,
-435 Bytes
Binary file not shown.

src/CometChatMessageComposer/CometChatMessageComposer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ let recordedTime = 0, timerIntervalId = null;
236236
export interface MessageComposerStyleInterface extends BaseStyle {
237237
attachIconTint?: string;
238238
sendIconTint?: string;
239+
voiceRecordingIconTint?: string;
239240
inputBackground?: string;
240241
inputBorder?: BorderStyleInterface;
241242
dividerTint?: string;
@@ -1210,7 +1211,10 @@ export const CometChatMessageComposer = React.forwardRef(
12101211
const RecordAudioButtonView = () => {
12111212
return <ImageButton
12121213
image={voiceRecordingIconURL || ICONS.MICROPHONE}
1213-
imageStyle={Style.imageStyle}
1214+
imageStyle={[
1215+
Style.imageStyle,
1216+
messageComposerStyle?.voiceRecordingIconTint ? { tintColor: messageComposerStyle?.voiceRecordingIconTint } : {},
1217+
]}
12141218
onClick={() => setShowRecordAudio(true)}
12151219
/>
12161220
}
@@ -1228,7 +1232,7 @@ export const CometChatMessageComposer = React.forwardRef(
12281232
//fetch logged in user
12291233
useEffect(() => {
12301234
CometChat.getLoggedinUser().then((user: any) => (loggedInUser.current = user));
1231-
let _formatter = [...(textFormatters || [])] || [];
1235+
let _formatter = [...(textFormatters ?? [])];
12321236

12331237
if (!disableMentions) {
12341238
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1-
import { CometChatMessageInformationInterface } from "./CometChatMessageInformation";
1+
import { CometChatMessageInformationInterface } from './CometChatMessageInformation';
22

3-
export interface MessageInformationConfigurationInterface extends
4-
Omit<CometChatMessageInformationInterface,
5-
'title' |
6-
'message' |
7-
'template' |
8-
'bubbleView' |
9-
'receiptDatePattern' |
10-
'readIcon' |
11-
'sentIcon' |
12-
'deliveredIcon'
13-
> {}
3+
// Interface/Class merging: Class and Interface name should be the same. (below)
4+
// Add a second interface for typing (if needed elsewhere)
5+
// To avoid listing all properties individually in the class
6+
export interface CometChatMessageInformationConfiguration
7+
extends Omit<
8+
CometChatMessageInformationInterface,
9+
| 'title'
10+
| 'message'
11+
| 'template'
12+
| 'BubbleView'
13+
| 'receiptDatePattern'
14+
| 'readIcon'
15+
| 'sentIcon'
16+
| 'deliveredIcon'
17+
> {}
18+
19+
export interface CometChatMessageInformationConfigurationInterface
20+
extends CometChatMessageInformationConfiguration {}
21+
22+
// Class name same as interface
23+
export class CometChatMessageInformationConfiguration {
24+
constructor(props: CometChatMessageInformationConfigurationInterface) {
25+
if (props) {
26+
for (const [key, value] of Object.entries(props)) {
27+
//@ts-ignore - Ignore dynamic property assignment type checks
28+
this[key] = value;
29+
}
30+
}
31+
}
32+
}

src/CometChatMessageInformation/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ import {
22
CometChatMessageInformation,
33
CometChatMessageInformationInterface,
44
} from "./CometChatMessageInformation";
5-
import { MessageInformationConfigurationInterface } from "./MessageInformationConfiguration";
5+
import {
6+
CometChatMessageInformationConfigurationInterface,
7+
CometChatMessageInformationConfiguration
8+
} from "./MessageInformationConfiguration";
69
import { MessageInformationStyleInterface } from "./MessageInformationStyle";
710

8-
export { CometChatMessageInformation };
11+
export { CometChatMessageInformation, CometChatMessageInformationConfiguration };
912
export type {
1013
CometChatMessageInformationInterface,
11-
MessageInformationConfigurationInterface,
14+
CometChatMessageInformationConfigurationInterface,
1215
MessageInformationStyleInterface,
1316
};

0 commit comments

Comments
 (0)