@sendbird/uikit-react-native 2.0.0 → 2.0.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/lib/commonjs/contexts/SendbirdChat.js +1 -1
- package/lib/commonjs/contexts/SendbirdChat.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 +1 -1
- package/lib/module/contexts/SendbirdChat.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 +5 -5
- package/src/contexts/SendbirdChat.tsx +1 -1
- package/src/version.ts +1 -1
|
@@ -63,7 +63,7 @@ const SendbirdChatProvider = _ref => {
|
|
|
63
63
|
(0, _react.useEffect)(() => {
|
|
64
64
|
const listener = status => {
|
|
65
65
|
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
66
|
-
if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();else sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
66
|
+
if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();else if (status === 'background') sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const subscriber = _reactNative.AppState.addEventListener('change', listener);
|
|
@@ -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","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;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AhE;EAwBA,MAAMU,0BAAiE,GAAG,IAAAT,kBAAA,EACvEU,OAAD,IAAmC;IACjC,IAAIb,WAAW,CAACc,sBAAhB,EAAwC,IAAAC,qCAAA,EAA0BxB,WAA1B,EAAuCsB,OAAvC;EACzC,CAHuE,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,
|
|
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 if (status === 'background') 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,+BAHmC;IAInCC,qCAJmC;IAKnCC;EALmC,CAMxB;EACX,MAAM,CAACC,WAAD,EAAcC,eAAd,IAAiC,IAAAC,eAAA,GAAvC;EACA,MAAMC,WAAW,GAAG,IAAAC,0BAAA,GAApB;EACA,MAAMC,WAAW,GAAG,IAAAC,8BAAA,EAAeV,WAAf,CAApB;EAEA,MAAMW,cAAyC,GAAG,IAAAC,kBAAA,EAAaC,IAAD,IAAU;IACtE;IACAR,eAAe,CAACQ,IAAD,CAAf;;IACAN,WAAW;EACZ,CAJiD,EAI/C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AA0C5B,WAAW,CAAC8B,kBAAZ,EAA1C;IACnC,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"}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.0.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.0.1';\nexport default VERSION;\n"],"mappings":";;;;;;AAAA,MAAMA,OAAO,GAAG,OAAhB;eACeA,O"}
|
|
@@ -45,7 +45,7 @@ export const SendbirdChatProvider = _ref => {
|
|
|
45
45
|
useEffect(() => {
|
|
46
46
|
const listener = status => {
|
|
47
47
|
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
48
|
-
if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();else sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
48
|
+
if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();else if (status === 'background') sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const subscriber = AppState.addEventListener('change', listener);
|
|
@@ -1 +1 @@
|
|
|
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,KAAJ,CAAU,gFAAV,CAAN;IAEX,MAAMC,MAAgC,GAAG;MAAEH;IAAF,CAAzC;;IAEA,IAAI,OAAOC,OAAP,KAAmB,QAAvB,EAAiC;MAC/BE,MAAM,CAACC,UAAP,GAAoBH,OAApB;IACD,CAFD,MAEO,IAAI,OAAOA,OAAP,KAAmB,QAAvB,EAAiC;MACtCE,MAAM,CAACE,YAAP,GAAsBJ,OAAtB;IACD,CAFM,MAEA;MACL,MAAM,IAAIC,KAAJ,CAAW,qDAAoD,OAAOD,OAAQ,GAA9E,CAAN;IACD;;IAEDH,IAAI,GAAG,MAAMT,WAAW,CAACU,qBAAZ,CAAkCI,MAAlC,CAAb;IAEAN,cAAc,CAACC,IAAD,CAAd;IACA,OAAOA,IAAP;EACD,CApBwE,EAqBzE,CAACT,WAAD,EAAcI,WAAd,EAA2BI,cAA3B,CArByE,CAA3E;EAwBA,MAAMS,0BAAiE,GAAG5B,WAAW,CAClF6B,OAAD,IAAmC;IACjC,IAAIX,WAAW,CAACY,sBAAhB,EAAwCzB,yBAAyB,CAACM,WAAD,EAAckB,OAAd,CAAzB;EACzC,CAHkF,EAInF,CAAClB,WAAD,EAAcO,WAAW,CAACY,sBAA1B,CAJmF,CAArF;EAOA7B,SAAS,CAAC,MAAM;IACd,MAAM8B,QAAQ,GAAIC,MAAD,IAA4B;MAC3C;MACA,IAAIA,MAAM,KAAK,QAAf,EAAyBrB,WAAW,CAACsB,eAAZ,KAAgC,QAAhC,IAA4CtB,WAAW,CAACuB,kBAAZ,EAA5C,CAAzB,
|
|
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 if (status === 'background') 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;AAC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ION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.0.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '2.0.1';\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: "2.0.
|
|
8
|
+
VERSION: "2.0.1";
|
|
9
9
|
PLATFORM: string;
|
|
10
10
|
}>;
|
|
11
11
|
export declare type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const VERSION = "2.0.
|
|
1
|
+
declare const VERSION = "2.0.1";
|
|
2
2
|
export default VERSION;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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": "2.0.
|
|
45
|
-
"@sendbird/uikit-react-native-foundation": "2.0.
|
|
46
|
-
"@sendbird/uikit-utils": "2.0.
|
|
44
|
+
"@sendbird/uikit-chat-hooks": "2.0.1",
|
|
45
|
+
"@sendbird/uikit-react-native-foundation": "2.0.1",
|
|
46
|
+
"@sendbird/uikit-utils": "2.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@react-native-clipboard/clipboard": "^1.8.5",
|
|
@@ -171,5 +171,5 @@
|
|
|
171
171
|
"readmeFile": "./README.md",
|
|
172
172
|
"displayName": "@sendbird/uikit-react-native"
|
|
173
173
|
},
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "3c00c29c86778ab2775049a22e03a2b5cce01d87"
|
|
175
175
|
}
|
|
@@ -96,7 +96,7 @@ export const SendbirdChatProvider = ({
|
|
|
96
96
|
const listener = (status: AppStateStatus) => {
|
|
97
97
|
// 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
|
|
98
98
|
if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();
|
|
99
|
-
else sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
99
|
+
else if (status === 'background') sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
const subscriber = AppState.addEventListener('change', listener);
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const VERSION = '2.0.
|
|
1
|
+
const VERSION = '2.0.1';
|
|
2
2
|
export default VERSION;
|