@sendbird/uikit-react-native 1.0.2 → 1.1.1
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 +7 -7
- package/lib/commonjs/components/FileViewer.js +319 -0
- package/lib/commonjs/components/FileViewer.js.map +1 -0
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +116 -0
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -0
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js +8 -0
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/MessageOutgoingStatus.js +20 -65
- package/lib/commonjs/components/MessageRenderer/MessageOutgoingStatus.js.map +1 -1
- package/lib/commonjs/components/UserActionBar.js +1 -3
- package/lib/commonjs/components/UserActionBar.js.map +1 -1
- package/lib/commonjs/components/UserSelectableBar.js +1 -3
- package/lib/commonjs/components/UserSelectableBar.js.map +1 -1
- package/lib/commonjs/constants.js +7 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +157 -0
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -0
- package/lib/commonjs/{InternalErrorBoundary.js → containers/InternalErrorBoundaryContainer.js} +5 -5
- package/lib/commonjs/containers/InternalErrorBoundaryContainer.js.map +1 -0
- package/lib/commonjs/{SendbirdUIKitContainer.js → containers/SendbirdUIKitContainer.js} +15 -12
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -0
- package/lib/commonjs/contexts/PlatformService.js +4 -2
- package/lib/commonjs/contexts/PlatformService.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChat.js +6 -2
- package/lib/commonjs/contexts/SendbirdChat.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +30 -7
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js +2 -3
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelList/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +1 -1
- package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js +3 -7
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +14 -12
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +10 -40
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelMembersFragment.js +1 -1
- package/lib/commonjs/fragments/createGroupChannelMembersFragment.js.map +1 -1
- package/lib/commonjs/hooks/useContext.js.map +1 -1
- package/lib/commonjs/index.js +30 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/{InternalLocalCacheStorage.js → libs/InternalLocalCacheStorage.js} +0 -0
- package/lib/commonjs/libs/InternalLocalCacheStorage.js.map +1 -0
- package/lib/commonjs/localization/StringSet.type.js +8 -0
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/platform/createFileService.expo.js +21 -2
- package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
- package/lib/commonjs/platform/createFileService.native.js +20 -3
- package/lib/commonjs/platform/createFileService.native.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.expo.js +64 -0
- package/lib/commonjs/platform/createMediaService.expo.js.map +1 -0
- package/lib/commonjs/platform/createMediaService.native.js +67 -0
- package/lib/commonjs/platform/createMediaService.native.js.map +1 -0
- package/lib/commonjs/platform/createNotificationService.expo.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 +300 -0
- package/lib/module/components/FileViewer.js.map +1 -0
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +100 -0
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -0
- package/lib/module/components/MessageRenderer/FileMessage/index.js +6 -0
- package/lib/module/components/MessageRenderer/FileMessage/index.js.map +1 -1
- package/lib/module/components/MessageRenderer/MessageOutgoingStatus.js +17 -60
- package/lib/module/components/MessageRenderer/MessageOutgoingStatus.js.map +1 -1
- package/lib/module/components/UserActionBar.js +1 -1
- package/lib/module/components/UserActionBar.js.map +1 -1
- package/lib/module/components/UserSelectableBar.js +1 -1
- package/lib/module/components/UserSelectableBar.js.map +1 -1
- package/lib/module/constants.js +5 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +135 -0
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -0
- package/lib/module/{InternalErrorBoundary.js → containers/InternalErrorBoundaryContainer.js} +5 -5
- package/lib/module/containers/InternalErrorBoundaryContainer.js.map +1 -0
- package/lib/module/{SendbirdUIKitContainer.js → containers/SendbirdUIKitContainer.js} +15 -12
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -0
- package/lib/module/contexts/PlatformService.js +4 -2
- package/lib/module/contexts/PlatformService.js.map +1 -1
- package/lib/module/contexts/SendbirdChat.js +6 -2
- package/lib/module/contexts/SendbirdChat.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +28 -7
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/module/moduleContext.js +2 -3
- package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/groupChannelList/types.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/module/moduleContext.js +1 -1
- package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
- package/lib/module/fragments/createGroupChannelCreateFragment.js +4 -4
- package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +16 -14
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +14 -41
- package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelMembersFragment.js +1 -1
- package/lib/module/fragments/createGroupChannelMembersFragment.js.map +1 -1
- package/lib/module/hooks/useContext.js.map +1 -1
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/{InternalLocalCacheStorage.js → libs/InternalLocalCacheStorage.js} +0 -0
- package/lib/module/libs/InternalLocalCacheStorage.js.map +1 -0
- package/lib/module/localization/StringSet.type.js +8 -0
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/platform/createFileService.expo.js +21 -2
- package/lib/module/platform/createFileService.expo.js.map +1 -1
- package/lib/module/platform/createFileService.native.js +20 -3
- package/lib/module/platform/createFileService.native.js.map +1 -1
- package/lib/module/platform/createMediaService.expo.js +54 -0
- package/lib/module/platform/createMediaService.expo.js.map +1 -0
- package/lib/module/platform/createMediaService.native.js +57 -0
- package/lib/module/platform/createMediaService.native.js.map +1 -0
- package/lib/module/platform/createNotificationService.expo.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/components/FileViewer.d.ts +12 -0
- package/lib/typescript/src/components/MessageRenderer/FileMessage/VideoFileMessage.d.ts +3 -0
- package/lib/typescript/src/components/UserActionBar.d.ts +2 -3
- package/lib/typescript/src/components/UserSelectableBar.d.ts +2 -3
- package/lib/typescript/src/constants.d.ts +5 -0
- package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +8 -0
- package/lib/typescript/src/{InternalErrorBoundary.d.ts → containers/InternalErrorBoundaryContainer.d.ts} +3 -3
- package/lib/typescript/src/{SendbirdUIKitContainer.d.ts → containers/SendbirdUIKitContainer.d.ts} +9 -5
- package/lib/typescript/src/contexts/PlatformService.d.ts +3 -2
- package/lib/typescript/src/contexts/SendbirdChat.d.ts +5 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +3 -2
- package/lib/typescript/src/domain/groupChannel/types.d.ts +6 -2
- package/lib/typescript/src/domain/groupChannelList/types.d.ts +2 -2
- package/lib/typescript/src/hooks/useContext.d.ts +7 -5
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/{InternalLocalCacheStorage.d.ts → libs/InternalLocalCacheStorage.d.ts} +2 -2
- package/lib/typescript/src/localization/StringSet.type.d.ts +4 -0
- package/lib/typescript/src/platform/createMediaService.expo.d.ts +9 -0
- package/lib/typescript/src/platform/createMediaService.native.d.ts +9 -0
- package/lib/typescript/src/platform/createNotificationService.expo.d.ts +1 -1
- package/lib/typescript/src/platform/types.d.ts +20 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +14 -5
- package/src/components/FileViewer.tsx +283 -0
- package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +91 -0
- package/src/components/MessageRenderer/FileMessage/index.tsx +6 -0
- package/src/components/MessageRenderer/MessageOutgoingStatus.tsx +14 -54
- package/src/components/UserActionBar.tsx +1 -1
- package/src/components/UserSelectableBar.tsx +1 -1
- package/src/constants.ts +5 -0
- package/src/containers/GroupChannelPreviewContainer.tsx +117 -0
- package/src/{InternalErrorBoundary.tsx → containers/InternalErrorBoundaryContainer.tsx} +4 -4
- package/src/{SendbirdUIKitContainer.tsx → containers/SendbirdUIKitContainer.tsx} +26 -14
- package/src/contexts/PlatformService.tsx +15 -3
- package/src/contexts/SendbirdChat.tsx +13 -5
- package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +1 -1
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +23 -6
- package/src/domain/groupChannel/module/moduleContext.tsx +6 -13
- package/src/domain/groupChannel/types.ts +8 -2
- package/src/domain/groupChannelList/types.ts +3 -2
- package/src/domain/groupChannelSettings/module/moduleContext.tsx +5 -10
- package/src/fragments/createGroupChannelCreateFragment.tsx +38 -41
- package/src/fragments/createGroupChannelFragment.tsx +24 -34
- package/src/fragments/createGroupChannelListFragment.tsx +13 -35
- package/src/fragments/createGroupChannelMembersFragment.tsx +34 -39
- package/src/hooks/useContext.ts +3 -5
- package/src/index.ts +6 -2
- package/src/{InternalLocalCacheStorage.ts → libs/InternalLocalCacheStorage.ts} +1 -1
- package/src/localization/StringSet.type.ts +8 -0
- package/src/platform/createFileService.expo.ts +17 -2
- package/src/platform/createFileService.native.ts +16 -3
- package/src/platform/createMediaService.expo.tsx +30 -0
- package/src/platform/createMediaService.native.tsx +37 -0
- package/src/platform/createNotificationService.expo.ts +1 -1
- package/src/platform/types.ts +26 -1
- package/src/version.ts +1 -1
- package/lib/commonjs/InternalErrorBoundary.js.map +0 -1
- package/lib/commonjs/InternalLocalCacheStorage.js.map +0 -1
- package/lib/commonjs/SendbirdUIKitContainer.js.map +0 -1
- package/lib/module/InternalErrorBoundary.js.map +0 -1
- package/lib/module/InternalLocalCacheStorage.js.map +0 -1
- package/lib/module/SendbirdUIKitContainer.js.map +0 -1
|
@@ -26,46 +26,41 @@ const createGroupChannelMembersFragment = (
|
|
|
26
26
|
|
|
27
27
|
const { STRINGS } = useLocalization();
|
|
28
28
|
|
|
29
|
-
useChannelHandler(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
onUserEntered(channel) {
|
|
34
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
35
|
-
},
|
|
36
|
-
onUserLeft(channel) {
|
|
37
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
38
|
-
},
|
|
39
|
-
onUserJoined(channel) {
|
|
40
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
41
|
-
},
|
|
42
|
-
onUserUnmuted(channel) {
|
|
43
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
44
|
-
},
|
|
45
|
-
onUserUnbanned(channel) {
|
|
46
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
47
|
-
},
|
|
48
|
-
onUserBanned(channel) {
|
|
49
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
50
|
-
},
|
|
51
|
-
onUserMuted(channel) {
|
|
52
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
53
|
-
},
|
|
54
|
-
onChannelMemberCountChanged(channels) {
|
|
55
|
-
if (channels.find((c) => c.url === channel.url)) forceUpdate();
|
|
56
|
-
},
|
|
57
|
-
onChannelChanged(channel) {
|
|
58
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
59
|
-
},
|
|
60
|
-
onChannelFrozen(channel) {
|
|
61
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
62
|
-
},
|
|
63
|
-
onChannelUnfrozen(channel) {
|
|
64
|
-
if (channel.url === activeChannel.url) forceUpdate();
|
|
65
|
-
},
|
|
29
|
+
useChannelHandler(sdk, `${name}_${uniqId}`, {
|
|
30
|
+
onUserEntered(channel) {
|
|
31
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
66
32
|
},
|
|
67
|
-
|
|
68
|
-
|
|
33
|
+
onUserLeft(channel) {
|
|
34
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
35
|
+
},
|
|
36
|
+
onUserJoined(channel) {
|
|
37
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
38
|
+
},
|
|
39
|
+
onUserUnmuted(channel) {
|
|
40
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
41
|
+
},
|
|
42
|
+
onUserUnbanned(channel) {
|
|
43
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
44
|
+
},
|
|
45
|
+
onUserBanned(channel) {
|
|
46
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
47
|
+
},
|
|
48
|
+
onUserMuted(channel) {
|
|
49
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
50
|
+
},
|
|
51
|
+
onChannelMemberCountChanged(channels) {
|
|
52
|
+
if (channels.find((c) => c.url === channel.url)) forceUpdate();
|
|
53
|
+
},
|
|
54
|
+
onChannelChanged(channel) {
|
|
55
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
56
|
+
},
|
|
57
|
+
onChannelFrozen(channel) {
|
|
58
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
59
|
+
},
|
|
60
|
+
onChannelUnfrozen(channel) {
|
|
61
|
+
if (channel.url === activeChannel.url) forceUpdate();
|
|
62
|
+
},
|
|
63
|
+
});
|
|
69
64
|
|
|
70
65
|
const _renderUser: NonNullable<typeof renderUser> = useCallback(
|
|
71
66
|
(user, selectedUsers, setSelectedUsers) => {
|
package/src/hooks/useContext.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
import { LocalizationContext
|
|
3
|
+
import { LocalizationContext } from '../contexts/Localization';
|
|
4
4
|
import { PlatformServiceContext } from '../contexts/PlatformService';
|
|
5
5
|
import { SendbirdChatContext } from '../contexts/SendbirdChat';
|
|
6
6
|
|
|
7
7
|
export const useLocalization = () => {
|
|
8
|
-
const value = useContext
|
|
9
|
-
LocalizationContext as React.Context<LocalizationContextType | null>,
|
|
10
|
-
);
|
|
8
|
+
const value = useContext(LocalizationContext);
|
|
11
9
|
if (!value) throw new Error('LocalizationContext is not provided');
|
|
12
10
|
return value;
|
|
13
11
|
};
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Logger } from '@sendbird/uikit-utils';
|
|
|
6
6
|
export { default as MessageRenderer } from './components/MessageRenderer';
|
|
7
7
|
export { default as ChannelCover } from './components/ChannelCover';
|
|
8
8
|
export { default as ChatFlatList } from './components/ChatFlatList';
|
|
9
|
+
export { default as FileViewer } from './components/FileViewer';
|
|
9
10
|
export { default as NewMessagesButton } from './components/NewMessagesButton';
|
|
10
11
|
export { default as ProviderLayout } from './components/ProviderLayout';
|
|
11
12
|
export { default as ScrollToBottomButton } from './components/ScrollToBottomButton';
|
|
@@ -41,9 +42,12 @@ export type { StringSet } from './localization/StringSet.type';
|
|
|
41
42
|
export { default as createNativeFileService } from './platform/createFileService.native';
|
|
42
43
|
export { default as createNativeClipboardService } from './platform/createClipboardService.native';
|
|
43
44
|
export { default as createNativeNotificationService } from './platform/createNotificationService.native';
|
|
45
|
+
export { default as createNativeMediaService } from './platform/createMediaService.native';
|
|
44
46
|
export { default as createExpoFileService } from './platform/createFileService.expo';
|
|
45
47
|
export { default as createExpoClipboardService } from './platform/createClipboardService.expo';
|
|
46
48
|
export { default as createExpoNotificationService } from './platform/createNotificationService.expo';
|
|
49
|
+
export { default as createExpoMediaService } from './platform/createMediaService.expo';
|
|
50
|
+
|
|
47
51
|
export type {
|
|
48
52
|
FileServiceInterface,
|
|
49
53
|
ClipboardServiceInterface,
|
|
@@ -96,9 +100,9 @@ export {
|
|
|
96
100
|
default as SendbirdUIKitContainer,
|
|
97
101
|
SendbirdUIKit,
|
|
98
102
|
SendbirdUIKitContainerProps,
|
|
99
|
-
} from './SendbirdUIKitContainer';
|
|
103
|
+
} from './containers/SendbirdUIKitContainer';
|
|
100
104
|
|
|
101
105
|
export * from './types';
|
|
102
106
|
|
|
107
|
+
Logger.setLogLevel(__DEV__ ? 'warn' : 'none');
|
|
103
108
|
Logger.setTitle(`[UIKIT_${Platform.OS}]`);
|
|
104
|
-
__DEV__ && Logger.setLogLevel('none');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KeyValuePairGet, KeyValuePairSet, LocalCacheStorage } from '
|
|
1
|
+
import type { KeyValuePairGet, KeyValuePairSet, LocalCacheStorage } from '../types';
|
|
2
2
|
|
|
3
3
|
export default class InternalLocalCacheStorage implements LocalCacheStorage {
|
|
4
4
|
constructor(private storage: LocalCacheStorage) {}
|
|
@@ -131,6 +131,10 @@ export interface StringSet {
|
|
|
131
131
|
CHANNEL_NO_MEMBERS: string;
|
|
132
132
|
TYPING_INDICATOR_TYPINGS: (users: SendbirdUser[]) => string | undefined;
|
|
133
133
|
};
|
|
134
|
+
FILE_VIEWER: {
|
|
135
|
+
TITLE: (message: SendbirdFileMessage) => string;
|
|
136
|
+
SUBTITLE: (message: SendbirdFileMessage) => string;
|
|
137
|
+
};
|
|
134
138
|
PLACEHOLDER: {
|
|
135
139
|
NO_BANNED_MEMBERS: string;
|
|
136
140
|
NO_USERS: string;
|
|
@@ -292,6 +296,10 @@ export const createBaseStringSet = ({ dateLocale, overrides }: StringSetCreateOp
|
|
|
292
296
|
},
|
|
293
297
|
...overrides?.LABELS,
|
|
294
298
|
},
|
|
299
|
+
FILE_VIEWER: {
|
|
300
|
+
TITLE: (message) => message.sender?.nickname || USER_NO_NAME,
|
|
301
|
+
SUBTITLE: (message) => messageTime(new Date(message.createdAt), dateLocale),
|
|
302
|
+
},
|
|
295
303
|
PLACEHOLDER: {
|
|
296
304
|
NO_BANNED_MEMBERS: 'No banned members',
|
|
297
305
|
NO_USERS: 'No users',
|
|
@@ -67,8 +67,10 @@ const createExpoFileService = ({
|
|
|
67
67
|
return imagePickerModule.MediaTypeOptions.Images;
|
|
68
68
|
case 'video':
|
|
69
69
|
return imagePickerModule.MediaTypeOptions.Videos;
|
|
70
|
-
|
|
70
|
+
case 'all':
|
|
71
71
|
return imagePickerModule.MediaTypeOptions.All;
|
|
72
|
+
default:
|
|
73
|
+
return imagePickerModule.MediaTypeOptions.Images;
|
|
72
74
|
}
|
|
73
75
|
})(),
|
|
74
76
|
});
|
|
@@ -92,7 +94,20 @@ const createExpoFileService = ({
|
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
const response = await imagePickerModule.launchImageLibraryAsync(
|
|
97
|
+
const response = await imagePickerModule.launchImageLibraryAsync({
|
|
98
|
+
mediaTypes: (() => {
|
|
99
|
+
switch (options?.mediaType) {
|
|
100
|
+
case 'photo':
|
|
101
|
+
return imagePickerModule.MediaTypeOptions.Images;
|
|
102
|
+
case 'video':
|
|
103
|
+
return imagePickerModule.MediaTypeOptions.Videos;
|
|
104
|
+
case 'all':
|
|
105
|
+
return imagePickerModule.MediaTypeOptions.All;
|
|
106
|
+
default:
|
|
107
|
+
return imagePickerModule.MediaTypeOptions.Images;
|
|
108
|
+
}
|
|
109
|
+
})(),
|
|
110
|
+
});
|
|
96
111
|
if (response.cancelled) return null;
|
|
97
112
|
const { uri } = response;
|
|
98
113
|
|
|
@@ -54,7 +54,7 @@ const createNativeFileService = ({
|
|
|
54
54
|
fsModule: typeof FileAccess;
|
|
55
55
|
}): FileServiceInterface => {
|
|
56
56
|
const cameraPermissions: Permission[] = Platform.select({
|
|
57
|
-
ios: [permissionModule.PERMISSIONS.IOS.CAMERA],
|
|
57
|
+
ios: [permissionModule.PERMISSIONS.IOS.CAMERA, permissionModule.PERMISSIONS.IOS.MICROPHONE],
|
|
58
58
|
android: [permissionModule.PERMISSIONS.ANDROID.CAMERA],
|
|
59
59
|
default: [],
|
|
60
60
|
});
|
|
@@ -94,7 +94,18 @@ const createNativeFileService = ({
|
|
|
94
94
|
|
|
95
95
|
const response = await imagePickerModule.launchCamera({
|
|
96
96
|
cameraType: options?.cameraType ?? 'back',
|
|
97
|
-
mediaType:
|
|
97
|
+
mediaType: (() => {
|
|
98
|
+
switch (options?.mediaType) {
|
|
99
|
+
case 'photo':
|
|
100
|
+
return 'photo';
|
|
101
|
+
case 'video':
|
|
102
|
+
return 'video';
|
|
103
|
+
case 'all':
|
|
104
|
+
return 'mixed';
|
|
105
|
+
default:
|
|
106
|
+
return 'photo';
|
|
107
|
+
}
|
|
108
|
+
})(),
|
|
98
109
|
});
|
|
99
110
|
if (response.didCancel) return null;
|
|
100
111
|
if (response.errorCode === 'camera_unavailable') {
|
|
@@ -128,8 +139,10 @@ const createNativeFileService = ({
|
|
|
128
139
|
return 'photo';
|
|
129
140
|
case 'video':
|
|
130
141
|
return 'video';
|
|
131
|
-
|
|
142
|
+
case 'all':
|
|
132
143
|
return 'mixed';
|
|
144
|
+
default:
|
|
145
|
+
return 'photo';
|
|
133
146
|
}
|
|
134
147
|
})(),
|
|
135
148
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as ExpoAV from 'expo-av';
|
|
2
|
+
import type * as ExpoVideoThumbnail from 'expo-video-thumbnails';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { MediaServiceInterface } from './types';
|
|
6
|
+
|
|
7
|
+
type Modules = {
|
|
8
|
+
avModule: typeof ExpoAV;
|
|
9
|
+
thumbnailModule: typeof ExpoVideoThumbnail;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const createExpoMediaService = ({ avModule, thumbnailModule }: Modules): MediaServiceInterface => {
|
|
13
|
+
return {
|
|
14
|
+
VideoComponent({ source, resizeMode, onLoad, ...props }) {
|
|
15
|
+
// FIXME: type error https://github.com/expo/expo/issues/17101
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
return <avModule.Video {...props} source={source} resizeMode={resizeMode} onLoad={onLoad} useNativeControls />;
|
|
18
|
+
},
|
|
19
|
+
async getVideoThumbnail({ url, quality, timeMills }) {
|
|
20
|
+
try {
|
|
21
|
+
const { uri } = await thumbnailModule.getThumbnailAsync(url, { quality, time: timeMills });
|
|
22
|
+
return { path: uri };
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default createExpoMediaService;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type * as CreateThumbnail from 'react-native-create-thumbnail';
|
|
3
|
+
import type Video from 'react-native-video';
|
|
4
|
+
|
|
5
|
+
import type { MediaServiceInterface } from './types';
|
|
6
|
+
|
|
7
|
+
type Modules = {
|
|
8
|
+
VideoComponent: typeof Video;
|
|
9
|
+
thumbnailModule: typeof CreateThumbnail;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function hash(str: string) {
|
|
13
|
+
return String(Math.abs(str.split('').reduce((a, c) => ((a << 5) - a + c.charCodeAt(0)) | 0, 0)));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const createNativeMediaService = ({ VideoComponent, thumbnailModule }: Modules): MediaServiceInterface => {
|
|
17
|
+
return {
|
|
18
|
+
VideoComponent({ source, resizeMode, onLoad, ...props }) {
|
|
19
|
+
return <VideoComponent {...props} source={source} resizeMode={resizeMode} onLoad={onLoad} controls />;
|
|
20
|
+
},
|
|
21
|
+
async getVideoThumbnail({ url, timeMills }) {
|
|
22
|
+
try {
|
|
23
|
+
const { path } = await thumbnailModule.createThumbnail({
|
|
24
|
+
url,
|
|
25
|
+
format: 'jpeg',
|
|
26
|
+
timeStamp: timeMills,
|
|
27
|
+
cacheName: hash(url),
|
|
28
|
+
});
|
|
29
|
+
return { path };
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default createNativeMediaService;
|
package/src/platform/types.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type DownloadedPath = string;
|
|
|
3
3
|
export type FilePickerResponse = FileType | null;
|
|
4
4
|
export type FileType = { uri: string; size: number; name: string; type: string };
|
|
5
5
|
|
|
6
|
+
// ---------- NotificationService ---------- //
|
|
6
7
|
export interface NotificationServiceInterface {
|
|
7
8
|
hasPushPermission(): Promise<boolean>;
|
|
8
9
|
requestPushPermission(): Promise<boolean>;
|
|
@@ -12,11 +13,13 @@ export interface NotificationServiceInterface {
|
|
|
12
13
|
onTokenRefresh(handler: (token: string) => void): Unsubscribe;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
// ---------- ClipboardService ---------- //
|
|
15
17
|
export interface ClipboardServiceInterface {
|
|
16
18
|
setString(text: string): void;
|
|
17
19
|
getString(): Promise<string>;
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
// ---------- FileService ---------- //
|
|
20
23
|
export interface FileServiceInterface extends FilePickerServiceInterface, FileSystemServiceInterface {}
|
|
21
24
|
|
|
22
25
|
export interface OpenResultListener {
|
|
@@ -28,7 +31,7 @@ export interface OpenMediaLibraryOptions extends OpenResultListener {
|
|
|
28
31
|
}
|
|
29
32
|
export interface OpenCameraOptions extends OpenResultListener {
|
|
30
33
|
cameraType?: 'front' | 'back';
|
|
31
|
-
mediaType?: 'photo' | 'video';
|
|
34
|
+
mediaType?: 'photo' | 'video' | 'all';
|
|
32
35
|
}
|
|
33
36
|
export type OpenDocumentOptions = OpenResultListener;
|
|
34
37
|
export interface SaveOptions {
|
|
@@ -49,3 +52,25 @@ export interface FileSystemServiceInterface {
|
|
|
49
52
|
// - Application supports iTunes file sharing
|
|
50
53
|
save(options?: SaveOptions): Promise<DownloadedPath | null>;
|
|
51
54
|
}
|
|
55
|
+
|
|
56
|
+
// ---------- MediaService ---------- //
|
|
57
|
+
interface VideoProps {
|
|
58
|
+
source: { uri: string } | number;
|
|
59
|
+
resizeMode?: 'cover' | 'contain' | 'stretch';
|
|
60
|
+
onLoad?: () => void;
|
|
61
|
+
}
|
|
62
|
+
interface GetVideoThumbnailOptions {
|
|
63
|
+
url: string;
|
|
64
|
+
timeMills?: number;
|
|
65
|
+
quality?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface MediaServiceInterface {
|
|
68
|
+
VideoComponent<Props = {}>(props: VideoProps & Props): JSX.Element;
|
|
69
|
+
getVideoThumbnail(options: GetVideoThumbnailOptions): Promise<{ path: string } | null>;
|
|
70
|
+
// compressImage(options: {
|
|
71
|
+
// path: string;
|
|
72
|
+
// compressionRate: number;
|
|
73
|
+
// resizingWidth: number;
|
|
74
|
+
// resizingHeight: number;
|
|
75
|
+
// }): Promise<{ path: string }>;
|
|
76
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const VERSION = '1.
|
|
1
|
+
const VERSION = '1.1.1';
|
|
2
2
|
export default VERSION;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultErrorBoundaryComponent","props","flex","justifyContent","alignItems","reset","InternalErrorBoundary","React","PureComponent","error","errorInfo","setState","onError","state","ErrorInfoComponent","children"],"sources":["InternalErrorBoundary.tsx"],"sourcesContent":["import React, { ErrorInfo } from 'react';\nimport { View } from 'react-native';\n\nimport TypedPlaceholder from './components/TypedPlaceholder';\nimport type { ErrorBoundaryProps } from './types';\n\nconst DefaultErrorBoundaryComponent = (props: ErrorBoundaryProps) => {\n return (\n <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>\n <TypedPlaceholder type={'error-wrong'} onPressRetry={props.reset} />\n </View>\n );\n};\n\nclass InternalErrorBoundary extends React.PureComponent<{\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n children?: React.ReactNode;\n}> {\n static defaultProps = {\n ErrorInfoComponent: DefaultErrorBoundaryComponent,\n };\n\n state: { error: Error | null; errorInfo: ErrorInfo | null } = {\n error: null,\n errorInfo: null,\n };\n\n componentDidCatch = (error: Error, errorInfo: ErrorInfo) => {\n this.setState({ error, errorInfo });\n this.props.onError?.({ error, errorInfo, reset: this.reset });\n };\n\n reset = () => {\n this.setState({ error: null, errorInfo: null });\n };\n\n render = () => {\n if (this.state.error && this.state.errorInfo) {\n return (\n this.props.ErrorInfoComponent?.({\n error: this.state.error,\n errorInfo: this.state.errorInfo,\n reset: this.reset,\n }) ??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Ad,CAAP;IACD,CA/BA;EAAA;;AAAA;;gBAJGT,qB,kBAKkB;EACpBQ,kBAAkB,EAAEd;AADA,C;;eAiCTM,qB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["InternalLocalCacheStorage","constructor","storage","getAllKeys","getItem","key","removeItem","setItem","value","multiGet","keys","Promise","all","map","multiRemove","multiSet","keyValuePairs"],"sources":["InternalLocalCacheStorage.ts"],"sourcesContent":["import type { KeyValuePairGet, KeyValuePairSet, LocalCacheStorage } from './types';\n\nexport default class InternalLocalCacheStorage implements LocalCacheStorage {\n constructor(private storage: LocalCacheStorage) {}\n\n getAllKeys() {\n return this.storage.getAllKeys();\n }\n\n getItem(key: string) {\n return this.storage.getItem(key);\n }\n\n removeItem(key: string) {\n return this.storage.removeItem(key);\n }\n\n setItem(key: string, value: string) {\n return this.storage.setItem(key, value);\n }\n\n async multiGet(keys: string[]) {\n if (this.storage.multiGet) {\n return this.storage.multiGet(keys);\n } else {\n return Promise.all(keys.map(async (key) => [key, await this.getItem(key)] as KeyValuePairGet));\n }\n }\n\n async multiRemove(keys: string[]) {\n if (this.storage.multiRemove) {\n await this.storage.multiRemove(keys);\n } else {\n await Promise.all(keys.map(async (key) => this.removeItem(key)));\n }\n }\n\n async multiSet(keyValuePairs: Array<KeyValuePairSet>) {\n if (this.storage.multiSet) {\n await this.storage.multiSet(keyValuePairs);\n } else {\n await Promise.all(keyValuePairs.map(([key, value]) => this.storage.setItem(key, value)));\n }\n }\n}\n"],"mappings":";;;;;;;AAEe,MAAMA,yBAAN,CAA6D;EAC1EC,WAAW,CAASC,OAAT,EAAqC;IAAA,KAA5BA,OAA4B,GAA5BA,OAA4B;EAAE;;EAElDC,UAAU,GAAG;IACX,OAAO,KAAKD,OAAL,CAAaC,UAAb,EAAP;EACD;;EAEDC,OAAO,CAACC,GAAD,EAAc;IACnB,OAAO,KAAKH,OAAL,CAAaE,OAAb,CAAqBC,GAArB,CAAP;EACD;;EAEDC,UAA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ACF;;AAzCyE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NetInfo","SBUDynamicModule","get","SendbirdUIKit","Object","freeze","VERSION","PLATFORM","Platform","OS","toLowerCase","SendbirdUIKitContainer","children","appId","chatOptions","platformServices","localization","styles","toast","errorBoundary","unsubscribes","useRef","current","getSendbirdSDK","sdk","localCacheStorage","Sendbird","localCacheEnabled","useAsyncStorageAsDatabase","InternalLocalCacheStorage","onInitialized","addExtension","addEventListener","listener","callback","callbackType","unsubscribe","state","online","Boolean","isConnected","isInternetReachable","push","setOnlineListener","onOnline","setOfflineListener","onOffline","sdkInstance","setSdkInstance","useState","useEffect","forEach","u","enableAutoPushTokenRegistration","stringSet","StringSetEn","file","notification","clipboard","theme","LightUIKitTheme","HeaderComponent","Header","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","LocalizedDialogProvider","STRINGS","useLocalization","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\nimport Sendbird from 'sendbird';\n\nimport type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n DialogProvider,\n Header,\n HeaderStyleProvider,\n LightUIKitTheme,\n ToastProvider,\n UIKitThemeProvider,\n} from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdChatSDK } from '@sendbird/uikit-utils';\n\nimport InternalErrorBoundary from './InternalErrorBoundary';\nimport InternalLocalCacheStorage from './InternalLocalCacheStorage';\nimport { LocalizationProvider } from './contexts/Localization';\nimport { PlatformServiceProvider } from './contexts/PlatformService';\nimport { SendbirdChatProvider } from './contexts/SendbirdChat';\nimport { useLocalization } from './hooks/useContext';\nimport StringSetEn from './localization/StringSet.en';\nimport type { StringSet } from './localization/StringSet.type';\nimport SBUDynamicModule from './platform/dynamicModule';\nimport type { ClipboardServiceInterface, FileServiceInterface, NotificationServiceInterface } from './platform/types';\nimport type { ErrorBoundaryProps, LocalCacheStorage } from './types';\nimport VERSION from './version';\n\nconst NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');\n\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n});\n\nexport type SendbirdUIKitContainerProps = React.PropsWithChildren<{\n appId: string;\n platformServices: {\n file: FileServiceInterface;\n notification: NotificationServiceInterface;\n clipboard: ClipboardServiceInterface;\n };\n chatOptions?: {\n localCacheStorage?: LocalCacheStorage;\n enableAutoPushTokenRegistration?: boolean;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n };\n localization?: {\n stringSet?: StringSet;\n };\n styles?: {\n theme?: UIKitTheme;\n statusBarTranslucent?: boolean;\n defaultHeaderTitleAlign?: 'left' | 'center';\n HeaderComponent?: HeaderStyleContextType['HeaderComponent'];\n };\n toast?: {\n dismissTimeout?: number;\n };\n errorBoundary?: {\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n toast,\n errorBoundary,\n}: SendbirdUIKitContainerProps) => {\n const unsubscribes = useRef<(() => void)[]>([]).current;\n const getSendbirdSDK = () => {\n let sdk: SendbirdChatSDK;\n\n if (chatOptions?.localCacheStorage) {\n sdk = new Sendbird({ appId, localCacheEnabled: true });\n sdk.useAsyncStorageAsDatabase(new InternalLocalCacheStorage(chatOptions.localCacheStorage));\n } else {\n sdk = new Sendbird({ appId });\n }\n\n if (chatOptions?.onInitialized) {\n sdk = chatOptions?.onInitialized(sdk);\n }\n\n if (SendbirdUIKit.VERSION) {\n // @ts-ignore\n sdk.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n if (SendbirdUIKit.PLATFORM) {\n // @ts-ignore\n sdk.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n sdk.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n sdk.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return sdk;\n };\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(getSendbirdSDK);\n\n useEffect(() => {\n setSdkInstance(getSendbirdSDK);\n return () => {\n unsubscribes.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, chatOptions?.localCacheStorage]);\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n enableAutoPushTokenRegistration={chatOptions?.enableAutoPushTokenRegistration ?? true}\n >\n <LocalizationProvider stringSet={localization?.stringSet ?? StringSetEn}>\n <PlatformServiceProvider\n fileService={platformServices.file}\n notificationService={platformServices.notification}\n clipboardService={platformServices.clipboard}\n >\n <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>\n <HeaderStyleProvider\n HeaderComponent={styles?.HeaderComponent ?? Header}\n defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <LocalizedDialogProvider>\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <InternalErrorBoundary {...errorBoundary}>{children}</InternalErrorBoundary>\n </ToastProvider>\n </LocalizedDialogProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst LocalizedDialogProvider = ({ children }: React.PropsWithChildren) => {\n const { STRINGS } = useLocalization();\n return (\n <DialogProvider\n defaultLabels={{\n alert: {\n ok: STRINGS.DIALOG.ALERT_DEFAULT_OK,\n },\n prompt: {\n ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,\n cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,\n placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,\n },\n }}\n >\n {children}\n </DialogProvider>\n );\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAGA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAGA;;;;;;;;AAEA,MAAMA,OAAO,GAAGC,sBAAA,CAAiBC,GAAjB,CAAqB,iCAArB,EAAwD,MAAxD,CAAhB;;AAEO,MAAMC,aAAa,GAAGC,MAAM,CAACC,MAAP,CAAc;EACzCC,OAAO,EAAPA,gBADyC;EAEzCC,QAAQ,EAAEC,qBAAA,CAASC,EAAT,CAAYC,WAAZ;AAF+B,CAAd,CAAtB;;;AAmCP,MAAMC,sBAAsB,GAAG,QASI;EAAA,IATH;IAC9BC,QAD8B;IAE9BC,KAF8B;IAG9BC,WAH8B;IAI9BC,gBAJ8B;IAK9BC,YAL8B;IAM9BC,MAN8B;IAO9BC,KAP8B;IAQ9BC;EAR8B,CASG;EACjC,MAAMC,YAAY,GAAG,IAAAC,aAAA,EAAuB,EAAvB,EAA2BC,OAAhD;;EACA,MAAMC,cAAc,GAAG,MAAM;IAC3B,IAAIC,GAAJ;;IAEA,IAAIV,WAAJ,aAAIA,WAAJ,eAAIA,WAAW,CAAEW,iBAAjB,EAAoC;MAClCD,GAAG,GAAG,IAAIE,iBAAJ,CAAa;QAAEb,KAAF;QAASc,iBAAiB,EAAE;MAA5B,CAAb,CAAN;MACAH,GAAG,CAACI,yBAAJ,CAA8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MAAM,CAAE8C,uBAAR,KAAmC,MAFxD;IAGE,oBAAoB,EAAE,CAAA9C,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAE+C,oBAAR,KAAgC;EAHxD,gBAKE,6BAAC,uBAAD,qBACE,6BAAC,yCAAD;IAAe,cAAc,EAAE9C,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAE+C;EAAtC,gBACE,6BAAC,8BAAD,EAA2B9C,aAA3B,EAA2CP,QAA3C,CADF,CADF,CALF,CADF,CALF,CADF,CAJF,CADF,CADF;AA8BD,CA7FD;;AA+FA,MAAMsD,uBAAuB,GAAG,SAA2C;EAAA,IAA1C;IAAEtD;EAAF,CAA0C;EACzE,MAAM;IAAEuD;EAAF,IAAc,IAAAC,2BAAA,GAApB;EACA,oBACE,6BAAC,0CAAD;IACE,aAAa,EAAE;MACbC,KAAK,EAAE;QACLC,EAAE,EAAEH,OAAO,CAACI,MAAR,CAAeC;MADd,CADM;MAIbC,MAAM,EAAE;QACNH,EAAE,EAAEH,OAAO,CAACI,MAAR,CAAeG,iBADb;QAENC,MAAM,EAAER,OAAO,CAACI,MAAR,CAAeK,qBAFjB;QAGNC,WAAW,EAAEV,OAAO,CAACI,MAAR,CAAeO;MAHtB;IAJK;EADjB,GAYGlE,QAZH,CADF;AAgBD,CAlBD;;eAoBeD,sB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","TypedPlaceholder","DefaultErrorBoundaryComponent","props","flex","justifyContent","alignItems","reset","InternalErrorBoundary","PureComponent","error","errorInfo","setState","onError","state","ErrorInfoComponent","children"],"sources":["InternalErrorBoundary.tsx"],"sourcesContent":["import React, { ErrorInfo } from 'react';\nimport { View } from 'react-native';\n\nimport TypedPlaceholder from './components/TypedPlaceholder';\nimport type { ErrorBoundaryProps } from './types';\n\nconst DefaultErrorBoundaryComponent = (props: ErrorBoundaryProps) => {\n return (\n <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>\n <TypedPlaceholder type={'error-wrong'} onPressRetry={props.reset} />\n </View>\n );\n};\n\nclass InternalErrorBoundary extends React.PureComponent<{\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n children?: React.ReactNode;\n}> {\n static defaultProps = {\n ErrorInfoComponent: DefaultErrorBoundaryComponent,\n };\n\n state: { error: Error | null; errorInfo: ErrorInfo | null } = {\n error: null,\n errorInfo: null,\n };\n\n componentDidCatch = (error: Error, errorInfo: ErrorInfo) => {\n this.setState({ error, errorInfo });\n this.props.onError?.({ error, errorInfo, reset: this.reset });\n };\n\n reset = () => {\n this.setState({ error: null, errorInfo: null });\n };\n\n render = () => {\n if (this.state.error && this.state.errorInfo) {\n return (\n this.props.ErrorInfoComponent?.({\n error: this.state.error,\n errorInfo: this.state.errorInfo,\n reset: this.reset,\n }) ?? null\n );\n }\n\n return <>{this.props.children}</>;\n };\n}\n\nexport default InternalErrorBoundary;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAiC,OAAjC;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,OAAOC,gBAAP,MAA6B,+BAA7B;;AAGA,MAAMC,6BAA6B,GAAIC,KAAD,IAA+B;EACnE,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAE;MAAEC,IAAI,EAAE,CAAR;MAAWC,cAAc,EAAE,QAA3B;MAAqCC,UAAU,EAAE;IAAjD;EAAb,gBACE,oBAAC,gBAAD;IAAkB,IAAI,EAAE,aAAxB;IAAuC,YAAY,EAAEH,KAAK,CAACI;EAA3D,EADF,CADF;AAKD,CAND;;AAQA,MAAMC,qBAAN,SAAoCT,KAAK,CAACU,aAA1C,CAIG;EAAA;IAAA;;IAAA,+BAK6D;MAC5DC,KAAK,EAAE,IADqD;MAE5DC,SAAS,EAAE;IAFiD,CAL7D;;IAAA,2CAUmB,CAACD,KAAD,EAAeC,SAAf,KAAwC;MAAA;;MAC1D,KAAKC,QAAL,CAAc;QAAEF,KAAF;QAASC;MAAT,CAAd;MACA,2CAAKR,KAAL,EAAWU,OAAX,8FAAqB;QAAEH,KAAF;QAASC,SAAT;QAAoBJ,KAAK,EAAE,KAAKA;MAAhC,CAArB;IACD,CAbA;;IAAA,+BAeO,MAAM;MACZ,KAAKK,QAAL,CAAc;QAAEF,KAAK,EAAE,IAAT;QAAeC,SAAS,EAAE;MAA1B,CAAd;IACD,CAjBA;;IAAA,gCAmBQ,MAAM;MACb,IAAI,KAAKG,KAAL,CAAWJ,KAAX,IAAoB,KAAKI,KAAL,CAAWH,SAAnC,EAA8C;QAAA;;QAC5C,OACE,+CAAKR,KAAL,EAAWY,kBAAX,mGAAgC;UAC9BL,KAAK,EAAE,KAAKI,KAAL,CAAWJ,KADY;UAE9BC,SAAS,EAAE,KAAKG,KAAL,CAAWH,SAFQ;UAG9BJ,KAAK,EAAE,KAAKA;QAHkB,CAAhC,MAIM,IALR;MAOD;;MAED,oBAAO,0CAAG,KAAKJ,KAAL,CAAWa,QAAd,CAAP;IACD,CA/BA;EAAA;;AAAA;;gBAJGR,qB,kBAKkB;EACpBO,kBAAkB,EAAEb;AADA,C;;AAiCxB,eAAeM,qBAAf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["InternalLocalCacheStorage","constructor","storage","getAllKeys","getItem","key","removeItem","setItem","value","multiGet","keys","Promise","all","map","multiRemove","multiSet","keyValuePairs"],"sources":["InternalLocalCacheStorage.ts"],"sourcesContent":["import type { KeyValuePairGet, KeyValuePairSet, LocalCacheStorage } from './types';\n\nexport default class InternalLocalCacheStorage implements LocalCacheStorage {\n constructor(private storage: LocalCacheStorage) {}\n\n getAllKeys() {\n return this.storage.getAllKeys();\n }\n\n getItem(key: string) {\n return this.storage.getItem(key);\n }\n\n removeItem(key: string) {\n return this.storage.removeItem(key);\n }\n\n setItem(key: string, value: string) {\n return this.storage.setItem(key, value);\n }\n\n async multiGet(keys: string[]) {\n if (this.storage.multiGet) {\n return this.storage.multiGet(keys);\n } else {\n return Promise.all(keys.map(async (key) => [key, await this.getItem(key)] as KeyValuePairGet));\n }\n }\n\n async multiRemove(keys: string[]) {\n if (this.storage.multiRemove) {\n await this.storage.multiRemove(keys);\n } else {\n await Promise.all(keys.map(async (key) => this.removeItem(key)));\n }\n }\n\n async multiSet(keyValuePairs: Array<KeyValuePairSet>) {\n if (this.storage.multiSet) {\n await this.storage.multiSet(keyValuePairs);\n } else {\n await Promise.all(keyValuePairs.map(([key, value]) => this.storage.setItem(key, value)));\n }\n }\n}\n"],"mappings":"AAEA,eAAe,MAAMA,yBAAN,CAA6D;EAC1EC,WAAW,CAASC,OAAT,EAAqC;IAAA,KAA5BA,OAA4B,GAA5BA,OAA4B;EAAE;;EAElDC,UAAU,GAAG;IACX,OAAO,KAAKD,OAAL,CAAaC,UAAb,EAAP;EACD;;EAEDC,OAAO,CAACC,GAAD,EAAc;IACnB,OAAO,KAAKH,OAAL,CAAaE,OAAb,CAAqBC,GAArB,CAAP;EACD;;EAEDC,UAAU,CAACD,GAAD,EAAc;IACtB,OAAO,KAAKH,OAAL,CAAaI,UAAb,CAAwBD,GAAxB,CAAP;EACD;;EAEDE,OAAO,CAACF,GAAD,EAAcG,KAAd,EAA6B;IAClC,OAAO,KAAKN,OAAL,CAAaK,OAAb,CAAqBF,GAArB,EAA0BG,KAA1B,CAAP;EACD;;EAEa,MAARC,QAAQ,CAACC,IAAD,EAAiB;IAC7B,IAAI,KAAKR,OAAL,CAAaO,QAAjB,EAA2B;MACzB,OAAO,KAAKP,OAAL,CAAaO,QAAb,CAAsBC,IAAtB,CAAP;IACD,CAFD,MAEO;MACL,OAAOC,OAAO,CAACC,GAAR,CAAYF,IAAI,CAACG,GAAL,CAAS,MAAOR,GAAP,IAAe,CAACA,GAAD,EAAM,MAAM,KAAKD,OAAL,CAAaC,GAAb,CAAZ,CAAxB,CAAZ,CAAP;IACD;EACF;;EAEgB,MAAXS,WAAW,CAACJ,IAAD,EAAiB;IAChC,IAAI,KAAKR,OAAL,CAAaY,WAAjB,EAA8B;MAC5B,MAAM,KAAKZ,OAAL,CAAaY,WAAb,CAAyBJ,IAAzB,CAAN;IACD,CAFD,MAEO;MACL,MAAMC,OAAO,CAACC,GAAR,CAAYF,IAAI,CAACG,GAAL,CAAS,MAAOR,GAAP,IAAe,KAAKC,UAAL,CAAgBD,GAAhB,CAAxB,CAAZ,CAAN;IACD;EACF;;EAEa,MAARU,QAAQ,CAACC,aAAD,EAAwC;IACpD,IAAI,KAAKd,OAAL,CAAaa,QAAjB,EAA2B;MACzB,MAAM,KAAKb,OAAL,CAAaa,QAAb,CAAsBC,aAAtB,CAAN;IACD,CAFD,MAEO;MACL,MAAML,OAAO,CAACC,GAAR,CAAYI,aAAa,CAACH,GAAd,CAAkB;QAAA,IAAC,CAACR,GAAD,EAAMG,KAAN,CAAD;QAAA,OAAkB,KAAKN,OAAL,CAAaK,OAAb,CAAqBF,GAArB,EAA0BG,KAA1B,CAAlB;MAAA,CAAlB,CAAZ,CAAN;IACD;EACF;;AAzCyE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","useState","Platform","SafeAreaProvider","Sendbird","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","InternalErrorBoundary","InternalLocalCacheStorage","LocalizationProvider","PlatformServiceProvider","SendbirdChatProvider","useLocalization","StringSetEn","SBUDynamicModule","VERSION","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","SendbirdUIKitContainer","children","appId","chatOptions","platformServices","localization","styles","toast","errorBoundary","unsubscribes","current","getSendbirdSDK","sdk","localCacheStorage","localCacheEnabled","useAsyncStorageAsDatabase","onInitialized","addExtension","addEventListener","listener","callback","callbackType","unsubscribe","state","online","Boolean","isConnected","isInternetReachable","push","setOnlineListener","onOnline","setOfflineListener","onOffline","sdkInstance","setSdkInstance","forEach","u","enableAutoPushTokenRegistration","stringSet","file","notification","clipboard","theme","HeaderComponent","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","LocalizedDialogProvider","STRINGS","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\nimport Sendbird from 'sendbird';\n\nimport type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n DialogProvider,\n Header,\n HeaderStyleProvider,\n LightUIKitTheme,\n ToastProvider,\n UIKitThemeProvider,\n} from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdChatSDK } from '@sendbird/uikit-utils';\n\nimport InternalErrorBoundary from './InternalErrorBoundary';\nimport InternalLocalCacheStorage from './InternalLocalCacheStorage';\nimport { LocalizationProvider } from './contexts/Localization';\nimport { PlatformServiceProvider } from './contexts/PlatformService';\nimport { SendbirdChatProvider } from './contexts/SendbirdChat';\nimport { useLocalization } from './hooks/useContext';\nimport StringSetEn from './localization/StringSet.en';\nimport type { StringSet } from './localization/StringSet.type';\nimport SBUDynamicModule from './platform/dynamicModule';\nimport type { ClipboardServiceInterface, FileServiceInterface, NotificationServiceInterface } from './platform/types';\nimport type { ErrorBoundaryProps, LocalCacheStorage } from './types';\nimport VERSION from './version';\n\nconst NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');\n\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n});\n\nexport type SendbirdUIKitContainerProps = React.PropsWithChildren<{\n appId: string;\n platformServices: {\n file: FileServiceInterface;\n notification: NotificationServiceInterface;\n clipboard: ClipboardServiceInterface;\n };\n chatOptions?: {\n localCacheStorage?: LocalCacheStorage;\n enableAutoPushTokenRegistration?: boolean;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n };\n localization?: {\n stringSet?: StringSet;\n };\n styles?: {\n theme?: UIKitTheme;\n statusBarTranslucent?: boolean;\n defaultHeaderTitleAlign?: 'left' | 'center';\n HeaderComponent?: HeaderStyleContextType['HeaderComponent'];\n };\n toast?: {\n dismissTimeout?: number;\n };\n errorBoundary?: {\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n toast,\n errorBoundary,\n}: SendbirdUIKitContainerProps) => {\n const unsubscribes = useRef<(() => void)[]>([]).current;\n const getSendbirdSDK = () => {\n let sdk: SendbirdChatSDK;\n\n if (chatOptions?.localCacheStorage) {\n sdk = new Sendbird({ appId, localCacheEnabled: true });\n sdk.useAsyncStorageAsDatabase(new InternalLocalCacheStorage(chatOptions.localCacheStorage));\n } else {\n sdk = new Sendbird({ appId });\n }\n\n if (chatOptions?.onInitialized) {\n sdk = chatOptions?.onInitialized(sdk);\n }\n\n if (SendbirdUIKit.VERSION) {\n // @ts-ignore\n sdk.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n if (SendbirdUIKit.PLATFORM) {\n // @ts-ignore\n sdk.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n sdk.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n sdk.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return sdk;\n };\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(getSendbirdSDK);\n\n useEffect(() => {\n setSdkInstance(getSendbirdSDK);\n return () => {\n unsubscribes.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, chatOptions?.localCacheStorage]);\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n enableAutoPushTokenRegistration={chatOptions?.enableAutoPushTokenRegistration ?? true}\n >\n <LocalizationProvider stringSet={localization?.stringSet ?? StringSetEn}>\n <PlatformServiceProvider\n fileService={platformServices.file}\n notificationService={platformServices.notification}\n clipboardService={platformServices.clipboard}\n >\n <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>\n <HeaderStyleProvider\n HeaderComponent={styles?.HeaderComponent ?? Header}\n defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <LocalizedDialogProvider>\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <InternalErrorBoundary {...errorBoundary}>{children}</InternalErrorBoundary>\n </ToastProvider>\n </LocalizedDialogProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst LocalizedDialogProvider = ({ children }: React.PropsWithChildren) => {\n const { STRINGS } = useLocalization();\n return (\n <DialogProvider\n defaultLabels={{\n alert: {\n ok: STRINGS.DIALOG.ALERT_DEFAULT_OK,\n },\n prompt: {\n ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,\n cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,\n placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,\n },\n }}\n >\n {children}\n </DialogProvider>\n );\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,EAAmCC,QAAnC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,cAA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