@sendbird/uikit-react-native 3.11.0 → 3.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +0 -3
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.expo.js +83 -12
- package/lib/commonjs/platform/createMediaService.expo.js.map +1 -1
- package/lib/commonjs/platform/createNotificationService.native.js +31 -6
- package/lib/commonjs/platform/createNotificationService.native.js.map +1 -1
- package/lib/commonjs/platform/createPlayerService.expo.js +214 -113
- package/lib/commonjs/platform/createPlayerService.expo.js.map +1 -1
- package/lib/commonjs/platform/createRecorderService.expo.js +248 -130
- package/lib/commonjs/platform/createRecorderService.expo.js.map +1 -1
- package/lib/commonjs/utils/expoBackwardUtils.js +23 -0
- package/lib/commonjs/utils/expoBackwardUtils.js.map +1 -1
- package/lib/commonjs/utils/expoPermissionGranted.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +0 -3
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/platform/createMediaService.expo.js +82 -13
- package/lib/module/platform/createMediaService.expo.js.map +1 -1
- package/lib/module/platform/createNotificationService.native.js +32 -6
- package/lib/module/platform/createNotificationService.native.js.map +1 -1
- package/lib/module/platform/createPlayerService.expo.js +214 -113
- package/lib/module/platform/createPlayerService.expo.js.map +1 -1
- package/lib/module/platform/createRecorderService.expo.js +249 -131
- package/lib/module/platform/createRecorderService.expo.js.map +1 -1
- package/lib/module/utils/expoBackwardUtils.js +23 -0
- package/lib/module/utils/expoBackwardUtils.js.map +1 -1
- package/lib/module/utils/expoPermissionGranted.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/platform/createMediaService.expo.d.ts +2 -2
- package/lib/typescript/src/platform/createNotificationService.native.d.ts +13 -1
- package/lib/typescript/src/platform/createPlayerService.expo.d.ts +2 -2
- package/lib/typescript/src/platform/createRecorderService.expo.d.ts +2 -2
- package/lib/typescript/src/utils/expoBackwardUtils.d.ts +10 -0
- package/lib/typescript/src/utils/expoPermissionGranted.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +16 -5
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +0 -3
- package/src/platform/createMediaService.expo.tsx +87 -9
- package/src/platform/createNotificationService.native.ts +53 -7
- package/src/platform/createPlayerService.expo.tsx +242 -109
- package/src/platform/createRecorderService.expo.tsx +267 -110
- package/src/utils/expoBackwardUtils.ts +29 -0
- package/src/utils/expoPermissionGranted.ts +3 -1
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -213,7 +213,8 @@ expo install expo-image-picker \
|
|
|
213
213
|
expo-file-system \
|
|
214
214
|
expo-clipboard \
|
|
215
215
|
expo-notifications \
|
|
216
|
-
expo-
|
|
216
|
+
expo-audio \
|
|
217
|
+
expo-video \
|
|
217
218
|
expo-video-thumbnails \
|
|
218
219
|
expo-image-manipulator
|
|
219
220
|
```
|
|
@@ -225,7 +226,8 @@ import * as ExpoFS from 'expo-file-system';
|
|
|
225
226
|
import * as ExpoImagePicker from 'expo-image-picker';
|
|
226
227
|
import * as ExpoMediaLibrary from 'expo-media-library';
|
|
227
228
|
import * as ExpoNotifications from 'expo-notifications';
|
|
228
|
-
import * as
|
|
229
|
+
import * as ExpoAudio from 'expo-audio';
|
|
230
|
+
import * as ExpoVideo from 'expo-video';
|
|
229
231
|
import * as ExpoVideoThumbnail from 'expo-video-thumbnails';
|
|
230
232
|
import * as ExpoImageManipulator from 'expo-image-manipulator';
|
|
231
233
|
|
|
@@ -239,16 +241,16 @@ const expoPlatformServices = {
|
|
|
239
241
|
documentPickerModule: ExpoDocumentPicker,
|
|
240
242
|
}),
|
|
241
243
|
media: createExpoMediaService({
|
|
242
|
-
avModule:
|
|
244
|
+
avModule: ExpoVideo,
|
|
243
245
|
thumbnailModule: ExpoVideoThumbnail,
|
|
244
246
|
imageManipulator: ExpoImageManipulator,
|
|
245
247
|
fsModule: ExpoFS,
|
|
246
248
|
}),
|
|
247
249
|
player: createExpoPlayerService({
|
|
248
|
-
avModule:
|
|
250
|
+
avModule: ExpoAudio,
|
|
249
251
|
}),
|
|
250
252
|
recorder: createExpoRecorderService({
|
|
251
|
-
avModule:
|
|
253
|
+
avModule: ExpoAudio,
|
|
252
254
|
}),
|
|
253
255
|
};
|
|
254
256
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikitReactNativeFoundation","_uikitTools","_uikitUtils","_ChannelMessageList","_interopRequireDefault","_constants","_useContext","_moduleContext","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","GroupChannelMessageList","props","toast","useToast","STRINGS","useLocalization","sdk","sbOptions","groupChannelFragmentOptions","useSendbirdChat","setMessageToEdit","setMessageToReply","useContext","GroupChannelContexts","Fragment","groupChannelPubSub","PubSub","flatListRef","lazyScrollToBottom","lazyScrollToMessageId","onPressReplyMessageInThread","MessageList","isFirstMount","useIsFirstMount","hasSeenNewLineRef","useRef","isNewLineInViewportRef","isNewLineExistInChannelRef","scrolledAwayFromBottomRef","isVisibleUnreadMessageFloating","setIsVisibleUnreadMessageFloating","useState","viewableMessages","hasUserMarkedAsUnreadRef","unreadFirstMessage","setUnreadFirstMessage","undefined","pendingBottomReachedRef","updateHasSeenNewLine","useCallback","hasSeenNewLine","current","_props$onNewLineSeenC","onNewLineSeenChange","updateHasUserMarkedAsUnread","hasUserMarkedAsUnread","_props$onUserMarkedAs","onUserMarkedAsUnreadChange","scrollToMessageWithCreatedAt","useFreshCallback","createdAt","focusAnimated","timeout","foundMessage","messages","find","it","isIncludedInList","setTimeout","onUpdateSearchItem","startingPoint","MESSAGE_FOCUS_ANIMATION_DELAY","timestamp","Date","now","messageId","animated","channel","messageOffsetTimestamp","onResetMessageListWithStartingPoint","catch","_","onScrolledAwayFromBottom","value","scrollToBottom","hasNext","onResetMessageList","onPressUnreadMessagesFloatingCloseButton","_props$resetNewMessag","resetNewMessages","confirmAndMarkAsRead","url","getPrevNonSilentMessage","prevMessageIndex","prevMessage","silent","findFirstUnreadMessage","isNewLineExistInChannel","uikit","groupChannel","enableMarkAsUnread","msg","index","_props$hasPrevious","isMarkedAsUnreadMessage","myLastRead","prevNonSilentMessage","hasNoPreviousAndNoPrevMessage","hasPrevious","prevMessageIsRead","isMessageUnread","useEffect","foundUnreadFirstMessage","processNewLineVisibility","unreadFirstMsg","_viewableMessages$cur","isNewLineInViewport","some","message","updateUnreadMessagesFloatingProps","newMessages","markAsUnread","markAsRead","onViewableItemsChanged","info","viewableItems","filter","token","item","map","onPressMarkAsUnreadMessage","unreadMessagesFloatingPropsRef","canAutoMarkAsRead","visible","unreadMessageCount","onPressClose","useGroupChannelHandler","onReactionUpdated","event","isDifferentChannel","recentMessage","isRecentMessage","scrollReachedBottomAndCanScroll","scrolledAwayFromBottom","onChannelChanged","subscribe","type","data","lastMessage","updatedMessage","lastMessageUpdated","isMaybeStreaming","hasAiBot","foundFirstUnreadMessage","pubsub","payload","MESSAGE_SEARCH_SAFE_SCROLL_DELAY","searchItem","onPressParentMessage","parentMessage","childMessage","replyType","threadReplySelectType","show","TOAST","FIND_PARENT_MSG_ERROR","canScrollToParent","onBottomReached","currentTime","elapsedTime","timeoutThreshold","_props$onBottomReache","_props$onBottomReache2","createElement","ref","onReplyMessage","onReplyInThreadMessage","onEditMessage","onPressNewMessagesButton","onPressScrollToBottomButton","unreadMessagesFloatingProps","_default","exports","React","memo"],"sources":["GroupChannelMessageList.tsx"],"sourcesContent":["import type { ViewToken } from '@react-native/virtualized-lists';\nimport React, { useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { useToast } from '@sendbird/uikit-react-native-foundation';\nimport { useGroupChannelHandler } from '@sendbird/uikit-tools';\nimport {\n SendbirdMessage,\n SendbirdSendableMessage,\n confirmAndMarkAsRead,\n isDifferentChannel,\n useFreshCallback,\n useIsFirstMount,\n} from '@sendbird/uikit-utils';\n\nimport ChannelMessageList from '../../../components/ChannelMessageList';\nimport { UnreadMessagesFloatingProps } from '../../../components/UnreadMessagesFloating';\nimport { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../../constants';\nimport { GroupChannelFragmentOptionsPubSubContextPayload } from '../../../contexts/SendbirdChatCtx';\nimport { useLocalization, useSendbirdChat } from '../../../hooks/useContext';\nimport { GroupChannelContexts } from '../module/moduleContext';\nimport type { GroupChannelProps } from '../types';\n\nconst GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {\n const toast = useToast();\n const { STRINGS } = useLocalization();\n const { sdk, sbOptions, groupChannelFragmentOptions } = useSendbirdChat();\n const { setMessageToEdit, setMessageToReply } = useContext(GroupChannelContexts.Fragment);\n const groupChannelPubSub = useContext(GroupChannelContexts.PubSub);\n const { flatListRef, lazyScrollToBottom, lazyScrollToMessageId, onPressReplyMessageInThread } = useContext(\n GroupChannelContexts.MessageList,\n );\n\n const isFirstMount = useIsFirstMount();\n\n const hasSeenNewLineRef = useRef(false);\n const isNewLineInViewportRef = useRef(false);\n const isNewLineExistInChannelRef = useRef(false);\n const scrolledAwayFromBottomRef = useRef(false);\n const [isVisibleUnreadMessageFloating, setIsVisibleUnreadMessageFloating] = useState(false);\n const viewableMessages = useRef<SendbirdMessage[]>();\n const hasUserMarkedAsUnreadRef = useRef(false);\n const [unreadFirstMessage, setUnreadFirstMessage] = useState<SendbirdMessage | undefined>(undefined);\n const pendingBottomReachedRef = useRef<{ timeout: number; timestamp: number } | null>(null);\n\n const updateHasSeenNewLine = useCallback(\n (hasSeenNewLine: boolean) => {\n if (hasSeenNewLineRef.current !== hasSeenNewLine) {\n hasSeenNewLineRef.current = hasSeenNewLine;\n props.onNewLineSeenChange?.(hasSeenNewLine);\n }\n },\n [props.onNewLineSeenChange],\n );\n\n const updateHasUserMarkedAsUnread = useCallback(\n (hasUserMarkedAsUnread: boolean) => {\n if (hasUserMarkedAsUnreadRef.current !== hasUserMarkedAsUnread) {\n hasUserMarkedAsUnreadRef.current = hasUserMarkedAsUnread;\n props.onUserMarkedAsUnreadChange?.(hasUserMarkedAsUnread);\n }\n },\n [props.onUserMarkedAsUnreadChange],\n );\n\n const scrollToMessageWithCreatedAt = useFreshCallback(\n (createdAt: number, focusAnimated: boolean, timeout: number): boolean => {\n const foundMessage = props.messages.find((it) => it.createdAt === createdAt);\n const isIncludedInList = !!foundMessage;\n pendingBottomReachedRef.current = null;\n\n if (isIncludedInList) {\n if (focusAnimated) {\n setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);\n }\n pendingBottomReachedRef.current = { timeout, timestamp: Date.now() };\n lazyScrollToMessageId({ messageId: foundMessage.messageId, animated: true, timeout });\n } else {\n if (props.channel.messageOffsetTimestamp <= createdAt) {\n if (focusAnimated) {\n props.onUpdateSearchItem({ startingPoint: createdAt });\n }\n props.onResetMessageListWithStartingPoint(createdAt).catch((_) => {});\n } else {\n return false;\n }\n }\n return true;\n },\n );\n\n const onScrolledAwayFromBottom = useFreshCallback((value: boolean) => {\n scrolledAwayFromBottomRef.current = value;\n props.onScrolledAwayFromBottom(value);\n });\n\n const scrollToBottom = useFreshCallback(async (animated = false) => {\n if (props.hasNext()) {\n props.onUpdateSearchItem(undefined);\n onScrolledAwayFromBottom(false);\n\n await props.onResetMessageList().catch((_) => {});\n onScrolledAwayFromBottom(false);\n lazyScrollToBottom({ animated });\n } else {\n lazyScrollToBottom({ animated });\n }\n });\n\n const onPressUnreadMessagesFloatingCloseButton = useCallback(() => {\n updateHasSeenNewLine(true);\n updateHasUserMarkedAsUnread(false);\n props.resetNewMessages?.();\n confirmAndMarkAsRead([props.channel]);\n }, [updateHasSeenNewLine, updateHasUserMarkedAsUnread, props.channel.url, props.resetNewMessages]);\n\n const getPrevNonSilentMessage = useCallback(\n (messages: SendbirdMessage[], prevMessageIndex: number): SendbirdMessage | null => {\n if (messages.length <= prevMessageIndex) {\n return null;\n }\n\n const prevMessage = messages[prevMessageIndex];\n if (prevMessage) {\n if (prevMessage.silent) {\n return getPrevNonSilentMessage(messages, prevMessageIndex + 1);\n } else {\n return prevMessage;\n }\n }\n return null;\n },\n [],\n );\n\n const findFirstUnreadMessage = useFreshCallback((isNewLineExistInChannel: boolean) => {\n if (!sbOptions.uikit.groupChannel.channel.enableMarkAsUnread || !isNewLineExistInChannel) {\n return;\n }\n\n return props.messages.find((msg, index) => {\n if (msg.silent) {\n return false;\n }\n\n const isMarkedAsUnreadMessage = props.channel.myLastRead === msg.createdAt - 1;\n if (isMarkedAsUnreadMessage) {\n return true;\n }\n\n const prevNonSilentMessage = getPrevNonSilentMessage(props.messages, index + 1);\n const hasNoPreviousAndNoPrevMessage = !props.hasPrevious?.() && prevNonSilentMessage == null;\n const prevMessageIsRead =\n prevNonSilentMessage != null && prevNonSilentMessage.createdAt <= props.channel.myLastRead;\n const isMessageUnread = props.channel.myLastRead < msg.createdAt;\n return (hasNoPreviousAndNoPrevMessage || prevMessageIsRead) && isMessageUnread;\n });\n });\n\n useEffect(() => {\n if (!unreadFirstMessage) {\n const foundUnreadFirstMessage = findFirstUnreadMessage(props.isNewLineExistInChannel ?? false);\n if (foundUnreadFirstMessage) {\n processNewLineVisibility(foundUnreadFirstMessage);\n setUnreadFirstMessage(foundUnreadFirstMessage);\n }\n }\n }, [props.messages, props.channel.myLastRead, sbOptions.uikit.groupChannel.channel.enableMarkAsUnread]);\n\n const processNewLineVisibility = useFreshCallback((unreadFirstMsg: SendbirdMessage | undefined) => {\n const isNewLineInViewport = !!viewableMessages.current?.some(\n (message) => message.messageId === unreadFirstMsg?.messageId,\n );\n\n if (isNewLineInViewportRef.current !== isNewLineInViewport) {\n isNewLineInViewportRef.current = isNewLineInViewport;\n updateUnreadMessagesFloatingProps();\n if (!isNewLineInViewport || hasSeenNewLineRef.current) {\n return;\n }\n\n updateHasSeenNewLine(true);\n if (hasUserMarkedAsUnreadRef.current) {\n return;\n }\n\n if (0 < props.newMessages.length) {\n props.channel.markAsUnread(props.newMessages[0]);\n } else {\n props.channel.markAsRead();\n }\n }\n });\n\n const onViewableItemsChanged = useFreshCallback(\n async (info: { viewableItems: Array<ViewToken<SendbirdMessage>>; changed: Array<ViewToken<SendbirdMessage>> }) => {\n if (!sbOptions.uikit.groupChannel.channel.enableMarkAsUnread) {\n return;\n }\n\n viewableMessages.current = info.viewableItems.filter((token) => token.item).map((token) => token.item);\n processNewLineVisibility(unreadFirstMessage);\n },\n );\n\n const onPressMarkAsUnreadMessage = useCallback(\n async (message: SendbirdMessage) => {\n if (sbOptions.uikit.groupChannel.channel.enableMarkAsUnread && message) {\n await props.channel.markAsUnread(message);\n updateHasUserMarkedAsUnread(true);\n }\n },\n [sbOptions.uikit.groupChannel.channel.enableMarkAsUnread, updateHasUserMarkedAsUnread],\n );\n\n useEffect(() => {\n isNewLineExistInChannelRef.current = !!props.isNewLineExistInChannel && !!viewableMessages.current;\n }, [props.isNewLineExistInChannel, viewableMessages.current]);\n\n const unreadMessagesFloatingPropsRef = useRef<UnreadMessagesFloatingProps>();\n const updateUnreadMessagesFloatingProps = useFreshCallback(() => {\n const canAutoMarkAsRead =\n !scrolledAwayFromBottomRef.current &&\n !hasUserMarkedAsUnreadRef.current &&\n (hasSeenNewLineRef.current || !isNewLineExistInChannelRef.current);\n\n unreadMessagesFloatingPropsRef.current = {\n visible:\n sbOptions.uikit.groupChannel.channel.enableMarkAsUnread &&\n !canAutoMarkAsRead &&\n isNewLineExistInChannelRef.current &&\n 0 < props.channel.unreadMessageCount &&\n !isNewLineInViewportRef.current,\n onPressClose: onPressUnreadMessagesFloatingCloseButton,\n unreadMessageCount: props.channel.unreadMessageCount,\n };\n if (isVisibleUnreadMessageFloating !== unreadMessagesFloatingPropsRef.current.visible) {\n setIsVisibleUnreadMessageFloating(unreadMessagesFloatingPropsRef.current.visible);\n }\n });\n\n useEffect(() => {\n updateUnreadMessagesFloatingProps();\n }, [\n isNewLineExistInChannelRef.current,\n props.channel.unreadMessageCount,\n sbOptions.uikit.groupChannel.channel.enableMarkAsUnread,\n ]);\n\n useGroupChannelHandler(sdk, {\n onReactionUpdated(channel, event) {\n if (isDifferentChannel(channel, props.channel)) return;\n const recentMessage = props.messages[0];\n const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;\n const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();\n if (isRecentMessage && scrollReachedBottomAndCanScroll) {\n lazyScrollToBottom({ animated: true, timeout: 250 });\n }\n },\n onChannelChanged(channel) {\n if (isDifferentChannel(channel, props.channel)) return;\n },\n });\n\n useEffect(() => {\n return groupChannelPubSub.subscribe(({ type, data }) => {\n switch (type) {\n case 'TYPING_BUBBLE_RENDERED':\n case 'MESSAGES_RECEIVED': {\n if (!props.scrolledAwayFromBottom) {\n scrollToBottom(true);\n }\n break;\n }\n case 'MESSAGES_UPDATED': {\n const lastMessage = props.channel.lastMessage;\n const [updatedMessage] = data.messages;\n\n const lastMessageUpdated =\n updatedMessage && lastMessage && lastMessage.messageId === updatedMessage.messageId;\n\n const isMaybeStreaming = props.channel.hasAiBot && lastMessageUpdated;\n\n if (isMaybeStreaming) {\n scrollToBottom(false);\n } else if (!props.scrolledAwayFromBottom && lastMessageUpdated) {\n scrollToBottom(true);\n }\n break;\n }\n case 'MESSAGE_SENT_SUCCESS':\n case 'MESSAGE_SENT_PENDING': {\n scrollToBottom(false);\n break;\n }\n case 'ON_MARKED_AS_READ_BY_CURRENT_USER': {\n updateUnreadMessagesFloatingProps();\n break;\n }\n case 'ON_MARKED_AS_UNREAD_BY_CURRENT_USER': {\n isNewLineExistInChannelRef.current = true;\n const foundFirstUnreadMessage = findFirstUnreadMessage(true);\n processNewLineVisibility(foundFirstUnreadMessage);\n setUnreadFirstMessage(foundFirstUnreadMessage);\n if (!props.scrolledAwayFromBottom) {\n scrollToBottom(true);\n }\n break;\n }\n }\n });\n }, [props.scrolledAwayFromBottom]);\n\n useEffect(() => {\n return groupChannelFragmentOptions.pubsub.subscribe((payload: GroupChannelFragmentOptionsPubSubContextPayload) => {\n switch (payload.type) {\n case 'OVERRIDE_SEARCH_ITEM_STARTING_POINT': {\n scrollToMessageWithCreatedAt(payload.data.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);\n break;\n }\n }\n });\n }, []);\n\n useEffect(() => {\n // Only trigger once when message list mount with initial props.searchItem\n // - Search screen + searchItem > mount message list\n // - Reset message list + searchItem > re-mount message list\n if (isFirstMount && props.searchItem) {\n scrollToMessageWithCreatedAt(props.searchItem.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);\n }\n }, [isFirstMount]);\n\n const onPressParentMessage = useFreshCallback(\n (parentMessage: SendbirdMessage, childMessage: SendbirdSendableMessage) => {\n if (\n onPressReplyMessageInThread &&\n sbOptions.uikit.groupChannel.channel.replyType === 'thread' &&\n sbOptions.uikit.groupChannel.channel.threadReplySelectType === 'thread'\n ) {\n if (parentMessage.createdAt >= props.channel.messageOffsetTimestamp) {\n onPressReplyMessageInThread(parentMessage as SendbirdSendableMessage, childMessage.createdAt);\n } else {\n toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');\n }\n } else {\n const canScrollToParent = scrollToMessageWithCreatedAt(parentMessage.createdAt, true, 0);\n if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');\n }\n },\n );\n\n const onBottomReached = useFreshCallback(() => {\n if (props.hasNext()) {\n if (pendingBottomReachedRef.current) {\n const currentTime = Date.now();\n const elapsedTime = currentTime - pendingBottomReachedRef.current.timestamp;\n\n const timeoutThreshold = 500;\n if (elapsedTime >= pendingBottomReachedRef.current.timeout + timeoutThreshold) {\n props.onBottomReached?.();\n pendingBottomReachedRef.current = null;\n }\n } else {\n props.onBottomReached?.();\n }\n }\n });\n\n return (\n <ChannelMessageList\n {...props}\n ref={flatListRef}\n onScrolledAwayFromBottom={onScrolledAwayFromBottom}\n onReplyMessage={setMessageToReply}\n onReplyInThreadMessage={setMessageToReply}\n onEditMessage={setMessageToEdit}\n onViewableItemsChanged={onViewableItemsChanged}\n onPressParentMessage={onPressParentMessage}\n onPressNewMessagesButton={scrollToBottom}\n onPressScrollToBottomButton={scrollToBottom}\n onPressMarkAsUnreadMessage={onPressMarkAsUnreadMessage}\n onBottomReached={onBottomReached}\n unreadFirstMessage={unreadFirstMessage}\n unreadMessagesFloatingProps={unreadMessagesFloatingPropsRef.current}\n />\n );\n};\n\nexport default React.memo(GroupChannelMessageList);\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,UAAA,GAAAN,OAAA;AAEA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAA+D,SAAAK,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAA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oBAAqB;IAC3CoB,wBAAwB,EAAE9F,cAAe;IACzC+F,2BAA2B,EAAE/F,cAAe;IAC5C8C,0BAA0B,EAAEA,0BAA2B;IACvDqC,eAAe,EAAEA,eAAgB;IACjC3H,kBAAkB,EAAEA,kBAAmB;IACvCwI,2BAA2B,EAAEjD,8BAA8B,CAAChF;EAAQ,EACrE,CAAC;AAEN,CAAC;AAAC,IAAAkI,QAAA,GAAAC,OAAA,CAAApM,OAAA,gBAEaqM,cAAK,CAACC,IAAI,CAAC9K,uBAAuB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikitReactNativeFoundation","_uikitTools","_uikitUtils","_ChannelMessageList","_interopRequireDefault","_constants","_useContext","_moduleContext","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","GroupChannelMessageList","props","toast","useToast","STRINGS","useLocalization","sdk","sbOptions","groupChannelFragmentOptions","useSendbirdChat","setMessageToEdit","setMessageToReply","useContext","GroupChannelContexts","Fragment","groupChannelPubSub","PubSub","flatListRef","lazyScrollToBottom","lazyScrollToMessageId","onPressReplyMessageInThread","MessageList","isFirstMount","useIsFirstMount","hasSeenNewLineRef","useRef","isNewLineInViewportRef","isNewLineExistInChannelRef","scrolledAwayFromBottomRef","isVisibleUnreadMessageFloating","setIsVisibleUnreadMessageFloating","useState","viewableMessages","hasUserMarkedAsUnreadRef","unreadFirstMessage","setUnreadFirstMessage","undefined","pendingBottomReachedRef","updateHasSeenNewLine","useCallback","hasSeenNewLine","current","_props$onNewLineSeenC","onNewLineSeenChange","updateHasUserMarkedAsUnread","hasUserMarkedAsUnread","_props$onUserMarkedAs","onUserMarkedAsUnreadChange","scrollToMessageWithCreatedAt","useFreshCallback","createdAt","focusAnimated","timeout","foundMessage","messages","find","it","isIncludedInList","setTimeout","onUpdateSearchItem","startingPoint","MESSAGE_FOCUS_ANIMATION_DELAY","timestamp","Date","now","messageId","animated","channel","messageOffsetTimestamp","onResetMessageListWithStartingPoint","catch","_","onScrolledAwayFromBottom","value","scrollToBottom","hasNext","onResetMessageList","onPressUnreadMessagesFloatingCloseButton","_props$resetNewMessag","resetNewMessages","confirmAndMarkAsRead","url","getPrevNonSilentMessage","prevMessageIndex","prevMessage","silent","findFirstUnreadMessage","isNewLineExistInChannel","uikit","groupChannel","enableMarkAsUnread","msg","index","_props$hasPrevious","isMarkedAsUnreadMessage","myLastRead","prevNonSilentMessage","hasNoPreviousAndNoPrevMessage","hasPrevious","prevMessageIsRead","isMessageUnread","useEffect","foundUnreadFirstMessage","processNewLineVisibility","unreadFirstMsg","_viewableMessages$cur","isNewLineInViewport","some","message","updateUnreadMessagesFloatingProps","newMessages","markAsUnread","markAsRead","onViewableItemsChanged","info","viewableItems","filter","token","item","map","onPressMarkAsUnreadMessage","unreadMessagesFloatingPropsRef","canAutoMarkAsRead","visible","unreadMessageCount","onPressClose","useGroupChannelHandler","onReactionUpdated","event","isDifferentChannel","recentMessage","isRecentMessage","scrollReachedBottomAndCanScroll","scrolledAwayFromBottom","subscribe","type","data","lastMessage","updatedMessage","lastMessageUpdated","isMaybeStreaming","hasAiBot","foundFirstUnreadMessage","pubsub","payload","MESSAGE_SEARCH_SAFE_SCROLL_DELAY","searchItem","onPressParentMessage","parentMessage","childMessage","replyType","threadReplySelectType","show","TOAST","FIND_PARENT_MSG_ERROR","canScrollToParent","onBottomReached","currentTime","elapsedTime","timeoutThreshold","_props$onBottomReache","_props$onBottomReache2","createElement","ref","onReplyMessage","onReplyInThreadMessage","onEditMessage","onPressNewMessagesButton","onPressScrollToBottomButton","unreadMessagesFloatingProps","_default","exports","React","memo"],"sources":["GroupChannelMessageList.tsx"],"sourcesContent":["import type { ViewToken } from '@react-native/virtualized-lists';\nimport React, { useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { useToast } from '@sendbird/uikit-react-native-foundation';\nimport { useGroupChannelHandler } from '@sendbird/uikit-tools';\nimport {\n SendbirdMessage,\n SendbirdSendableMessage,\n confirmAndMarkAsRead,\n isDifferentChannel,\n useFreshCallback,\n useIsFirstMount,\n} from '@sendbird/uikit-utils';\n\nimport ChannelMessageList from '../../../components/ChannelMessageList';\nimport { UnreadMessagesFloatingProps } from '../../../components/UnreadMessagesFloating';\nimport { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../../constants';\nimport { GroupChannelFragmentOptionsPubSubContextPayload } from '../../../contexts/SendbirdChatCtx';\nimport { useLocalization, useSendbirdChat } from '../../../hooks/useContext';\nimport { GroupChannelContexts } from '../module/moduleContext';\nimport type { GroupChannelProps } from '../types';\n\nconst GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {\n const toast = useToast();\n const { STRINGS } = useLocalization();\n const { sdk, sbOptions, groupChannelFragmentOptions } = useSendbirdChat();\n const { setMessageToEdit, setMessageToReply } = useContext(GroupChannelContexts.Fragment);\n const groupChannelPubSub = useContext(GroupChannelContexts.PubSub);\n const { flatListRef, lazyScrollToBottom, lazyScrollToMessageId, onPressReplyMessageInThread } = useContext(\n GroupChannelContexts.MessageList,\n );\n\n const isFirstMount = useIsFirstMount();\n\n const hasSeenNewLineRef = useRef(false);\n const isNewLineInViewportRef = useRef(false);\n const isNewLineExistInChannelRef = useRef(false);\n const scrolledAwayFromBottomRef = useRef(false);\n const [isVisibleUnreadMessageFloating, setIsVisibleUnreadMessageFloating] = useState(false);\n const viewableMessages = useRef<SendbirdMessage[]>();\n const hasUserMarkedAsUnreadRef = useRef(false);\n const [unreadFirstMessage, setUnreadFirstMessage] = useState<SendbirdMessage | undefined>(undefined);\n const pendingBottomReachedRef = useRef<{ timeout: number; timestamp: number } | null>(null);\n\n const updateHasSeenNewLine = useCallback(\n (hasSeenNewLine: boolean) => {\n if (hasSeenNewLineRef.current !== hasSeenNewLine) {\n hasSeenNewLineRef.current = hasSeenNewLine;\n props.onNewLineSeenChange?.(hasSeenNewLine);\n }\n },\n [props.onNewLineSeenChange],\n );\n\n const updateHasUserMarkedAsUnread = useCallback(\n (hasUserMarkedAsUnread: boolean) => {\n if (hasUserMarkedAsUnreadRef.current !== hasUserMarkedAsUnread) {\n hasUserMarkedAsUnreadRef.current = hasUserMarkedAsUnread;\n props.onUserMarkedAsUnreadChange?.(hasUserMarkedAsUnread);\n }\n },\n [props.onUserMarkedAsUnreadChange],\n );\n\n const scrollToMessageWithCreatedAt = useFreshCallback(\n (createdAt: number, focusAnimated: boolean, timeout: number): boolean => {\n const foundMessage = props.messages.find((it) => it.createdAt === createdAt);\n const isIncludedInList = !!foundMessage;\n pendingBottomReachedRef.current = null;\n\n if (isIncludedInList) {\n if (focusAnimated) {\n setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);\n }\n pendingBottomReachedRef.current = { timeout, timestamp: Date.now() };\n lazyScrollToMessageId({ messageId: foundMessage.messageId, animated: true, timeout });\n } else {\n if (props.channel.messageOffsetTimestamp <= createdAt) {\n if (focusAnimated) {\n props.onUpdateSearchItem({ startingPoint: createdAt });\n }\n props.onResetMessageListWithStartingPoint(createdAt).catch((_) => {});\n } else {\n return false;\n }\n }\n return true;\n },\n );\n\n const onScrolledAwayFromBottom = useFreshCallback((value: boolean) => {\n scrolledAwayFromBottomRef.current = value;\n props.onScrolledAwayFromBottom(value);\n });\n\n const scrollToBottom = useFreshCallback(async (animated = false) => {\n if (props.hasNext()) {\n props.onUpdateSearchItem(undefined);\n onScrolledAwayFromBottom(false);\n\n await props.onResetMessageList().catch((_) => {});\n onScrolledAwayFromBottom(false);\n lazyScrollToBottom({ animated });\n } else {\n lazyScrollToBottom({ animated });\n }\n });\n\n const onPressUnreadMessagesFloatingCloseButton = useCallback(() => {\n updateHasSeenNewLine(true);\n updateHasUserMarkedAsUnread(false);\n props.resetNewMessages?.();\n confirmAndMarkAsRead([props.channel]);\n }, [updateHasSeenNewLine, updateHasUserMarkedAsUnread, props.channel.url, props.resetNewMessages]);\n\n const getPrevNonSilentMessage = useCallback(\n (messages: SendbirdMessage[], prevMessageIndex: number): SendbirdMessage | null => {\n if (messages.length <= prevMessageIndex) {\n return null;\n }\n\n const prevMessage = messages[prevMessageIndex];\n if (prevMessage) {\n if (prevMessage.silent) {\n return getPrevNonSilentMessage(messages, prevMessageIndex + 1);\n } else {\n return prevMessage;\n }\n }\n return null;\n },\n [],\n );\n\n const findFirstUnreadMessage = useFreshCallback((isNewLineExistInChannel: boolean) => {\n if (!sbOptions.uikit.groupChannel.channel.enableMarkAsUnread || !isNewLineExistInChannel) {\n return;\n }\n\n return props.messages.find((msg, index) => {\n if (msg.silent) {\n return false;\n }\n\n const isMarkedAsUnreadMessage = props.channel.myLastRead === msg.createdAt - 1;\n if (isMarkedAsUnreadMessage) {\n return true;\n }\n\n const prevNonSilentMessage = getPrevNonSilentMessage(props.messages, index + 1);\n const hasNoPreviousAndNoPrevMessage = !props.hasPrevious?.() && prevNonSilentMessage == null;\n const prevMessageIsRead =\n prevNonSilentMessage != null && prevNonSilentMessage.createdAt <= props.channel.myLastRead;\n const isMessageUnread = props.channel.myLastRead < msg.createdAt;\n return (hasNoPreviousAndNoPrevMessage || prevMessageIsRead) && isMessageUnread;\n });\n });\n\n useEffect(() => {\n if (!unreadFirstMessage) {\n const foundUnreadFirstMessage = findFirstUnreadMessage(props.isNewLineExistInChannel ?? false);\n if (foundUnreadFirstMessage) {\n processNewLineVisibility(foundUnreadFirstMessage);\n setUnreadFirstMessage(foundUnreadFirstMessage);\n }\n }\n }, [props.messages, props.channel.myLastRead, sbOptions.uikit.groupChannel.channel.enableMarkAsUnread]);\n\n const processNewLineVisibility = useFreshCallback((unreadFirstMsg: SendbirdMessage | undefined) => {\n const isNewLineInViewport = !!viewableMessages.current?.some(\n (message) => message.messageId === unreadFirstMsg?.messageId,\n );\n\n if (isNewLineInViewportRef.current !== isNewLineInViewport) {\n isNewLineInViewportRef.current = isNewLineInViewport;\n updateUnreadMessagesFloatingProps();\n if (!isNewLineInViewport || hasSeenNewLineRef.current) {\n return;\n }\n\n updateHasSeenNewLine(true);\n if (hasUserMarkedAsUnreadRef.current) {\n return;\n }\n\n if (0 < props.newMessages.length) {\n props.channel.markAsUnread(props.newMessages[0]);\n } else {\n props.channel.markAsRead();\n }\n }\n });\n\n const onViewableItemsChanged = useFreshCallback(\n async (info: { viewableItems: Array<ViewToken<SendbirdMessage>>; changed: Array<ViewToken<SendbirdMessage>> }) => {\n if (!sbOptions.uikit.groupChannel.channel.enableMarkAsUnread) {\n return;\n }\n\n viewableMessages.current = info.viewableItems.filter((token) => token.item).map((token) => token.item);\n processNewLineVisibility(unreadFirstMessage);\n },\n );\n\n const onPressMarkAsUnreadMessage = useCallback(\n async (message: SendbirdMessage) => {\n if (sbOptions.uikit.groupChannel.channel.enableMarkAsUnread && message) {\n await props.channel.markAsUnread(message);\n updateHasUserMarkedAsUnread(true);\n }\n },\n [sbOptions.uikit.groupChannel.channel.enableMarkAsUnread, updateHasUserMarkedAsUnread],\n );\n\n useEffect(() => {\n isNewLineExistInChannelRef.current = !!props.isNewLineExistInChannel && !!viewableMessages.current;\n }, [props.isNewLineExistInChannel, viewableMessages.current]);\n\n const unreadMessagesFloatingPropsRef = useRef<UnreadMessagesFloatingProps>();\n const updateUnreadMessagesFloatingProps = useFreshCallback(() => {\n const canAutoMarkAsRead =\n !scrolledAwayFromBottomRef.current &&\n !hasUserMarkedAsUnreadRef.current &&\n (hasSeenNewLineRef.current || !isNewLineExistInChannelRef.current);\n\n unreadMessagesFloatingPropsRef.current = {\n visible:\n sbOptions.uikit.groupChannel.channel.enableMarkAsUnread &&\n !canAutoMarkAsRead &&\n isNewLineExistInChannelRef.current &&\n 0 < props.channel.unreadMessageCount &&\n !isNewLineInViewportRef.current,\n onPressClose: onPressUnreadMessagesFloatingCloseButton,\n unreadMessageCount: props.channel.unreadMessageCount,\n };\n if (isVisibleUnreadMessageFloating !== unreadMessagesFloatingPropsRef.current.visible) {\n setIsVisibleUnreadMessageFloating(unreadMessagesFloatingPropsRef.current.visible);\n }\n });\n\n useEffect(() => {\n updateUnreadMessagesFloatingProps();\n }, [\n isNewLineExistInChannelRef.current,\n props.channel.unreadMessageCount,\n sbOptions.uikit.groupChannel.channel.enableMarkAsUnread,\n ]);\n\n useGroupChannelHandler(sdk, {\n onReactionUpdated(channel, event) {\n if (isDifferentChannel(channel, props.channel)) return;\n const recentMessage = props.messages[0];\n const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;\n const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();\n if (isRecentMessage && scrollReachedBottomAndCanScroll) {\n lazyScrollToBottom({ animated: true, timeout: 250 });\n }\n },\n });\n\n useEffect(() => {\n return groupChannelPubSub.subscribe(({ type, data }) => {\n switch (type) {\n case 'TYPING_BUBBLE_RENDERED':\n case 'MESSAGES_RECEIVED': {\n if (!props.scrolledAwayFromBottom) {\n scrollToBottom(true);\n }\n break;\n }\n case 'MESSAGES_UPDATED': {\n const lastMessage = props.channel.lastMessage;\n const [updatedMessage] = data.messages;\n\n const lastMessageUpdated =\n updatedMessage && lastMessage && lastMessage.messageId === updatedMessage.messageId;\n\n const isMaybeStreaming = props.channel.hasAiBot && lastMessageUpdated;\n\n if (isMaybeStreaming) {\n scrollToBottom(false);\n } else if (!props.scrolledAwayFromBottom && lastMessageUpdated) {\n scrollToBottom(true);\n }\n break;\n }\n case 'MESSAGE_SENT_SUCCESS':\n case 'MESSAGE_SENT_PENDING': {\n scrollToBottom(false);\n break;\n }\n case 'ON_MARKED_AS_READ_BY_CURRENT_USER': {\n updateUnreadMessagesFloatingProps();\n break;\n }\n case 'ON_MARKED_AS_UNREAD_BY_CURRENT_USER': {\n isNewLineExistInChannelRef.current = true;\n const foundFirstUnreadMessage = findFirstUnreadMessage(true);\n processNewLineVisibility(foundFirstUnreadMessage);\n setUnreadFirstMessage(foundFirstUnreadMessage);\n if (!props.scrolledAwayFromBottom) {\n scrollToBottom(true);\n }\n break;\n }\n }\n });\n }, [props.scrolledAwayFromBottom]);\n\n useEffect(() => {\n return groupChannelFragmentOptions.pubsub.subscribe((payload: GroupChannelFragmentOptionsPubSubContextPayload) => {\n switch (payload.type) {\n case 'OVERRIDE_SEARCH_ITEM_STARTING_POINT': {\n scrollToMessageWithCreatedAt(payload.data.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);\n break;\n }\n }\n });\n }, []);\n\n useEffect(() => {\n // Only trigger once when message list mount with initial props.searchItem\n // - Search screen + searchItem > mount message list\n // - Reset message list + searchItem > re-mount message list\n if (isFirstMount && props.searchItem) {\n scrollToMessageWithCreatedAt(props.searchItem.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);\n }\n }, [isFirstMount]);\n\n const onPressParentMessage = useFreshCallback(\n (parentMessage: SendbirdMessage, childMessage: SendbirdSendableMessage) => {\n if (\n onPressReplyMessageInThread &&\n sbOptions.uikit.groupChannel.channel.replyType === 'thread' &&\n sbOptions.uikit.groupChannel.channel.threadReplySelectType === 'thread'\n ) {\n if (parentMessage.createdAt >= props.channel.messageOffsetTimestamp) {\n onPressReplyMessageInThread(parentMessage as SendbirdSendableMessage, childMessage.createdAt);\n } else {\n toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');\n }\n } else {\n const canScrollToParent = scrollToMessageWithCreatedAt(parentMessage.createdAt, true, 0);\n if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');\n }\n },\n );\n\n const onBottomReached = useFreshCallback(() => {\n if (props.hasNext()) {\n if (pendingBottomReachedRef.current) {\n const currentTime = Date.now();\n const elapsedTime = currentTime - pendingBottomReachedRef.current.timestamp;\n\n const timeoutThreshold = 500;\n if (elapsedTime >= pendingBottomReachedRef.current.timeout + timeoutThreshold) {\n props.onBottomReached?.();\n pendingBottomReachedRef.current = null;\n }\n } else {\n props.onBottomReached?.();\n }\n }\n });\n\n return (\n <ChannelMessageList\n {...props}\n ref={flatListRef}\n onScrolledAwayFromBottom={onScrolledAwayFromBottom}\n onReplyMessage={setMessageToReply}\n onReplyInThreadMessage={setMessageToReply}\n onEditMessage={setMessageToEdit}\n onViewableItemsChanged={onViewableItemsChanged}\n onPressParentMessage={onPressParentMessage}\n onPressNewMessagesButton={scrollToBottom}\n onPressScrollToBottomButton={scrollToBottom}\n onPressMarkAsUnreadMessage={onPressMarkAsUnreadMessage}\n onBottomReached={onBottomReached}\n unreadFirstMessage={unreadFirstMessage}\n unreadMessagesFloatingProps={unreadMessagesFloatingPropsRef.current}\n />\n );\n};\n\nexport default React.memo(GroupChannelMessageList);\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,UAAA,GAAAN,OAAA;AAEA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAA+D,SAAAK,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA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,CAACC,IAAI,CAAC7K,uBAAuB,CAAC","ignoreList":[]}
|
|
@@ -4,34 +4,105 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _uikitUtils = require("@sendbird/uikit-utils");
|
|
9
9
|
var _SBUUtils = _interopRequireDefault(require("../libs/SBUUtils"));
|
|
10
10
|
var _expoBackwardUtils = _interopRequireDefault(require("../utils/expoBackwardUtils"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
VideoComponent({
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
class LegacyExpoAVVideoAdapter {
|
|
19
|
+
constructor(avModule) {
|
|
20
|
+
_defineProperty(this, "avModule", void 0);
|
|
21
|
+
_defineProperty(this, "VideoComponent", ({
|
|
21
22
|
source,
|
|
22
23
|
resizeMode,
|
|
23
24
|
onLoad,
|
|
24
25
|
...props
|
|
25
|
-
}) {
|
|
26
|
+
}) => {
|
|
26
27
|
// FIXME: type error https://github.com/expo/expo/issues/17101
|
|
27
28
|
// @ts-ignore
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(avModule.Video, _extends({}, props, {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(this.avModule.Video, _extends({}, props, {
|
|
29
30
|
source: source,
|
|
30
31
|
resizeMode: resizeMode,
|
|
31
32
|
onLoad: onLoad,
|
|
32
33
|
useNativeControls: true
|
|
33
34
|
}));
|
|
34
|
-
}
|
|
35
|
+
});
|
|
36
|
+
this.avModule = avModule;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
class ExpoVideoAdapter {
|
|
40
|
+
constructor(_videoModule) {
|
|
41
|
+
this._videoModule = _videoModule;
|
|
42
|
+
_defineProperty(this, "VideoComponent", ({
|
|
43
|
+
source,
|
|
44
|
+
resizeMode,
|
|
45
|
+
onLoad,
|
|
46
|
+
...props
|
|
47
|
+
}) => {
|
|
48
|
+
const player = this._videoModule.useVideoPlayer(source);
|
|
49
|
+
(0, _react.useEffect)(() => {
|
|
50
|
+
if (onLoad && player) {
|
|
51
|
+
let subscription = null;
|
|
52
|
+
try {
|
|
53
|
+
subscription = player.addListener('statusChange', eventData => {
|
|
54
|
+
const {
|
|
55
|
+
status,
|
|
56
|
+
error
|
|
57
|
+
} = eventData;
|
|
58
|
+
if (status === 'readyToPlay' && !error) {
|
|
59
|
+
onLoad();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} catch (error) {
|
|
63
|
+
const timeout = setTimeout(() => onLoad(), 300);
|
|
64
|
+
return () => clearTimeout(timeout);
|
|
65
|
+
}
|
|
66
|
+
return () => {
|
|
67
|
+
if (subscription) {
|
|
68
|
+
subscription.remove();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}, [onLoad, player]);
|
|
74
|
+
const getContentFit = mode => {
|
|
75
|
+
switch (mode) {
|
|
76
|
+
case 'cover':
|
|
77
|
+
return 'cover';
|
|
78
|
+
case 'contain':
|
|
79
|
+
return 'contain';
|
|
80
|
+
case 'stretch':
|
|
81
|
+
return 'fill';
|
|
82
|
+
default:
|
|
83
|
+
return 'contain';
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(this._videoModule.VideoView, {
|
|
87
|
+
...props,
|
|
88
|
+
player,
|
|
89
|
+
contentFit: getContentFit(resizeMode)
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const createExpoMediaService = ({
|
|
95
|
+
avModule,
|
|
96
|
+
thumbnailModule,
|
|
97
|
+
imageManipulator,
|
|
98
|
+
fsModule
|
|
99
|
+
}) => {
|
|
100
|
+
if (_expoBackwardUtils.default.expoAV.isLegacyAVModule(avModule)) {
|
|
101
|
+
_uikitUtils.Logger.warn('[MediaService.Expo] expo-av is deprecated and will be removed in Expo 54. Please migrate to expo-video.');
|
|
102
|
+
}
|
|
103
|
+
const videoAdapter = _expoBackwardUtils.default.expoAV.isVideoModule(avModule) ? new ExpoVideoAdapter(avModule) : new LegacyExpoAVVideoAdapter(avModule);
|
|
104
|
+
return {
|
|
105
|
+
VideoComponent: videoAdapter.VideoComponent,
|
|
35
106
|
async getVideoThumbnail({
|
|
36
107
|
url,
|
|
37
108
|
quality,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_uikitUtils","_SBUUtils","_expoBackwardUtils","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","createExpoMediaService","avModule","thumbnailModule","imageManipulator","fsModule","VideoComponent","source","resizeMode","onLoad","props","createElement","Video","useNativeControls","getVideoThumbnail","url","quality","timeMills","uri","getThumbnailAsync","time","path","compressImage","maxWidth","maxHeight","compressionRate","originSize","SBUUtils","getImageSize","resizingSize","getDownscaleSize","width","height","compressedURI","manipulateAsync","resize","compress","Math","min","max","fileInfo","getInfoAsync","size","expoBackwardUtils","toFileSize","_default","exports"],"sources":["createMediaService.expo.tsx"],"sourcesContent":["import type * as ExpoAV from 'expo-av';\nimport type * as ExpoFS from 'expo-file-system';\nimport type * as ExpoImageManipulator from 'expo-image-manipulator';\nimport type * as ExpoVideoThumbnail from 'expo-video-thumbnails';\nimport React from 'react';\n\nimport { getDownscaleSize } from '@sendbird/uikit-utils';\n\nimport SBUUtils from '../libs/SBUUtils';\nimport expoBackwardUtils from '../utils/expoBackwardUtils';\nimport type { MediaServiceInterface } from './types';\n\ntype Modules = {\n avModule: typeof ExpoAV;\n thumbnailModule: typeof ExpoVideoThumbnail;\n imageManipulator: typeof ExpoImageManipulator;\n fsModule: typeof ExpoFS;\n};\n\nconst createExpoMediaService = ({\n avModule,\n thumbnailModule,\n imageManipulator,\n fsModule,\n}: Modules): MediaServiceInterface => {\n return {\n VideoComponent({ source, resizeMode, onLoad, ...props }) {\n // FIXME: type error https://github.com/expo/expo/issues/17101\n // @ts-ignore\n return <avModule.Video {...props} source={source} resizeMode={resizeMode} onLoad={onLoad} useNativeControls />;\n },\n async getVideoThumbnail({ url, quality, timeMills }) {\n try {\n const { uri } = await thumbnailModule.getThumbnailAsync(url, { quality, time: timeMills });\n return { path: uri };\n } catch {\n return null;\n }\n },\n async compressImage({ maxWidth, maxHeight, compressionRate = 1, uri }) {\n const originSize = await SBUUtils.getImageSize(uri);\n const resizingSize = getDownscaleSize(originSize, { width: maxWidth, height: maxHeight });\n\n const { uri: compressedURI } = await imageManipulator.manipulateAsync(uri, [{ resize: resizingSize }], {\n compress: Math.min(Math.max(0, compressionRate), 1),\n });\n const fileInfo = await fsModule.getInfoAsync(uri);\n\n return { uri: compressedURI, size: expoBackwardUtils.toFileSize(fileInfo) };\n },\n };\n};\n\nexport default createExpoMediaService;\n"],"mappings":";;;;;;AAIA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA2D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAU3D,MAAMO,sBAAsB,GAAGA,CAAC;EAC9BC,QAAQ;EACRC,eAAe;EACfC,gBAAgB;EAChBC;AACO,CAAC,KAA4B;EACpC,OAAO;IACLC,cAAcA,CAA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Q,GAAG,MAAMnC,QAAQ,CAACoC,YAAY,CAACvB,GAAG,CAAC;MAEjD,OAAO;QAAEA,GAAG,EAAEe,aAAa;QAAES,IAAI,EAAEC,0BAAiB,CAACC,UAAU,CAACJ,QAAQ;MAAE,CAAC;IAC7E;EACF,CAAC;AACH,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAA1D,OAAA,GAEaa,sBAAsB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_uikitUtils","_SBUUtils","_interopRequireDefault","_expoBackwardUtils","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","LegacyExpoAVVideoAdapter","constructor","avModule","source","resizeMode","onLoad","props","createElement","Video","useNativeControls","ExpoVideoAdapter","_videoModule","player","useVideoPlayer","useEffect","subscription","addListener","eventData","status","error","timeout","setTimeout","clearTimeout","remove","undefined","getContentFit","mode","React","VideoView","contentFit","createExpoMediaService","thumbnailModule","imageManipulator","fsModule","expoBackwardUtils","expoAV","isLegacyAVModule","Logger","warn","videoAdapter","isVideoModule","VideoComponent","getVideoThumbnail","url","quality","timeMills","uri","getThumbnailAsync","time","path","compressImage","maxWidth","maxHeight","compressionRate","originSize","SBUUtils","getImageSize","resizingSize","getDownscaleSize","width","height","compressedURI","manipulateAsync","resize","compress","Math","min","max","fileInfo","getInfoAsync","size","toFileSize","_default","exports"],"sources":["createMediaService.expo.tsx"],"sourcesContent":["import type * as ExpoAV from 'expo-av';\nimport type * as ExpoFS from 'expo-file-system';\nimport type * as ExpoImageManipulator from 'expo-image-manipulator';\nimport type { EventSubscription } from 'expo-modules-core';\nimport type * as ExpoVideo from 'expo-video';\nimport type { StatusChangeEventPayload } from 'expo-video';\nimport type * as ExpoVideoThumbnail from 'expo-video-thumbnails';\nimport React, { useEffect } from 'react';\n\nimport { Logger, getDownscaleSize } from '@sendbird/uikit-utils';\n\nimport SBUUtils from '../libs/SBUUtils';\nimport expoBackwardUtils from '../utils/expoBackwardUtils';\nimport type { ExpoVideoModule } from '../utils/expoBackwardUtils';\nimport type { MediaServiceInterface, VideoProps } from './types';\n\ntype Modules = {\n avModule: ExpoVideoModule;\n thumbnailModule: typeof ExpoVideoThumbnail;\n imageManipulator: typeof ExpoImageManipulator;\n fsModule: typeof ExpoFS;\n};\n\ninterface VideoModuleAdapter {\n VideoComponent: React.ComponentType<VideoProps>;\n}\n\nclass LegacyExpoAVVideoAdapter implements VideoModuleAdapter {\n private readonly avModule: typeof ExpoAV;\n constructor(avModule: typeof ExpoAV) {\n this.avModule = avModule;\n }\n\n VideoComponent = ({ source, resizeMode, onLoad, ...props }: VideoProps) => {\n // FIXME: type error https://github.com/expo/expo/issues/17101\n // @ts-ignore\n return <this.avModule.Video {...props} source={source} resizeMode={resizeMode} onLoad={onLoad} useNativeControls />;\n };\n}\n\nclass ExpoVideoAdapter implements VideoModuleAdapter {\n constructor(private readonly _videoModule: typeof ExpoVideo) {}\n\n VideoComponent = ({ source, resizeMode, onLoad, ...props }: VideoProps) => {\n const player = this._videoModule.useVideoPlayer(source);\n\n useEffect(() => {\n if (onLoad && player) {\n let subscription: EventSubscription | null = null;\n try {\n subscription = player.addListener('statusChange', (eventData: StatusChangeEventPayload) => {\n const { status, error } = eventData;\n if (status === 'readyToPlay' && !error) {\n onLoad();\n }\n });\n } catch (error) {\n const timeout = setTimeout(() => onLoad(), 300);\n return () => clearTimeout(timeout);\n }\n\n return () => {\n if (subscription) {\n subscription.remove();\n }\n };\n }\n return undefined;\n }, [onLoad, player]);\n\n const getContentFit = (mode: typeof resizeMode): 'cover' | 'contain' | 'fill' => {\n switch (mode) {\n case 'cover':\n return 'cover';\n case 'contain':\n return 'contain';\n case 'stretch':\n return 'fill';\n default:\n return 'contain';\n }\n };\n\n return React.createElement(this._videoModule.VideoView, {\n ...props,\n player,\n contentFit: getContentFit(resizeMode),\n });\n };\n}\n\nconst createExpoMediaService = ({\n avModule,\n thumbnailModule,\n imageManipulator,\n fsModule,\n}: Modules): MediaServiceInterface => {\n if (expoBackwardUtils.expoAV.isLegacyAVModule(avModule)) {\n Logger.warn(\n '[MediaService.Expo] expo-av is deprecated and will be removed in Expo 54. Please migrate to expo-video.',\n );\n }\n\n const videoAdapter = expoBackwardUtils.expoAV.isVideoModule(avModule)\n ? new ExpoVideoAdapter(avModule)\n : new LegacyExpoAVVideoAdapter(avModule);\n\n return {\n VideoComponent: videoAdapter.VideoComponent,\n async getVideoThumbnail({ url, quality, timeMills }) {\n try {\n const { uri } = await thumbnailModule.getThumbnailAsync(url, { quality, time: timeMills });\n return { path: uri };\n } catch {\n return null;\n }\n },\n async compressImage({ maxWidth, maxHeight, compressionRate = 1, uri }) {\n const originSize = await SBUUtils.getImageSize(uri);\n const resizingSize = getDownscaleSize(originSize, { width: maxWidth, height: maxHeight });\n\n const { uri: compressedURI } = await imageManipulator.manipulateAsync(uri, [{ resize: resizingSize }], {\n compress: Math.min(Math.max(0, compressionRate), 1),\n });\n const fileInfo = await fsModule.getInfoAsync(uri);\n\n return { uri: compressedURI, size: expoBackwardUtils.toFileSize(fileInfo) };\n },\n };\n};\n\nexport default createExpoMediaService;\n"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA2D,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OA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GAAG,IAAAC,4BAAgB,EAACJ,UAAU,EAAE;QAAEK,KAAK,EAAER,QAAQ;QAAES,MAAM,EAAER;MAAU,CAAC,CAAC;MAEzF,MAAM;QAAEN,GAAG,EAAEe;MAAc,CAAC,GAAG,MAAM7B,gBAAgB,CAAC8B,eAAe,CAAChB,GAAG,EAAE,CAAC;QAAEiB,MAAM,EAAEN;MAAa,CAAC,CAAC,EAAE;QACrGO,QAAQ,EAAEC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEd,eAAe,CAAC,EAAE,CAAC;MACpD,CAAC,CAAC;MACF,MAAMe,QAAQ,GAAG,MAAMnC,QAAQ,CAACoC,YAAY,CAACvB,GAAG,CAAC;MAEjD,OAAO;QAAEA,GAAG,EAAEe,aAAa;QAAES,IAAI,EAAEpC,0BAAiB,CAACqC,UAAU,CAACH,QAAQ;MAAE,CAAC;IAC7E;EACF,CAAC;AACH,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAA7G,OAAA,GAEakE,sBAAsB","ignoreList":[]}
|
|
@@ -5,18 +5,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
+
// Type definitions for Firebase Messaging Module instance
|
|
9
|
+
// This represents the instance returned by messaging() or getMessaging()
|
|
10
|
+
// We use a type alias to handle both v14 and v22+ types
|
|
11
|
+
|
|
12
|
+
// Type definitions for modular API support (Firebase v22+)
|
|
13
|
+
// The modular API provides standalone functions that accept a messaging instance
|
|
14
|
+
|
|
15
|
+
// Create a flexible type that can handle both v14 and v22+ Firebase modules
|
|
16
|
+
|
|
17
|
+
const isModularAPI = module => {
|
|
18
|
+
return typeof module.getMessaging === 'function';
|
|
19
|
+
};
|
|
8
20
|
const createNativeNotificationService = ({
|
|
9
21
|
messagingModule,
|
|
10
22
|
permissionModule
|
|
11
23
|
}) => {
|
|
12
|
-
const
|
|
24
|
+
const isModular = isModularAPI(messagingModule);
|
|
25
|
+
const modularMessaging = isModular ? messagingModule : null;
|
|
26
|
+
const messaging = isModular ? modularMessaging.getMessaging() : messagingModule();
|
|
13
27
|
const authorizedStatus = [messagingModule.AuthorizationStatus.AUTHORIZED, messagingModule.AuthorizationStatus.PROVISIONAL];
|
|
14
28
|
return {
|
|
15
29
|
getAPNSToken() {
|
|
16
|
-
|
|
30
|
+
if (modularMessaging) {
|
|
31
|
+
return modularMessaging.getAPNSToken(messaging);
|
|
32
|
+
}
|
|
33
|
+
return messaging.getAPNSToken();
|
|
17
34
|
},
|
|
18
35
|
getFCMToken() {
|
|
19
|
-
|
|
36
|
+
if (modularMessaging) {
|
|
37
|
+
return modularMessaging.getToken(messaging);
|
|
38
|
+
}
|
|
39
|
+
return messaging.getToken();
|
|
20
40
|
},
|
|
21
41
|
async hasPushPermission() {
|
|
22
42
|
if (_reactNative.Platform.OS === 'android') {
|
|
@@ -24,7 +44,7 @@ const createNativeNotificationService = ({
|
|
|
24
44
|
return result.status === 'granted';
|
|
25
45
|
}
|
|
26
46
|
if (_reactNative.Platform.OS === 'ios') {
|
|
27
|
-
const status = await
|
|
47
|
+
const status = modularMessaging ? await modularMessaging.hasPermission(messaging) : await messaging.hasPermission();
|
|
28
48
|
return authorizedStatus.includes(status);
|
|
29
49
|
}
|
|
30
50
|
return false;
|
|
@@ -35,13 +55,18 @@ const createNativeNotificationService = ({
|
|
|
35
55
|
return result.status === 'granted';
|
|
36
56
|
}
|
|
37
57
|
if (_reactNative.Platform.OS === 'ios') {
|
|
38
|
-
const status = await
|
|
58
|
+
const status = modularMessaging ? await modularMessaging.requestPermission(messaging) : await messaging.requestPermission();
|
|
39
59
|
return authorizedStatus.includes(status);
|
|
40
60
|
}
|
|
41
61
|
return false;
|
|
42
62
|
},
|
|
43
63
|
onTokenRefresh(handler) {
|
|
44
|
-
|
|
64
|
+
if (modularMessaging) {
|
|
65
|
+
return modularMessaging.onTokenRefresh(messaging, token => {
|
|
66
|
+
if (_reactNative.Platform.OS === 'android') handler(token);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return messaging.onTokenRefresh(token => {
|
|
45
70
|
if (_reactNative.Platform.OS === 'android') handler(token);
|
|
46
71
|
});
|
|
47
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","createNativeNotificationService","messagingModule","permissionModule","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","isModularAPI","module","getMessaging","createNativeNotificationService","messagingModule","permissionModule","isModular","modularMessaging","messaging","authorizedStatus","AuthorizationStatus","AUTHORIZED","PROVISIONAL","getAPNSToken","getFCMToken","getToken","hasPushPermission","Platform","OS","result","checkNotifications","status","hasPermission","includes","requestPushPermission","requestNotifications","requestPermission","onTokenRefresh","handler","token","_default","exports","default"],"sources":["createNotificationService.native.ts"],"sourcesContent":["import type RNFBMessaging from '@react-native-firebase/messaging';\nimport type { FirebaseMessagingTypes } from '@react-native-firebase/messaging';\nimport { Platform } from 'react-native';\nimport type * as Permissions from 'react-native-permissions';\n\nimport type { NotificationServiceInterface } from './types';\n\n// Type definitions for Firebase Messaging Module instance\n// This represents the instance returned by messaging() or getMessaging()\n// We use a type alias to handle both v14 and v22+ types\ntype MessagingInstance = ReturnType<typeof RNFBMessaging>;\n\n// Type definitions for modular API support (Firebase v22+)\n// The modular API provides standalone functions that accept a messaging instance\ntype ModularMessagingType = {\n getMessaging: () => MessagingInstance;\n getAPNSToken: (messaging: MessagingInstance) => Promise<string | null>;\n getToken: (messaging: MessagingInstance) => Promise<string>;\n hasPermission: (messaging: MessagingInstance) => Promise<FirebaseMessagingTypes.AuthorizationStatus>;\n requestPermission: (\n messaging: MessagingInstance,\n iosPermissions?: FirebaseMessagingTypes.IOSPermissions,\n ) => Promise<FirebaseMessagingTypes.AuthorizationStatus>;\n onTokenRefresh: (messaging: MessagingInstance, listener: (token: string) => void) => () => void;\n AuthorizationStatus: typeof RNFBMessaging.AuthorizationStatus;\n};\n\n// Create a flexible type that can handle both v14 and v22+ Firebase modules\ntype FirebaseMessagingModule = typeof RNFBMessaging | ModularMessagingType;\n\nconst isModularAPI = (module: FirebaseMessagingModule): module is ModularMessagingType => {\n return typeof (module as ModularMessagingType).getMessaging === 'function';\n};\n\nconst createNativeNotificationService = ({\n messagingModule,\n permissionModule,\n}: {\n messagingModule: FirebaseMessagingModule;\n permissionModule: typeof Permissions;\n}): NotificationServiceInterface => {\n const isModular = isModularAPI(messagingModule);\n const modularMessaging = isModular ? (messagingModule as ModularMessagingType) : null;\n const messaging = isModular ? modularMessaging!.getMessaging() : (messagingModule as typeof RNFBMessaging)();\n\n const authorizedStatus = [\n messagingModule.AuthorizationStatus.AUTHORIZED,\n messagingModule.AuthorizationStatus.PROVISIONAL,\n ];\n return {\n getAPNSToken(): Promise<string | null> {\n if (modularMessaging) {\n return modularMessaging.getAPNSToken(messaging);\n }\n return messaging.getAPNSToken();\n },\n getFCMToken(): Promise<string | null> {\n if (modularMessaging) {\n return modularMessaging.getToken(messaging);\n }\n return messaging.getToken();\n },\n async hasPushPermission(): Promise<boolean> {\n if (Platform.OS === 'android') {\n const result = await permissionModule.checkNotifications();\n return result.status === 'granted';\n }\n\n if (Platform.OS === 'ios') {\n const status = modularMessaging\n ? await modularMessaging.hasPermission(messaging)\n : await messaging.hasPermission();\n return authorizedStatus.includes(status);\n }\n\n return false;\n },\n async requestPushPermission(): Promise<boolean> {\n if (Platform.OS === 'android') {\n const result = await permissionModule.requestNotifications([]);\n return result.status === 'granted';\n }\n\n if (Platform.OS === 'ios') {\n const status = modularMessaging\n ? await modularMessaging.requestPermission(messaging)\n : await messaging.requestPermission();\n return authorizedStatus.includes(status);\n }\n\n return false;\n },\n onTokenRefresh(handler: (token: string) => void): () => void | undefined {\n if (modularMessaging) {\n return modularMessaging.onTokenRefresh(messaging, (token: string) => {\n if (Platform.OS === 'android') handler(token);\n });\n }\n return messaging.onTokenRefresh((token: string) => {\n if (Platform.OS === 'android') hand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