1- import SendbirdChat , { SendbirdError , User } from '@sendbird/chat' ;
1+ import SendbirdChat , { DeviceOsPlatform , SendbirdError , SendbirdPlatform , SendbirdProduct , User } from '@sendbird/chat' ;
22import { OpenChannelModule } from '@sendbird/chat/openChannel' ;
33import { GroupChannelModule } from '@sendbird/chat/groupChannel' ;
44
@@ -80,6 +80,7 @@ export async function setUpConnection({
8080 accessToken,
8181 isUserIdUsedForNickname,
8282 sdkInitParams,
83+ isMobile = false ,
8384} : SetupConnectionTypes ) : Promise < void > {
8485 return new Promise ( ( resolve , reject ) => {
8586 logger ?. info ?.( 'SendbirdProvider | useConnect/setupConnection/init' , { userId, appId } ) ;
@@ -100,6 +101,22 @@ export async function setUpConnection({
100101 }
101102
102103 logger ?. info ?.( 'SendbirdProvider | useConnect/setupConnection/setVersion' , { version : APP_VERSION_STRING } ) ;
104+ /**
105+ * Keep optional chaining to the addSendbirdExtensions
106+ * for supporting the ChatSDK v4.9.5 or less
107+ */
108+ newSdk ?. addSendbirdExtensions ?.(
109+ [
110+ {
111+ product : SendbirdProduct ?. UIKIT_CHAT ?? 'uikit-chat' ,
112+ version : APP_VERSION_STRING ,
113+ platform : SendbirdPlatform ?. JS ?? 'js' ,
114+ } ,
115+ ] ,
116+ isMobile
117+ ? ( DeviceOsPlatform ?. MOBILE_WEB ?? 'mobile_web' )
118+ : ( DeviceOsPlatform ?. WEB ?? 'web' ) ,
119+ ) ;
103120 newSdk . addExtension ( 'sb_uikit' , APP_VERSION_STRING ) ;
104121
105122 const connectCbSucess = async ( user : User ) => {
0 commit comments