@sendbird/uikit-react-native 1.1.3 → 1.1.5
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/lib/commonjs/contexts/SendbirdChat.js +4 -12
- package/lib/commonjs/contexts/SendbirdChat.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +4 -14
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/contexts/SendbirdChat.js +6 -12
- package/lib/module/contexts/SendbirdChat.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +5 -9
- package/lib/module/fragments/createGroupChannelListFragment.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 +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/contexts/SendbirdChat.tsx +7 -13
- package/src/fragments/createGroupChannelListFragment.tsx +5 -9
- package/src/version.ts +1 -1
|
@@ -7,8 +7,6 @@ exports.SendbirdChatProvider = exports.SendbirdChatContext = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
10
|
var _uikitChatHooks = require("@sendbird/uikit-chat-hooks");
|
|
13
11
|
|
|
14
12
|
var _uikitUtils = require("@sendbird/uikit-utils");
|
|
@@ -60,16 +58,10 @@ const SendbirdChatProvider = _ref => {
|
|
|
60
58
|
sdkInstance.markAsDelivered(channel.url);
|
|
61
59
|
}
|
|
62
60
|
}, [sdkInstance, appFeatures.deliveryReceiptEnabled]);
|
|
63
|
-
(0,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const subscriber = _reactNative.AppState.addEventListener('change', listener);
|
|
70
|
-
|
|
71
|
-
return () => subscriber.remove();
|
|
72
|
-
}, [sdkInstance]);
|
|
61
|
+
(0, _uikitUtils.useAppState)('change', status => {
|
|
62
|
+
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
63
|
+
if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();else if (status === 'background') sdkInstance.getConnectionState() === 'OPEN' && sdkInstance.setBackgroundState();
|
|
64
|
+
});
|
|
73
65
|
const value = {
|
|
74
66
|
sdk: sdkInstance,
|
|
75
67
|
currentUser,
|
|
@@ -1 +1 @@
|
|
|
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","profileUrl","updateCurrentUserInfoWithProfileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","unreadMessageCount","markAsDelivered","url","
|
|
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","profileUrl","updateCurrentUserInfoWithProfileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","unreadMessageCount","markAsDelivered","url","useAppState","status","getConnectionState","setForegroundState","setBackgroundState","value","sdk","features","autoPushTokenRegistrationEnabled","channelListTypingIndicatorEnabled","channelListMessageReceiptStatusEnabled"],"sources":["SendbirdChat.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport type { SendbirdChatSDK, SendbirdGroupChannel, SendbirdUser } from '@sendbird/uikit-utils';\nimport { useAppState, 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 if (typeof profile === 'undefined') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, sdkInstance.currentUser.profileUrl);\n } else if (typeof profile === 'string') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, profile);\n } else if (typeof profile === 'object') {\n user = await sdkInstance.updateCurrentUserInfoWithProfileImage(nickname, profile);\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\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 && channel.unreadMessageCount > 0) {\n sdkInstance.markAsDelivered(channel.url);\n }\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useAppState('change', (status) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();\n else if (status === 'background') sdkInstance.getConnectionState() === 'OPEN' && sdkInstance.setBackgroundState();\n });\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;;AAEA;;AAEA;;;;;;AAmCO,MAAMA,mBAAmB,gBAAGC,cAAA,CAAMC,aAAN,CAAoC,IAApC,CAA5B;;;;AACA,MAAMC,oBAAoB,GAAG,QAMvB;EAAA,IANwB;IACnCC,QADmC;IAEnCC,WAFmC;IAGnCC,+BAHmC;IAInCC,qCAJmC;IAKnCC;EALmC,CAMxB;EACX,MAAM,CAACC,WAAD,EAAcC,eAAd,IAAiC,IAAAC,eAAA,GAAvC;EACA,MAAMC,WAAW,GAAG,IAAAC,0BAAA,GAApB;EACA,MAA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OAAO,CAACI,GAApC;IACD;EACF,CALuE,EAMxE,CAACzB,WAAD,EAAcS,WAAW,CAACa,sBAA1B,CANwE,CAA1E;EASA,IAAAI,uBAAA,EAAY,QAAZ,EAAuBC,MAAD,IAAY;IAChC;IACA,IAAIA,MAAM,KAAK,QAAf,EAAyB3B,WAAW,CAAC4B,kBAAZ,OAAqC,QAArC,IAAiD5B,WAAW,CAAC6B,kBAAZ,EAAjD,CAAzB,KACK,IAAIF,MAAM,KAAK,YAAf,EAA6B3B,WAAW,CAAC4B,kBAAZ,OAAqC,MAArC,IAA+C5B,WAAW,CAAC8B,kBAAZ,EAA/C;EACnC,CAJD;EAMA,MAAMC,KAAc,GAAG;IACrBC,GAAG,EAAEhC,WADgB;IAErBI,WAFqB;IAGrBO,cAHqB;IAKrBG,qBALqB;IAMrBM,0BANqB;IAQrBa,QAAQ,EAAE,EACR,GAAGxB,WADK;MAERyB,gCAAgC,EAAEjC,+BAF1B;MAGRkC,iCAAiC,EAAEhC,gCAH3B;MAIRiC,sCAAsC,EAAElC;IAJhC;EARW,CAAvB;EAgBA,oBAAO,6BAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAE6B;EAArC,GAA6ChC,QAA7C,CAAP;AACD,CAvEM"}
|
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _uikitChatHooks = require("@sendbird/uikit-chat-hooks");
|
|
13
11
|
|
|
@@ -23,10 +21,6 @@ var _useContext = require("../hooks/useContext");
|
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
23
|
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
24
|
const createGroupChannelListFragment = initModule => {
|
|
31
25
|
const GroupChannelListModule = (0, _createGroupChannelListModule.default)(initModule);
|
|
32
26
|
return _ref => {
|
|
@@ -58,13 +52,9 @@ const createGroupChannelListFragment = initModule => {
|
|
|
58
52
|
});
|
|
59
53
|
|
|
60
54
|
if (features.deliveryReceiptEnabled) {
|
|
61
|
-
(0,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return () => listener.remove();
|
|
67
|
-
}, []);
|
|
55
|
+
(0, _uikitUtils.useAppState)('change', status => {
|
|
56
|
+
if (status === 'active') groupChannels.forEach(markAsDeliveredWithChannel);
|
|
57
|
+
});
|
|
68
58
|
}
|
|
69
59
|
|
|
70
60
|
const _renderGroupChannelPreview = (0, _uikitUtils.useFreshCallback)((channel, onLongPressChannel) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createGroupChannelListFragment","initModule","GroupChannelListModule","createGroupChannelListModule","TypeSelectorHeader","onPressChannel","onPressCreateChannel","queryCreator","collectionCreator","renderGroupChannelPreview","flatListProps","menuItemCreator","PASS","sdk","currentUser","features","markAsDeliveredWithChannel","useSendbirdChat","groupChannels","next","loading","useGroupChannelList","userId","enableCollectionWithoutLocalCache","deliveryReceiptEnabled","
|
|
1
|
+
{"version":3,"names":["createGroupChannelListFragment","initModule","GroupChannelListModule","createGroupChannelListModule","TypeSelectorHeader","onPressChannel","onPressCreateChannel","queryCreator","collectionCreator","renderGroupChannelPreview","flatListProps","menuItemCreator","PASS","sdk","currentUser","features","markAsDeliveredWithChannel","useSendbirdChat","groupChannels","next","loading","useGroupChannelList","userId","enableCollectionWithoutLocalCache","deliveryReceiptEnabled","useAppState","status","forEach","_renderGroupChannelPreview","useFreshCallback","channel","onLongPressChannel","Logger","warn","ListEmptyComponent","contentContainerStyle","flexGrow"],"sources":["createGroupChannelListFragment.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useGroupChannelList } from '@sendbird/uikit-chat-hooks';\nimport { Logger, PASS, useAppState, useFreshCallback } from '@sendbird/uikit-utils';\n\nimport StatusComposition from '../components/StatusComposition';\nimport GroupChannelPreviewContainer from '../containers/GroupChannelPreviewContainer';\nimport createGroupChannelListModule from '../domain/groupChannelList/module/createGroupChannelListModule';\nimport type {\n GroupChannelListFragment,\n GroupChannelListModule,\n GroupChannelListProps,\n} from '../domain/groupChannelList/types';\nimport { useSendbirdChat } from '../hooks/useContext';\n\nconst createGroupChannelListFragment = (initModule?: Partial<GroupChannelListModule>): GroupChannelListFragment => {\n const GroupChannelListModule = createGroupChannelListModule(initModule);\n return ({\n TypeSelectorHeader,\n onPressChannel,\n onPressCreateChannel,\n queryCreator,\n collectionCreator,\n renderGroupChannelPreview,\n // skipTypeSelection = true,\n flatListProps = {},\n menuItemCreator = PASS,\n }) => {\n const { sdk, currentUser, features, markAsDeliveredWithChannel } = useSendbirdChat();\n const { groupChannels, next, loading } = useGroupChannelList(sdk, currentUser?.userId, {\n queryCreator,\n collectionCreator,\n enableCollectionWithoutLocalCache: !queryCreator,\n });\n\n if (features.deliveryReceiptEnabled) {\n useAppState('change', (status) => {\n if (status === 'active') groupChannels.forEach(markAsDeliveredWithChannel);\n });\n }\n\n const _renderGroupChannelPreview: GroupChannelListProps['List']['renderGroupChannelPreview'] = useFreshCallback(\n (channel, onLongPressChannel) => {\n if (renderGroupChannelPreview) return renderGroupChannelPreview(channel, onLongPressChannel);\n return (\n <GroupChannelPreviewContainer\n channel={channel}\n onPress={() => onPressChannel(channel)}\n onLongPress={() => onLongPressChannel()}\n />\n );\n },\n );\n\n if (!currentUser) {\n Logger.warn('Cannot render GroupChannelListFragment, please connect using `useConnection()` hook first');\n return null;\n }\n\n return (\n <GroupChannelListModule.Provider>\n <GroupChannelListModule.Header />\n <StatusComposition loading={loading} LoadingComponent={<GroupChannelListModule.StatusLoading />}>\n <GroupChannelListModule.List\n menuItemCreator={menuItemCreator}\n renderGroupChannelPreview={_renderGroupChannelPreview}\n groupChannels={groupChannels}\n onLoadNext={next}\n flatListProps={{\n ListEmptyComponent: <GroupChannelListModule.StatusEmpty />,\n contentContainerStyle: { flexGrow: 1 },\n ...flatListProps,\n }}\n />\n </StatusComposition>\n <GroupChannelListModule.TypeSelector\n // NOTE: not included in first iteration\n skipTypeSelection\n Header={TypeSelectorHeader}\n onSelectType={onPressCreateChannel}\n />\n </GroupChannelListModule.Provider>\n );\n };\n};\n\nexport default createGroupChannelListFragment;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAMA;;;;AAEA,MAAMA,8BAA8B,GAAIC,UAAD,IAA4E;EACjH,MAAMC,sBAAsB,GAAG,IAAAC,qCAAA,EAA6BF,UAA7B,CAA/B;EACA,OAAO,QAUD;IAAA,IAVE;MACNG,kBADM;MAENC,cAFM;MAGNC,oBAHM;MAINC,YAJM;MAKNC,iBALM;MAMNC,yBANM;MAON;MACAC,aAAa,GAAG,EARV;MASNC,eAAe,GAAGC;IATZ,CAUF;IACJ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;MAGE,aAAa,EAAEV,aAHjB;MAIE,UAAU,EAAEC,IAJd;MAKE,aAAa,EAAE;QACbe,kBAAkB,eAAE,6BAAC,sBAAD,CAAwB,WAAxB,OADP;QAEbC,qBAAqB,EAAE;UAAEC,QAAQ,EAAE;QAAZ,CAFV;QAGb,GAAG1B;MAHU;IALjB,EADF,CAFF,eAeE,6BAAC,sBAAD,CAAwB,YAAxB;MACE;MACA,iBAAiB,MAFnB;MAGE,MAAM,EAAEN,kBAHV;MAIE,YAAY,EAAEE;IAJhB,EAfF,CADF;EAwBD,CAlED;AAmED,CArED;;eAuEeN,8B"}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '1.1.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '1.1.5';\nexport default VERSION;\n"],"mappings":";;;;;;AAAA,MAAMA,OAAO,GAAG,OAAhB;eACeA,O"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
2
|
-
import { AppState } from 'react-native';
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
3
2
|
import { useAppFeatures } from '@sendbird/uikit-chat-hooks';
|
|
4
|
-
import { useForceUpdate } from '@sendbird/uikit-utils';
|
|
3
|
+
import { useAppState, useForceUpdate } from '@sendbird/uikit-utils';
|
|
5
4
|
export const SendbirdChatContext = /*#__PURE__*/React.createContext(null);
|
|
6
5
|
export const SendbirdChatProvider = _ref => {
|
|
7
6
|
let {
|
|
@@ -42,15 +41,10 @@ export const SendbirdChatProvider = _ref => {
|
|
|
42
41
|
sdkInstance.markAsDelivered(channel.url);
|
|
43
42
|
}
|
|
44
43
|
}, [sdkInstance, appFeatures.deliveryReceiptEnabled]);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const subscriber = AppState.addEventListener('change', listener);
|
|
52
|
-
return () => subscriber.remove();
|
|
53
|
-
}, [sdkInstance]);
|
|
44
|
+
useAppState('change', status => {
|
|
45
|
+
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
46
|
+
if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();else if (status === 'background') sdkInstance.getConnectionState() === 'OPEN' && sdkInstance.setBackgroundState();
|
|
47
|
+
});
|
|
54
48
|
const value = {
|
|
55
49
|
sdk: sdkInstance,
|
|
56
50
|
currentUser,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useState","useAppFeatures","useAppState","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","children","sdkInstance","enableAutoPushTokenRegistration","enableChannelListMessageReceiptStatus","enableChannelListTypingIndicator","currentUser","_setCurrentUser","forceUpdate","appFeatures","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","profileUrl","updateCurrentUserInfoWithProfileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","unreadMessageCount","markAsDelivered","url","status","getConnectionState","setForegroundState","setBackgroundState","value","sdk","features","autoPushTokenRegistrationEnabled","channelListTypingIndicatorEnabled","channelListMessageReceiptStatusEnabled"],"sources":["SendbirdChat.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport type { SendbirdChatSDK, SendbirdGroupChannel, SendbirdUser } from '@sendbird/uikit-utils';\nimport { useAppState, 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 if (typeof profile === 'undefined') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, sdkInstance.currentUser.profileUrl);\n } else if (typeof profile === 'string') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, profile);\n } else if (typeof profile === 'object') {\n user = await sdkInstance.updateCurrentUserInfoWithProfileImage(nickname, profile);\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\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 && channel.unreadMessageCount > 0) {\n sdkInstance.markAsDelivered(channel.url);\n }\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useAppState('change', (status) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();\n else if (status === 'background') sdkInstance.getConnectionState() === 'OPEN' && sdkInstance.setBackgroundState();\n });\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,QAA7B,QAA6C,OAA7C;AAEA,SAASC,cAAT,QAA+B,4BAA/B;AAEA,SAASC,WAAT,EAAsBC,cAAtB,QAA4C,uBAA5C;AAmCA,OAAO,MAAMC,mBAAmB,gBAAGN,KAAK,CAACO,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,IAAiCb,QAAQ,EAA/C;EACA,MAAMc,WAAW,GAAGX,cAAc,EAAlC;EACA,MAAMY,WAAW,GAAGd,cAAc,CAACO,WAAD,CAAlC;EAEA,MAAMQ,cAAyC,GAAGjB,WAAW,CAAEkB,IAAD,IAAU;IACtE;IACAJ,eAAe,CAACI,IAAD,CAAf;;IACAH,WAAW;EACZ,CAJ4D,EAI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W,CAACuB,kBAAZ,OAAqC,QAArC,IAAiDvB,WAAW,CAACwB,kBAAZ,EAAjD,CAAzB,KACK,IAAIF,MAAM,KAAK,YAAf,EAA6BtB,WAAW,CAACuB,kBAAZ,OAAqC,MAArC,IAA+CvB,WAAW,CAACyB,kBAAZ,EAA/C;EACnC,CAJU,CAAX;EAMA,MAAMC,KAAc,GAAG;IACrBC,GAAG,EAAE3B,WADgB;IAErBI,WAFqB;IAGrBI,cAHqB;IAKrBE,qBALqB;IAMrBM,0BANqB;IAQrBY,QAAQ,EAAE,EACR,GAAGrB,WADK;MAERsB,gCAAgC,EAAE5B,+BAF1B;MAGR6B,iCAAiC,EAAE3B,gCAH3B;MAIR4B,sCAAsC,EAAE7B;IAJhC;EARW,CAAvB;EAgBA,oBAAO,oBAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAEwB;EAArC,GAA6C3B,QAA7C,CAAP;AACD,CAvEM"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { AppState } from 'react-native';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { useGroupChannelList } from '@sendbird/uikit-chat-hooks';
|
|
4
|
-
import { Logger, PASS, useFreshCallback } from '@sendbird/uikit-utils';
|
|
3
|
+
import { Logger, PASS, useAppState, useFreshCallback } from '@sendbird/uikit-utils';
|
|
5
4
|
import StatusComposition from '../components/StatusComposition';
|
|
6
5
|
import GroupChannelPreviewContainer from '../containers/GroupChannelPreviewContainer';
|
|
7
6
|
import createGroupChannelListModule from '../domain/groupChannelList/module/createGroupChannelListModule';
|
|
@@ -38,12 +37,9 @@ const createGroupChannelListFragment = initModule => {
|
|
|
38
37
|
});
|
|
39
38
|
|
|
40
39
|
if (features.deliveryReceiptEnabled) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
return () => listener.remove();
|
|
46
|
-
}, []);
|
|
40
|
+
useAppState('change', status => {
|
|
41
|
+
if (status === 'active') groupChannels.forEach(markAsDeliveredWithChannel);
|
|
42
|
+
});
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
const _renderGroupChannelPreview = useFreshCallback((channel, onLongPressChannel) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","useGroupChannelList","Logger","PASS","useAppState","useFreshCallback","StatusComposition","GroupChannelPreviewContainer","createGroupChannelListModule","useSendbirdChat","createGroupChannelListFragment","initModule","GroupChannelListModule","TypeSelectorHeader","onPressChannel","onPressCreateChannel","queryCreator","collectionCreator","renderGroupChannelPreview","flatListProps","menuItemCreator","sdk","currentUser","features","markAsDeliveredWithChannel","groupChannels","next","loading","userId","enableCollectionWithoutLocalCache","deliveryReceiptEnabled","status","forEach","_renderGroupChannelPreview","channel","onLongPressChannel","warn","ListEmptyComponent","contentContainerStyle","flexGrow"],"sources":["createGroupChannelListFragment.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useGroupChannelList } from '@sendbird/uikit-chat-hooks';\nimport { Logger, PASS, useAppState, useFreshCallback } from '@sendbird/uikit-utils';\n\nimport StatusComposition from '../components/StatusComposition';\nimport GroupChannelPreviewContainer from '../containers/GroupChannelPreviewContainer';\nimport createGroupChannelListModule from '../domain/groupChannelList/module/createGroupChannelListModule';\nimport type {\n GroupChannelListFragment,\n GroupChannelListModule,\n GroupChannelListProps,\n} from '../domain/groupChannelList/types';\nimport { useSendbirdChat } from '../hooks/useContext';\n\nconst createGroupChannelListFragment = (initModule?: Partial<GroupChannelListModule>): GroupChannelListFragment => {\n const GroupChannelListModule = createGroupChannelListModule(initModule);\n return ({\n TypeSelectorHeader,\n onPressChannel,\n onPressCreateChannel,\n queryCreator,\n collectionCreator,\n renderGroupChannelPreview,\n // skipTypeSelection = true,\n flatListProps = {},\n menuItemCreator = PASS,\n }) => {\n const { sdk, currentUser, features, markAsDeliveredWithChannel } = useSendbirdChat();\n const { groupChannels, next, loading } = useGroupChannelList(sdk, currentUser?.userId, {\n queryCreator,\n collectionCreator,\n enableCollectionWithoutLocalCache: !queryCreator,\n });\n\n if (features.deliveryReceiptEnabled) {\n useAppState('change', (status) => {\n if (status === 'active') groupChannels.forEach(markAsDeliveredWithChannel);\n });\n }\n\n const _renderGroupChannelPreview: GroupChannelListProps['List']['renderGroupChannelPreview'] = useFreshCallback(\n (channel, onLongPressChannel) => {\n if (renderGroupChannelPreview) return renderGroupChannelPreview(channel, onLongPressChannel);\n return (\n <GroupChannelPreviewContainer\n channel={channel}\n onPress={() => onPressChannel(channel)}\n onLongPress={() => onLongPressChannel()}\n />\n );\n },\n );\n\n if (!currentUser) {\n Logger.warn('Cannot render GroupChannelListFragment, please connect using `useConnection()` hook first');\n return null;\n }\n\n return (\n <GroupChannelListModule.Provider>\n <GroupChannelListModule.Header />\n <StatusComposition loading={loading} LoadingComponent={<GroupChannelListModule.StatusLoading />}>\n <GroupChannelListModule.List\n menuItemCreator={menuItemCreator}\n renderGroupChannelPreview={_renderGroupChannelPreview}\n groupChannels={groupChannels}\n onLoadNext={next}\n flatListProps={{\n ListEmptyComponent: <GroupChannelListModule.StatusEmpty />,\n contentContainerStyle: { flexGrow: 1 },\n ...flatListProps,\n }}\n />\n </StatusComposition>\n <GroupChannelListModule.TypeSelector\n // NOTE: not included in first iteration\n skipTypeSelection\n Header={TypeSelectorHeader}\n onSelectType={onPressCreateChannel}\n />\n </GroupChannelListModule.Provider>\n );\n };\n};\n\nexport default createGroupChannelListFragment;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,mBAAT,QAAoC,4BAApC;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,WAAvB,EAAoCC,gBAApC,QAA4D,uBAA5D;AAEA,OAAOC,iBAAP,MAA8B,iCAA9B;AACA,OAAOC,4BAAP,MAAyC,4CAAzC;AACA,OAAOC,4BAAP,MAAyC,gEAAzC;AAMA,SAASC,eAAT,QAAgC,qBAAhC;;AAEA,MAAMC,8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qBACE,oBAAC,sBAAD,CAAwB,MAAxB,OADF,eAEE,oBAAC,iBAAD;MAAmB,OAAO,EAAET,OAA5B;MAAqC,gBAAgB,eAAE,oBAAC,sBAAD,CAAwB,aAAxB;IAAvD,gBACE,oBAAC,sBAAD,CAAwB,IAAxB;MACE,eAAe,EAAEP,eADnB;MAEE,yBAAyB,EAAEa,0BAF7B;MAGE,aAAa,EAAER,aAHjB;MAIE,UAAU,EAAEC,IAJd;MAKE,aAAa,EAAE;QACbW,kBAAkB,eAAE,oBAAC,sBAAD,CAAwB,WAAxB,OADP;QAEbC,qBAAqB,EAAE;UAAEC,QAAQ,EAAE;QAAZ,CAFV;QAGb,GAAGpB;MAHU;IALjB,EADF,CAFF,eAeE,oBAAC,sBAAD,CAAwB,YAAxB;MACE;MACA,iBAAiB,MAFnB;MAGE,MAAM,EAAEN,kBAHV;MAIE,YAAY,EAAEE;IAJhB,EAfF,CADF;EAwBD,CAlED;AAmED,CArED;;AAuEA,eAAeL,8BAAf"}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '1.1.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '1.1.5';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,OAAhB;AACA,eAAeA,OAAf"}
|
|
@@ -5,7 +5,7 @@ import type { StringSet } from '../localization/StringSet.type';
|
|
|
5
5
|
import type { ClipboardServiceInterface, FileServiceInterface, MediaServiceInterface, NotificationServiceInterface } from '../platform/types';
|
|
6
6
|
import type { ErrorBoundaryProps, LocalCacheStorage } from '../types';
|
|
7
7
|
export declare const SendbirdUIKit: Readonly<{
|
|
8
|
-
VERSION: "1.1.
|
|
8
|
+
VERSION: "1.1.5";
|
|
9
9
|
PLATFORM: string;
|
|
10
10
|
}>;
|
|
11
11
|
export declare type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const VERSION = "1.1.
|
|
1
|
+
declare const VERSION = "1.1.5";
|
|
2
2
|
export default VERSION;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "react-native-uikit",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@sendbird/uikit-chat-hooks": "1.1.
|
|
45
|
-
"@sendbird/uikit-react-native-foundation": "1.1.
|
|
46
|
-
"@sendbird/uikit-utils": "1.1.
|
|
44
|
+
"@sendbird/uikit-chat-hooks": "1.1.5",
|
|
45
|
+
"@sendbird/uikit-react-native-foundation": "1.1.5",
|
|
46
|
+
"@sendbird/uikit-utils": "1.1.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@react-native-clipboard/clipboard": "^1.8.5",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"inquirer": "^8.2.0",
|
|
68
68
|
"js-convert-case": "^4.2.0",
|
|
69
69
|
"react": "17.0.2",
|
|
70
|
-
"react-native": "0.66.
|
|
70
|
+
"react-native": "0.66.5",
|
|
71
71
|
"react-native-builder-bob": "^0.18.0",
|
|
72
72
|
"react-native-create-thumbnail": "^1.5.1",
|
|
73
73
|
"react-native-document-picker": "^8.0.0",
|
|
@@ -159,5 +159,5 @@
|
|
|
159
159
|
"readmeFile": "./README.md",
|
|
160
160
|
"displayName": "@sendbird/uikit-react-native"
|
|
161
161
|
},
|
|
162
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "771842db01ff834bc1cec6766e97db0aacf908a8"
|
|
163
163
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
2
|
-
import { AppState, AppStateStatus } from 'react-native';
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
3
2
|
|
|
4
3
|
import { useAppFeatures } from '@sendbird/uikit-chat-hooks';
|
|
5
4
|
import type { SendbirdChatSDK, SendbirdGroupChannel, SendbirdUser } from '@sendbird/uikit-utils';
|
|
6
|
-
import { useForceUpdate } from '@sendbird/uikit-utils';
|
|
5
|
+
import { useAppState, useForceUpdate } from '@sendbird/uikit-utils';
|
|
7
6
|
|
|
8
7
|
import type { FileType } from '../platform/types';
|
|
9
8
|
|
|
@@ -87,16 +86,11 @@ export const SendbirdChatProvider = ({
|
|
|
87
86
|
[sdkInstance, appFeatures.deliveryReceiptEnabled],
|
|
88
87
|
);
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const subscriber = AppState.addEventListener('change', listener);
|
|
98
|
-
return () => subscriber.remove();
|
|
99
|
-
}, [sdkInstance]);
|
|
89
|
+
useAppState('change', (status) => {
|
|
90
|
+
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
91
|
+
if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();
|
|
92
|
+
else if (status === 'background') sdkInstance.getConnectionState() === 'OPEN' && sdkInstance.setBackgroundState();
|
|
93
|
+
});
|
|
100
94
|
|
|
101
95
|
const value: Context = {
|
|
102
96
|
sdk: sdkInstance,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { AppState } from 'react-native';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
|
|
4
3
|
import { useGroupChannelList } from '@sendbird/uikit-chat-hooks';
|
|
5
|
-
import { Logger, PASS, useFreshCallback } from '@sendbird/uikit-utils';
|
|
4
|
+
import { Logger, PASS, useAppState, useFreshCallback } from '@sendbird/uikit-utils';
|
|
6
5
|
|
|
7
6
|
import StatusComposition from '../components/StatusComposition';
|
|
8
7
|
import GroupChannelPreviewContainer from '../containers/GroupChannelPreviewContainer';
|
|
@@ -35,12 +34,9 @@ const createGroupChannelListFragment = (initModule?: Partial<GroupChannelListMod
|
|
|
35
34
|
});
|
|
36
35
|
|
|
37
36
|
if (features.deliveryReceiptEnabled) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
return () => listener.remove();
|
|
43
|
-
}, []);
|
|
37
|
+
useAppState('change', (status) => {
|
|
38
|
+
if (status === 'active') groupChannels.forEach(markAsDeliveredWithChannel);
|
|
39
|
+
});
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
const _renderGroupChannelPreview: GroupChannelListProps['List']['renderGroupChannelPreview'] = useFreshCallback(
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const VERSION = '1.1.
|
|
1
|
+
const VERSION = '1.1.5';
|
|
2
2
|
export default VERSION;
|