@@ -32,6 +32,7 @@ import {
3232import { LocalizationContext , LocalizationProvider } from '../contexts/LocalizationCtx' ;
3333import { PlatformServiceProvider } from '../contexts/PlatformServiceCtx' ;
3434import { ReactionProvider } from '../contexts/ReactionCtx' ;
35+ import { type SBUHandlers , SBUHandlersProvider } from '../contexts/SBUHandlersCtx' ;
3536import type { ChatRelatedFeaturesInUIKit } from '../contexts/SendbirdChatCtx' ;
3637import { SendbirdChatProvider } from '../contexts/SendbirdChatCtx' ;
3738import { UserProfileProvider } from '../contexts/UserProfileCtx' ;
@@ -41,6 +42,7 @@ import ImageCompressionConfig from '../libs/ImageCompressionConfig';
4142import InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage' ;
4243import MentionConfig , { MentionConfigInterface } from '../libs/MentionConfig' ;
4344import MentionManager from '../libs/MentionManager' ;
45+ import SBUUtils from '../libs/SBUUtils' ;
4446import VoiceMessageConfig , { VoiceMessageConfigInterface } from '../libs/VoiceMessageConfig' ;
4547import VoiceMessageStatusManager from '../libs/VoiceMessageStatusManager' ;
4648import StringSetEn from '../localization/StringSet.en' ;
@@ -131,6 +133,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
131133 onError ?: ( props : ErrorBoundaryProps ) => void ;
132134 ErrorInfoComponent ?: ( props : ErrorBoundaryProps ) => React . ReactNode ;
133135 } ;
136+ handlers ?: Partial < SBUHandlers > ;
134137 toast ?: {
135138 dismissTimeout ?: number ;
136139 } ;
@@ -159,6 +162,7 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
159162 localization,
160163 styles,
161164 errorBoundary,
165+ handlers,
162166 toast,
163167 userProfile,
164168 reaction,
@@ -213,85 +217,93 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
213217 }
214218 } ;
215219
220+ const sbuHandlers : SBUHandlers = {
221+ onOpenURL : SBUUtils . openURL ,
222+ onOpenFileURL : SBUUtils . openURL ,
223+ ...handlers ,
224+ } ;
225+
216226 return (
217- < SafeAreaProvider >
218- < UIKitConfigProvider
219- storage = { internalStorage }
220- localConfigs = { {
221- common : uikitOptions ?. common ,
222- groupChannel : {
223- channel : { ...uikitOptions ?. groupChannel , enableReactionsSupergroup : undefined } ,
224- channelList : uikitOptions ?. groupChannelList ,
225- setting : uikitOptions ?. groupChannelSettings ,
226- } ,
227- openChannel : {
228- channel : uikitOptions ?. openChannel ,
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+ } }
246242 >
247- < LocalizationProvider stringSet = { defaultStringSet } >
248- < PlatformServiceProvider
249- fileService = { platformServices . file }
250- notificationService = { platformServices . notification }
251- clipboardService = { platformServices . clipboard }
252- mediaService = { platformServices . media }
253- playerService = { platformServices . player }
254- recorderService = { platformServices . recorder }
255- voiceMessageConfig = { voiceMessageConfig }
256- >
257- < UIKitThemeProvider theme = { styles ?. theme ?? LightUIKitTheme } >
258- < HeaderStyleProvider
259- HeaderComponent = { styles ?. HeaderComponent ?? Header }
260- defaultTitleAlign = { styles ?. defaultHeaderTitleAlign ?? 'left' }
261- statusBarTranslucent = { styles ?. statusBarTranslucent ?? true }
262- >
263- < ToastProvider dismissTimeout = { toast ?. dismissTimeout } >
264- < UserProfileProvider { ...userProfile } statusBarTranslucent = { styles ?. statusBarTranslucent ?? true } >
265- < ReactionProvider { ...reaction } >
266- < LocalizationContext . Consumer >
267- { ( value ) => {
268- const STRINGS = value ?. STRINGS || defaultStringSet ;
269- return (
270- < DialogProvider
271- defaultLabels = { {
272- alert : { ok : STRINGS . DIALOG . ALERT_DEFAULT_OK } ,
273- prompt : {
274- ok : STRINGS . DIALOG . PROMPT_DEFAULT_OK ,
275- cancel : STRINGS . DIALOG . PROMPT_DEFAULT_CANCEL ,
276- placeholder : STRINGS . DIALOG . PROMPT_DEFAULT_PLACEHOLDER ,
277- } ,
278- } }
279- >
280- { renderChildren ( ) }
281- </ DialogProvider >
282- ) ;
283- } }
284- </ LocalizationContext . Consumer >
285- </ ReactionProvider >
286- </ UserProfileProvider >
287- </ ToastProvider >
288- </ HeaderStyleProvider >
289- </ UIKitThemeProvider >
290- </ PlatformServiceProvider >
291- </ LocalizationProvider >
292- </ SendbirdChatProvider >
293- </ UIKitConfigProvider >
294- </ SafeAreaProvider >
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 >
295307 ) ;
296308} ;
297309
0 commit comments