@sendbird/uikit-react-native 2.2.0 → 2.3.0
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/README.md +42 -17
- package/lib/commonjs/components/FileViewer.js +2 -5
- package/lib/commonjs/components/FileViewer.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js +1 -6
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js +2 -2
- package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +5 -3
- package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +14 -3
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChatCtx.js +10 -14
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +68 -13
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js +1 -0
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +3 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +2 -2
- package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +4 -14
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardStatus.js +13 -9
- package/lib/commonjs/hooks/useKeyboardStatus.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/libs/ImageCompressionConfig.js +38 -0
- package/lib/commonjs/libs/ImageCompressionConfig.js.map +1 -0
- package/lib/commonjs/libs/SBUUtils.js +27 -0
- package/lib/commonjs/libs/SBUUtils.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js +3 -0
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.expo.js +35 -1
- package/lib/commonjs/platform/createMediaService.expo.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.native.js +41 -6
- package/lib/commonjs/platform/createMediaService.native.js.map +1 -1
- package/lib/commonjs/platform/dynamicModule.js +9 -57
- package/lib/commonjs/platform/dynamicModule.js.map +1 -1
- package/lib/commonjs/platform/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/FileViewer.js +2 -5
- package/lib/module/components/FileViewer.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/FileMessage/index.js +1 -5
- package/lib/module/components/MessageRenderer/FileMessage/index.js.map +1 -1
- package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js +2 -2
- package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
- package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +4 -4
- package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +13 -3
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/module/contexts/SendbirdChatCtx.js +12 -14
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +69 -14
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js +1 -0
- package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +3 -2
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/module/moduleContext.js +2 -2
- package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +5 -9
- package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/module/hooks/useKeyboardStatus.js +12 -9
- package/lib/module/hooks/useKeyboardStatus.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/libs/ImageCompressionConfig.js +30 -0
- package/lib/module/libs/ImageCompressionConfig.js.map +1 -0
- package/lib/module/libs/SBUUtils.js +26 -1
- package/lib/module/libs/SBUUtils.js.map +1 -1
- package/lib/module/localization/StringSet.type.js +3 -0
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/platform/createMediaService.expo.js +33 -1
- package/lib/module/platform/createMediaService.expo.js.map +1 -1
- package/lib/module/platform/createMediaService.native.js +38 -5
- package/lib/module/platform/createMediaService.native.js.map +1 -1
- package/lib/module/platform/dynamicModule.js +10 -56
- package/lib/module/platform/dynamicModule.js.map +1 -1
- package/lib/module/platform/types.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 +10 -7
- package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +8 -2
- package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +8 -3
- package/lib/typescript/src/hooks/useContext.d.ts +2 -29
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/libs/ImageCompressionConfig.d.ts +16 -0
- package/lib/typescript/src/libs/SBUUtils.d.ts +6 -0
- package/lib/typescript/src/localization/StringSet.type.d.ts +3 -0
- package/lib/typescript/src/platform/createMediaService.expo.d.ts +5 -1
- package/lib/typescript/src/platform/createMediaService.native.d.ts +7 -5
- package/lib/typescript/src/platform/dynamicModule.d.ts +7 -12
- package/lib/typescript/src/platform/types.d.ts +28 -3
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +15 -5
- package/src/components/FileViewer.tsx +2 -5
- package/src/components/MessageRenderer/FileMessage/ImageFileMessage.tsx +6 -1
- package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +1 -1
- package/src/components/MessageRenderer/FileMessage/index.tsx +1 -4
- package/src/components/MessageRenderer/UserMessage/BaseUserMessage.tsx +2 -2
- package/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.tsx +4 -4
- package/src/containers/SendbirdUIKitContainer.tsx +25 -6
- package/src/contexts/PlatformServiceCtx.tsx +9 -2
- package/src/contexts/SendbirdChatCtx.tsx +22 -19
- package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +82 -14
- package/src/domain/groupChannel/component/GroupChannelInput/index.tsx +1 -0
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +3 -2
- package/src/domain/groupChannelSettings/module/moduleContext.tsx +8 -2
- package/src/fragments/createGroupChannelListFragment.tsx +5 -9
- package/src/hooks/useKeyboardStatus.ts +10 -5
- package/src/index.ts +1 -0
- package/src/libs/ImageCompressionConfig.ts +31 -0
- package/src/libs/SBUUtils.ts +28 -1
- package/src/localization/StringSet.type.ts +7 -0
- package/src/platform/createMediaService.expo.tsx +24 -1
- package/src/platform/createMediaService.native.tsx +31 -9
- package/src/platform/dynamicModule.ts +17 -59
- package/src/platform/types.ts +29 -7
- package/src/version.ts +1 -1
- package/lib/commonjs/utils/common.js +0 -19
- package/lib/commonjs/utils/common.js.map +0 -1
- package/lib/module/utils/common.js +0 -7
- package/lib/module/utils/common.js.map +0 -1
- package/lib/typescript/src/utils/common.d.ts +0 -1
- package/src/utils/common.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","
|
|
1
|
+
{"version":3,"names":["NativeModules","UIManager","Logger","checkLink","dmi","logLevel","nativeModule","isComponent","getViewManagerConfig","nativeModuleNamespace","message","packageName","url","console","error","warn","SBUDynamicModuleRegistry","getPackage","require","e","SBUDynamicModule","register","mdi","getInfo","name","get"],"sources":["dynamicModule.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport type * as RNCNetInfo from '@react-native-community/netinfo';\nimport { NativeModules, UIManager } from 'react-native';\n\nimport { Logger } from '@sendbird/uikit-utils';\n\nexport type SBUNativeModule = keyof DynamicModules;\n\ninterface SBUDynamicModuleInfo {\n packageName: SBUNativeModule;\n nativeModuleNamespace: string;\n getPackage: <T>(logLevel: 'error' | 'warn' | 'none') => T;\n url: string;\n isComponent?: boolean;\n}\n\nfunction checkLink(dmi: SBUDynamicModuleInfo, logLevel: 'error' | 'warn' | 'none') {\n const nativeModule = (() => {\n if (dmi.isComponent) {\n return UIManager.getViewManagerConfig(dmi.nativeModuleNamespace);\n } else {\n return NativeModules[dmi.nativeModuleNamespace];\n }\n })();\n\n if (!nativeModule) {\n const message = `[UIKit] Cannot use native module, you should install and link ${dmi.packageName} (${dmi.url})`;\n if (logLevel === 'error') console.error(message);\n if (logLevel === 'warn') console.warn(message);\n }\n}\n\nexport interface DynamicModules {\n '@react-native-community/netinfo': typeof RNCNetInfo;\n}\n\nconst SBUDynamicModuleRegistry: Record<SBUNativeModule, SBUDynamicModuleInfo> = {\n '@react-native-community/netinfo': {\n packageName: '@react-native-community/netinfo',\n nativeModuleNamespace: 'RNCNetInfo',\n url: 'https://github.com/react-native-netinfo/react-native-netinfo',\n getPackage(logLevel) {\n checkLink(this, logLevel);\n\n try {\n return require('@react-native-community/netinfo');\n } catch (e) {\n return null;\n }\n },\n },\n};\n\nconst SBUDynamicModule = {\n register(mdi: SBUDynamicModuleInfo) {\n SBUDynamicModuleRegistry[mdi.nativeModuleNamespace as SBUNativeModule] = mdi;\n },\n getInfo(name: SBUNativeModule) {\n return SBUDynamicModuleRegistry[name] ?? null;\n },\n get<K extends SBUNativeModule, T extends DynamicModules[K]>(name: K, logLevel: 'error' | 'warn' | 'none' = 'error') {\n const dmi = this.getInfo(name);\n if (!dmi) Logger.warn(`${name} doesn't exist in the dynamic module`);\n return dmi?.getPackage<T>(logLevel);\n },\n};\n\nexport default SBUDynamicModule;\n"],"mappings":"AAAA;AAEA,SAASA,aAAT,EAAwBC,SAAxB,QAAyC,cAAzC;AAEA,SAASC,MAAT,QAAuB,uBAAvB;;AAYA,SAASC,SAAT,CAAmBC,GAAnB,EAA8CC,QAA9C,EAAmF;EACjF,MAAMC,YAAY,GAAG,CAAC,MAAM;IAC1B,IAAIF,GAAG,CAACG,WAAR,EAAqB;MACnB,OAAON,SAAS,CAACO,oBAAV,CAA+BJ,GAAG,CAACK,qBAAnC,CAAP;IACD,CAFD,MAEO;MACL,OAAOT,aAAa,CAACI,GAAG,CAACK,qBAAL,CAApB;IACD;EACF,CANoB,GAArB;;EAQA,IAAI,CAACH,YAAL,EAAmB;IACjB,MAAMI,OAAO,GAAI,iEAAgEN,GAAG,CAACO,WAAY,KAAIP,GAAG,CAACQ,GAAI,GAA7G;IACA,IAAIP,QAAQ,KAAK,OAAjB,EAA0BQ,OAAO,CAACC,KAAR,CAAcJ,OAAd;IAC1B,IAAIL,QAAQ,KAAK,MAAjB,EAAyBQ,OAAO,CAACE,IAAR,CAAaL,OAAb;EAC1B;AACF;;AAMD,MAAMM,wBAAuE,GAAG;EAC9E,mCAAmC;IACjCL,WAAW,EAAE,iCADoB;IAEjCF,qBAAqB,EAAE,YAFU;IAGjCG,GAAG,EAAE,8DAH4B;;IAIjCK,UAAU,CAACZ,QAAD,EAAW;MACnBF,SAAS,CAAC,IAAD,EAAOE,QAAP,CAAT;;MAEA,IAAI;QACF,OAAOa,OAAO,CAAC,iCAAD,CAAd;MACD,CAFD,CAEE,OAAOC,CAAP,EAAU;QACV,OAAO,IAAP;MACD;IACF;;EAZgC;AAD2C,CAAhF;AAiBA,MAAMC,gBAAgB,GAAG;EACvBC,QAAQ,CAACC,GAAD,EAA4B;IAClCN,wBAAwB,CAACM,GAAG,CAACb,qBAAL,CAAxB,GAAyEa,GAAzE;EACD,CAHsB;;EAIvBC,OAAO,CAACC,IAAD,EAAwB;IAC7B,OAAOR,wBAAwB,CAACQ,IAAD,CAAxB,IAAkC,IAAzC;EACD,CANsB;;EAOvBC,GAAG,CAAyDD,IAAzD,EAAiH;IAAA,IAA/CnB,QAA+C,uEAAT,OAAS;IAClH,MAAMD,GAAG,GAAG,KAAKmB,OAAL,CAAaC,IAAb,CAAZ;IACA,IAAI,CAACpB,GAAL,EAAUF,MAAM,CAACa,IAAP,CAAa,GAAES,IAAK,sCAApB;IACV,OAAOpB,GAAP,aAAOA,GAAP,uBAAOA,GAAG,CAAEa,UAAL,CAAmBZ,QAAnB,CAAP;EACD;;AAXsB,CAAzB;AAcA,eAAee,gBAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type SBUError from '../libs/SBUError';\n\nexport type Unsubscribe = () => void | undefined;\nexport type DownloadedPath = string;\nexport type FilePickerResponse = FileType | null;\nexport type FileType = { uri: string; size: number; name: string; type: string };\n\n// ---------- NotificationService ---------- //\nexport interface NotificationServiceInterface {\n hasPushPermission(): Promise<boolean>;\n requestPushPermission(): Promise<boolean>;\n\n getAPNSToken(): Promise<string | null>;\n getFCMToken(): Promise<string | null>;\n onTokenRefresh(handler: (token: string) => void): Unsubscribe;\n}\n\n// ---------- ClipboardService ---------- //\nexport interface ClipboardServiceInterface {\n setString(text: string): void;\n getString(): Promise<string>;\n}\n\n// ---------- FileService ---------- //\nexport interface FileServiceInterface extends FilePickerServiceInterface, FileSystemServiceInterface {}\n\nexport interface OpenResultListener {\n onOpenFailure?: (error: SBUError, originError?: unknown) => void;\n}\nexport interface OpenMediaLibraryOptions extends OpenResultListener {\n selectionLimit?: number;\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport interface OpenCameraOptions extends OpenResultListener {\n cameraType?: 'front' | 'back';\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport type OpenDocumentOptions = OpenResultListener;\nexport interface SaveOptions {\n fileUrl: string;\n fileName: string;\n fileType?: string | null;\n}\n\nexport interface FilePickerServiceInterface {\n openMediaLibrary(options?: OpenMediaLibraryOptions): Promise<null | FilePickerResponse[]>;\n openCamera(options?: OpenCameraOptions): Promise<FilePickerResponse>;\n openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse>;\n}\n\nexport interface FileSystemServiceInterface {\n // NOTE: On iOS, You can access the downloaded files by providing options below to info.plist\n // - Supports opening documents in place\n // - Application supports iTunes file sharing\n save(options?: SaveOptions): Promise<DownloadedPath | null>;\n}\n\n// ---------- MediaService ---------- //\ninterface VideoProps {\n source: { uri: string } | number;\n resizeMode?: 'cover' | 'contain' | 'stretch';\n onLoad?: () => void;\n}\ninterface GetVideoThumbnailOptions {\n url: string;\n timeMills?: number;\n quality?: number;\n}\
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type SBUError from '../libs/SBUError';\n\nexport type Unsubscribe = () => void | undefined;\nexport type DownloadedPath = string;\nexport type FilePickerResponse = FileType | null;\nexport type FileType = { uri: string; size: number; name: string; type: string };\n\n// ---------- NotificationService ---------- //\nexport interface NotificationServiceInterface {\n hasPushPermission(): Promise<boolean>;\n requestPushPermission(): Promise<boolean>;\n\n getAPNSToken(): Promise<string | null>;\n getFCMToken(): Promise<string | null>;\n onTokenRefresh(handler: (token: string) => void): Unsubscribe;\n}\n\n// ---------- ClipboardService ---------- //\nexport interface ClipboardServiceInterface {\n setString(text: string): void;\n getString(): Promise<string>;\n}\n\n// ---------- FileService ---------- //\nexport interface FileServiceInterface extends FilePickerServiceInterface, FileSystemServiceInterface {}\n\nexport interface OpenResultListener {\n onOpenFailure?: (error: SBUError, originError?: unknown) => void;\n}\nexport interface OpenMediaLibraryOptions extends OpenResultListener {\n selectionLimit?: number;\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport interface OpenCameraOptions extends OpenResultListener {\n cameraType?: 'front' | 'back';\n mediaType?: 'photo' | 'video' | 'all';\n}\nexport type OpenDocumentOptions = OpenResultListener;\nexport interface SaveOptions {\n fileUrl: string;\n fileName: string;\n fileType?: string | null;\n}\n\nexport interface FilePickerServiceInterface {\n openMediaLibrary(options?: OpenMediaLibraryOptions): Promise<null | FilePickerResponse[]>;\n openCamera(options?: OpenCameraOptions): Promise<FilePickerResponse>;\n openDocument(options?: OpenDocumentOptions): Promise<FilePickerResponse>;\n}\n\nexport interface FileSystemServiceInterface {\n // NOTE: On iOS, You can access the downloaded files by providing options below to info.plist\n // - Supports opening documents in place\n // - Application supports iTunes file sharing\n save(options?: SaveOptions): Promise<DownloadedPath | null>;\n}\n\n// ---------- MediaService ---------- //\ninterface VideoProps {\n source: { uri: string } | number;\n resizeMode?: 'cover' | 'contain' | 'stretch';\n onLoad?: () => void;\n}\ninterface GetVideoThumbnailOptions {\n url: string;\n timeMills?: number;\n quality?: number;\n}\n\ninterface CompressImageOptions {\n /**\n * A uri of image file to compress\n * */\n uri: string;\n\n /**\n * A resize width, apply only to downscale\n * */\n maxWidth?: number;\n\n /**\n * A resize height, apply only to downscale\n * */\n maxHeight?: number;\n\n /**\n * A value in range 0.0 - 1.0 specifying compression level of the result image.\n * 1 means highest quality and 0 the lowest quality.\n * */\n compressionRate?: number;\n}\n\ntype GetVideoThumbnailResult = Promise<{ path: string } | null>;\ntype CompressImageResult = Promise<{ uri: string; size: number } | null>;\n\nexport interface MediaServiceInterface {\n VideoComponent<Props = {}>(props: VideoProps & Props): JSX.Element;\n getVideoThumbnail(options: GetVideoThumbnailOptions): GetVideoThumbnailResult;\n compressImage(options: CompressImageOptions): CompressImageResult;\n}\n"],"mappings":""}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.3.0';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,OAAhB;AACA,eAAeA,OAAf"}
|
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
3
3
|
import type { SendbirdBaseChannel, SendbirdChatSDK, SendbirdGroupChannelCreateParams, SendbirdMember, SendbirdUser } from '@sendbird/uikit-utils';
|
|
4
4
|
import type { UIKitFeaturesInSendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
5
|
+
import type { ImageCompressionConfigInterface } from '../libs/ImageCompressionConfig';
|
|
5
6
|
import { MentionConfigInterface } from '../libs/MentionConfig';
|
|
6
7
|
import type { StringSet } from '../localization/StringSet.type';
|
|
7
8
|
import type { ClipboardServiceInterface, FileServiceInterface, MediaServiceInterface, NotificationServiceInterface } from '../platform/types';
|
|
8
9
|
import type { ErrorBoundaryProps, LocalCacheStorage } from '../types';
|
|
9
10
|
export declare const SendbirdUIKit: Readonly<{
|
|
10
|
-
VERSION: "2.
|
|
11
|
+
VERSION: "2.3.0";
|
|
11
12
|
PLATFORM: string;
|
|
12
13
|
DEFAULT: {
|
|
13
14
|
AUTO_PUSH_TOKEN_REGISTRATION: boolean;
|
|
@@ -15,6 +16,7 @@ export declare const SendbirdUIKit: Readonly<{
|
|
|
15
16
|
CHANNEL_LIST_MESSAGE_RECEIPT_STATUS: boolean;
|
|
16
17
|
USE_USER_ID_FOR_NICKNAME: boolean;
|
|
17
18
|
USER_MENTION: boolean;
|
|
19
|
+
IMAGE_COMPRESSION: boolean;
|
|
18
20
|
};
|
|
19
21
|
}>;
|
|
20
22
|
export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
@@ -23,7 +25,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
23
25
|
file: FileServiceInterface;
|
|
24
26
|
notification: NotificationServiceInterface;
|
|
25
27
|
clipboard: ClipboardServiceInterface;
|
|
26
|
-
media
|
|
28
|
+
media: MediaServiceInterface;
|
|
27
29
|
};
|
|
28
30
|
chatOptions?: {
|
|
29
31
|
localCacheStorage?: LocalCacheStorage;
|
|
@@ -39,6 +41,10 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
39
41
|
defaultHeaderHeight?: number;
|
|
40
42
|
HeaderComponent?: HeaderStyleContextType['HeaderComponent'];
|
|
41
43
|
};
|
|
44
|
+
errorBoundary?: {
|
|
45
|
+
onError?: (props: ErrorBoundaryProps) => void;
|
|
46
|
+
ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;
|
|
47
|
+
};
|
|
42
48
|
toast?: {
|
|
43
49
|
dismissTimeout?: number;
|
|
44
50
|
};
|
|
@@ -47,10 +53,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
47
53
|
onBeforeCreateChannel?: (channelParams: SendbirdGroupChannelCreateParams, users: SendbirdUser[] | SendbirdMember[]) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;
|
|
48
54
|
};
|
|
49
55
|
userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;
|
|
50
|
-
|
|
51
|
-
onError?: (props: ErrorBoundaryProps) => void;
|
|
52
|
-
ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;
|
|
53
|
-
};
|
|
56
|
+
imageCompression?: Partial<ImageCompressionConfigInterface>;
|
|
54
57
|
}>;
|
|
55
|
-
declare const SendbirdUIKitContainer: ({ children, appId, chatOptions, platformServices, localization, styles, toast, userProfile, userMention,
|
|
58
|
+
declare const SendbirdUIKitContainer: ({ children, appId, chatOptions, platformServices, localization, styles, errorBoundary, toast, userProfile, userMention, imageCompression, }: SendbirdUIKitContainerProps) => JSX.Element;
|
|
56
59
|
export default SendbirdUIKitContainer;
|
|
@@ -4,8 +4,14 @@ type Props = React.PropsWithChildren<{
|
|
|
4
4
|
fileService: FileServiceInterface;
|
|
5
5
|
clipboardService: ClipboardServiceInterface;
|
|
6
6
|
notificationService: NotificationServiceInterface;
|
|
7
|
-
mediaService
|
|
7
|
+
mediaService: MediaServiceInterface;
|
|
8
8
|
}>;
|
|
9
|
-
export
|
|
9
|
+
export type PlatformServiceContextType = {
|
|
10
|
+
fileService: FileServiceInterface;
|
|
11
|
+
clipboardService: ClipboardServiceInterface;
|
|
12
|
+
notificationService: NotificationServiceInterface;
|
|
13
|
+
mediaService: MediaServiceInterface;
|
|
14
|
+
};
|
|
15
|
+
export declare const PlatformServiceContext: React.Context<PlatformServiceContextType | null>;
|
|
10
16
|
export declare const PlatformServiceProvider: ({ children, fileService, clipboardService, notificationService, mediaService, }: Props) => JSX.Element;
|
|
11
17
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SendbirdChatSDK, SendbirdGroupChannel, SendbirdUser } from '@sendbird/uikit-utils';
|
|
3
3
|
import type EmojiManager from '../libs/EmojiManager';
|
|
4
|
+
import type ImageCompressionConfig from '../libs/ImageCompressionConfig';
|
|
4
5
|
import type MentionManager from '../libs/MentionManager';
|
|
5
6
|
import type { FileType } from '../platform/types';
|
|
6
7
|
export interface UIKitFeaturesInSendbirdChatContext {
|
|
@@ -9,16 +10,19 @@ export interface UIKitFeaturesInSendbirdChatContext {
|
|
|
9
10
|
enableChannelListMessageReceiptStatus: boolean;
|
|
10
11
|
enableUseUserIdForNickname: boolean;
|
|
11
12
|
enableUserMention: boolean;
|
|
13
|
+
enableImageCompression: boolean;
|
|
12
14
|
}
|
|
13
15
|
interface Props extends UIKitFeaturesInSendbirdChatContext, React.PropsWithChildren {
|
|
14
16
|
sdkInstance: SendbirdChatSDK;
|
|
15
17
|
emojiManager: EmojiManager;
|
|
16
18
|
mentionManager: MentionManager;
|
|
19
|
+
imageCompressionConfig: ImageCompressionConfig;
|
|
17
20
|
}
|
|
18
|
-
type
|
|
21
|
+
export type SendbirdChatContextType = {
|
|
19
22
|
sdk: SendbirdChatSDK;
|
|
20
23
|
emojiManager: EmojiManager;
|
|
21
24
|
mentionManager: MentionManager;
|
|
25
|
+
imageCompressionConfig: ImageCompressionConfig;
|
|
22
26
|
currentUser?: SendbirdUser;
|
|
23
27
|
setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;
|
|
24
28
|
updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;
|
|
@@ -29,12 +33,13 @@ type Context = {
|
|
|
29
33
|
channelListMessageReceiptStatusEnabled: boolean;
|
|
30
34
|
useUserIdForNicknameEnabled: boolean;
|
|
31
35
|
userMentionEnabled: boolean;
|
|
36
|
+
imageCompressionEnabled: boolean;
|
|
32
37
|
deliveryReceiptEnabled: boolean;
|
|
33
38
|
broadcastChannelEnabled: boolean;
|
|
34
39
|
superGroupChannelEnabled: boolean;
|
|
35
40
|
reactionEnabled: boolean;
|
|
36
41
|
};
|
|
37
42
|
};
|
|
38
|
-
export declare const SendbirdChatContext: React.Context<
|
|
39
|
-
export declare const SendbirdChatProvider: ({ children, sdkInstance, emojiManager, mentionManager, enableAutoPushTokenRegistration, enableChannelListMessageReceiptStatus, enableChannelListTypingIndicator, enableUseUserIdForNickname, enableUserMention, }: Props) => JSX.Element;
|
|
43
|
+
export declare const SendbirdChatContext: React.Context<SendbirdChatContextType | null>;
|
|
44
|
+
export declare const SendbirdChatProvider: ({ children, sdkInstance, emojiManager, mentionManager, imageCompressionConfig, enableAutoPushTokenRegistration, enableChannelListMessageReceiptStatus, enableChannelListTypingIndicator, enableUseUserIdForNickname, enableUserMention, enableImageCompression, }: Props) => JSX.Element;
|
|
40
45
|
export {};
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const useLocalization: () => import("../contexts/LocalizationCtx").LocalizationContextType;
|
|
3
|
-
export declare const usePlatformService: () =>
|
|
4
|
-
|
|
5
|
-
clipboardService: import("..").ClipboardServiceInterface;
|
|
6
|
-
notificationService: import("..").NotificationServiceInterface;
|
|
7
|
-
mediaService?: import("../platform/types").MediaServiceInterface | undefined;
|
|
8
|
-
} & {
|
|
9
|
-
children?: import("react").ReactNode;
|
|
10
|
-
};
|
|
11
|
-
export declare const useSendbirdChat: () => {
|
|
12
|
-
sdk: import("packages/uikit-utils/lib/typescript/src").SendbirdChatSDK;
|
|
13
|
-
emojiManager: import("../libs/EmojiManager").default;
|
|
14
|
-
mentionManager: import("../libs/MentionManager").default;
|
|
15
|
-
currentUser?: import("@sendbird/chat").User | undefined;
|
|
16
|
-
setCurrentUser: import("react").Dispatch<import("react").SetStateAction<import("@sendbird/chat").User | undefined>>;
|
|
17
|
-
updateCurrentUserInfo: (nickname?: string | undefined, profile?: string | import("..").FileType | undefined) => Promise<import("@sendbird/chat").User>;
|
|
18
|
-
markAsDeliveredWithChannel: (channel: import("@sendbird/chat/groupChannel").GroupChannel) => void;
|
|
19
|
-
features: {
|
|
20
|
-
autoPushTokenRegistrationEnabled: boolean;
|
|
21
|
-
channelListTypingIndicatorEnabled: boolean;
|
|
22
|
-
channelListMessageReceiptStatusEnabled: boolean;
|
|
23
|
-
useUserIdForNicknameEnabled: boolean;
|
|
24
|
-
userMentionEnabled: boolean;
|
|
25
|
-
deliveryReceiptEnabled: boolean;
|
|
26
|
-
broadcastChannelEnabled: boolean;
|
|
27
|
-
superGroupChannelEnabled: boolean;
|
|
28
|
-
reactionEnabled: boolean;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
2
|
+
export declare const usePlatformService: () => import("../contexts/PlatformServiceCtx").PlatformServiceContextType;
|
|
3
|
+
export declare const useSendbirdChat: () => import("../contexts/SendbirdChatCtx").SendbirdChatContextType;
|
|
31
4
|
export declare const useUserProfile: () => import("../contexts/UserProfileCtx").UserProfileContextType;
|
|
32
5
|
export declare const useReaction: () => import("../contexts/ReactionCtx").ReactionContextType;
|
|
@@ -46,7 +46,7 @@ export { default as createExpoFileService } from './platform/createFileService.e
|
|
|
46
46
|
export { default as createExpoClipboardService } from './platform/createClipboardService.expo';
|
|
47
47
|
export { default as createExpoNotificationService } from './platform/createNotificationService.expo';
|
|
48
48
|
export { default as createExpoMediaService } from './platform/createMediaService.expo';
|
|
49
|
-
export type { FileServiceInterface, ClipboardServiceInterface, FilePickerServiceInterface, FileSystemServiceInterface, SaveOptions, OpenDocumentOptions, OpenCameraOptions, OpenMediaLibraryOptions, OpenResultListener, DownloadedPath, Unsubscribe, FilePickerResponse, FileType, NotificationServiceInterface, } from './platform/types';
|
|
49
|
+
export type { FileServiceInterface, ClipboardServiceInterface, FilePickerServiceInterface, FileSystemServiceInterface, SaveOptions, OpenDocumentOptions, OpenCameraOptions, OpenMediaLibraryOptions, OpenResultListener, DownloadedPath, Unsubscribe, FilePickerResponse, FileType, NotificationServiceInterface, MediaServiceInterface, } from './platform/types';
|
|
50
50
|
/** Domain **/
|
|
51
51
|
export * from './domain/groupChannel';
|
|
52
52
|
export type { GroupChannelProps, GroupChannelModule, GroupChannelFragment, GroupChannelContextsType, } from './domain/groupChannel/types';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ImageCompressionConfigInterface {
|
|
2
|
+
compressionRate: number;
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
}
|
|
6
|
+
declare class ImageCompressionConfig {
|
|
7
|
+
private _config;
|
|
8
|
+
static DEFAULT: {
|
|
9
|
+
COMPRESSION_RATE: number;
|
|
10
|
+
};
|
|
11
|
+
constructor(_config: ImageCompressionConfigInterface);
|
|
12
|
+
get compressionRate(): number;
|
|
13
|
+
get width(): number | undefined;
|
|
14
|
+
get height(): number | undefined;
|
|
15
|
+
}
|
|
16
|
+
export default ImageCompressionConfig;
|
|
@@ -144,6 +144,9 @@ export interface StringSet {
|
|
|
144
144
|
}) => string;
|
|
145
145
|
};
|
|
146
146
|
LABELS: {
|
|
147
|
+
PERMISSION_APP_NAME: string;
|
|
148
|
+
PERMISSION_CAMERA: string;
|
|
149
|
+
PERMISSION_DEVICE_STORAGE: string;
|
|
147
150
|
USER_NO_NAME: string;
|
|
148
151
|
CHANNEL_NO_MEMBERS: string;
|
|
149
152
|
TYPING_INDICATOR_TYPINGS: (users: SendbirdUser[]) => string | undefined;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type * as ExpoAV from 'expo-av';
|
|
2
|
+
import type * as ExpoFS from 'expo-file-system';
|
|
3
|
+
import type * as ExpoImageManipulator from 'expo-image-manipulator';
|
|
2
4
|
import type * as ExpoVideoThumbnail from 'expo-video-thumbnails';
|
|
3
5
|
import type { MediaServiceInterface } from './types';
|
|
4
6
|
type Modules = {
|
|
5
7
|
avModule: typeof ExpoAV;
|
|
6
8
|
thumbnailModule: typeof ExpoVideoThumbnail;
|
|
9
|
+
imageManipulator: typeof ExpoImageManipulator;
|
|
10
|
+
fsModule: typeof ExpoFS;
|
|
7
11
|
};
|
|
8
|
-
declare const createExpoMediaService: ({ avModule, thumbnailModule }: Modules) => MediaServiceInterface;
|
|
12
|
+
declare const createExpoMediaService: ({ avModule, thumbnailModule, imageManipulator, fsModule, }: Modules) => MediaServiceInterface;
|
|
9
13
|
export default createExpoMediaService;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type * as
|
|
2
|
-
import type
|
|
1
|
+
import type * as RNImageResizer from '@bam.tech/react-native-image-resizer';
|
|
2
|
+
import type * as RNCreateThumbnail from 'react-native-create-thumbnail';
|
|
3
|
+
import type RNVideo from 'react-native-video';
|
|
3
4
|
import type { MediaServiceInterface } from './types';
|
|
4
5
|
type Modules = {
|
|
5
|
-
VideoComponent: typeof
|
|
6
|
-
thumbnailModule: typeof
|
|
6
|
+
VideoComponent: typeof RNVideo;
|
|
7
|
+
thumbnailModule: typeof RNCreateThumbnail;
|
|
8
|
+
imageResizerModule: typeof RNImageResizer;
|
|
7
9
|
};
|
|
8
|
-
declare const createNativeMediaService: ({ VideoComponent, thumbnailModule }: Modules) => MediaServiceInterface;
|
|
10
|
+
declare const createNativeMediaService: ({ VideoComponent, thumbnailModule, imageResizerModule, }: Modules) => MediaServiceInterface;
|
|
9
11
|
export default createNativeMediaService;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type RNFastImage from 'react-native-fast-image';
|
|
3
|
-
import type RNFileAccess from 'react-native-file-access';
|
|
4
|
-
export interface DynamicModules {
|
|
5
|
-
'react-native-file-access': typeof RNFileAccess;
|
|
6
|
-
'react-native-fast-image': typeof RNFastImage;
|
|
7
|
-
'@react-native-community/netinfo': typeof RNNetInfo;
|
|
8
|
-
}
|
|
1
|
+
import type * as RNCNetInfo from '@react-native-community/netinfo';
|
|
9
2
|
export type SBUNativeModule = keyof DynamicModules;
|
|
10
3
|
interface SBUDynamicModuleInfo {
|
|
11
4
|
packageName: SBUNativeModule;
|
|
12
|
-
|
|
13
|
-
moduleName: string;
|
|
5
|
+
nativeModuleNamespace: string;
|
|
14
6
|
getPackage: <T>(logLevel: 'error' | 'warn' | 'none') => T;
|
|
15
7
|
url: string;
|
|
8
|
+
isComponent?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DynamicModules {
|
|
11
|
+
'@react-native-community/netinfo': typeof RNCNetInfo;
|
|
16
12
|
}
|
|
17
|
-
export declare function checkVersion(minVersion: string, currentVersion: string): boolean;
|
|
18
13
|
declare const SBUDynamicModule: {
|
|
19
14
|
register(mdi: SBUDynamicModuleInfo): void;
|
|
20
15
|
getInfo(name: SBUNativeModule): SBUDynamicModuleInfo;
|
|
21
|
-
get<K extends
|
|
16
|
+
get<K extends "@react-native-community/netinfo", T extends DynamicModules[K]>(name: K, logLevel?: 'error' | 'warn' | 'none'): T;
|
|
22
17
|
};
|
|
23
18
|
export default SBUDynamicModule;
|
|
@@ -58,10 +58,35 @@ interface GetVideoThumbnailOptions {
|
|
|
58
58
|
timeMills?: number;
|
|
59
59
|
quality?: number;
|
|
60
60
|
}
|
|
61
|
+
interface CompressImageOptions {
|
|
62
|
+
/**
|
|
63
|
+
* A uri of image file to compress
|
|
64
|
+
* */
|
|
65
|
+
uri: string;
|
|
66
|
+
/**
|
|
67
|
+
* A resize width, apply only to downscale
|
|
68
|
+
* */
|
|
69
|
+
maxWidth?: number;
|
|
70
|
+
/**
|
|
71
|
+
* A resize height, apply only to downscale
|
|
72
|
+
* */
|
|
73
|
+
maxHeight?: number;
|
|
74
|
+
/**
|
|
75
|
+
* A value in range 0.0 - 1.0 specifying compression level of the result image.
|
|
76
|
+
* 1 means highest quality and 0 the lowest quality.
|
|
77
|
+
* */
|
|
78
|
+
compressionRate?: number;
|
|
79
|
+
}
|
|
80
|
+
type GetVideoThumbnailResult = Promise<{
|
|
81
|
+
path: string;
|
|
82
|
+
} | null>;
|
|
83
|
+
type CompressImageResult = Promise<{
|
|
84
|
+
uri: string;
|
|
85
|
+
size: number;
|
|
86
|
+
} | null>;
|
|
61
87
|
export interface MediaServiceInterface {
|
|
62
88
|
VideoComponent<Props = {}>(props: VideoProps & Props): JSX.Element;
|
|
63
|
-
getVideoThumbnail(options: GetVideoThumbnailOptions):
|
|
64
|
-
|
|
65
|
-
} | null>;
|
|
89
|
+
getVideoThumbnail(options: GetVideoThumbnailOptions): GetVideoThumbnailResult;
|
|
90
|
+
compressImage(options: CompressImageOptions): CompressImageResult;
|
|
66
91
|
}
|
|
67
92
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const VERSION = "2.
|
|
1
|
+
declare const VERSION = "2.3.0";
|
|
2
2
|
export default VERSION;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "react-native-uikit",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -41,11 +41,12 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@sendbird/uikit-chat-hooks": "2.
|
|
45
|
-
"@sendbird/uikit-react-native-foundation": "2.
|
|
46
|
-
"@sendbird/uikit-utils": "2.
|
|
44
|
+
"@sendbird/uikit-chat-hooks": "2.3.0",
|
|
45
|
+
"@sendbird/uikit-react-native-foundation": "2.3.0",
|
|
46
|
+
"@sendbird/uikit-utils": "2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@bam.tech/react-native-image-resizer": "^3.0.4",
|
|
49
50
|
"@react-native-camera-roll/camera-roll": "^5.0.4",
|
|
50
51
|
"@react-native-clipboard/clipboard": "^1.8.5",
|
|
51
52
|
"@react-native-community/netinfo": "^9.3.0",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"expo-clipboard": "^2.1.1",
|
|
60
61
|
"expo-document-picker": "^10.1.3",
|
|
61
62
|
"expo-file-system": "^13.1.4",
|
|
63
|
+
"expo-image-manipulator": "^11.0.0",
|
|
62
64
|
"expo-image-picker": "^12.0.2",
|
|
63
65
|
"expo-media-library": "^14.0.1",
|
|
64
66
|
"expo-notifications": "^0.14.1",
|
|
@@ -79,6 +81,7 @@
|
|
|
79
81
|
"typescript": "4.9.4"
|
|
80
82
|
},
|
|
81
83
|
"peerDependencies": {
|
|
84
|
+
"@bam.tech/react-native-image-resizer": ">=3.0.0",
|
|
82
85
|
"@react-native-camera-roll/camera-roll": ">=5.0.0",
|
|
83
86
|
"@react-native-clipboard/clipboard": ">=1.8.5",
|
|
84
87
|
"@react-native-community/netinfo": ">=9.3.0",
|
|
@@ -89,6 +92,7 @@
|
|
|
89
92
|
"expo-clipboard": ">=2.1.1",
|
|
90
93
|
"expo-document-picker": ">=10.1.3",
|
|
91
94
|
"expo-file-system": ">=13.1.4",
|
|
95
|
+
"expo-image-manipulator": ">=11.0.0",
|
|
92
96
|
"expo-image-picker": ">=12.0.2",
|
|
93
97
|
"expo-notifications": ">=0.14.1",
|
|
94
98
|
"expo-video-thumbnails": ">=6.4.0",
|
|
@@ -103,6 +107,9 @@
|
|
|
103
107
|
"react-native-video": ">=5.2.0"
|
|
104
108
|
},
|
|
105
109
|
"peerDependenciesMeta": {
|
|
110
|
+
"@bam.tech/react-native-image-resizer": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
106
113
|
"@react-native-camera-roll/camera-roll": {
|
|
107
114
|
"optional": true
|
|
108
115
|
},
|
|
@@ -124,6 +131,9 @@
|
|
|
124
131
|
"expo-file-system": {
|
|
125
132
|
"optional": true
|
|
126
133
|
},
|
|
134
|
+
"expo-image-manipulator": {
|
|
135
|
+
"optional": true
|
|
136
|
+
},
|
|
127
137
|
"expo-image-picker": {
|
|
128
138
|
"optional": true
|
|
129
139
|
},
|
|
@@ -171,5 +181,5 @@
|
|
|
171
181
|
"readmeFile": "./README.md",
|
|
172
182
|
"displayName": "@sendbird/uikit-react-native"
|
|
173
183
|
},
|
|
174
|
-
"gitHead": "
|
|
184
|
+
"gitHead": "a9bf41fd7919436db99f6cc3bacd0f8d791b7729"
|
|
175
185
|
}
|
|
@@ -63,10 +63,8 @@ const FileViewer = ({
|
|
|
63
63
|
const fileType = getFileType(fileMessage.type || getFileExtension(fileMessage.url));
|
|
64
64
|
|
|
65
65
|
useEffect(() => {
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}, [mediaService]);
|
|
66
|
+
if (fileType === 'file') onClose();
|
|
67
|
+
}, []);
|
|
70
68
|
|
|
71
69
|
const fileViewer = useIIFE(() => {
|
|
72
70
|
switch (fileType) {
|
|
@@ -83,7 +81,6 @@ const FileViewer = ({
|
|
|
83
81
|
|
|
84
82
|
case 'video':
|
|
85
83
|
case 'audio': {
|
|
86
|
-
if (!mediaService?.VideoComponent) return null;
|
|
87
84
|
return (
|
|
88
85
|
<mediaService.VideoComponent
|
|
89
86
|
source={{ uri: fileMessage.url }}
|
|
@@ -44,7 +44,12 @@ const ImageFileMessage = ({ message, children, variant }: FileMessageProps) => {
|
|
|
44
44
|
const key = useRetry(imageNotFound);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<View
|
|
47
|
+
<View
|
|
48
|
+
style={[
|
|
49
|
+
styles.bubbleContainer,
|
|
50
|
+
{ backgroundColor: imageNotFound ? colors.onBackground04 : colors.ui.message[variant].enabled.background },
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
48
53
|
<View style={style}>
|
|
49
54
|
<Image
|
|
50
55
|
key={key}
|
|
@@ -15,7 +15,7 @@ const useRetry = (videoFileUrl: string, retryCount = 5) => {
|
|
|
15
15
|
const { mediaService } = usePlatformService();
|
|
16
16
|
|
|
17
17
|
const fetchThumbnail = () => {
|
|
18
|
-
return mediaService
|
|
18
|
+
return mediaService.getVideoThumbnail({ url: videoFileUrl, timeMills: 1000 }).then((result) => {
|
|
19
19
|
setState({ loading: false, thumbnail: result?.path ?? null });
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { SendbirdFileMessage, getFileExtension, getFileType } from '@sendbird/uikit-utils';
|
|
4
4
|
|
|
5
|
-
import { usePlatformService } from '../../../hooks/useContext';
|
|
6
5
|
import type { MessageRendererInterface } from '../index';
|
|
7
6
|
import BaseFileMessage from './BaseFileMessage';
|
|
8
7
|
import ImageFileMessage from './ImageFileMessage';
|
|
@@ -10,12 +9,10 @@ import VideoFileMessage from './VideoFileMessage';
|
|
|
10
9
|
|
|
11
10
|
export type FileMessageProps = MessageRendererInterface<SendbirdFileMessage>;
|
|
12
11
|
const FileMessage = (props: FileMessageProps) => {
|
|
13
|
-
const { mediaService } = usePlatformService();
|
|
14
|
-
|
|
15
12
|
const fileType = getFileType(props.message.type || getFileExtension(props.message.name));
|
|
16
13
|
|
|
17
14
|
if (fileType === 'image') return <ImageFileMessage {...props} />;
|
|
18
|
-
if (fileType === 'video'
|
|
15
|
+
if (fileType === 'video') return <VideoFileMessage {...props} />;
|
|
19
16
|
|
|
20
17
|
return <BaseFileMessage {...props} type={fileType} />;
|
|
21
18
|
};
|
|
@@ -5,7 +5,7 @@ import { RegexText, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uiki
|
|
|
5
5
|
import { urlRegexStrict } from '@sendbird/uikit-utils';
|
|
6
6
|
|
|
7
7
|
import { useLocalization, useSendbirdChat, useUserProfile } from '../../../hooks/useContext';
|
|
8
|
-
import
|
|
8
|
+
import SBUUtils from '../../../libs/SBUUtils';
|
|
9
9
|
import type { UserMessageProps } from './index';
|
|
10
10
|
|
|
11
11
|
const BaseUserMessage = ({
|
|
@@ -62,7 +62,7 @@ const BaseUserMessage = ({
|
|
|
62
62
|
<Text
|
|
63
63
|
{...parentProps}
|
|
64
64
|
key={`${keyPrefix}-${index}`}
|
|
65
|
-
onPress={() =>
|
|
65
|
+
onPress={() => SBUUtils.openURL(match)}
|
|
66
66
|
onLongPress={onLongPressURL}
|
|
67
67
|
style={[parentProps?.style, { textDecorationLine: 'underline' }]}
|
|
68
68
|
>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type { OGMetaData } from '@sendbird/chat/message';
|
|
5
5
|
import { Icon, Image, RegexText, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
6
6
|
import { conditionChaining, urlRegexRough } from '@sendbird/uikit-utils';
|
|
7
7
|
|
|
8
8
|
import { useLocalization, useSendbirdChat, useUserProfile } from '../../../hooks/useContext';
|
|
9
|
-
import
|
|
9
|
+
import SBUUtils from '../../../libs/SBUUtils';
|
|
10
10
|
import type { UserMessageProps } from './index';
|
|
11
11
|
|
|
12
12
|
type Props = UserMessageProps & {
|
|
@@ -73,7 +73,7 @@ const OpenGraphUserMessage = ({
|
|
|
73
73
|
<Text
|
|
74
74
|
{...parentProps}
|
|
75
75
|
key={`${keyPrefix}-${index}`}
|
|
76
|
-
onPress={() =>
|
|
76
|
+
onPress={() => SBUUtils.openURL(match)}
|
|
77
77
|
onLongPress={onLongPressURL}
|
|
78
78
|
style={[parentProps?.style, styles.urlText]}
|
|
79
79
|
>
|
|
@@ -98,7 +98,7 @@ const OpenGraphUserMessage = ({
|
|
|
98
98
|
<TouchableOpacity
|
|
99
99
|
style={{ backgroundColor: select({ dark: palette.background500, light: palette.background200 }) }}
|
|
100
100
|
activeOpacity={0.85}
|
|
101
|
-
onPress={() =>
|
|
101
|
+
onPress={() => SBUUtils.openURL(ogMetaData.url)}
|
|
102
102
|
>
|
|
103
103
|
<View
|
|
104
104
|
style={[
|