Skip to content

Commit 7b0448a

Browse files
committed
chore: enable overriding all chat options
1 parent c804ee2 commit 7b0448a

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

packages/uikit-react-native/src/containers/SendbirdUIKitContainer.tsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,6 @@ export type ChatOmittedInitParams = Omit<
7777
(typeof chatOmitKeys)[number]
7878
>;
7979

80-
const chatOmitKeys = [
81-
'appId',
82-
'newInstance',
83-
'modules',
84-
'debugMode',
85-
'appVersion',
86-
'localCacheEnabled',
87-
'useAsyncStorageStore',
88-
'useMMKVStorageStore',
89-
] as const;
90-
function sanitizeChatOptions<T extends Record<string, unknown>>(chatOptions: T): T {
91-
const opts = { ...chatOptions };
92-
chatOmitKeys.forEach((key) => delete opts[key]);
93-
return opts;
94-
}
9580
export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
9681
appId: string;
9782
platformServices: {
@@ -184,7 +169,7 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
184169

185170
const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));
186171
const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {
187-
const sendbird = initializeSendbird(appId, sanitizeChatOptions(chatOptions));
172+
const sendbird = initializeSendbird(appId, chatOptions);
188173
unsubscribes.current = sendbird.unsubscribes;
189174
return sendbird.chatSDK;
190175
});
@@ -196,7 +181,7 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
196181

197182
useLayoutEffect(() => {
198183
if (!isFirstMount) {
199-
const sendbird = initializeSendbird(appId, sanitizeChatOptions(chatOptions));
184+
const sendbird = initializeSendbird(appId, chatOptions);
200185
setSdkInstance(sendbird.chatSDK);
201186
unsubscribes.current = sendbird.unsubscribes;
202187
}
@@ -318,13 +303,13 @@ const initializeSendbird = (appId: string, options: InitOptions) => {
318303

319304
const isMMKVStorage = 'getString' in localCacheStorage;
320305
chatSDK = SendbirdChat.init({
321-
...chatInitParams,
322306
appId,
323307
newInstance: true,
324308
modules: [new GroupChannelModule(), new OpenChannelModule()],
325309
localCacheEnabled: true,
326310
useMMKVStorageStore: isMMKVStorage ? (localCacheStorage as MMKV) : undefined,
327311
useAsyncStorageStore: !isMMKVStorage ? (localCacheStorage as AsyncStorageStatic) : undefined,
312+
...chatInitParams,
328313
});
329314

330315
if (onInitialized) {

0 commit comments

Comments
 (0)