@sendbird/uikit-react-native 1.0.2 → 1.1.0

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.
Files changed (172) hide show
  1. package/README.md +7 -7
  2. package/lib/commonjs/SendbirdUIKitContainer.js +5 -2
  3. package/lib/commonjs/SendbirdUIKitContainer.js.map +1 -1
  4. package/lib/commonjs/components/FileViewer.js +326 -0
  5. package/lib/commonjs/components/FileViewer.js.map +1 -0
  6. package/lib/commonjs/components/GroupChannelPreviewContainer.js +180 -0
  7. package/lib/commonjs/components/GroupChannelPreviewContainer.js.map +1 -0
  8. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +116 -0
  9. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -0
  10. package/lib/commonjs/components/MessageRenderer/FileMessage/index.js +8 -0
  11. package/lib/commonjs/components/MessageRenderer/FileMessage/index.js.map +1 -1
  12. package/lib/commonjs/components/MessageRenderer/MessageOutgoingStatus.js +15 -24
  13. package/lib/commonjs/components/MessageRenderer/MessageOutgoingStatus.js.map +1 -1
  14. package/lib/commonjs/components/SBUPressable.js +45 -0
  15. package/lib/commonjs/components/SBUPressable.js.map +1 -0
  16. package/lib/commonjs/components/UserActionBar.js +1 -3
  17. package/lib/commonjs/components/UserActionBar.js.map +1 -1
  18. package/lib/commonjs/components/UserSelectableBar.js +1 -3
  19. package/lib/commonjs/components/UserSelectableBar.js.map +1 -1
  20. package/lib/commonjs/constants.js +7 -1
  21. package/lib/commonjs/constants.js.map +1 -1
  22. package/lib/commonjs/contexts/PlatformService.js +4 -2
  23. package/lib/commonjs/contexts/PlatformService.js.map +1 -1
  24. package/lib/commonjs/contexts/SendbirdChat.js +6 -2
  25. package/lib/commonjs/contexts/SendbirdChat.js.map +1 -1
  26. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +1 -1
  27. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  28. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +30 -7
  29. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  30. package/lib/commonjs/domain/groupChannel/module/moduleContext.js +2 -3
  31. package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
  32. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  33. package/lib/commonjs/domain/groupChannelList/types.js.map +1 -1
  34. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +1 -1
  35. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  36. package/lib/commonjs/fragments/createGroupChannelCreateFragment.js +3 -7
  37. package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
  38. package/lib/commonjs/fragments/createGroupChannelFragment.js +13 -11
  39. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  40. package/lib/commonjs/fragments/createGroupChannelListFragment.js +7 -37
  41. package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
  42. package/lib/commonjs/fragments/createGroupChannelMembersFragment.js +1 -1
  43. package/lib/commonjs/fragments/createGroupChannelMembersFragment.js.map +1 -1
  44. package/lib/commonjs/hooks/useContext.js.map +1 -1
  45. package/lib/commonjs/index.js +29 -2
  46. package/lib/commonjs/index.js.map +1 -1
  47. package/lib/commonjs/localization/StringSet.type.js +8 -0
  48. package/lib/commonjs/localization/StringSet.type.js.map +1 -1
  49. package/lib/commonjs/platform/createFileService.expo.js +21 -2
  50. package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
  51. package/lib/commonjs/platform/createFileService.native.js +20 -3
  52. package/lib/commonjs/platform/createFileService.native.js.map +1 -1
  53. package/lib/commonjs/platform/createMediaService.expo.js +64 -0
  54. package/lib/commonjs/platform/createMediaService.expo.js.map +1 -0
  55. package/lib/commonjs/platform/createMediaService.native.js +67 -0
  56. package/lib/commonjs/platform/createMediaService.native.js.map +1 -0
  57. package/lib/commonjs/platform/createNotificationService.expo.js.map +1 -1
  58. package/lib/commonjs/platform/types.js.map +1 -1
  59. package/lib/commonjs/version.js +1 -1
  60. package/lib/commonjs/version.js.map +1 -1
  61. package/lib/module/SendbirdUIKitContainer.js +5 -2
  62. package/lib/module/SendbirdUIKitContainer.js.map +1 -1
  63. package/lib/module/components/FileViewer.js +304 -0
  64. package/lib/module/components/FileViewer.js.map +1 -0
  65. package/lib/module/components/GroupChannelPreviewContainer.js +158 -0
  66. package/lib/module/components/GroupChannelPreviewContainer.js.map +1 -0
  67. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +100 -0
  68. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -0
  69. package/lib/module/components/MessageRenderer/FileMessage/index.js +6 -0
  70. package/lib/module/components/MessageRenderer/FileMessage/index.js.map +1 -1
  71. package/lib/module/components/MessageRenderer/MessageOutgoingStatus.js +17 -26
  72. package/lib/module/components/MessageRenderer/MessageOutgoingStatus.js.map +1 -1
  73. package/lib/module/components/SBUPressable.js +33 -0
  74. package/lib/module/components/SBUPressable.js.map +1 -0
  75. package/lib/module/components/UserActionBar.js +1 -1
  76. package/lib/module/components/UserActionBar.js.map +1 -1
  77. package/lib/module/components/UserSelectableBar.js +1 -1
  78. package/lib/module/components/UserSelectableBar.js.map +1 -1
  79. package/lib/module/constants.js +5 -0
  80. package/lib/module/constants.js.map +1 -1
  81. package/lib/module/contexts/PlatformService.js +4 -2
  82. package/lib/module/contexts/PlatformService.js.map +1 -1
  83. package/lib/module/contexts/SendbirdChat.js +6 -2
  84. package/lib/module/contexts/SendbirdChat.js.map +1 -1
  85. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +1 -1
  86. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  87. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +28 -7
  88. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  89. package/lib/module/domain/groupChannel/module/moduleContext.js +2 -3
  90. package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
  91. package/lib/module/domain/groupChannel/types.js.map +1 -1
  92. package/lib/module/domain/groupChannelList/types.js.map +1 -1
  93. package/lib/module/domain/groupChannelSettings/module/moduleContext.js +1 -1
  94. package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  95. package/lib/module/fragments/createGroupChannelCreateFragment.js +4 -4
  96. package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
  97. package/lib/module/fragments/createGroupChannelFragment.js +15 -13
  98. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  99. package/lib/module/fragments/createGroupChannelListFragment.js +11 -38
  100. package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
  101. package/lib/module/fragments/createGroupChannelMembersFragment.js +1 -1
  102. package/lib/module/fragments/createGroupChannelMembersFragment.js.map +1 -1
  103. package/lib/module/hooks/useContext.js.map +1 -1
  104. package/lib/module/index.js +4 -1
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/module/localization/StringSet.type.js +8 -0
  107. package/lib/module/localization/StringSet.type.js.map +1 -1
  108. package/lib/module/platform/createFileService.expo.js +21 -2
  109. package/lib/module/platform/createFileService.expo.js.map +1 -1
  110. package/lib/module/platform/createFileService.native.js +20 -3
  111. package/lib/module/platform/createFileService.native.js.map +1 -1
  112. package/lib/module/platform/createMediaService.expo.js +54 -0
  113. package/lib/module/platform/createMediaService.expo.js.map +1 -0
  114. package/lib/module/platform/createMediaService.native.js +57 -0
  115. package/lib/module/platform/createMediaService.native.js.map +1 -0
  116. package/lib/module/platform/createNotificationService.expo.js.map +1 -1
  117. package/lib/module/platform/types.js.map +1 -1
  118. package/lib/module/version.js +1 -1
  119. package/lib/module/version.js.map +1 -1
  120. package/lib/typescript/src/SendbirdUIKitContainer.d.ts +7 -3
  121. package/lib/typescript/src/components/FileViewer.d.ts +12 -0
  122. package/lib/typescript/src/components/GroupChannelPreviewContainer.d.ts +8 -0
  123. package/lib/typescript/src/components/MessageRenderer/FileMessage/VideoFileMessage.d.ts +3 -0
  124. package/lib/typescript/src/components/SBUPressable.d.ts +18 -0
  125. package/lib/typescript/src/components/UserActionBar.d.ts +2 -3
  126. package/lib/typescript/src/components/UserSelectableBar.d.ts +2 -3
  127. package/lib/typescript/src/constants.d.ts +5 -0
  128. package/lib/typescript/src/contexts/PlatformService.d.ts +3 -2
  129. package/lib/typescript/src/contexts/SendbirdChat.d.ts +5 -1
  130. package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +3 -2
  131. package/lib/typescript/src/domain/groupChannel/types.d.ts +6 -2
  132. package/lib/typescript/src/hooks/useContext.d.ts +7 -5
  133. package/lib/typescript/src/index.d.ts +3 -0
  134. package/lib/typescript/src/localization/StringSet.type.d.ts +4 -0
  135. package/lib/typescript/src/platform/createMediaService.expo.d.ts +9 -0
  136. package/lib/typescript/src/platform/createMediaService.native.d.ts +9 -0
  137. package/lib/typescript/src/platform/createNotificationService.expo.d.ts +1 -1
  138. package/lib/typescript/src/platform/types.d.ts +20 -1
  139. package/lib/typescript/src/version.d.ts +1 -1
  140. package/package.json +14 -5
  141. package/src/SendbirdUIKitContainer.tsx +14 -2
  142. package/src/components/FileViewer.tsx +284 -0
  143. package/src/components/GroupChannelPreviewContainer.tsx +134 -0
  144. package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +91 -0
  145. package/src/components/MessageRenderer/FileMessage/index.tsx +6 -0
  146. package/src/components/MessageRenderer/MessageOutgoingStatus.tsx +25 -32
  147. package/src/components/SBUPressable.tsx +40 -0
  148. package/src/components/UserActionBar.tsx +1 -1
  149. package/src/components/UserSelectableBar.tsx +1 -1
  150. package/src/constants.ts +5 -0
  151. package/src/contexts/PlatformService.tsx +15 -3
  152. package/src/contexts/SendbirdChat.tsx +13 -5
  153. package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +1 -1
  154. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +23 -6
  155. package/src/domain/groupChannel/module/moduleContext.tsx +6 -13
  156. package/src/domain/groupChannel/types.ts +8 -2
  157. package/src/domain/groupChannelList/types.ts +1 -0
  158. package/src/domain/groupChannelSettings/module/moduleContext.tsx +5 -10
  159. package/src/fragments/createGroupChannelCreateFragment.tsx +38 -41
  160. package/src/fragments/createGroupChannelFragment.tsx +23 -33
  161. package/src/fragments/createGroupChannelListFragment.tsx +10 -32
  162. package/src/fragments/createGroupChannelMembersFragment.tsx +34 -39
  163. package/src/hooks/useContext.ts +3 -5
  164. package/src/index.ts +5 -1
  165. package/src/localization/StringSet.type.ts +8 -0
  166. package/src/platform/createFileService.expo.ts +17 -2
  167. package/src/platform/createFileService.native.ts +16 -3
  168. package/src/platform/createMediaService.expo.tsx +30 -0
  169. package/src/platform/createMediaService.native.tsx +37 -0
  170. package/src/platform/createNotificationService.expo.ts +1 -1
  171. package/src/platform/types.ts +26 -1
  172. package/src/version.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["iconMapper","audio","image","video","file","GroupChannelPreviewContainer","onPress","onLongPress","channel","currentUser","sdk","features","useSendbirdChat","STRINGS","useLocalization","colors","useUIKitTheme","typingUsers","setTypingUsers","useState","forceUpdate","useForceUpdate","channelListTypingIndicatorEnabled","typingId","useUniqId","useChannelHandler","onTypingStatusUpdated","eventChannel","isDifferentChannel","getTypingUsers","channelListMessageReceiptStatusEnabled","receiptId","onDeliveryReceiptUpdated","isGroupChannel","lastMessage","isMyMessage","userId","onReadReceiptUpdated","bodyText","useIIFE","length","LABELS","TYPING_INDICATOR_TYPINGS","GROUP_CHANNEL_LIST","CHANNEL_PREVIEW_BODY","bodyIcon","isFileMessage","undefined","getFileType","type","getFileExtension","name","titleCaptionIcon","sendingStatus","styles","error","getUnreadMemberCount","secondary","deliveryReceiptEnabled","getUndeliveredMemberCount","onBackground03","coverUrl","CHANNEL_PREVIEW_TITLE","CHANNEL_PREVIEW_TITLE_CAPTION","unreadMessageCount","memberCount","isFrozen","myPushTriggerOption","createStyleSheet","marginRight"],"sources":["GroupChannelPreviewContainer.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport { useChannelHandler } from '@sendbird/uikit-chat-hooks';\nimport {\n GroupChannelPreview,\n LoadingSpinner,\n createStyleSheet,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport Icon from '@sendbird/uikit-react-native-foundation/src/ui/Icon';\nimport {\n SendbirdGroupChannel,\n SendbirdUser,\n getFileExtension,\n getFileType,\n isDifferentChannel,\n isMyMessage,\n useForceUpdate,\n useIIFE,\n useUniqId,\n} from '@sendbird/uikit-utils';\n\nimport { useLocalization, useSendbirdChat } from '../hooks/useContext';\nimport ChannelCover from './ChannelCover';\nimport SBUPressable from './SBUPressable';\n\nconst iconMapper = { audio: 'file-audio', image: 'photo', video: 'play', file: 'file-document' } as const;\n\ntype Props = {\n channel: SendbirdGroupChannel;\n onPress: () => void;\n onLongPress: () => void;\n};\nconst GroupChannelPreviewContainer = ({ onPress, onLongPress, channel }: Props) => {\n const { currentUser, sdk, features } = useSendbirdChat();\n const { STRINGS } = useLocalization();\n const { colors } = useUIKitTheme();\n\n const [typingUsers, setTypingUsers] = useState<SendbirdUser[]>([]);\n const forceUpdate = useForceUpdate();\n\n if (features.channelListTypingIndicatorEnabled) {\n const typingId = useUniqId('GroupChannelPreviewContainer');\n useChannelHandler(sdk, `GroupChannelPreviewContainer_TypingIndicator_${typingId}`, {\n onTypingStatusUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n setTypingUsers(eventChannel.getTypingUsers());\n },\n });\n }\n\n if (features.channelListMessageReceiptStatusEnabled) {\n const receiptId = useUniqId('GroupChannelPreviewContainer');\n useChannelHandler(sdk, `GroupChannelPreviewContainer_ReceiptStatus_${receiptId}`, {\n onDeliveryReceiptUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (!eventChannel.isGroupChannel() || !eventChannel.lastMessage) return;\n if (!isMyMessage(eventChannel.lastMessage, currentUser?.userId)) return;\n\n forceUpdate();\n },\n onReadReceiptUpdated(eventChannel) {\n if (isDifferentChannel(channel, eventChannel)) return;\n if (!eventChannel.isGroupChannel() || !eventChannel.lastMessage) return;\n if (!isMyMessage(eventChannel.lastMessage, currentUser?.userId)) return;\n\n forceUpdate();\n },\n });\n }\n\n const bodyText = useIIFE(() => {\n if (typingUsers.length > 0) return STRINGS.LABELS.TYPING_INDICATOR_TYPINGS(typingUsers) || '';\n else return STRINGS.GROUP_CHANNEL_LIST.CHANNEL_PREVIEW_BODY(channel);\n });\n\n const bodyIcon = useIIFE(() => {\n if (!channel.lastMessage?.isFileMessage()) return undefined;\n return iconMapper[getFileType(channel.lastMessage.type || getFileExtension(channel.lastMessage.name))];\n });\n\n const titleCaptionIcon = useIIFE(() => {\n if (!channel.lastMessage) return undefined;\n if (!features.channelListMessageReceiptStatusEnabled) return undefined;\n if (!isMyMessage(channel.lastMessage, currentUser?.userId)) return undefined;\n\n if (channel.lastMessage.sendingStatus === 'pending') {\n return <LoadingSpinner size={16} style={styles.titleCaptionIcon} />;\n }\n\n if (channel.lastMessage.sendingStatus === 'failed') {\n return <Icon icon={'error'} size={16} color={colors.error} style={styles.titleCaptionIcon} />;\n }\n\n if (channel.getUnreadMemberCount(channel.lastMessage) === 0) {\n return <Icon icon={'done-all'} size={16} color={colors.secondary} style={styles.titleCaptionIcon} />;\n }\n\n if (features.deliveryReceiptEnabled) {\n if (channel.getUndeliveredMemberCount(channel.lastMessage) === 0) {\n return <Icon icon={'done-all'} size={16} color={colors.onBackground03} style={styles.titleCaptionIcon} />;\n }\n return <Icon icon={'done'} size={16} color={colors.onBackground03} containerStyle={styles.titleCaptionIcon} />;\n }\n\n return <Icon icon={'done-all'} size={16} color={colors.onBackground03} style={styles.titleCaptionIcon} />;\n });\n\n return (\n <SBUPressable onPress={onPress} onLongPress={onLongPress}>\n <GroupChannelPreview\n customCover={<ChannelCover channel={channel} size={56} />}\n coverUrl={channel.coverUrl}\n title={STRINGS.GROUP_CHANNEL_LIST.CHANNEL_PREVIEW_TITLE(currentUser?.userId ?? '', channel)}\n titleCaptionLeft={titleCaptionIcon}\n titleCaption={STRINGS.GROUP_CHANNEL_LIST.CHANNEL_PREVIEW_TITLE_CAPTION(channel)}\n body={bodyText}\n bodyIcon={bodyIcon}\n badgeCount={channel.unreadMessageCount}\n memberCount={channel.memberCount > 2 ? channel.memberCount : undefined}\n frozen={channel.isFrozen}\n notificationOff={channel.myPushTriggerOption === 'off'}\n />\n </SBUPressable>\n );\n};\n\nconst styles = createStyleSheet({\n titleCaptionIcon: {\n marginRight: 4,\n },\n});\n\nexport default GroupChannelPreviewContainer;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAMA;;AACA;;AAYA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,UAAU,GAAG;EAAEC,KAAK,EAAE,YAAT;EAAuBC,KAAK,EAAE,OAA9B;EAAuCC,KAAK,EAAE,MAA9C;EAAsDC,IAAI,EAAE;AAA5D,CAAnB;;AAOA,MAAMC,4BAA4B,GAAG,QAA8C;EAAA,IAA7C;IAAEC,OAAF;IAAWC,WAAX;IAAwBC;EAAxB,CAA6C;EACjF,MAAM;IAAEC,WAAF;IAAeC,GAAf;IAAoBC;EAApB,IAAiC,IAAAC,2BAAA,GAAvC;EACA,MAAM;IAAEC;EAAF,IAAc,IAAAC,2BAAA,GAApB;EACA,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EAEA,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,IAAAC,eAAA,EAAyB,EAAzB,CAAtC;EACA,MAAMC,WAAW,GAAG,IAAAC,0BAAA,GAApB;;EAEA,IAAIV,QAAQ,CAACW,iCAAb,EAAgD;IAC9C,MAAMC,QAAQ,GAAG,IAAAC,qBAAA,EAAU,8BAAV,CAAjB;IACA,IAAAC,iCAAA,EAAkBf,GAAlB,EAAwB,gDAA+Ca,QAAS,EAAhF,EAAmF;MACjFG,qBA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AiD,CAAArD,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAE2B,MAAb,KAAuB,EAAxE,EAA4E5B,OAA5E,CAHT;IAIE,gBAAgB,EAAE4C,gBAJpB;IAKE,YAAY,EAAEvC,OAAO,CAAC8B,kBAAR,CAA2BoB,6BAA3B,CAAyDvD,OAAzD,CALhB;IAME,IAAI,EAAE8B,QANR;IAOE,QAAQ,EAAEO,QAPZ;IAQE,UAAU,EAAErC,OAAO,CAACwD,kBARtB;IASE,WAAW,EAAExD,OAAO,CAACyD,WAAR,GAAsB,CAAtB,GAA0BzD,OAAO,CAACyD,WAAlC,GAAgDlB,SAT/D;IAUE,MAAM,EAAEvC,OAAO,CAAC0D,QAVlB;IAWE,eAAe,EAAE1D,OAAO,CAAC2D,mBAAR,KAAgC;EAXnD,EADF,CADF;AAiBD,CA5FD;;AA8FA,MAAMb,MAAM,GAAG,IAAAc,4CAAA,EAAiB;EAC9BhB,gBAAgB,EAAE;IAChBiB,WAAW,EAAE;EADG;AADY,CAAjB,CAAf;eAMehE,4B"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _uikitReactNativeFoundation = require("@sendbird/uikit-react-native-foundation");
13
+
14
+ var _uikitUtils = require("@sendbird/uikit-utils");
15
+
16
+ var _useContext = require("../../../hooks/useContext");
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ const VideoFileMessage = _ref => {
23
+ let {
24
+ message
25
+ } = _ref;
26
+ const {
27
+ colors
28
+ } = (0, _uikitReactNativeFoundation.useUIKitTheme)();
29
+ const {
30
+ mediaService
31
+ } = (0, _useContext.usePlatformService)();
32
+ const fileUrl = (0, _uikitUtils.getAvailableUriFromFileMessage)(message);
33
+ const style = [styles.image, {
34
+ backgroundColor: colors.onBackground04
35
+ }];
36
+ const [state, setState] = (0, _react.useState)({
37
+ thumbnail: null,
38
+ loading: true,
39
+ imageNotFound: false
40
+ });
41
+ (0, _react.useEffect)(() => {
42
+ mediaService === null || mediaService === void 0 ? void 0 : mediaService.getVideoThumbnail({
43
+ url: fileUrl,
44
+ timeMills: 1000
45
+ }).then(result => {
46
+ if (result !== null && result !== void 0 && result.path) {
47
+ setState(prev => ({ ...prev,
48
+ loading: false,
49
+ thumbnail: result.path
50
+ }));
51
+ } else {
52
+ throw new Error('Cannot generate thumbnail');
53
+ }
54
+ }).catch(() => {
55
+ setState(prev => ({ ...prev,
56
+ loading: false,
57
+ imageNotFound: true
58
+ }));
59
+ });
60
+ }, []);
61
+
62
+ if (state.loading || state.imageNotFound) {
63
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
64
+ style: [style, styles.container]
65
+ }, /*#__PURE__*/_react.default.createElement(PlayIcon, null));
66
+ }
67
+
68
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
69
+ style: styles.container
70
+ }, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Image, {
71
+ source: {
72
+ uri: state.thumbnail || fileUrl
73
+ },
74
+ style: style,
75
+ resizeMode: 'cover',
76
+ resizeMethod: 'resize',
77
+ onError: () => setState(prev => ({ ...prev,
78
+ imageNotFound: true
79
+ }))
80
+ }), /*#__PURE__*/_react.default.createElement(PlayIcon, null));
81
+ };
82
+
83
+ const PlayIcon = () => {
84
+ const {
85
+ colors
86
+ } = (0, _uikitReactNativeFoundation.useUIKitTheme)();
87
+ return /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
88
+ icon: 'play',
89
+ size: 28,
90
+ color: colors.onBackground02,
91
+ containerStyle: [styles.playIcon, {
92
+ backgroundColor: colors.onBackgroundReverse01
93
+ }]
94
+ });
95
+ };
96
+
97
+ const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
98
+ container: {
99
+ alignItems: 'center',
100
+ justifyContent: 'center'
101
+ },
102
+ image: {
103
+ width: 240,
104
+ maxWidth: 240,
105
+ height: 160,
106
+ borderRadius: 16
107
+ },
108
+ playIcon: {
109
+ position: 'absolute',
110
+ padding: 10,
111
+ borderRadius: 50
112
+ }
113
+ });
114
+ var _default = VideoFileMessage;
115
+ exports.default = _default;
116
+ //# sourceMappingURL=VideoFileMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["VideoFileMessage","message","colors","useUIKitTheme","mediaService","usePlatformService","fileUrl","getAvailableUriFromFileMessage","style","styles","image","backgroundColor","onBackground04","state","setState","useState","thumbnail","loading","imageNotFound","useEffect","getVideoThumbnail","url","timeMills","then","result","path","prev","Error","catch","container","uri","PlayIcon","onBackground02","playIcon","onBackgroundReverse01","createStyleSheet","alignItems","justifyContent","width","maxWidth","height","borderRadius","position","padding"],"sources":["VideoFileMessage.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { View } from 'react-native';\n\nimport { Icon, Image, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { getAvailableUriFromFileMessage } from '@sendbird/uikit-utils';\n\nimport { usePlatformService } from '../../../hooks/useContext';\nimport type { FileMessageProps } from './index';\n\nconst VideoFileMessage = ({ message }: FileMessageProps) => {\n const { colors } = useUIKitTheme();\n\n const { mediaService } = usePlatformService();\n const fileUrl = getAvailableUriFromFileMessage(message);\n const style = [styles.image, { backgroundColor: colors.onBackground04 }];\n\n const [state, setState] = useState({\n thumbnail: null as null | string,\n loading: true,\n imageNotFound: false,\n });\n\n useEffect(() => {\n mediaService\n ?.getVideoThumbnail({ url: fileUrl, timeMills: 1000 })\n .then((result) => {\n if (result?.path) {\n setState((prev) => ({ ...prev, loading: false, thumbnail: result.path }));\n } else {\n throw new Error('Cannot generate thumbnail');\n }\n })\n .catch(() => {\n setState((prev) => ({ ...prev, loading: false, imageNotFound: true }));\n });\n }, []);\n\n if (state.loading || state.imageNotFound) {\n return (\n <View style={[style, styles.container]}>\n <PlayIcon />\n </View>\n );\n }\n\n return (\n <View style={styles.container}>\n <Image\n source={{ uri: state.thumbnail || fileUrl }}\n style={style}\n resizeMode={'cover'}\n resizeMethod={'resize'}\n onError={() => setState((prev) => ({ ...prev, imageNotFound: true }))}\n />\n <PlayIcon />\n </View>\n );\n};\n\nconst PlayIcon = () => {\n const { colors } = useUIKitTheme();\n\n return (\n <Icon\n icon={'play'}\n size={28}\n color={colors.onBackground02}\n containerStyle={[styles.playIcon, { backgroundColor: colors.onBackgroundReverse01 }]}\n />\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n image: {\n width: 240,\n maxWidth: 240,\n height: 160,\n borderRadius: 16,\n },\n playIcon: {\n position: 'absolute',\n padding: 10,\n borderRadius: 50,\n },\n});\n\nexport default VideoFileMessage;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;;;;;AAGA,MAAMA,gBAAgB,GAAG,QAAmC;EAAA,IAAlC;IAAEC;EAAF,CAAkC;EA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ird/uikit-utils");
11
11
 
