@sendbird/uikit-react-native 3.7.1 → 3.7.3
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/lib/commonjs/components/ChannelMessageList/index.js +2 -3
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
- package/lib/commonjs/components/ChannelThreadMessageList/index.js +2 -3
- package/lib/commonjs/components/ChannelThreadMessageList/index.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js +2 -2
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +2 -2
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.js +2 -2
- package/lib/commonjs/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.js.map +1 -1
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js +2 -2
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/ThreadParentMessageRenderer/index.js +2 -2
- package/lib/commonjs/components/ThreadParentMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +10 -2
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/SBUHandlersCtx.js +25 -0
- package/lib/commonjs/contexts/SBUHandlersCtx.js.map +1 -0
- package/lib/commonjs/domain/groupChannelThread/component/GroupChannelThreadParentMessageInfo.js +2 -3
- package/lib/commonjs/domain/groupChannelThread/component/GroupChannelThreadParentMessageInfo.js.map +1 -1
- package/lib/commonjs/hooks/useContext.js +8 -1
- package/lib/commonjs/hooks/useContext.js.map +1 -1
- package/lib/commonjs/hooks/usePushTokenRegistration.js +10 -7
- package/lib/commonjs/hooks/usePushTokenRegistration.js.map +1 -1
- package/lib/commonjs/localization/StringSet.en.js +2 -3
- package/lib/commonjs/localization/StringSet.en.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +3 -4
- package/lib/module/components/ChannelMessageList/index.js.map +1 -1
- package/lib/module/components/ChannelThreadMessageList/index.js +3 -4
- package/lib/module/components/ChannelThreadMessageList/index.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/index.js +3 -3
- package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.js +1 -1
- package/lib/module/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.js.map +1 -1
- package/lib/module/components/OpenChannelMessageRenderer/index.js +3 -3
- package/lib/module/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/ThreadParentMessageRenderer/index.js +3 -3
- package/lib/module/components/ThreadParentMessageRenderer/index.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +10 -2
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/SBUHandlersCtx.js +16 -0
- package/lib/module/contexts/SBUHandlersCtx.js.map +1 -0
- package/lib/module/domain/groupChannelThread/component/GroupChannelThreadParentMessageInfo.js +3 -4
- package/lib/module/domain/groupChannelThread/component/GroupChannelThreadParentMessageInfo.js.map +1 -1
- package/lib/module/hooks/useContext.js +6 -0
- package/lib/module/hooks/useContext.js.map +1 -1
- package/lib/module/hooks/usePushTokenRegistration.js +10 -7
- package/lib/module/hooks/usePushTokenRegistration.js.map +1 -1
- package/lib/module/localization/StringSet.en.js +2 -2
- package/lib/module/localization/StringSet.en.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +3 -1
- package/lib/typescript/src/contexts/SBUHandlersCtx.d.ts +21 -0
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelThread/component/GroupChannelThreadInput.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelThread/component/GroupChannelThreadMessageList.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelMessageList.d.ts +1 -1
- package/lib/typescript/src/hooks/useContext.d.ts +1 -0
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/components/ChannelMessageList/index.tsx +9 -4
- package/src/components/ChannelThreadMessageList/index.tsx +9 -4
- package/src/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.tsx +1 -1
- package/src/components/GroupChannelMessageRenderer/index.tsx +3 -3
- package/src/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.tsx +1 -1
- package/src/components/OpenChannelMessageRenderer/index.tsx +3 -3
- package/src/components/ThreadParentMessageRenderer/index.tsx +3 -3
- package/src/containers/SendbirdUIKitContainer.tsx +89 -77
- package/src/contexts/SBUHandlersCtx.tsx +27 -0
- package/src/domain/groupChannelThread/component/GroupChannelThreadParentMessageInfo.tsx +3 -4
- package/src/hooks/useContext.ts +7 -0
- package/src/hooks/usePushTokenRegistration.ts +10 -7
- package/src/localization/StringSet.en.ts +2 -2
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.3",
|
|
4
4
|
"description": "Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sendbird",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@openspacelabs/react-native-zoomable-view": "^2.1.5",
|
|
63
|
-
"@sendbird/uikit-chat-hooks": "3.7.
|
|
64
|
-
"@sendbird/uikit-react-native-foundation": "3.7.
|
|
63
|
+
"@sendbird/uikit-chat-hooks": "3.7.3",
|
|
64
|
+
"@sendbird/uikit-react-native-foundation": "3.7.3",
|
|
65
65
|
"@sendbird/uikit-tools": "0.0.1-alpha.77",
|
|
66
|
-
"@sendbird/uikit-utils": "3.7.
|
|
66
|
+
"@sendbird/uikit-utils": "3.7.3"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@bam.tech/react-native-image-resizer": "^3.0.4",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@react-native-firebase/messaging": "^14.4.0",
|
|
76
76
|
"@types/react": "*",
|
|
77
77
|
"@types/react-native": "*",
|
|
78
|
-
"date-fns": "
|
|
78
|
+
"date-fns": ">=2.28.0",
|
|
79
79
|
"expo-av": "^13.2.1",
|
|
80
80
|
"expo-clipboard": "^4.1.2",
|
|
81
81
|
"expo-document-picker": "^11.5.3",
|
|
@@ -208,5 +208,5 @@
|
|
|
208
208
|
]
|
|
209
209
|
]
|
|
210
210
|
},
|
|
211
|
-
"gitHead": "
|
|
211
|
+
"gitHead": "c6efa80d5e1859100d6cb02c239f0a2c45eec860"
|
|
212
212
|
}
|
|
@@ -30,8 +30,13 @@ import {
|
|
|
30
30
|
} from '@sendbird/uikit-utils';
|
|
31
31
|
|
|
32
32
|
import type { UserProfileContextType } from '../../contexts/UserProfileCtx';
|
|
33
|
-
import {
|
|
34
|
-
|
|
33
|
+
import {
|
|
34
|
+
useLocalization,
|
|
35
|
+
usePlatformService,
|
|
36
|
+
useSBUHandlers,
|
|
37
|
+
useSendbirdChat,
|
|
38
|
+
useUserProfile,
|
|
39
|
+
} from '../../hooks/useContext';
|
|
35
40
|
import ChatFlatList from '../ChatFlatList';
|
|
36
41
|
import { ReactionAddons } from '../ReactionAddons';
|
|
37
42
|
|
|
@@ -216,6 +221,7 @@ const useCreateMessagePressActions = <T extends SendbirdGroupChannel | SendbirdO
|
|
|
216
221
|
| 'onResendFailedMessage'
|
|
217
222
|
| 'onPressMediaMessage'
|
|
218
223
|
>): CreateMessagePressActions => {
|
|
224
|
+
const handlers = useSBUHandlers();
|
|
219
225
|
const { colors } = useUIKitTheme();
|
|
220
226
|
const { STRINGS } = useLocalization();
|
|
221
227
|
const toast = useToast();
|
|
@@ -265,9 +271,8 @@ const useCreateMessagePressActions = <T extends SendbirdGroupChannel | SendbirdO
|
|
|
265
271
|
const fileType = getFileType(message.type || getFileExtension(message.name));
|
|
266
272
|
if (['image', 'video', 'audio'].includes(fileType)) {
|
|
267
273
|
onPressMediaMessage?.(message, () => onDeleteMessage(message), getAvailableUriFromFileMessage(message));
|
|
268
|
-
} else {
|
|
269
|
-
SBUUtils.openURL(message.url);
|
|
270
274
|
}
|
|
275
|
+
handlers.onOpenFileURL(message.url);
|
|
271
276
|
}
|
|
272
277
|
};
|
|
273
278
|
|
|
@@ -30,8 +30,13 @@ import {
|
|
|
30
30
|
} from '@sendbird/uikit-utils';
|
|
31
31
|
|
|
32
32
|
import type { UserProfileContextType } from '../../contexts/UserProfileCtx';
|
|
33
|
-
import {
|
|
34
|
-
|
|
33
|
+
import {
|
|
34
|
+
useLocalization,
|
|
35
|
+
usePlatformService,
|
|
36
|
+
useSBUHandlers,
|
|
37
|
+
useSendbirdChat,
|
|
38
|
+
useUserProfile,
|
|
39
|
+
} from '../../hooks/useContext';
|
|
35
40
|
import { ReactionAddons } from '../ReactionAddons';
|
|
36
41
|
import ThreadChatFlatList from '../ThreadChatFlatList';
|
|
37
42
|
|
|
@@ -194,6 +199,7 @@ const useCreateMessagePressActions = <T extends SendbirdGroupChannel | SendbirdO
|
|
|
194
199
|
ChannelThreadMessageListProps<T>,
|
|
195
200
|
'channel' | 'currentUserId' | 'onEditMessage' | 'onDeleteMessage' | 'onResendFailedMessage' | 'onPressMediaMessage'
|
|
196
201
|
>): CreateMessagePressActions => {
|
|
202
|
+
const handlers = useSBUHandlers();
|
|
197
203
|
const { colors } = useUIKitTheme();
|
|
198
204
|
const { STRINGS } = useLocalization();
|
|
199
205
|
const toast = useToast();
|
|
@@ -243,9 +249,8 @@ const useCreateMessagePressActions = <T extends SendbirdGroupChannel | SendbirdO
|
|
|
243
249
|
const fileType = getFileType(message.type || getFileExtension(message.name));
|
|
244
250
|
if (['image', 'video', 'audio'].includes(fileType)) {
|
|
245
251
|
onPressMediaMessage?.(message, () => onDeleteMessage(message), getAvailableUriFromFileMessage(message));
|
|
246
|
-
} else {
|
|
247
|
-
SBUUtils.openURL(message.url);
|
|
248
252
|
}
|
|
253
|
+
handlers.onOpenFileURL(message.url);
|
|
249
254
|
}
|
|
250
255
|
};
|
|
251
256
|
|
|
@@ -25,8 +25,7 @@ import {
|
|
|
25
25
|
import { VOICE_MESSAGE_META_ARRAY_DURATION_KEY } from '../../constants';
|
|
26
26
|
import { GroupChannelContexts } from '../../domain/groupChannel/module/moduleContext';
|
|
27
27
|
import type { GroupChannelProps } from '../../domain/groupChannel/types';
|
|
28
|
-
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
29
|
-
import SBUUtils from '../../libs/SBUUtils';
|
|
28
|
+
import { useLocalization, usePlatformService, useSBUHandlers, useSendbirdChat } from '../../hooks/useContext';
|
|
30
29
|
import { TypingIndicatorType } from '../../types';
|
|
31
30
|
import { ReactionAddons } from '../ReactionAddons';
|
|
32
31
|
import GroupChannelMessageDateSeparator from './GroupChannelMessageDateSeparator';
|
|
@@ -49,6 +48,7 @@ const GroupChannelMessageRenderer: GroupChannelProps['Fragment']['renderMessage'
|
|
|
49
48
|
nextMessage,
|
|
50
49
|
hideParentMessage,
|
|
51
50
|
}) => {
|
|
51
|
+
const handlers = useSBUHandlers();
|
|
52
52
|
const playerUnsubscribes = useRef<(() => void)[]>([]);
|
|
53
53
|
const { palette } = useUIKitTheme();
|
|
54
54
|
const { sbOptions, currentUser, mentionManager, voiceMessageStatusManager } = useSendbirdChat();
|
|
@@ -98,7 +98,7 @@ const GroupChannelMessageRenderer: GroupChannelProps['Fragment']['renderMessage'
|
|
|
98
98
|
variant,
|
|
99
99
|
onPress,
|
|
100
100
|
onLongPress,
|
|
101
|
-
onPressURL: (url) =>
|
|
101
|
+
onPressURL: (url) => handlers.onOpenURL(url),
|
|
102
102
|
onPressAvatar: () => {
|
|
103
103
|
if ('sender' in message) onShowUserProfile?.(message.sender);
|
|
104
104
|
},
|
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
} from '@sendbird/uikit-utils';
|
|
13
13
|
|
|
14
14
|
import type { OpenChannelProps } from '../../domain/openChannel/types';
|
|
15
|
-
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
16
|
-
import SBUUtils from '../../libs/SBUUtils';
|
|
15
|
+
import { useLocalization, usePlatformService, useSBUHandlers, useSendbirdChat } from '../../hooks/useContext';
|
|
17
16
|
import OpenChannelMessageDateSeparator from './OpenChannelMessageDateSeparator';
|
|
18
17
|
|
|
19
18
|
const OpenChannelMessageRenderer: OpenChannelProps['Fragment']['renderMessage'] = ({
|
|
@@ -26,6 +25,7 @@ const OpenChannelMessageRenderer: OpenChannelProps['Fragment']['renderMessage']
|
|
|
26
25
|
prevMessage,
|
|
27
26
|
nextMessage,
|
|
28
27
|
}) => {
|
|
28
|
+
const handlers = useSBUHandlers();
|
|
29
29
|
const { sbOptions } = useSendbirdChat();
|
|
30
30
|
const { STRINGS } = useLocalization();
|
|
31
31
|
const { mediaService } = usePlatformService();
|
|
@@ -35,7 +35,7 @@ const OpenChannelMessageRenderer: OpenChannelProps['Fragment']['renderMessage']
|
|
|
35
35
|
channel,
|
|
36
36
|
onPress,
|
|
37
37
|
onLongPress,
|
|
38
|
-
onPressURL: (url) =>
|
|
38
|
+
onPressURL: (url) => handlers.onOpenURL(url),
|
|
39
39
|
onPressAvatar: () => 'sender' in message && onShowUserProfile?.(message.sender, { hideMessageButton: true }),
|
|
40
40
|
grouped: groupWithPrev,
|
|
41
41
|
strings: {
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
} from '@sendbird/uikit-utils';
|
|
12
12
|
|
|
13
13
|
import { VOICE_MESSAGE_META_ARRAY_DURATION_KEY } from '../../constants';
|
|
14
|
-
import
|
|
15
|
-
import { usePlatformService, useSendbirdChat } from './../../hooks/useContext';
|
|
14
|
+
import { usePlatformService, useSBUHandlers, useSendbirdChat } from './../../hooks/useContext';
|
|
16
15
|
import ThreadParentMessageFile from './ThreadParentMessage.file';
|
|
17
16
|
import ThreadParentMessageFileImage from './ThreadParentMessage.file.image';
|
|
18
17
|
import ThreadParentMessageFileVideo from './ThreadParentMessage.file.video';
|
|
@@ -33,6 +32,7 @@ export type ThreadParentMessageRendererProps<AdditionalProps = unknown> = {
|
|
|
33
32
|
} & AdditionalProps;
|
|
34
33
|
|
|
35
34
|
const ThreadParentMessageRenderer = (props: ThreadParentMessageRendererProps) => {
|
|
35
|
+
const handlers = useSBUHandlers();
|
|
36
36
|
const playerUnsubscribes = useRef<(() => void)[]>([]);
|
|
37
37
|
const { sbOptions, currentUser, mentionManager } = useSendbirdChat();
|
|
38
38
|
const { palette } = useUIKitTheme();
|
|
@@ -50,7 +50,7 @@ const ThreadParentMessageRenderer = (props: ThreadParentMessageRendererProps) =>
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const messageProps: ThreadParentMessageRendererProps = {
|
|
53
|
-
onPressURL: (url) =>
|
|
53
|
+
onPressURL: (url) => handlers.onOpenURL(url),
|
|
54
54
|
onToggleVoiceMessage: async (state, setState) => {
|
|
55
55
|
if (isVoiceMessage(parentMessage) && parentMessage.sendingStatus === 'succeeded') {
|
|
56
56
|
if (playerService.uri === parentMessage.url) {
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';
|
|
33
33
|
import { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';
|
|
34
34
|
import { ReactionProvider } from '../contexts/ReactionCtx';
|
|
35
|
+
import { type SBUHandlers, SBUHandlersProvider } from '../contexts/SBUHandlersCtx';
|
|
35
36
|
import type { ChatRelatedFeaturesInUIKit } from '../contexts/SendbirdChatCtx';
|
|
36
37
|
import { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';
|
|
37
38
|
import { UserProfileProvider } from '../contexts/UserProfileCtx';
|
|
@@ -41,6 +42,7 @@ import ImageCompressionConfig from '../libs/ImageCompressionConfig';
|
|
|
41
42
|
import InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';
|
|
42
43
|
import MentionConfig, { MentionConfigInterface } from '../libs/MentionConfig';
|
|
43
44
|
import MentionManager from '../libs/MentionManager';
|
|
45
|
+
import SBUUtils from '../libs/SBUUtils';
|
|
44
46
|
import VoiceMessageConfig, { VoiceMessageConfigInterface } from '../libs/VoiceMessageConfig';
|
|
45
47
|
import VoiceMessageStatusManager from '../libs/VoiceMessageStatusManager';
|
|
46
48
|
import StringSetEn from '../localization/StringSet.en';
|
|
@@ -131,6 +133,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
131
133
|
onError?: (props: ErrorBoundaryProps) => void;
|
|
132
134
|
ErrorInfoComponent?: (props: ErrorBoundaryProps) => React.ReactNode;
|
|
133
135
|
};
|
|
136
|
+
handlers?: Partial<SBUHandlers>;
|
|
134
137
|
toast?: {
|
|
135
138
|
dismissTimeout?: number;
|
|
136
139
|
};
|
|
@@ -159,6 +162,7 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
|
|
|
159
162
|
localization,
|
|
160
163
|
styles,
|
|
161
164
|
errorBoundary,
|
|
165
|
+
handlers,
|
|
162
166
|
toast,
|
|
163
167
|
userProfile,
|
|
164
168
|
reaction,
|
|
@@ -213,85 +217,93 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
|
|
|
213
217
|
}
|
|
214
218
|
};
|
|
215
219
|
|
|
220
|
+
const sbuHandlers: SBUHandlers = {
|
|
221
|
+
onOpenURL: SBUUtils.openURL,
|
|
222
|
+
onOpenFileURL: SBUUtils.openURL,
|
|
223
|
+
...handlers,
|
|
224
|
+
};
|
|
225
|
+
|
|
216
226
|
return (
|
|
217
|
-
<
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
<SendbirdChatProvider
|
|
233
|
-
sdkInstance={sdkInstance}
|
|
234
|
-
emojiManager={emojiManager}
|
|
235
|
-
mentionManager={mentionManager}
|
|
236
|
-
imageCompressionConfig={imageCompressionConfig}
|
|
237
|
-
voiceMessageConfig={voiceMessageConfig}
|
|
238
|
-
voiceMessageStatusManager={voiceMessageStatusManager}
|
|
239
|
-
enableAutoPushTokenRegistration={
|
|
240
|
-
chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION
|
|
241
|
-
}
|
|
242
|
-
enableUseUserIdForNickname={
|
|
243
|
-
chatOptions.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME
|
|
244
|
-
}
|
|
245
|
-
enableImageCompression={chatOptions.enableImageCompression ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION}
|
|
227
|
+
<SBUHandlersProvider {...sbuHandlers}>
|
|
228
|
+
<SafeAreaProvider>
|
|
229
|
+
<UIKitConfigProvider
|
|
230
|
+
storage={internalStorage}
|
|
231
|
+
localConfigs={{
|
|
232
|
+
common: uikitOptions?.common,
|
|
233
|
+
groupChannel: {
|
|
234
|
+
channel: { ...uikitOptions?.groupChannel, enableReactionsSupergroup: undefined },
|
|
235
|
+
channelList: uikitOptions?.groupChannelList,
|
|
236
|
+
setting: uikitOptions?.groupChannelSettings,
|
|
237
|
+
},
|
|
238
|
+
openChannel: {
|
|
239
|
+
channel: uikitOptions?.openChannel,
|
|
240
|
+
},
|
|
241
|
+
}}
|
|
246
242
|
>
|
|
247
|
-
<
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
243
|
+
<SendbirdChatProvider
|
|
244
|
+
sdkInstance={sdkInstance}
|
|
245
|
+
emojiManager={emojiManager}
|
|
246
|
+
mentionManager={mentionManager}
|
|
247
|
+
imageCompressionConfig={imageCompressionConfig}
|
|
248
|
+
voiceMessageConfig={voiceMessageConfig}
|
|
249
|
+
voiceMessageStatusManager={voiceMessageStatusManager}
|
|
250
|
+
enableAutoPushTokenRegistration={
|
|
251
|
+
chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION
|
|
252
|
+
}
|
|
253
|
+
enableUseUserIdForNickname={
|
|
254
|
+
chatOptions.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME
|
|
255
|
+
}
|
|
256
|
+
enableImageCompression={chatOptions.enableImageCompression ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION}
|
|
257
|
+
>
|
|
258
|
+
<LocalizationProvider stringSet={defaultStringSet}>
|
|
259
|
+
<PlatformServiceProvider
|
|
260
|
+
fileService={platformServices.file}
|
|
261
|
+
notificationService={platformServices.notification}
|
|
262
|
+
clipboardService={platformServices.clipboard}
|
|
263
|
+
mediaService={platformServices.media}
|
|
264
|
+
playerService={platformServices.player}
|
|
265
|
+
recorderService={platformServices.recorder}
|
|
266
|
+
voiceMessageConfig={voiceMessageConfig}
|
|
267
|
+
>
|
|
268
|
+
<UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>
|
|
269
|
+
<HeaderStyleProvider
|
|
270
|
+
HeaderComponent={styles?.HeaderComponent ?? Header}
|
|
271
|
+
defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}
|
|
272
|
+
statusBarTranslucent={styles?.statusBarTranslucent ?? true}
|
|
273
|
+
>
|
|
274
|
+
<ToastProvider dismissTimeout={toast?.dismissTimeout}>
|
|
275
|
+
<UserProfileProvider {...userProfile} statusBarTranslucent={styles?.statusBarTranslucent ?? true}>
|
|
276
|
+
<ReactionProvider {...reaction}>
|
|
277
|
+
<LocalizationContext.Consumer>
|
|
278
|
+
{(value) => {
|
|
279
|
+
const STRINGS = value?.STRINGS || defaultStringSet;
|
|
280
|
+
return (
|
|
281
|
+
<DialogProvider
|
|
282
|
+
defaultLabels={{
|
|
283
|
+
alert: { ok: STRINGS.DIALOG.ALERT_DEFAULT_OK },
|
|
284
|
+
prompt: {
|
|
285
|
+
ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,
|
|
286
|
+
cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,
|
|
287
|
+
placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,
|
|
288
|
+
},
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
{renderChildren()}
|
|
292
|
+
</DialogProvider>
|
|
293
|
+
);
|
|
294
|
+
}}
|
|
295
|
+
</LocalizationContext.Consumer>
|
|
296
|
+
</ReactionProvider>
|
|
297
|
+
</UserProfileProvider>
|
|
298
|
+
</ToastProvider>
|
|
299
|
+
</HeaderStyleProvider>
|
|
300
|
+
</UIKitThemeProvider>
|
|
301
|
+
</PlatformServiceProvider>
|
|
302
|
+
</LocalizationProvider>
|
|
303
|
+
</SendbirdChatProvider>
|
|
304
|
+
</UIKitConfigProvider>
|
|
305
|
+
</SafeAreaProvider>
|
|
306
|
+
</SBUHandlersProvider>
|
|
295
307
|
);
|
|
296
308
|
};
|
|
297
309
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface SBUHandlers {
|
|
4
|
+
/**
|
|
5
|
+
* Callback function to handle opening a URL.
|
|
6
|
+
* This is triggered when a URL needs to be opened.
|
|
7
|
+
*/
|
|
8
|
+
onOpenURL: (url: string) => void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Callback function to handle opening a file URL.
|
|
12
|
+
* This is triggered when a file URL needs to be opened.
|
|
13
|
+
*
|
|
14
|
+
* Note that this function is also called redundantly
|
|
15
|
+
* when `onPressMediaMessage` handler is triggered by clicking on media messages containing images, videos, or audio.
|
|
16
|
+
*/
|
|
17
|
+
onOpenFileURL: (url: string) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type Props = React.PropsWithChildren<SBUHandlers>;
|
|
21
|
+
|
|
22
|
+
export type SBUHandlersContextType = SBUHandlers;
|
|
23
|
+
|
|
24
|
+
export const SBUHandlersContext = React.createContext<SBUHandlersContextType | null>(null);
|
|
25
|
+
export const SBUHandlersProvider = ({ children, onOpenURL, onOpenFileURL }: Props) => {
|
|
26
|
+
return <SBUHandlersContext.Provider value={{ onOpenURL, onOpenFileURL }}>{children}</SBUHandlersContext.Provider>;
|
|
27
|
+
};
|
|
@@ -30,8 +30,7 @@ import {
|
|
|
30
30
|
import ThreadParentMessageRenderer, {
|
|
31
31
|
ThreadParentMessageRendererProps,
|
|
32
32
|
} from '../../../components/ThreadParentMessageRenderer';
|
|
33
|
-
import { useLocalization, usePlatformService, useSendbirdChat } from '../../../hooks/useContext';
|
|
34
|
-
import SBUUtils from '../../../libs/SBUUtils';
|
|
33
|
+
import { useLocalization, usePlatformService, useSBUHandlers, useSendbirdChat } from '../../../hooks/useContext';
|
|
35
34
|
import { GroupChannelThreadContexts } from '../module/moduleContext';
|
|
36
35
|
import type { GroupChannelThreadProps } from '../types';
|
|
37
36
|
import { ReactionAddons } from './../../../components/ReactionAddons';
|
|
@@ -182,6 +181,7 @@ const useCreateMessagePressActions = ({
|
|
|
182
181
|
GroupChannelThreadProps['ParentMessageInfo'],
|
|
183
182
|
'channel' | 'currentUserId' | 'onDeleteMessage' | 'onPressMediaMessage'
|
|
184
183
|
> & { onEditMessage: (message: HandleableMessage) => void }): CreateMessagePressActions => {
|
|
184
|
+
const handlers = useSBUHandlers();
|
|
185
185
|
const { STRINGS } = useLocalization();
|
|
186
186
|
const toast = useToast();
|
|
187
187
|
const { openSheet } = useBottomSheet();
|
|
@@ -225,9 +225,8 @@ const useCreateMessagePressActions = ({
|
|
|
225
225
|
const fileType = getFileType(message.type || getFileExtension(message.name));
|
|
226
226
|
if (['image', 'video', 'audio'].includes(fileType)) {
|
|
227
227
|
onPressMediaMessage?.(message, () => onDeleteMessage?.(message), getAvailableUriFromFileMessage(message));
|
|
228
|
-
} else {
|
|
229
|
-
SBUUtils.openURL(message.url);
|
|
230
228
|
}
|
|
229
|
+
handlers.onOpenFileURL(message.url);
|
|
231
230
|
}
|
|
232
231
|
};
|
|
233
232
|
|
package/src/hooks/useContext.ts
CHANGED
|
@@ -3,9 +3,16 @@ import { useContext } from 'react';
|
|
|
3
3
|
import { LocalizationContext } from '../contexts/LocalizationCtx';
|
|
4
4
|
import { PlatformServiceContext } from '../contexts/PlatformServiceCtx';
|
|
5
5
|
import { ReactionContext } from '../contexts/ReactionCtx';
|
|
6
|
+
import { SBUHandlersContext } from '../contexts/SBUHandlersCtx';
|
|
6
7
|
import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
7
8
|
import { UserProfileContext } from '../contexts/UserProfileCtx';
|
|
8
9
|
|
|
10
|
+
export const useSBUHandlers = () => {
|
|
11
|
+
const value = useContext(SBUHandlersContext);
|
|
12
|
+
if (!value) throw new Error('SBUHandlersContext is not provided');
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
|
|
9
16
|
export const useLocalization = () => {
|
|
10
17
|
const value = useContext(LocalizationContext);
|
|
11
18
|
if (!value) throw new Error('LocalizationContext is not provided');
|
|
@@ -38,24 +38,27 @@ const usePushTokenRegistration = () => {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// Register
|
|
41
|
+
// Register token refresh listener
|
|
42
|
+
refreshListener.current = notificationService.onTokenRefresh(registerToken);
|
|
43
|
+
|
|
44
|
+
// Register token
|
|
42
45
|
const token = await getToken();
|
|
43
46
|
if (token) {
|
|
44
47
|
Logger.log('[usePushTokenRegistration]', 'registered token:', token);
|
|
45
|
-
registerToken(token);
|
|
48
|
+
await registerToken(token);
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
// Remove listener
|
|
49
|
-
refreshListener.current = notificationService.onTokenRefresh(registerToken);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
const unregisterPushTokenForCurrentUser = useFreshCallback(async () => {
|
|
53
|
+
// Unregister token refresh listener
|
|
54
|
+
refreshListener.current?.();
|
|
55
|
+
|
|
56
|
+
// Unregister token
|
|
53
57
|
const token = await getToken();
|
|
54
58
|
if (token) {
|
|
55
|
-
unregisterToken(token);
|
|
59
|
+
await unregisterToken(token);
|
|
56
60
|
Logger.log('[usePushTokenRegistration]', 'unregistered token:', token);
|
|
57
61
|
}
|
|
58
|
-
refreshListener.current?.();
|
|
59
62
|
});
|
|
60
63
|
|
|
61
64
|
return { registerPushTokenForCurrentUser, unregisterPushTokenForCurrentUser };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { enUS } from 'date-fns/locale';
|
|
2
2
|
|
|
3
3
|
import { createBaseStringSet } from './createBaseStringSet';
|
|
4
4
|
|
|
5
|
-
const StringSetEn = createBaseStringSet({ dateLocale });
|
|
5
|
+
const StringSetEn = createBaseStringSet({ dateLocale: enUS });
|
|
6
6
|
|
|
7
7
|
export default StringSetEn;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const VERSION = '3.7.
|
|
1
|
+
const VERSION = '3.7.3';
|
|
2
2
|
export default VERSION;
|