@cometchat/chat-uikit-react-native 4.3.3 → 4.3.4
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/ios/CommonUtil.h +4 -0
- package/ios/CommonUtil.m +27 -0
- package/package.json +1 -1
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
- package/src/CometChatConversations/CometChatConversations.tsx +121 -59
- package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
- package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +554 -52
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
- package/src/CometChatMessageComposer/resources/Info.png +0 -0
- package/src/CometChatMessageComposer/resources/index.ts +3 -1
- package/src/CometChatMessageHeader/listners.ts +0 -2
- package/src/CometChatMessageList/CometChatMessageList.tsx +124 -15
- package/src/CometChatMessageList/MessageListConfiguration.ts +14 -1
- package/src/CometChatMessages/CometChatMessages.tsx +16 -16
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +6 -1
- package/src/calls/CallingExtentionDecorator.tsx +5 -5
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
- package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
- package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
- package/src/extensions/Polls/Polls.tsx +106 -70
- package/src/extensions/Polls/PollsDecorator.tsx +3 -2
- package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
- package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
- package/src/index.ts +21 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +150 -25
- package/src/shared/CometChatUiKit/index.ts +1 -1
- package/src/shared/base/vars.ts +13 -0
- package/src/shared/constants/UIKitConstants.ts +6 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
- package/src/shared/events/CometChatUIEvents.ts +3 -1
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
- package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
- package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
- package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
- package/src/shared/formatters/index.ts +11 -0
- package/src/shared/framework/DataSource.ts +21 -16
- package/src/shared/framework/DataSourceDecorator.tsx +29 -13
- package/src/shared/framework/MessageDataSource.tsx +215 -49
- package/src/shared/helper/useKeyboard.tsx +20 -2
- package/src/shared/index.ts +23 -3
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
- package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
- package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
- package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
- package/src/shared/utils/PermissionUtil.ts +142 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +7 -5
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
- package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
- package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
- package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
- package/src/shared/views/CometChatTextBubble/index.ts +2 -3
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +5 -3
- package/src/shared/views/index.ts +9 -3
- package/src/shared/utils/PermissionUtilIOS.ts +0 -104
|
@@ -9,21 +9,11 @@ export interface TextBubbleStyleInterface extends BaseStyleInterface {
|
|
|
9
9
|
* font style for text
|
|
10
10
|
*/
|
|
11
11
|
textFont?: FontStyle,
|
|
12
|
-
/**
|
|
13
|
-
* font syle for special text
|
|
14
|
-
*/
|
|
15
|
-
linkTextFont?: FontStyle,
|
|
16
|
-
/**
|
|
17
|
-
* color for special text
|
|
18
|
-
*/
|
|
19
|
-
linkTextColor?: string
|
|
20
12
|
}
|
|
21
13
|
|
|
22
14
|
export class TextBubbleStyle extends BaseStyle {
|
|
23
15
|
textColor: string
|
|
24
16
|
textFont: FontStyle
|
|
25
|
-
linkTextFont: FontStyle
|
|
26
|
-
linkTextColor: string
|
|
27
17
|
|
|
28
18
|
constructor({
|
|
29
19
|
width = "auto",
|
|
@@ -33,8 +23,6 @@ export class TextBubbleStyle extends BaseStyle {
|
|
|
33
23
|
borderRadius = 0,
|
|
34
24
|
textColor = "rgb(20, 20, 20)",
|
|
35
25
|
textFont = new FontStyle({fontSize: 17, fontWeight: "400"}),
|
|
36
|
-
linkTextColor = "blue",
|
|
37
|
-
linkTextFont = new FontStyle({fontSize: 17, fontWeight: "400"}),
|
|
38
26
|
}: TextBubbleStyleInterface) {
|
|
39
27
|
super({
|
|
40
28
|
width,
|
|
@@ -45,7 +33,5 @@ export class TextBubbleStyle extends BaseStyle {
|
|
|
45
33
|
});
|
|
46
34
|
this.textColor = textColor;
|
|
47
35
|
this.textFont = new FontStyle({...textFont});
|
|
48
|
-
this.linkTextColor = linkTextColor;
|
|
49
|
-
this.linkTextFont = new FontStyle({...linkTextFont});
|
|
50
36
|
}
|
|
51
37
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {CometChatTextBubble, CometChatTextBubbleInterface
|
|
1
|
+
import { CometChatTextBubble, CometChatTextBubbleInterface } from "./CometChatTextBubble";
|
|
2
2
|
|
|
3
|
-
import {TextBubbleStyle, TextBubbleStyleInterface} from "./TextBubbleStyle";
|
|
3
|
+
import { TextBubbleStyle, TextBubbleStyleInterface } from "./TextBubbleStyle";
|
|
4
4
|
|
|
5
5
|
export {
|
|
6
|
-
FormatTextForLinks,
|
|
7
6
|
CometChatTextBubble,
|
|
8
7
|
CometChatTextBubbleInterface,
|
|
9
8
|
TextBubbleStyle,
|
|
@@ -133,7 +133,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
const handleTouchEnd = () => {
|
|
136
|
-
|
|
136
|
+
if (pressTime.current === null && Platform.OS === "ios") return;
|
|
137
137
|
const endTime = Date.now();
|
|
138
138
|
const pressDuration = endTime - pressTime.current;
|
|
139
139
|
if (pressDuration < 500) {
|
|
@@ -142,7 +142,9 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
const onTouchMove = () => {
|
|
145
|
-
|
|
145
|
+
if (Platform.OS === "ios") {
|
|
146
|
+
pressTime.current = null;
|
|
147
|
+
}
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
return (
|
|
@@ -169,7 +171,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
169
171
|
<View
|
|
170
172
|
onTouchStart={handleTouchStart}
|
|
171
173
|
onTouchEnd={handleTouchEnd}
|
|
172
|
-
|
|
174
|
+
onTouchMove={onTouchMove}
|
|
173
175
|
style={[Style.playIconPosition, { backgroundColor: playIconBackgroundColor, borderRadius }]}>
|
|
174
176
|
{isLoading ? <ActivityIndicator size={"small"} color={playIconTint} />
|
|
175
177
|
: <Image source={playIcon || defaultPlayIcon} style={{ tintColor: playIconTint }} />
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
CometChatTextBubbleInterface,
|
|
17
17
|
TextBubbleStyle,
|
|
18
18
|
TextBubbleStyleInterface,
|
|
19
|
-
FormatTextForLinks,
|
|
20
19
|
} from './CometChatTextBubble';
|
|
21
20
|
import {
|
|
22
21
|
CometChatImageBubble,
|
|
@@ -94,6 +93,8 @@ import { CometChatQuickReactions, CometChatQuickReactionsInterface, QuickReactio
|
|
|
94
93
|
|
|
95
94
|
import { CometChatEmojiKeyboard, EmojiKeyboardConfiguration, EmojiKeyboardStyle } from './CometChatEmojiKeyboard';
|
|
96
95
|
|
|
96
|
+
import { CometChatSuggestionList, CometChatSuggestionListInterface, SuggestionItem, SuggestionListConfiguration, SuggestionListConfigurationInterface } from './CometChatSuggestionList';
|
|
97
|
+
|
|
97
98
|
export {
|
|
98
99
|
CometChatMessageInputStyleInterface,
|
|
99
100
|
CometChatMessageInputInterface,
|
|
@@ -109,7 +110,6 @@ export {
|
|
|
109
110
|
BadgeConfigurationInterface,
|
|
110
111
|
BadgeStyleInterface,
|
|
111
112
|
AvatarConfigurationInterface,
|
|
112
|
-
FormatTextForLinks,
|
|
113
113
|
ActionItemInterface,
|
|
114
114
|
ActionSheetStylesInterface,
|
|
115
115
|
CometChatConfirmDialogInterface,
|
|
@@ -198,5 +198,11 @@ export {
|
|
|
198
198
|
EmojiKeyboardStyle,
|
|
199
199
|
|
|
200
200
|
CometChatSchedulerBubble,
|
|
201
|
-
CometChatSchedulerBubbleInterface
|
|
201
|
+
CometChatSchedulerBubbleInterface,
|
|
202
|
+
|
|
203
|
+
CometChatSuggestionList,
|
|
204
|
+
CometChatSuggestionListInterface,
|
|
205
|
+
SuggestionItem,
|
|
206
|
+
SuggestionListConfiguration,
|
|
207
|
+
SuggestionListConfigurationInterface,
|
|
202
208
|
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Alert, Linking, NativeModules, Platform } from 'react-native';
|
|
2
|
-
import { localize } from '../../shared/resources/CometChatLocalize/CometChatLocalize';
|
|
3
|
-
const { FileManager } = NativeModules;
|
|
4
|
-
|
|
5
|
-
let instance: PermissionUtilIOS;
|
|
6
|
-
const permissionStatus = {
|
|
7
|
-
'Not Determined': 0,
|
|
8
|
-
'Restricted': 1,
|
|
9
|
-
'Denied': 2,
|
|
10
|
-
'Authorized': 3,
|
|
11
|
-
'Unknown': -1,
|
|
12
|
-
} as const;
|
|
13
|
-
|
|
14
|
-
const permissibleResources = ['camera', 'mic'] as const;
|
|
15
|
-
type TPermissibleResources = (typeof permissibleResources)[number];
|
|
16
|
-
|
|
17
|
-
type ValueOf<T> = T[keyof T];
|
|
18
|
-
type TPermissionStatus = ValueOf<typeof permissionStatus>;
|
|
19
|
-
|
|
20
|
-
const permissionStore: Record<TPermissibleResources, TPermissionStatus> = {
|
|
21
|
-
camera: permissionStatus.Unknown,
|
|
22
|
-
mic: permissionStatus.Unknown,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
class PermissionUtilIOS {
|
|
26
|
-
status = permissionStatus;
|
|
27
|
-
constructor() {
|
|
28
|
-
if (instance) {
|
|
29
|
-
throw new Error('New instance cannot be created!!');
|
|
30
|
-
}
|
|
31
|
-
instance = this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async init() {
|
|
35
|
-
try {
|
|
36
|
-
const res: Record<TPermissibleResources, TPermissionStatus> =
|
|
37
|
-
await FileManager.checkResourcesPermission(['mic', 'camera']);
|
|
38
|
-
for (const resourceType in res) {
|
|
39
|
-
permissionStore[resourceType as TPermissibleResources] =
|
|
40
|
-
res[resourceType as TPermissibleResources];
|
|
41
|
-
}
|
|
42
|
-
permissionStore.camera = res.camera;
|
|
43
|
-
permissionStore.mic = res.mic;
|
|
44
|
-
return true;
|
|
45
|
-
} catch (error: any) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async get(resources: TPermissibleResources[]) {
|
|
51
|
-
return resources.map((resource) => {
|
|
52
|
-
if (!permissibleResources.includes(resource)) {
|
|
53
|
-
throw new Error('Invalid resource type');
|
|
54
|
-
}
|
|
55
|
-
return permissionStore[resource];
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async request(resources: TPermissibleResources[]) {
|
|
60
|
-
for (const resource of resources) {
|
|
61
|
-
if (!permissibleResources.includes(resource)) {
|
|
62
|
-
throw new Error('Invalid resource type');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const res: Record<TPermissibleResources, TPermissionStatus> =
|
|
66
|
-
await FileManager.requestResourcesPermission(resources);
|
|
67
|
-
for (const resourceType in res) {
|
|
68
|
-
permissionStore[resourceType as TPermissibleResources] =
|
|
69
|
-
res[resourceType as TPermissibleResources];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async startResourceBasedTask(resources: TPermissibleResources[]) {
|
|
74
|
-
if (Platform.OS === 'ios') {
|
|
75
|
-
const resourcePermStatuses = await this.get(resources);
|
|
76
|
-
for (let i = 0; i < resourcePermStatuses.length; i++) {
|
|
77
|
-
const resourcePermStatus = resourcePermStatuses[i];
|
|
78
|
-
if (resourcePermStatus === this.status['Not Determined']) {
|
|
79
|
-
await this.request([resources[i]]);
|
|
80
|
-
[resourcePermStatuses[i]] = await this.get([resources[i]]);
|
|
81
|
-
}
|
|
82
|
-
if (resourcePermStatuses[i] === this.status.Denied) {
|
|
83
|
-
Alert.alert(localize('RESOURCE_PERMISSION_REQUIRED'), undefined, [
|
|
84
|
-
{
|
|
85
|
-
style: 'cancel',
|
|
86
|
-
text: localize('CANCEL'),
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
style: 'default',
|
|
90
|
-
text: localize('SETTINGS'),
|
|
91
|
-
onPress: () => {
|
|
92
|
-
Linking.openSettings();
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
]);
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export const permissionUtilIOS = Object.freeze(new PermissionUtilIOS());
|