12
+ var _useContext = require("../../../hooks/useContext");
13
+
12
14
  var _BaseFileMessage = _interopRequireDefault(require("./BaseFileMessage"));
13
15
 
14
16
  var _ImageFileMessage = _interopRequireDefault(require("./ImageFileMessage"));
15
17
 
18
+ var _VideoFileMessage = _interopRequireDefault(require("./VideoFileMessage"));
19
+
16
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
21
 
18
22
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
23
 
20
24
  const FileMessage = props => {
25
+ const {
26
+ mediaService
27
+ } = (0, _useContext.usePlatformService)();
21
28
  const fileType = (0, _uikitUtils.getFileType)(props.message.type || (0, _uikitUtils.getFileExtension)(props.message.name));
22
29
  if (fileType === 'image') return /*#__PURE__*/_react.default.createElement(_ImageFileMessage.default, props);
30
+ if (fileType === 'video' && mediaService !== null && mediaService !== void 0 && mediaService.getVideoThumbnail) return /*#__PURE__*/_react.default.createElement(_VideoFileMessage.default, props);
23
31
  return /*#__PURE__*/_react.default.createElement(_BaseFileMessage.default, _extends({}, props, {
24
32
  type: fileType
25
33
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["FileMessage","props","fileType","getFileType","message","type","getFileExtension","name","React","memo"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SendbirdFileMessage, getFileExtension, getFileType } from '@sendbird/uikit-utils';\n\nimport type { MessageRendererInterface } from '../index';\nimport BaseFileMessage from './BaseFileMessage';\nimport ImageFileMessage from './ImageFileMessage';\n\nexport type FileMessageProps = MessageRendererInterface<SendbirdFileMessage>;\nconst FileMessage = (props: FileMessageProps) => {\n const fileType = getFileType(props.message.type || getFileExtension(props.message.name));\n\n if (fileType === 'image') return <ImageFileMessage {...props} />;\n return <BaseFileMessage {...props} type={fileType} />;\n};\n\nexport default React.memo(FileMessage);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;AACA;;;;;;AAGA,MAAMA,WAAW,GAAIC,KAAD,IAA6B;EAC/C,MAAMC,QAAQ,GAAG,IAAAC,uBAAA,EAAYF,KAAK,CAACG,OAAN,CAAcC,IAAd,IAAsB,IAAAC,4BAAA,EAAiBL,KAAK,CAACG,OAAN,CAAcG,IAA/B,CAAlC,CAAjB;EAEA,IAAIL,QAAQ,KAAK,OAAjB,EAA0B,oBAAO,6BAAC,yBAAD,EAAsBD,KAAtB,CAAP;EAC1B,oBAAO,6BAAC,wBAAD,eAAqBA,KAArB;IAA4B,IAAI,EAAEC;EAAlC,GAAP;AACD,CALD;;4BAOeM,cAAA,CAAMC,IAAN,CAAWT,WAAX,C"}
1
+ {"version":3,"names":["FileMessage","props","mediaService","usePlatformService","fileType","getFileType","message","type","getFileExtension","name","getVideoThumbnail","React","memo"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SendbirdFileMessage, getFileExtension, getFileType } from '@sendbird/uikit-utils';\n\nimport { usePlatformService } from '../../../hooks/useContext';\nimport type { MessageRendererInterface } from '../index';\nimport BaseFileMessage from './BaseFileMessage';\nimport ImageFileMessage from './ImageFileMessage';\nimport VideoFileMessage from './VideoFileMessage';\n\nexport type FileMessageProps = MessageRendererInterface<SendbirdFileMessage>;\nconst FileMessage = (props: FileMessageProps) => {\n const { mediaService } = usePlatformService();\n\n const fileType = getFileType(props.message.type || getFileExtension(props.message.name));\n\n if (fileType === 'image') return <ImageFileMessage {...props} />;\n if (fileType === 'video' && mediaService?.getVideoThumbnail) return <VideoFileMessage {...props} />;\n\n return <BaseFileMessage {...props} type={fileType} />;\n};\n\nexport default React.memo(FileMessage);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;;;;;AAGA,MAAMA,WAAW,GAAIC,KAAD,IAA6B;EAC/C,MAAM;IAAEC;EAAF,IAAmB,IAAAC,8BAAA,GAAzB;EAEA,MAAMC,QAAQ,GAAG,IAAAC,uBAAA,EAAYJ,KAAK,CAACK,OAAN,CAAcC,IAAd,IAAsB,IAAAC,4BAAA,EAAiBP,KAAK,CAACK,OAAN,CAAcG,IAA/B,CAAlC,CAAjB;EAEA,IAAIL,QAAQ,KAAK,OAAjB,EAA0B,oBAAO,6BAAC,yBAAD,EAAsBH,KAAtB,CAAP;EAC1B,IAAIG,QAAQ,KAAK,OAAb,IAAwBF,YAAxB,aAAwBA,YAAxB,eAAwBA,YAAY,CAAEQ,iBAA1C,EAA6D,oBAAO,6BAAC,yBAAD,EAAsBT,KAAtB,CAAP;EAE7D,oBAAO,6BAAC,wBAAD,eAAqBA,KAArB;IAA4B,IAAI,EAAEG;EAAlC,GAAP;AACD,CATD;;4BAWeO,cAAA,CAAMC,IAAN,CAAWZ,WAAX,C"}
@@ -25,7 +25,6 @@ const MessageOutgoingStatus = _ref => {
25
25
  message
26
26
  } = _ref;
27
27
  if (!message.isUserMessage() && !message.isFileMessage()) return null;
28
- const handlerId = (0, _uikitUtils.useUniqId)('MessageOutgoingStatus');
29
28
  const {
30
29
  sdk,
31
30
  features
@@ -33,41 +32,33 @@ const MessageOutgoingStatus = _ref => {
33
32
  const {
34
33
  colors
35
34
  } = (0, _uikitReactNativeFoundation.useUIKitTheme)();
36
- const [state, setState] = (0, _react.useState)(() => ({
37
- unreadCount: channel.getUnreadMemberCount(message),
38
- undeliveredCount: channel.getUndeliveredMemberCount(message)
39
- }));
40
-
41
- const getCounts = (channel, message) => {
42
- return {
43
- unreadCount: channel.getUnreadMemberCount(message),
44
- undeliveredCount: channel.getUndeliveredMemberCount(message)
45
- };
46
- };
47
-
35
+ const uniqId = (0, _uikitUtils.useUniqId)('MessageOutgoingStatus');
36
+ const forceUpdate = (0, _uikitUtils.useForceUpdate)();
48
37
  (0, _react.useEffect)(() => {
49
- const id = String(handlerId);
38
+ const handlerId = `MessageOutgoingStatus_${uniqId}`;
50
39
 
51
- if (message.sendingStatus === 'succeeded' && state.unreadCount === 0 && state.undeliveredCount === 0) {
52
- sdk.removeChannelHandler(id);
40
+ if (message.sendingStatus === 'succeeded' && channel.getUnreadMemberCount(message) === 0 && channel.getUndeliveredMemberCount(message) === 0) {
41
+ sdk.removeChannelHandler(handlerId);
53
42
  } else {
54
43
  const handler = new sdk.ChannelHandler();
55
44
 
56
- handler.onReadReceiptUpdated = channel => {
57
- if (channel.url === message.channelUrl) setState(getCounts(channel, message));
45
+ handler.onReadReceiptUpdated = eventChannel => {
46
+ if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
47
+ forceUpdate();
58
48
  };
59
49
 
60
50
  if (features.deliveryReceiptEnabled) {
61
- handler.onDeliveryReceiptUpdated = channel => {
62
- if (channel.url === message.channelUrl && channel.isGroupChannel()) setState(getCounts(channel, message));
51
+ handler.onDeliveryReceiptUpdated = eventChannel => {
52
+ if ((0, _uikitUtils.isDifferentChannel)(channel, eventChannel)) return;
53
+ forceUpdate();
63
54
  };
64
55
  }
65
56
 
66
- sdk.addChannelHandler(id, handler);
57
+ sdk.addChannelHandler(handlerId, handler);
67
58
  }
68
59
 
69
60
  return () => {
70
- sdk.removeChannelHandler(id);
61
+ sdk.removeChannelHandler(handlerId);
71
62
  };
72
63
  }, [message.sendingStatus]);
73
64
 
@@ -87,7 +78,7 @@ const MessageOutgoingStatus = _ref => {
87
78
  });
88
79
  }
89
80
 
90
- if (state.unreadCount === 0) {
81
+ if (channel.getUnreadMemberCount(message) === 0) {
91
82
  return /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
92
83
  icon: 'done-all',
93
84
  size: SIZE,
@@ -97,7 +88,7 @@ const MessageOutgoingStatus = _ref => {
97
88
  }
98
89
 
99
90
  if (features.deliveryReceiptEnabled) {
100
- if (state.undeliveredCount === 0) {
91
+ if (channel.getUndeliveredMemberCount(message) === 0) {
101
92
  return /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
102
93
  icon: 'done-all',
103
94
  size: SIZE,
@@ -1 +1 @@
1
- {"version":3,"names":["SIZE","MessageOutgoingStatus","channel","message","isUserMessage","isFileMessage","handlerId","useUniqId","sdk","features","useSendbirdChat","colors","useUIKitTheme","state","setState","useState","unreadCount","getUnreadMemberCount","undeliveredCount","getUndeliveredMemberCount","getCounts","useEffect","id","String","sendingStatus","removeChannelHandler","handler","ChannelHandler","onReadReceiptUpdated","url","channelUrl","deliveryReceiptEnabled","onDeliveryReceiptUpdated","isGroupChannel","addChannelHandler","styles","container","error","secondary","onBackground03","createStyleSheet","marginRight","React","memo"],"sources":["MessageOutgoingStatus.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport { Icon, LoadingSpinner, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdUserMessage,\n} from '@sendbird/uikit-utils';\nimport { useUniqId } from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\n\nconst SIZE = 16;\n\ntype Props = { channel: SendbirdGroupChannel; message: SendbirdMessage };\nconst MessageOutgoingStatus = ({ channel, message }: Props) => {\n if (!message.isUserMessage() && !message.isFileMessage()) return null;\n\n const handlerId = useUniqId('MessageOutgoingStatus');\n\n const { sdk, features } = useSendbirdChat();\n const { colors } = useUIKitTheme();\n\n const [state, setState] = useState(() => ({\n unreadCount: channel.getUnreadMemberCount(message),\n undeliveredCount: channel.getUndeliveredMemberCount(message),\n }));\n\n const getCounts = (channel: SendbirdGroupChannel, message: SendbirdUserMessage | SendbirdFileMessage) => {\n return {\n unreadCount: channel.getUnreadMemberCount(message),\n undeliveredCount: channel.getUndeliveredMemberCount(message),\n };\n };\n\n useEffect(() => {\n const id = String(handlerId);\n if (message.sendingStatus === 'succeeded' && state.unreadCount === 0 && state.undeliveredCount === 0) {\n sdk.removeChannelHandler(id);\n } else {\n const handler = new sdk.ChannelHandler();\n handler.onReadReceiptUpdated = (channel) => {\n if (channel.url === message.channelUrl) setState(getCounts(channel, message));\n };\n\n if (features.deliveryReceiptEnabled) {\n handler.onDeliveryReceiptUpdated = (channel) => {\n if (channel.url === message.channelUrl && channel.isGroupChannel()) setState(getCounts(channel, message));\n };\n }\n sdk.addChannelHandler(id, handler);\n }\n\n return () => {\n sdk.removeChannelHandler(id);\n };\n }, [message.sendingStatus]);\n\n if (message.sendingStatus === 'pending') {\n return <LoadingSpinner size={SIZE} style={styles.container} />;\n }\n\n if (message.sendingStatus === 'failed') {\n return <Icon icon={'error'} size={SIZE} color={colors.error} style={styles.container} />;\n }\n\n if (state.unreadCount === 0) {\n return <Icon icon={'done-all'} size={SIZE} color={colors.secondary} style={styles.container} />;\n }\n\n if (features.deliveryReceiptEnabled) {\n if (state.undeliveredCount === 0) {\n return <Icon icon={'done-all'} size={SIZE} color={colors.onBackground03} style={styles.container} />;\n }\n return <Icon icon={'done'} size={SIZE} color={colors.onBackground03} style={styles.container} />;\n }\n\n return <Icon icon={'done-all'} size={SIZE} color={colors.onBackground03} style={styles.container} />;\n};\n\nconst styles = createStyleSheet({\n container: {\n marginRight: 4,\n },\n});\n\nexport default React.memo(MessageOutgoingStatus);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAOA;;AAEA;;;;;;AAEA,MAAMA,IAAI,GAAG,EAAb;;AAGA,MAAMC,qBAAqB,GAAG,QAAiC;EAAA,IAAhC;IAAEC,OAAF;IAAWC;EAAX,CAAgC;EAC7D,IAAI,CAACA,OAAO,CAACC,aAAR,EAAD,IAA4B,CAACD,OAAO,CAACE,aAAR,EAAjC,EAA0D,OAAO,IAAP;EAE1D,MAAMC,SAAS,GAAG,IAAAC,qBAAA,EAAU,uBAAV,CAAlB;EAEA,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAoB,IAAAC,2BAAA,GAA1B;EACA,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EAEA,MAAM,CAACC,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EJ,MAAM,CAACC;IAA5E,EAAP;EACD;;EAED,oBAAO,6BAAC,gCAAD;IAAM,IAAI,EAAE,UAAZ;IAAwB,IAAI,EAAEpC,IAA9B;IAAoC,KAAK,EAAEW,MAAM,CAAC4B,cAAlD;IAAkE,KAAK,EAAEJ,MAAM,CAACC;EAAhF,EAAP;AACD,CA/DD;;AAiEA,MAAMD,MAAM,GAAG,IAAAK,4CAAA,EAAiB;EAC9BJ,SAAS,EAAE;IACTK,WAAW,EAAE;EADJ;AADmB,CAAjB,CAAf;;4BAMeC,cAAA,CAAMC,IAAN,CAAW1C,qBAAX,C"}
1
+ {"version":3,"names":["SIZE","MessageOutgoingStatus","channel","message","isUserMessage","isFileMessage","sdk","features","useSendbirdChat","colors","useUIKitTheme","uniqId","useUniqId","forceUpdate","useForceUpdate","useEffect","handlerId","sendingStatus","getUnreadMemberCount","getUndeliveredMemberCount","removeChannelHandler","handler","ChannelHandler","onReadReceiptUpdated","eventChannel","isDifferentChannel","deliveryReceiptEnabled","onDeliveryReceiptUpdated","addChannelHandler","styles","container","error","secondary","onBackground03","createStyleSheet","marginRight","React","memo"],"sources":["MessageOutgoingStatus.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Icon, LoadingSpinner, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdGroupChannel, SendbirdMessage } from '@sendbird/uikit-utils';\nimport { isDifferentChannel, useForceUpdate, useUniqId } from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\n\nconst SIZE = 16;\n\ntype Props = { channel: SendbirdGroupChannel; message: SendbirdMessage };\nconst MessageOutgoingStatus = ({ channel, message }: Props) => {\n if (!message.isUserMessage() && !message.isFileMessage()) return null;\n\n const { sdk, features } = useSendbirdChat();\n const { colors } = useUIKitTheme();\n\n const uniqId = useUniqId('MessageOutgoingStatus');\n const forceUpdate = useForceUpdate();\n\n useEffect(() => {\n const handlerId = `MessageOutgoingStatus_${uniqId}`;\n\n if (\n message.sendingStatus === 'succeeded' &&\n channel.getUnreadMemberCount(message) === 0 &&\n channel.getUndeliveredMemberCount(message) === 0\n ) {\n sdk.removeChannelHandler(handlerId);\n } else {\n const handler = new sdk.ChannelHandler();\n\n handler.onReadReceiptUpdated = (eventChannel) => {\n if (isDifferentChannel(channel, eventChannel)) return;\n forceUpdate();\n };\n\n if (features.deliveryReceiptEnabled) {\n handler.onDeliveryReceiptUpdated = (eventChannel) => {\n if (isDifferentChannel(channel, eventChannel)) return;\n forceUpdate();\n };\n }\n\n sdk.addChannelHandler(handlerId, handler);\n }\n\n return () => {\n sdk.removeChannelHandler(handlerId);\n };\n }, [message.sendingStatus]);\n\n if (message.sendingStatus === 'pending') {\n return <LoadingSpinner size={SIZE} style={styles.container} />;\n }\n\n if (message.sendingStatus === 'failed') {\n return <Icon icon={'error'} size={SIZE} color={colors.error} style={styles.container} />;\n }\n\n if (channel.getUnreadMemberCount(message) === 0) {\n return <Icon icon={'done-all'} size={SIZE} color={colors.secondary} style={styles.container} />;\n }\n\n if (features.deliveryReceiptEnabled) {\n if (channel.getUndeliveredMemberCount(message) === 0) {\n return <Icon icon={'done-all'} size={SIZE} color={colors.onBackground03} style={styles.container} />;\n }\n return <Icon icon={'done'} size={SIZE} color={colors.onBackground03} style={styles.container} />;\n }\n\n return <Icon icon={'done-all'} size={SIZE} color={colors.onBackground03} style={styles.container} />;\n};\n\nconst styles = createStyleSheet({\n container: {\n marginRight: 4,\n },\n});\n\nexport default React.memo(MessageOutgoingStatus);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA;;;;;;AAEA,MAAMA,IAAI,GAAG,EAAb;;AAGA,MAAMC,qBAAqB,GAAG,QAAiC;EAAA,IAAhC;IAAEC,OAAF;IAAWC;EAAX,CAAgC;EAC7D,IAAI,CAACA,OAAO,CAACC,aAAR,EAAD,IAA4B,CAACD,OAAO,CAACE,aAAR,EAAjC,EAA0D,OAAO,IAAP;EAE1D,MAAM;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WAAW,EAAE;EADJ;AADmB,CAAjB,CAAf;;4BAMeC,cAAA,CAAMC,IAAN,CAAWpC,qBAAX,C"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _constants = require("../constants");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
+
18
+ function getComponent(as) {
19
+ switch (as) {
20
+ case 'Pressable':
21
+ return _reactNative.Pressable;
22
+
23
+ case 'TouchableOpacity':
24
+ return _reactNative.TouchableOpacity;
25
+
26
+ default:
27
+ return _reactNative.Pressable;
28
+ }
29
+ }
30
+
31
+ const SBUPressable = _ref => {
32
+ let {
33
+ as,
34
+ ...props
35
+ } = _ref;
36
+ const Renderer = getComponent(as); // @ts-ignore
37
+
38
+ return /*#__PURE__*/_react.default.createElement(Renderer, _extends({
39
+ delayLongPress: _constants.DEFAULT_LONG_PRESS_DELAY
40
+ }, props));
41
+ };
42
+
43
+ var _default = SBUPressable;
44
+ exports.default = _default;
45
+ //# sourceMappingURL=SBUPressable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getComponent","as","Pressable","TouchableOpacity","SBUPressable","props","Renderer","DEFAULT_LONG_PRESS_DELAY"],"sources":["SBUPressable.tsx"],"sourcesContent":["import React from 'react';\nimport { Pressable, PressableProps, TouchableOpacity, TouchableOpacityProps } from 'react-native';\n\nimport { DEFAULT_LONG_PRESS_DELAY } from '../constants';\n\ntype Components = 'Pressable' | 'TouchableOpacity';\ntype Props<T extends Components = 'Pressable'> = {\n as?: T;\n} & ExtractProps<T, AsProps>;\n\ntype AsProps =\n | {\n type: 'Pressable';\n props: PressableProps;\n }\n | {\n type: 'TouchableOpacity';\n props: TouchableOpacityProps;\n };\n\ntype ExtractProps<T extends Components, U extends AsProps> = U extends { type: T; props: infer P } ? P : never;\n\nfunction getComponent(as?: Components) {\n switch (as) {\n case 'Pressable':\n return Pressable;\n case 'TouchableOpacity':\n return TouchableOpacity;\n default:\n return Pressable;\n }\n}\n\nconst SBUPressable = <T extends Components>({ as, ...props }: Props<T>) => {\n const Renderer = getComponent(as);\n // @ts-ignore\n return <Renderer delayLongPress={DEFAULT_LONG_PRESS_DELAY} {...props} />;\n};\n\nexport default SBUPressable;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAmBA,SAASA,YAAT,CAAsBC,EAAtB,EAAuC;EACrC,QAAQA,EAAR;IACE,KAAK,WAAL;MACE,OAAOC,sBAAP;;IACF,KAAK,kBAAL;MACE,OAAOC,6BAAP;;IACF;MACE,OAAOD,sBAAP;EANJ;AAQD;;AAED,MAAME,YAAY,GAAG,QAAsD;EAAA,IAA/B;IAAEH,EAAF;IAAM,GAAGI;EAAT,CAA+B;EACzE,MAAMC,QAAQ,GAAGN,YAAY,CAACC,EAAD,CAA7B,CADyE,CAEzE;;EACA,oBAAO,6BAAC,QAAD;IAAU,cAAc,EAAEM;EAA1B,GAAwDF,KAAxD,EAAP;AACD,CAJD;;eAMeD,Y"}
@@ -89,8 +89,6 @@ const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
89
89
  marginRight: 8
90
90
  }
91
91
  });
92
-
93
- var _default = /*#__PURE__*/_react.default.memo(UserActionBar);
94
-
92
+ var _default = UserActionBar;
95
93
  exports.default = _default;
96
94
  //# sourceMappingURL=UserActionBar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UserActionBar","muted","uri","name","disabled","onPressActionMenu","label","colors","useUIKitTheme","iconColor","conditionChaining","onBackground04","onBackground01","styles","container","avatar","infoContainer","borderBottomColor","Boolean","onBackground02","iconContainer","createStyleSheet","flexDirection","alignItems","width","height","marginLeft","marginRight","flex","paddingRight","borderBottomWidth","padding","React","memo"],"sources":["UserActionBar.tsx"],"sourcesContent":["import React from 'react';\nimport { TouchableOpacity, View } from 'react-native';\n\nimport { Avatar, Icon, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\ntype Props = {\n uri: string;\n name: string;\n label?: string;\n muted: boolean;\n disabled: boolean;\n onPressActionMenu?: () => void;\n};\nconst UserActionBar = ({ muted, uri, name, disabled, onPressActionMenu, label }: Props) => {\n const { colors } = useUIKitTheme();\n\n const iconColor = conditionChaining([disabled], [colors.onBackground04, colors.onBackground01]);\n\n return (\n <View style={styles.container}>\n <Avatar muted={muted} size={36} uri={uri} containerStyle={styles.avatar} />\n <View style={[styles.infoContainer, { borderBottomColor: colors.onBackground04 }]}>\n <Text subtitle2 numberOfLines={1} style={styles.name} color={colors.onBackground01}>\n {name}\n </Text>\n {Boolean(label) && (\n <Text body2 color={colors.onBackground02} style={styles.label}>\n {label}\n </Text>\n )}\n {Boolean(onPressActionMenu) && (\n <TouchableOpacity onPress={onPressActionMenu} disabled={disabled}>\n <Icon color={iconColor} size={24} icon={'more'} containerStyle={styles.iconContainer} />\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n width: '100%',\n height: 56,\n },\n avatar: {\n marginLeft: 16,\n marginRight: 16,\n },\n label: {\n marginRight: 4,\n },\n infoContainer: {\n height: '100%',\n flex: 1,\n alignItems: 'center',\n flexDirection: 'row',\n paddingRight: 12,\n borderBottomWidth: 1,\n },\n iconContainer: {\n padding: 4,\n },\n name: {\n flex: 1,\n marginRight: 8,\n },\n});\n\nexport default React.memo(UserActionBar);\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;AAUA,MAA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AVJ,CAFF,CADF;AAoBD,CAzBD;;AA2BA,MAAMP,MAAM,GAAG,IAAAQ,4CAAA,EAAiB;EAC9BP,SAAS,EAAE;IACTQ,aAAa,EAAE,KADN;IAETC,UAAU,EAAE,QAFH;IAGTC,KAAK,EAAE,MAHE;IAITC,MAAM,EAAE;EAJC,CADmB;EAO9BV,MAAM,EAAE;IACNW,UAAU,EAAE,EADN;IAENC,WAAW,EAAE;EAFP,CAPsB;EAW9BrB,KAAK,EAAE;IACLqB,WAAW,EAAE;EADR,CAXuB;EAc9BX,aAAa,EAAE;IACbS,MAAM,EAAE,MADK;IAEbG,IAAI,EAAE,CAFO;IAGbL,UAAU,EAAE,QAHC;IAIbD,aAAa,EAAE,KAJF;IAKbO,YAAY,EAAE,EALD;IAMbC,iBAAiB,EAAE;EANN,CAde;EAsB9BV,aAAa,EAAE;IACbW,OAAO,EAAE;EADI,CAtBe;EAyB9B5B,IAAI,EAAE;IACJyB,IAAI,EAAE,CADF;IAEJD,WAAW,EAAE;EAFT;AAzBwB,CAAjB,CAAf;;4BA+BeK,cAAA,CAAMC,IAAN,CAAWjC,aAAX,C"}
1
+ {"version":3,"names":["UserActionBar","muted","uri","name","disabled","onPressActionMenu","label","colors","useUIKitTheme","iconColor","conditionChaining","onBackground04","onBackground01","styles","container","avatar","infoContainer","borderBottomColor","Boolean","onBackground02","iconContainer","createStyleSheet","flexDirection","alignItems","width","height","marginLeft","marginRight","flex","paddingRight","borderBottomWidth","padding"],"sources":["UserActionBar.tsx"],"sourcesContent":["import React from 'react';\nimport { TouchableOpacity, View } from 'react-native';\n\nimport { Avatar, Icon, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\ntype Props = {\n uri: string;\n name: string;\n label?: string;\n muted: boolean;\n disabled: boolean;\n onPressActionMenu?: () => void;\n};\nconst UserActionBar = ({ muted, uri, name, disabled, onPressActionMenu, label }: Props) => {\n const { colors } = useUIKitTheme();\n\n const iconColor = conditionChaining([disabled], [colors.onBackground04, colors.onBackground01]);\n\n return (\n <View style={styles.container}>\n <Avatar muted={muted} size={36} uri={uri} containerStyle={styles.avatar} />\n <View style={[styles.infoContainer, { borderBottomColor: colors.onBackground04 }]}>\n <Text subtitle2 numberOfLines={1} style={styles.name} color={colors.onBackground01}>\n {name}\n </Text>\n {Boolean(label) && (\n <Text body2 color={colors.onBackground02} style={styles.label}>\n {label}\n </Text>\n )}\n {Boolean(onPressActionMenu) && (\n <TouchableOpacity onPress={onPressActionMenu} disabled={disabled}>\n <Icon color={iconColor} size={24} icon={'more'} containerStyle={styles.iconContainer} />\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n width: '100%',\n height: 56,\n },\n avatar: {\n marginLeft: 16,\n marginRight: 16,\n },\n label: {\n marginRight: 4,\n },\n infoContainer: {\n height: '100%',\n flex: 1,\n alignItems: 'center',\n flexDirection: 'row',\n paddingRight: 12,\n borderBottomWidth: 1,\n },\n iconContainer: {\n padding: 4,\n },\n name: {\n flex: 1,\n marginRight: 8,\n },\n});\n\nexport default UserActionBar;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;AAUA,MAAMA,aAAa,GAAG,QAAqE;EAAA,IAApE;IAAEC,KAAF;IAASC,GAAT;IAAcC,IAAd;IAAoBC,QAApB;IAA8BC,iBAA9B;IAAiDC;EAAjD,CAAoE;EACzF,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EAEA,MAAMC,SAAS,GAAG,IAAAC,6BAAA,EAAkB,CAACN,QAAD,CAAlB,EAA8B,CAACG,MAAM,CAACI,cAAR,EAAwBJ,MAAM,CAACK,cAA/B,CAA9B,CAAlB;EAEA,oBACE,6BAAC,iBAAD;IAAM,KAAK,EAAEC,MAAM,CAACC;EAApB,gBACE,6BAAC,kCAAD;IAAQ,KAAK,EAAEb,KAAf;I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,aAAa,EAAE,KAJF;IAKbO,YAAY,EAAE,EALD;IAMbC,iBAAiB,EAAE;EANN,CAde;EAsB9BV,aAAa,EAAE;IACbW,OAAO,EAAE;EADI,CAtBe;EAyB9B5B,IAAI,EAAE;IACJyB,IAAI,EAAE,CADF;IAEJD,WAAW,EAAE;EAFT;AAzBwB,CAAjB,CAAf;eA+Be3B,a"}
@@ -71,8 +71,6 @@ const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
71
71
  marginRight: 8
72
72
  }
73
73
  });
74
-
75
- var _default = /*#__PURE__*/_react.default.memo(UserSelectableBar);
76
-
74
+ var _default = UserSelectableBar;
77
75
  exports.default = _default;
78
76
  //# sourceMappingURL=UserSelectableBar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UserSelectableBar","uri","name","selected","disabled","colors","useUIKitTheme","iconColor","conditionChaining","onBackground04","primary","onBackground03","styles","container","avatar","infoContainer","borderBottomColor","onBackground01","createStyleSheet","flexDirection","alignItems","width","height","paddingHorizontal","marginRight","flex","borderBottomWidth","React","memo"],"sources":["UserSelectableBar.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\n\nimport { Avatar, Icon, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\ntype Props = {\n uri: string;\n name: string;\n selected: boolean;\n disabled: boolean;\n};\nconst UserSelectableBar = ({ uri, name, selected, disabled }: Props) => {\n const { colors } = useUIKitTheme();\n\n const iconColor = conditionChaining(\n [disabled, selected],\n [colors.onBackground04, colors.primary, colors.onBackground03],\n );\n\n return (\n <View style={styles.container}>\n <Avatar size={36} uri={uri} containerStyle={styles.avatar} />\n <View style={[styles.infoContainer, { borderBottomColor: colors.onBackground04 }]}>\n <Text subtitle2 numberOfLines={1} style={styles.name} color={colors.onBackground01}>\n {name}\n </Text>\n <Icon color={iconColor} size={24} icon={selected ? 'checkbox-on' : 'checkbox-off'} />\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n width: '100%',\n height: 56,\n paddingHorizontal: 16,\n },\n avatar: {\n marginRight: 16,\n },\n infoContainer: {\n height: '100%',\n flex: 1,\n alignItems: 'center',\n flexDirection: 'row',\n borderBottomWidth: 1,\n },\n name: {\n flex: 1,\n marginRight: 8,\n },\n});\n\nexport default React.memo(UserSelectableBar);\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;AAQA,MAAMA,iBAAiB,GAAG,QAA8C;EAAA,IAA7C;IAAEC,GAAF;IAAOC,IAAP;IAAaC,QAAb;IAAuBC;EAAvB,CAA6C;EACtE,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EAEA,MAAMC,SAAS,GAAG,IAAAC,6BAAA,EAChB,CAACJ,QAAD,EAAWD,QAAX,CADgB,EAEhB,CAACE,MAAM,CAACI,cAAR,EAAwBJ,MAAM,CAACK,OAA/B,EAAwCL,MAAM,CAACM,cAA/C,CAFgB,CAAlB;EAKA,oBACE,6BAAC,iBAAD;IAAM,KAAK,EAAEC,MAAM,CAACC;EAApB,gBACE,6BAAC,kCAAD;IAAQ,IAAI,EAAE,EAAd;IAAkB,GAAG,EAAEZ,GAAvB;IAA4B,cAAc,EAAEW,MAAM,CAACE;EAAnD,EADF,eAEE,6BAAC,iBAAD;IAAM,KAAK,EAAE,CAACF,MAAM,CAACG,aAAR,EAAuB;MAAEC,iBAAiB,EAAEX,MAAM,CAACI;IAA5B,CAAvB;EAAb,gBACE,6BAAC,gCAAD;IAAM,SAAS,MAAf;IAAgB,aAAa,EAAE,CAA/B;IAAkC,KAAK,EAAEG,MAAM,CAACV,IAAhD;IAAsD,KAAK,EAAEG,MAAM,CAACY;EAApE,GACGf,IADH,CADF,eAIE,6BAAC,gCAAD;IAAM,KAAK,EAAEK,SAAb;IAAwB,IAAI,EAAE,EAA9B;IAAkC,IAAI,EAAEJ,QAAQ,GAAG,aAAH,GAAmB;EAAnE,EAJF,CAFF,CADF;AAWD,CAnBD;;AAqBA,MAAMS,MAAM,GAAG,IAAAM,4CAAA,EAAiB;EAC9BL,SAAS,EAAE;IACTM,aAAa,EAAE,KADN;IAETC,UAAU,EAAE,QAFH;IAGTC,KAAK,EAAE,MAHE;IAITC,MAAM,EAAE,EAJC;IAKTC,iBAAiB,EAAE;EALV,CADmB;EAQ9BT,MAAM,EAAE;IACNU,WAAW,EAAE;EADP,CARsB;EAW9BT,aAAa,EAAE;IACbO,MAAM,EAAE,MADK;IAEbG,IAAI,EAAE,CAFO;IAGbL,UAAU,EAAE,QAHC;IAIbD,aAAa,EAAE,KAJF;IAKbO,iBAAiB,EAAE;EALN,CAXe;EAkB9BxB,IAAI,EAAE;IACJuB,IAAI,EAAE,CADF;IAEJD,WAAW,EAAE;EAFT;AAlBwB,CAAjB,CAAf;;4BAwBeG,cAAA,CAAMC,IAAN,CAAW5B,iBAAX,C"}
1
+ {"version":3,"names":["UserSelectableBar","uri","name","selected","disabled","colors","useUIKitTheme","iconColor","conditionChaining","onBackground04","primary","onBackground03","styles","container","avatar","infoContainer","borderBottomColor","onBackground01","createStyleSheet","flexDirection","alignItems","width","height","paddingHorizontal","marginRight","flex","borderBottomWidth"],"sources":["UserSelectableBar.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\n\nimport { Avatar, Icon, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\ntype Props = {\n uri: string;\n name: string;\n selected: boolean;\n disabled: boolean;\n};\nconst UserSelectableBar = ({ uri, name, selected, disabled }: Props) => {\n const { colors } = useUIKitTheme();\n\n const iconColor = conditionChaining(\n [disabled, selected],\n [colors.onBackground04, colors.primary, colors.onBackground03],\n );\n\n return (\n <View style={styles.container}>\n <Avatar size={36} uri={uri} containerStyle={styles.avatar} />\n <View style={[styles.infoContainer, { borderBottomColor: colors.onBackground04 }]}>\n <Text subtitle2 numberOfLines={1} style={styles.name} color={colors.onBackground01}>\n {name}\n </Text>\n <Icon color={iconColor} size={24} icon={selected ? 'checkbox-on' : 'checkbox-off'} />\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n width: '100%',\n height: 56,\n paddingHorizontal: 16,\n },\n avatar: {\n marginRight: 16,\n },\n infoContainer: {\n height: '100%',\n flex: 1,\n alignItems: 'center',\n flexDirection: 'row',\n borderBottomWidth: 1,\n },\n name: {\n flex: 1,\n marginRight: 8,\n },\n});\n\nexport default UserSelectableBar;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;AAQA,MAAMA,iBAAiB,GAAG,QAA8C;EAAA,IAA7C;IAAEC,GAAF;IAAOC,IAAP;IAAaC,QAAb;IAAuBC;EAAvB,CAA6C;EACtE,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EAEA,MAAMC,SAAS,GAAG,IAAAC,6BAAA,EAChB,CAACJ,QAAD,EAAWD,QAAX,CADgB,EAEhB,CAACE,MAAM,CAACI,cAAR,EAAwBJ,MAAM,CAACK,OAA/B,EAAwCL,MAAM,CAACM,cAA/C,CAFgB,CAAlB;EAKA,oBACE,6BAAC,iBAAD;IAAM,KAAK,EAAEC,MAAM,CAACC;EAApB,gBACE,6BAAC,kCAAD;IAAQ,IAAI,EAAE,EAAd;IAAkB,GAAG,EAAEZ,GAAvB;IAA4B,cAAc,EAAEW,MAAM,CAACE;EAAnD,EADF,eAEE,6BAAC,iBAAD;IAAM,KAAK,EAAE,CAACF,MAAM,CAACG,aAAR,EAAuB;MAAEC,iBAAiB,EAAEX,MAAM,CAACI;IAA5B,CAAvB;EAAb,gBACE,6BAAC,gCAAD;IAAM,SAAS,MAAf;IAAgB,aAAa,EAAE,CAA/B;IAAkC,KAAK,EAAEG,MAAM,CAACV,IAAhD;IAAsD,KAAK,EAAEG,MAAM,CAACY;EAApE,GACGf,IADH,CADF,eAIE,6BAAC,gCAAD;IAAM,KAAK,EAAEK,SAAb;IAAwB,IAAI,EAAE,EAA9B;IAAkC,IAAI,EAAEJ,QAAQ,GAAG,aAAH,GAAmB;EAAnE,EAJF,CAFF,CADF;AAWD,CAnBD;;AAqBA,MAAMS,MAAM,GAAG,IAAAM,4CAAA,EAAiB;EAC9BL,SAAS,EAAE;IACTM,aAAa,EAAE,KADN;IAETC,UAAU,EAAE,QAFH;IAGTC,KAAK,EAAE,MAHE;IAITC,MAAM,EAAE,EAJC;IAKTC,iBAAiB,EAAE;EALV,CADmB;EAQ9BT,MAAM,EAAE;IACNU,WAAW,EAAE;EADP,CARsB;EAW9BT,aAAa,EAAE;IACbO,MAAM,EAAE,MADK;IAEbG,IAAI,EAAE,CAFO;IAGbL,UAAU,EAAE,QAHC;IAIbD,aAAa,EAAE,KAJF;IAKbO,iBAAiB,EAAE;EALN,CAXe;EAkB9BxB,IAAI,EAAE;IACJuB,IAAI,EAAE,CADF;IAEJD,WAAW,EAAE;EAFT;AAlBwB,CAAjB,CAAf;eAwBexB,iB"}
@@ -3,7 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DEFAULT_LONG_PRESS_DELAY = void 0;
6
+ exports.DEPRECATION_WARNING = exports.DEFAULT_LONG_PRESS_DELAY = void 0;
7
7
  const DEFAULT_LONG_PRESS_DELAY = 350;
8
8
  exports.DEFAULT_LONG_PRESS_DELAY = DEFAULT_LONG_PRESS_DELAY;
9
+ const DEPRECATION_WARNING = {
10
+ GROUP_CHANNEL: {
11
+ ON_PRESS_IMAGE_MESSAGE: '`onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead'
12
+ }
13
+ };
14
+ exports.DEPRECATION_WARNING = DEPRECATION_WARNING;
9
15
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_LONG_PRESS_DELAY"],"sources":["constants.ts"],"sourcesContent":["export const DEFAULT_LONG_PRESS_DELAY = 350;\n"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAG,GAAjC"}
1
+ {"version":3,"names":["DEFAULT_LONG_PRESS_DELAY","DEPRECATION_WARNING","GROUP_CHANNEL","ON_PRESS_IMAGE_MESSAGE"],"sources":["constants.ts"],"sourcesContent":["export const DEFAULT_LONG_PRESS_DELAY = 350;\nexport const DEPRECATION_WARNING = {\n GROUP_CHANNEL: {\n ON_PRESS_IMAGE_MESSAGE: '`onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead',\n },\n} as const;\n"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAG,GAAjC;;AACA,MAAMC,mBAAmB,GAAG;EACjCC,aAAa,EAAE;IACbC,sBAAsB,EAAE;EADX;AADkB,CAA5B"}
@@ -18,13 +18,15 @@ const PlatformServiceProvider = _ref => {
18
18
  children,
19
19
  fileService,
20
20
  clipboardService,
21
- notificationService
21
+ notificationService,
22
+ mediaService
22
23
  } = _ref;
23
24
  return /*#__PURE__*/_react.default.createElement(PlatformServiceContext.Provider, {
24
25
  value: {
25
26
  fileService,
26
27
  clipboardService,
27
- notificationService
28
+ notificationService,
29
+ mediaService
28
30
  }
29
31
  }, children);
30
32
  };
@@ -1 +1 @@
1
- {"version":3,"names":["PlatformServiceContext","React","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService"],"sources":["PlatformService.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { ClipboardServiceInterface, FileServiceInterface, NotificationServiceInterface } from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n}>;\n\nexport const PlatformServiceContext = React.createContext<Props | null>(null);\nexport const PlatformServiceProvider = ({ children, fileService, clipboardService, notificationService }: Props) => {\n return (\n <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService }}>\n {children}\n </PlatformServiceContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;;;AAUO,MAAMA,sBAAsB,gBAAGC,cAAA,CAAMC,aAAN,CAAkC,IAAlC,CAA/B;;;;AACA,MAAMC,uBAAuB,GAAG,QAA6E;EAAA,IAA5E;IAAEC,QAAF;IAAYC,WAAZ;IAAyBC,gBAAzB;IAA2CC;EAA3C,CAA4E;EAClH,oBACE,6BAAC,sBAAD,CAAwB,QAAxB;IAAiC,KAAK,EAAE;MAAEF,WAAF;MAAeC,gBAAf;MAAiCC;IAAjC;EAAxC,GACGH,QADH,CADF;AAKD,CANM"}
1
+ {"version":3,"names":["PlatformServiceContext","React","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService","mediaService"],"sources":["PlatformService.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService?: MediaServiceInterface;\n}>;\n\nexport const PlatformServiceContext = React.createContext<Props | null>(null);\nexport const PlatformServiceProvider = ({\n children,\n fileService,\n clipboardService,\n notificationService,\n mediaService,\n}: Props) => {\n return (\n <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService, mediaService }}>\n {children}\n </PlatformServiceContext.Provider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;;;AAgBO,MAAMA,sBAAsB,gBAAGC,cAAA,CAAMC,aAAN,CAAkC,IAAlC,CAA/B;;;;AACA,MAAMC,uBAAuB,GAAG,QAM1B;EAAA,IAN2B;IACtCC,QADsC;IAEtCC,WAFsC;IAGtCC,gBAHsC;IAItCC,mBAJsC;IAKtCC;EALsC,CAM3B;EACX,oBACE,6BAAC,sBAAD,CAAwB,QAAxB;IAAiC,KAAK,EAAE;MAAEH,WAAF;MAAeC,gBAAf;MAAiCC,mBAAjC;MAAsDC;IAAtD;EAAxC,GACGJ,QADH,CADF;AAKD,CAZM"}
@@ -25,7 +25,9 @@ const SendbirdChatProvider = _ref => {
25
25
  let {
26
26
  children,
27
27
  sdkInstance,
28
- enableAutoPushTokenRegistration
28
+ enableAutoPushTokenRegistration,
29
+ enableChannelListMessageReceiptStatus,
30
+ enableChannelListTypingIndicator
29
31
  } = _ref;
30
32
  const [currentUser, _setCurrentUser] = (0, _react.useState)();
31
33
  const forceUpdate = (0, _uikitUtils.useForceUpdate)();
@@ -75,7 +77,9 @@ const SendbirdChatProvider = _ref => {
75
77
  updateCurrentUserInfo,
76
78
  markAsDeliveredWithChannel,
77
79
  features: { ...appFeatures,
78
- autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration
80
+ autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,
81
+ channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,
82
+ channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus
79
83
  }
80
84
  };
81
85
  return /*#__PURE__*/_react.default.createElement(SendbirdChatContext.Provider, {
@@ -1 +1 @@
1
- {"version":3,"names":["SendbirdChatContext","React","createContext","SendbirdChatProvider","children","sdkInstance","enableAutoPushTokenRegistration","currentUser","_setCurrentUser","useState","forceUpdate","useForceUpdate","appFeatures","useAppFeatures","setCurrentUser","useCallback","user","updateCurrentUserInfo","nickname","profile","Error","profileUrl","updateCurrentUserInfoWithProfileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","unreadMessageCount","markAsDelivered","url","useEffect","listener","status","getConnectionState","setForegroundState","setBackgroundState","subscriber","AppState","addEventListener","remove","value","sdk","features","autoPushTokenRegistrationEnabled"],"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 { SendbirdChatSDK, SendbirdGroupChannel, SendbirdUser } from '@sendbird/uikit-utils';\nimport { 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 // channelListMessageReceiptStateEnabled: 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 = ({ children, sdkInstance, enableAutoPushTokenRegistration }: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n\n const setCurrentUser: Context['setCurrentUser'] = useCallback((user) => {\n // NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser\n _setCurrentUser(user);\n forceUpdate();\n }, []);\n\n const updateCurrentUserInfo: Context['updateCurrentUserInfo'] = useCallback(\n async (nickname, profile) => {\n let user = currentUser;\n\n if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');\n\n if (typeof profile === 'undefined') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, sdkInstance.currentUser.profileUrl);\n } else if (typeof profile === 'string') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, profile);\n } else if (typeof profile === 'object') {\n user = await sdkInstance.updateCurrentUserInfoWithProfileImage(nickname, profile);\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\n\n setCurrentUser(user);\n return user;\n },\n [sdkInstance, currentUser, setCurrentUser],\n );\n\n const markAsDeliveredWithChannel: Context['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled && channel.unreadMessageCount > 0) {\n sdkInstance.markAsDelivered(channel.url);\n }\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useEffect(() => {\n const listener = (status: AppStateStatus) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();\n else sdkInstance.getConnectionState() === '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 },\n };\n\n return <SendbirdChatContext.Provider value={value}>{children}</SendbirdChatContext.Provider>;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;AAmCO,MAAMA,mBAAmB,gBAAGC,cAAA,CAAMC,aAAN,CAAoC,IAApC,CAA5B;;;;AACA,MAAMC,oBAAoB,GAAG,QAAuE;EAAA,IAAtE;IAAEC,QAAF;IAAYC,WAAZ;IAAyBC;EAAzB,CAAsE;EACzG,MAAM,CAACC,WAAD,EAAcC,eAAd,IAAiC,IAAAC,eAAA,GAAvC;EACA,MAAMC,WAAW,GAAG,IAAAC,0BAAA,GAApB;EACA,MAAMC,WAAW,GAAG,IAAAC,8BAAA,EAAeR,WAAf,CAApB;EAEA,MAAMS,cAAyC,GAAG,IAAAC,kBAAA,EAAaC,IAAD,IAAU;IACtE;IACAR,eAAe,CAACQ,IAAD,CAAf;;IACAN,WAAW;EACZ,CAJiD,EAI/C,EAJ+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AM,KAAK,QAAf,EAAyB1B,WAAW,CAAC2B,kBAAZ,OAAqC,QAArC,IAAiD3B,WAAW,CAAC4B,kBAAZ,EAAjD,CAAzB,KACK5B,WAAW,CAAC2B,kBAAZ,OAAqC,MAArC,IAA+C3B,WAAW,CAAC6B,kBAAZ,EAA/C;IACN,CAJD;;IAMA,MAAMC,UAAU,GAAGC,qBAAA,CAASC,gBAAT,CAA0B,QAA1B,EAAoCP,QAApC,CAAnB;;IACA,OAAO,MAAMK,UAAU,CAACG,MAAX,EAAb;EACD,CATD,EASG,CAACjC,WAAD,CATH;EAWA,MAAMkC,KAAc,GAAG;IACrBC,GAAG,EAAEnC,WADgB;IAErBE,WAFqB;IAGrBO,cAHqB;IAKrBG,qBALqB;IAMrBM,0BANqB;IAQrBkB,QAAQ,EAAE,EACR,GAAG7B,WADK;MAER8B,gCAAgC,EAAEpC;IAF1B;EARW,CAAvB;EAcA,oBAAO,6BAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAEiC;EAArC,GAA6CnC,QAA7C,CAAP;AACD,CApEM"}
1
+ {"version":3,"names":["SendbirdChatContext","React","createContext","SendbirdChatProvider","children","sdkInstance","enableAutoPushTokenRegistration","enableChannelListMessageReceiptStatus","enableChannelListTypingIndicator","currentUser","_setCurrentUser","useState","forceUpdate","useForceUpdate","appFeatures","useAppFeatures","setCurrentUser","useCallback","user","updateCurrentUserInfo","nickname","profile","Error","profileUrl","updateCurrentUserInfoWithProfileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","unreadMessageCount","markAsDelivered","url","useEffect","listener","status","getConnectionState","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 { SendbirdChatSDK, SendbirdGroupChannel, SendbirdUser } from '@sendbird/uikit-utils';\nimport { useForceUpdate } from '@sendbird/uikit-utils';\n\nimport type { FileType } from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n sdkInstance: SendbirdChatSDK;\n\n enableAutoPushTokenRegistration: boolean;\n enableChannelListTypingIndicator: boolean;\n enableChannelListMessageReceiptStatus: boolean;\n}>;\n\ntype Context = {\n sdk: SendbirdChatSDK;\n currentUser?: SendbirdUser;\n setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;\n\n // helper functions\n updateCurrentUserInfo: (nickname: string, profile?: string | FileType) => Promise<SendbirdUser>;\n markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;\n\n features: {\n // UIKit features\n autoPushTokenRegistrationEnabled: boolean;\n channelListTypingIndicatorEnabled: boolean;\n channelListMessageReceiptStatusEnabled: boolean;\n\n // Sendbird application features\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\n};\n\nexport const SendbirdChatContext = React.createContext<Context | null>(null);\nexport const SendbirdChatProvider = ({\n children,\n sdkInstance,\n enableAutoPushTokenRegistration,\n enableChannelListMessageReceiptStatus,\n enableChannelListTypingIndicator,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n\n const setCurrentUser: Context['setCurrentUser'] = useCallback((user) => {\n // NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser\n _setCurrentUser(user);\n forceUpdate();\n }, []);\n\n const updateCurrentUserInfo: Context['updateCurrentUserInfo'] = useCallback(\n async (nickname, profile) => {\n let user = currentUser;\n\n if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');\n\n if (typeof profile === 'undefined') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, sdkInstance.currentUser.profileUrl);\n } else if (typeof profile === 'string') {\n user = await sdkInstance.updateCurrentUserInfo(nickname, profile);\n } else if (typeof profile === 'object') {\n user = await sdkInstance.updateCurrentUserInfoWithProfileImage(nickname, profile);\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\n\n setCurrentUser(user);\n return user;\n },\n [sdkInstance, currentUser, setCurrentUser],\n );\n\n const markAsDeliveredWithChannel: Context['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled && channel.unreadMessageCount > 0) {\n sdkInstance.markAsDelivered(channel.url);\n }\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useEffect(() => {\n const listener = (status: AppStateStatus) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.getConnectionState() === 'CLOSED' && sdkInstance.setForegroundState();\n else sdkInstance.getConnectionState() === '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;;AAEA;;;;;;AAmCO,MAAMA,mBAAmB,gBAAGC,cAAA,CAAMC,aAAN,CAAoC,IAApC,CAA5B;;;;AACA,MAAMC,oBAAoB,GAAG,QAMvB;EAAA,IANwB;IACnCC,QADmC;IAEnCC,WAFmC;IAGnCC,+BAHmC;IAInCC,qCAJmC;IAKnCC;EALmC,CAMxB;EACX,MAAM,CAACC,W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ACa,sBAAZ,IAAsCD,OAAO,CAACE,kBAAR,GAA6B,CAAvE,EAA0E;MACxEvB,WAAW,CAACwB,eAAZ,CAA4BH,OAAO,CAACI,GAApC;IACD;EACF,CALuE,EAMxE,CAACzB,WAAD,EAAcS,WAAW,CAACa,sBAA1B,CANwE,CAA1E;EASA,IAAAI,gBAAA,EAAU,MAAM;IACd,MAAMC,QAAQ,GAAIC,MAAD,IAA4B;MAC3C;MACA,IAAIA,MAAM,KAAK,QAAf,EAAyB5B,WAAW,CAAC6B,kBAAZ,OAAqC,QAArC,IAAiD7B,WAAW,CAAC8B,kBAAZ,EAAjD,CAAzB,KACK9B,WAAW,CAAC6B,kBAAZ,OAAqC,MAArC,IAA+C7B,WAAW,CAAC+B,kBAAZ,EAA/C;IACN,CAJD;;IAMA,MAAMC,UAAU,GAAGC,qBAAA,CAASC,gBAAT,CAA0B,QAA1B,EAAoCP,QAApC,CAAnB;;IACA,OAAO,MAAMK,UAAU,CAACG,MAAX,EAAb;EACD,CATD,EASG,CAACnC,WAAD,CATH;EAWA,MAAMoC,KAAc,GAAG;IACrBC,GAAG,EAAErC,WADgB;IAErBI,WAFqB;IAGrBO,cAHqB;IAKrBG,qBALqB;IAMrBM,0BANqB;IAQrBkB,QAAQ,EAAE,EACR,GAAG7B,WADK;MAER8B,gCAAgC,EAAEtC,+BAF1B;MAGRuC,iCAAiC,EAAErC,gCAH3B;MAIRsC,sCAAsC,EAAEvC;IAJhC;EARW,CAAvB;EAgBA,oBAAO,6BAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAEkC;EAArC,GAA6CrC,QAA7C,CAAP;AACD,CA5EM"}
@@ -51,7 +51,7 @@ const SendInput = _ref => {
51
51
  icon: 'camera',
52
52
  onPress: async () => {
53
53
  const photo = await fileService.openCamera({
54
- mediaType: 'photo',
54
+ mediaType: 'all',
55
55
  onOpenFailureWithToastMessage: () => toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error')
56
56
  });
57
57