@sendbird/uikit-react-native 2.0.0 → 2.0.2
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 +2 -2
- package/lib/commonjs/components/MessageRenderer/MessageIncomingAvatar.js +9 -2
- package/lib/commonjs/components/MessageRenderer/MessageIncomingAvatar.js.map +1 -1
- package/lib/commonjs/components/UserActionBar.js +7 -4
- package/lib/commonjs/components/UserActionBar.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +23 -4
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +13 -7
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/{Localization.js → LocalizationCtx.js} +1 -1
- package/lib/commonjs/contexts/LocalizationCtx.js.map +1 -0
- package/lib/commonjs/contexts/{PlatformService.js → PlatformServiceCtx.js} +1 -1
- package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -0
- package/lib/commonjs/contexts/ProfileCardCtx.js +119 -0
- package/lib/commonjs/contexts/ProfileCardCtx.js.map +1 -0
- package/lib/commonjs/contexts/{SendbirdChat.js → SendbirdChatCtx.js} +3 -3
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -0
- package/lib/commonjs/domain/groupChannelList/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +9 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +2 -3
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelMembersFragment.js +11 -11
- package/lib/commonjs/fragments/createGroupChannelMembersFragment.js.map +1 -1
- package/lib/commonjs/hooks/useContext.js +17 -7
- package/lib/commonjs/hooks/useContext.js.map +1 -1
- package/lib/commonjs/index.js +32 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js +6 -0
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/platform/createFileService.native.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/MessageRenderer/MessageIncomingAvatar.js +9 -3
- package/lib/module/components/MessageRenderer/MessageIncomingAvatar.js.map +1 -1
- package/lib/module/components/UserActionBar.js +8 -5
- package/lib/module/components/UserActionBar.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +23 -4
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +9 -4
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/{Localization.js → LocalizationCtx.js} +1 -1
- package/lib/module/contexts/LocalizationCtx.js.map +1 -0
- package/lib/module/contexts/{PlatformService.js → PlatformServiceCtx.js} +1 -1
- package/lib/module/contexts/PlatformServiceCtx.js.map +1 -0
- package/lib/module/contexts/ProfileCardCtx.js +97 -0
- package/lib/module/contexts/ProfileCardCtx.js.map +1 -0
- package/lib/module/contexts/{SendbirdChat.js → SendbirdChatCtx.js} +3 -3
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -0
- package/lib/module/domain/groupChannelList/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +9 -1
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +2 -3
- package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelMembersFragment.js +13 -9
- package/lib/module/fragments/createGroupChannelMembersFragment.js.map +1 -1
- package/lib/module/hooks/useContext.js +9 -3
- package/lib/module/hooks/useContext.js.map +1 -1
- package/lib/module/index.js +5 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/localization/StringSet.type.js +6 -0
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/platform/createFileService.native.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/UserActionBar.d.ts +4 -2
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +7 -3
- package/lib/typescript/src/contexts/{Localization.d.ts → LocalizationCtx.d.ts} +0 -0
- package/lib/typescript/src/contexts/{PlatformService.d.ts → PlatformServiceCtx.d.ts} +0 -0
- package/lib/typescript/src/contexts/ProfileCardCtx.d.ts +15 -0
- package/lib/typescript/src/contexts/{SendbirdChat.d.ts → SendbirdChatCtx.d.ts} +0 -0
- package/lib/typescript/src/domain/groupChannelList/types.d.ts +2 -0
- package/lib/typescript/src/hooks/useContext.d.ts +2 -1
- package/lib/typescript/src/index.d.ts +5 -4
- package/lib/typescript/src/localization/StringSet.type.d.ts +6 -1
- package/lib/typescript/src/platform/createFileService.native.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +9 -9
- package/src/components/MessageRenderer/MessageIncomingAvatar.tsx +9 -2
- package/src/components/UserActionBar.tsx +10 -4
- package/src/containers/GroupChannelPreviewContainer.tsx +20 -1
- package/src/containers/SendbirdUIKitContainer.tsx +26 -6
- package/src/contexts/{Localization.tsx → LocalizationCtx.tsx} +0 -0
- package/src/contexts/{PlatformService.tsx → PlatformServiceCtx.tsx} +0 -0
- package/src/contexts/ProfileCardCtx.tsx +125 -0
- package/src/contexts/{SendbirdChat.tsx → SendbirdChatCtx.tsx} +2 -2
- package/src/domain/groupChannelList/types.ts +2 -2
- package/src/fragments/createGroupChannelFragment.tsx +18 -8
- package/src/fragments/createGroupChannelListFragment.tsx +2 -3
- package/src/fragments/createGroupChannelMembersFragment.tsx +25 -25
- package/src/hooks/useContext.ts +10 -3
- package/src/index.ts +5 -4
- package/src/localization/StringSet.type.ts +12 -0
- package/src/platform/createFileService.native.ts +1 -1
- package/src/version.ts +1 -1
- package/lib/commonjs/contexts/Localization.js.map +0 -1
- package/lib/commonjs/contexts/PlatformService.js.map +0 -1
- package/lib/commonjs/contexts/SendbirdChat.js.map +0 -1
- package/lib/module/contexts/Localization.js.map +0 -1
- package/lib/module/contexts/PlatformService.js.map +0 -1
- package/lib/module/contexts/SendbirdChat.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { useActiveGroupChannel, useChannelHandler } from '@sendbird/uikit-chat-hooks';
|
|
4
4
|
import { Icon } from '@sendbird/uikit-react-native-foundation';
|
|
5
5
|
import type { SendbirdMember } from '@sendbird/uikit-utils';
|
|
6
|
-
import { useForceUpdate, useUniqId } from '@sendbird/uikit-utils';
|
|
6
|
+
import { useForceUpdate, useFreshCallback, useUniqId } from '@sendbird/uikit-utils';
|
|
7
7
|
|
|
8
8
|
import UserActionBar from '../components/UserActionBar';
|
|
9
9
|
import type { GroupChannelMembersFragment } from '../domain/groupChannelUserList/types';
|
|
10
10
|
import createUserListModule from '../domain/userList/module/createUserListModule';
|
|
11
11
|
import type { UserListModule } from '../domain/userList/types';
|
|
12
|
-
import { useLocalization, useSendbirdChat } from '../hooks/useContext';
|
|
12
|
+
import { useLocalization, useProfileCard, useSendbirdChat } from '../hooks/useContext';
|
|
13
13
|
|
|
14
14
|
const noop = () => '';
|
|
15
15
|
const name = 'createGroupChannelMembersFragment';
|
|
@@ -21,10 +21,12 @@ const createGroupChannelMembersFragment = (
|
|
|
21
21
|
return ({ channel, onPressHeaderLeft, onPressHeaderRight, renderUser }) => {
|
|
22
22
|
const uniqId = useUniqId(name);
|
|
23
23
|
const forceUpdate = useForceUpdate();
|
|
24
|
-
const { sdk, currentUser } = useSendbirdChat();
|
|
25
|
-
const { activeChannel } = useActiveGroupChannel(sdk, channel);
|
|
26
24
|
|
|
27
25
|
const { STRINGS } = useLocalization();
|
|
26
|
+
const { sdk, currentUser } = useSendbirdChat();
|
|
27
|
+
const { show } = useProfileCard();
|
|
28
|
+
|
|
29
|
+
const { activeChannel } = useActiveGroupChannel(sdk, channel);
|
|
28
30
|
|
|
29
31
|
useChannelHandler(sdk, `${name}_${uniqId}`, {
|
|
30
32
|
// Note: Removed from v4
|
|
@@ -63,27 +65,25 @@ const createGroupChannelMembersFragment = (
|
|
|
63
65
|
},
|
|
64
66
|
});
|
|
65
67
|
|
|
66
|
-
const _renderUser: NonNullable<typeof renderUser> =
|
|
67
|
-
(user, selectedUsers, setSelectedUsers)
|
|
68
|
-
if (renderUser) return renderUser(user, selectedUsers, setSelectedUsers);
|
|
68
|
+
const _renderUser: NonNullable<typeof renderUser> = useFreshCallback((user, selectedUsers, setSelectedUsers) => {
|
|
69
|
+
if (renderUser) return renderUser(user, selectedUsers, setSelectedUsers);
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
71
|
+
return (
|
|
72
|
+
<UserActionBar
|
|
73
|
+
muted={user.isMuted}
|
|
74
|
+
uri={user.profileUrl}
|
|
75
|
+
label={user.role === 'operator' ? STRINGS.GROUP_CHANNEL_MEMBERS.USER_BAR_OPERATOR : ''}
|
|
76
|
+
name={
|
|
77
|
+
(user.nickname || STRINGS.LABELS.USER_NO_NAME) +
|
|
78
|
+
(user.userId === currentUser?.userId ? STRINGS.GROUP_CHANNEL_MEMBERS.USER_BAR_ME_POSTFIX : '')
|
|
79
|
+
}
|
|
80
|
+
disabled={user.userId === currentUser?.userId}
|
|
81
|
+
// TODO: implement ban/mute actions, use channel.members with handlers instead member query
|
|
82
|
+
onPressActionMenu={undefined}
|
|
83
|
+
onPressAvatar={() => show(user)}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
87
|
|
|
88
88
|
return (
|
|
89
89
|
<UserListModule.Provider headerRight={noop} headerTitle={STRINGS.GROUP_CHANNEL_MEMBERS.HEADER_TITLE}>
|
package/src/hooks/useContext.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
import { LocalizationContext } from '../contexts/
|
|
4
|
-
import { PlatformServiceContext } from '../contexts/
|
|
5
|
-
import {
|
|
3
|
+
import { LocalizationContext } from '../contexts/LocalizationCtx';
|
|
4
|
+
import { PlatformServiceContext } from '../contexts/PlatformServiceCtx';
|
|
5
|
+
import { ProfileCardContext } from '../contexts/ProfileCardCtx';
|
|
6
|
+
import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
6
7
|
|
|
7
8
|
export const useLocalization = () => {
|
|
8
9
|
const value = useContext(LocalizationContext);
|
|
@@ -21,3 +22,9 @@ export const useSendbirdChat = () => {
|
|
|
21
22
|
if (!value) throw new Error('SendbirdChatContext is not provided');
|
|
22
23
|
return value;
|
|
23
24
|
};
|
|
25
|
+
|
|
26
|
+
export const useProfileCard = () => {
|
|
27
|
+
const value = useContext(ProfileCardContext);
|
|
28
|
+
if (!value) throw new Error('ProfileCardContext is not provided');
|
|
29
|
+
return value;
|
|
30
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -24,14 +24,15 @@ export { default as createGroupChannelListFragment } from './fragments/createGro
|
|
|
24
24
|
export { default as createGroupChannelMembersFragment } from './fragments/createGroupChannelMembersFragment';
|
|
25
25
|
|
|
26
26
|
/** Context **/
|
|
27
|
-
export { SendbirdChatContext, SendbirdChatProvider } from './contexts/
|
|
28
|
-
export { PlatformServiceContext, PlatformServiceProvider } from './contexts/
|
|
29
|
-
export {
|
|
27
|
+
export { SendbirdChatContext, SendbirdChatProvider } from './contexts/SendbirdChatCtx';
|
|
28
|
+
export { PlatformServiceContext, PlatformServiceProvider } from './contexts/PlatformServiceCtx';
|
|
29
|
+
export { ProfileCardContext, ProfileCardProvider } from './contexts/ProfileCardCtx';
|
|
30
|
+
export { LocalizationContext, LocalizationProvider } from './contexts/LocalizationCtx';
|
|
30
31
|
|
|
31
32
|
/** Hooks **/
|
|
32
33
|
export { default as useConnection } from './hooks/useConnection';
|
|
33
34
|
export { default as usePushTokenRegistration } from './hooks/usePushTokenRegistration';
|
|
34
|
-
export { useLocalization, usePlatformService, useSendbirdChat } from './hooks/useContext';
|
|
35
|
+
export { useLocalization, usePlatformService, useSendbirdChat, useProfileCard } from './hooks/useContext';
|
|
35
36
|
|
|
36
37
|
/** Localization **/
|
|
37
38
|
export { default as StringSetEn } from './localization/StringSet.en';
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
PartialDeep,
|
|
5
5
|
SendbirdFileMessage,
|
|
6
6
|
SendbirdGroupChannel,
|
|
7
|
+
SendbirdMember,
|
|
7
8
|
SendbirdMessage,
|
|
8
9
|
SendbirdUser,
|
|
9
10
|
} from '@sendbird/uikit-utils';
|
|
@@ -174,6 +175,11 @@ export interface StringSet {
|
|
|
174
175
|
TURN_OFF_NOTIFICATIONS_ERROR: string;
|
|
175
176
|
LEAVE_CHANNEL_ERROR: string;
|
|
176
177
|
};
|
|
178
|
+
PROFILE_CARD: {
|
|
179
|
+
BUTTON_MESSAGE: string;
|
|
180
|
+
BODY_LABEL: string;
|
|
181
|
+
BODY: (user: SendbirdUser | SendbirdMember) => string;
|
|
182
|
+
};
|
|
177
183
|
}
|
|
178
184
|
|
|
179
185
|
type StringSetCreateOptions = {
|
|
@@ -348,5 +354,11 @@ export const createBaseStringSet = ({ dateLocale, overrides }: StringSetCreateOp
|
|
|
348
354
|
LEAVE_CHANNEL_ERROR: "Couldn't leave channel.",
|
|
349
355
|
...overrides?.TOAST,
|
|
350
356
|
},
|
|
357
|
+
PROFILE_CARD: {
|
|
358
|
+
BUTTON_MESSAGE: 'Message',
|
|
359
|
+
BODY_LABEL: 'User ID',
|
|
360
|
+
BODY: (user) => user.userId,
|
|
361
|
+
...overrides?.PROFILE_CARD,
|
|
362
|
+
},
|
|
351
363
|
};
|
|
352
364
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type CameraRoll from '@react-native-
|
|
1
|
+
import type { CameraRoll } from '@react-native-camera-roll/camera-roll';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import type * as DocumentPicker from 'react-native-document-picker';
|
|
4
4
|
import type * as FileAccess from 'react-native-file-access';
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const VERSION = '2.0.
|
|
1
|
+
const VERSION = '2.0.2';
|
|
2
2
|
export default VERSION;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LocalizationContext","React","createContext","LocalizationProvider","children","stringSet","STRINGS"],"sources":["Localization.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { StringSet } from '../localization/StringSet.type';\n\ntype Props = React.PropsWithChildren<{\n stringSet: StringSet;\n}>;\n\nexport type LocalizationContextType = {\n STRINGS: StringSet;\n};\n\nexport const LocalizationContext = React.createContext<LocalizationContextType | null>(null);\nexport const LocalizationProvider = ({ children, stringSet }: Props) => {\n return <LocalizationContext.Provider value={{ STRINGS: stringSet }}>{children}</LocalizationContext.Provider>;\n};\n"],"mappings":";;;;;;;AAAA;;;;AAYO,MAAMA,mBAAmB,gBAAGC,cAAA,CAAMC,aAAN,CAAoD,IAApD,CAA5B;;;;AACA,MAAMC,oBAAoB,GAAG,QAAoC;EAAA,IAAnC;IAAEC,QAAF;IAAYC;EAAZ,CAAmC;EACtE,oBAAO,6BAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAE;MAAEC,OAAO,EAAED;IAAX;EAArC,GAA8DD,QAA9D,CAAP;AACD,CAFM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PlatformServiceContext","React","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService","mediaService"],"sources":["PlatformService.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService?: MediaServiceInterface;\n}>;\n\nexport const PlatformServiceContext = React.createContext<Props | null>(null);\nexport const PlatformServiceProvider = ({\n children,\n fileService,\n clipboardService,\n notificationService,\n mediaService,\n}: Props) => {\n return (\n <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService, mediaService }}>\n {children}\n </PlatformServiceContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;;;AAgBO,MAAMA,sBAAsB,gBAAGC,cAAA,CAAMC,aAAN,CAAkC,IAAlC,CAA/B;;;;AACA,MAAMC,uBAAuB,GAAG,QAM1B;EAAA,IAN2B;IACtCC,QADsC;IAEtCC,WAFsC;IAGtCC,gBAHsC;IAItCC,mBAJsC;IAKtCC;EALsC,CAM3B;EACX,oBACE,6BAAC,sBAAD,CAAwB,QAAxB;IAAiC,KAAK,EAAE;MAAEH,WAAF;MAAeC,gBAAf;MAAiCC,mBAAjC;MAAsDC;IAAtD;EAAxC,GACGJ,QADH,CADF;AAKD,CAZM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["SendbirdChatContext","React","createContext","SendbirdChatProvider","children","sdkInstance","enableAutoPushTokenRegistration","enableChannelListMessageReceiptStatus","enableChannelListTypingIndicator","currentUser","_setCurrentUser","useState","forceUpdate","useForceUpdate","appFeatures","useAppFeatures","setCurrentUser","useCallback","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","confirmAndMarkAsDelivered","useEffect","listener","status","connectionState","setForegroundState","setBackgroundState","subscriber","AppState","addEventListener","remove","value","sdk","features","autoPushTokenRegistrationEnabled","channelListTypingIndicatorEnabled","channelListMessageReceiptStatusEnabled"],"sources":["SendbirdChat.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { AppState, AppStateStatus } from 'react-native';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport type {\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdUser,\n SendbirdUserUpdateParams,\n} from '@sendbird/uikit-utils';\nimport { confirmAndMarkAsDelivered, useForceUpdate } from '@sendbird/uikit-utils';\n\nimport type { FileType } from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n sdkInstance: SendbirdChatSDK;\n\n enableAutoPushTokenRegistration: boolean;\n enableChannelListTypingIndicator: boolean;\n enableChannelListMessageReceiptStatus: boolean;\n}>;\n\ntype Context = {\n sdk: SendbirdChatSDK;\n currentUser?: SendbirdUser;\n setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;\n\n // helper functions\n updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;\n markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;\n\n features: {\n // UIKit features\n autoPushTokenRegistrationEnabled: boolean;\n channelListTypingIndicatorEnabled: boolean;\n channelListMessageReceiptStatusEnabled: boolean;\n\n // Sendbird application features\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\n};\n\nexport const SendbirdChatContext = React.createContext<Context | null>(null);\nexport const SendbirdChatProvider = ({\n children,\n sdkInstance,\n enableAutoPushTokenRegistration,\n enableChannelListMessageReceiptStatus,\n enableChannelListTypingIndicator,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n\n const setCurrentUser: Context['setCurrentUser'] = useCallback((user) => {\n // NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser\n _setCurrentUser(user);\n forceUpdate();\n }, []);\n\n const updateCurrentUserInfo: Context['updateCurrentUserInfo'] = useCallback(\n async (nickname, profile) => {\n let user = currentUser;\n\n if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');\n\n const params: SendbirdUserUpdateParams = { nickname };\n\n if (typeof profile === 'string') {\n params.profileUrl = profile;\n } else if (typeof profile === 'object') {\n params.profileImage = profile;\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\n\n user = await sdkInstance.updateCurrentUserInfo(params);\n\n setCurrentUser(user);\n return user;\n },\n [sdkInstance, currentUser, setCurrentUser],\n );\n\n const markAsDeliveredWithChannel: Context['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled) confirmAndMarkAsDelivered(sdkInstance, channel);\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useEffect(() => {\n const listener = (status: AppStateStatus) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();\n else sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();\n };\n\n const subscriber = AppState.addEventListener('change', listener);\n return () => subscriber.remove();\n }, [sdkInstance]);\n\n const value: Context = {\n sdk: sdkInstance,\n currentUser,\n setCurrentUser,\n\n updateCurrentUserInfo,\n markAsDeliveredWithChannel,\n\n features: {\n ...appFeatures,\n autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,\n channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,\n channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus,\n },\n };\n\n return <SendbirdChatContext.Provider value={value}>{children}</SendbirdChatContext.Provider>;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAOA;;;;;;AAmCO,MAAMA,mBAAmB,gBAAGC,cAAA,CAAMC,aAAN,CAAoC,IAApC,CAA5B;;;;AACA,MAAMC,oBAAoB,GAAG,QAMvB;EAAA,IANwB;IACnCC,QADmC;IAEnCC,WAFmC;IAGnCC,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EAIxE,CAACtB,WAAD,EAAcS,WAAW,CAACc,sBAA1B,CAJwE,CAA1E;EAOA,IAAAE,gBAAA,EAAU,MAAM;IACd,MAAMC,QAAQ,GAAIC,MAAD,IAA4B;MAC3C;MACA,IAAIA,MAAM,KAAK,QAAf,EAAyB3B,WAAW,CAAC4B,eAAZ,KAAgC,QAAhC,IAA4C5B,WAAW,CAAC6B,kBAAZ,EAA5C,CAAzB,KACK7B,WAAW,CAAC4B,eAAZ,KAAgC,MAAhC,IAA0C5B,WAAW,CAAC8B,kBAAZ,EAA1C;IACN,CAJD;;IAMA,MAAMC,UAAU,GAAGC,qBAAA,CAASC,gBAAT,CAA0B,QAA1B,EAAoCP,QAApC,CAAnB;;IACA,OAAO,MAAMK,UAAU,CAACG,MAAX,EAAb;EACD,CATD,EASG,CAAClC,WAAD,CATH;EAWA,MAAMmC,KAAc,GAAG;IACrBC,GAAG,EAAEpC,WADgB;IAErBI,WAFqB;IAGrBO,cAHqB;IAKrBG,qBALqB;IAMrBO,0BANqB;IAQrBgB,QAAQ,EAAE,EACR,GAAG5B,WADK;MAER6B,gCAAgC,EAAErC,+BAF1B;MAGRsC,iCAAiC,EAAEpC,gCAH3B;MAIRqC,sCAAsC,EAAEtC;IAJhC;EARW,CAAvB;EAgBA,oBAAO,6BAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAEiC;EAArC,GAA6CpC,QAA7C,CAAP;AACD,CA5EM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","LocalizationContext","createContext","LocalizationProvider","children","stringSet","STRINGS"],"sources":["Localization.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { StringSet } from '../localization/StringSet.type';\n\ntype Props = React.PropsWithChildren<{\n stringSet: StringSet;\n}>;\n\nexport type LocalizationContextType = {\n STRINGS: StringSet;\n};\n\nexport const LocalizationContext = React.createContext<LocalizationContextType | null>(null);\nexport const LocalizationProvider = ({ children, stringSet }: Props) => {\n return <LocalizationContext.Provider value={{ STRINGS: stringSet }}>{children}</LocalizationContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAYA,OAAO,MAAMC,mBAAmB,gBAAGD,KAAK,CAACE,aAAN,CAAoD,IAApD,CAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,QAAoC;EAAA,IAAnC;IAAEC,QAAF;IAAYC;EAAZ,CAAmC;EACtE,oBAAO,oBAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAE;MAAEC,OAAO,EAAED;IAAX;EAArC,GAA8DD,QAA9D,CAAP;AACD,CAFM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","PlatformServiceContext","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService","mediaService"],"sources":["PlatformService.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService?: MediaServiceInterface;\n}>;\n\nexport const PlatformServiceContext = React.createContext<Props | null>(null);\nexport const PlatformServiceProvider = ({\n children,\n fileService,\n clipboardService,\n notificationService,\n mediaService,\n}: Props) => {\n return (\n <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService, mediaService }}>\n {children}\n </PlatformServiceContext.Provider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAgBA,OAAO,MAAMC,sBAAsB,gBAAGD,KAAK,CAACE,aAAN,CAAkC,IAAlC,CAA/B;AACP,OAAO,MAAMC,uBAAuB,GAAG,QAM1B;EAAA,IAN2B;IACtCC,QADsC;IAEtCC,WAFsC;IAGtCC,gBAHsC;IAItCC,mBAJsC;IAKtCC;EALsC,CAM3B;EACX,oBACE,oBAAC,sBAAD,CAAwB,QAAxB;IAAiC,KAAK,EAAE;MAAEH,WAAF;MAAeC,gBAAf;MAAiCC,mBAAjC;MAAsDC;IAAtD;EAAxC,GACGJ,QADH,CADF;AAKD,CAZM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useState","AppState","useAppFeatures","confirmAndMarkAsDelivered","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","children","sdkInstance","enableAutoPushTokenRegistration","enableChannelListMessageReceiptStatus","enableChannelListTypingIndicator","currentUser","_setCurrentUser","forceUpdate","appFeatures","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","listener","status","connectionState","setForegroundState","setBackgroundState","subscriber","addEventListener","remove","value","sdk","features","autoPushTokenRegistrationEnabled","channelListTypingIndicatorEnabled","channelListMessageReceiptStatusEnabled"],"sources":["SendbirdChat.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { AppState, AppStateStatus } from 'react-native';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport type {\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdUser,\n SendbirdUserUpdateParams,\n} from '@sendbird/uikit-utils';\nimport { confirmAndMarkAsDelivered, useForceUpdate } from '@sendbird/uikit-utils';\n\nimport type { FileType } from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n sdkInstance: SendbirdChatSDK;\n\n enableAutoPushTokenRegistration: boolean;\n enableChannelListTypingIndicator: boolean;\n enableChannelListMessageReceiptStatus: boolean;\n}>;\n\ntype Context = {\n sdk: SendbirdChatSDK;\n currentUser?: SendbirdUser;\n setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;\n\n // helper functions\n updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;\n markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;\n\n features: {\n // UIKit features\n autoPushTokenRegistrationEnabled: boolean;\n channelListTypingIndicatorEnabled: boolean;\n channelListMessageReceiptStatusEnabled: boolean;\n\n // Sendbird application features\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\n};\n\nexport const SendbirdChatContext = React.createContext<Context | null>(null);\nexport const SendbirdChatProvider = ({\n children,\n sdkInstance,\n enableAutoPushTokenRegistration,\n enableChannelListMessageReceiptStatus,\n enableChannelListTypingIndicator,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n\n const setCurrentUser: Context['setCurrentUser'] = useCallback((user) => {\n // NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser\n _setCurrentUser(user);\n forceUpdate();\n }, []);\n\n const updateCurrentUserInfo: Context['updateCurrentUserInfo'] = useCallback(\n async (nickname, profile) => {\n let user = currentUser;\n\n if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');\n\n const params: SendbirdUserUpdateParams = { nickname };\n\n if (typeof profile === 'string') {\n params.profileUrl = profile;\n } else if (typeof profile === 'object') {\n params.profileImage = profile;\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\n\n user = await sdkInstance.updateCurrentUserInfo(params);\n\n setCurrentUser(user);\n return user;\n },\n [sdkInstance, currentUser, setCurrentUser],\n );\n\n const markAsDeliveredWithChannel: Context['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled) confirmAndMarkAsDelivered(sdkInstance, channel);\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useEffect(() => {\n const listener = (status: AppStateStatus) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();\n else sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();\n };\n\n const subscriber = AppState.addEventListener('change', listener);\n return () => subscriber.remove();\n }, [sdkInstance]);\n\n const value: Context = {\n sdk: sdkInstance,\n currentUser,\n setCurrentUser,\n\n updateCurrentUserInfo,\n markAsDeliveredWithChannel,\n\n features: {\n ...appFeatures,\n autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,\n channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,\n channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus,\n },\n };\n\n return <SendbirdChatContext.Provider value={value}>{children}</SendbirdChatContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,SAA7B,EAAwCC,QAAxC,QAAwD,OAAxD;AACA,SAASC,QAAT,QAAyC,cAAzC;AAEA,SAASC,cAAT,QAA+B,4BAA/B;AAOA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,uBAA1D;AAmCA,OAAO,MAAMC,mBAAmB,gBAAGR,KAAK,CAACS,aAAN,CAAoC,IAApC,CAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,QAMvB;EAAA,IANwB;IACnCC,QADmC;IAEnCC,WAFmC;IAGnCC,+BAHmC;IAInCC,qCAJmC;IAKnCC;EALmC,CAMxB;EACX,MAAM,CAACC,WAAD,EAAcC,eAAd,IAAiCd,QAAQ,EAA/C;EACA,MAAMe,WAAW,GAAGX,cAAc,EAAlC;EACA,MAAMY,WAAW,GAAGd,cAAc,CAACO,WAAD,CAAlC;EAEA,MAAMQ,cAAyC,GAAGnB,WAAW,CAAEoB,IAAD,IAAU;IACtE;IACAJ,eAAe,CAACI,IAAD,CAAf;;IACAH,WAAW;EACZ,CAJ4D,EAI1D,EAJ0D,CAA7D;EAMA,MAAMI,qBAAuD,GAAGrB,WAAW,CACzE,OAAOsB,QAAP,EAAiBC,OAAjB,KAA6B;IAC3B,IAAIH,IAAI,GAAGL,WAAX;IAEA,IAAI,CAACK,IAAL,EAAW,MAAM,IAAII,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