stream-chat-react-native-core 5.22.0-beta.9 → 5.22.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/lib/commonjs/components/Attachment/AudioAttachment.js +12 -12
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
  3. package/lib/commonjs/components/Channel/Channel.js +65 -46
  4. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  5. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +2 -0
  6. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
  8. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  9. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +19 -19
  10. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  11. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +13 -13
  12. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  13. package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
  14. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  15. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +61 -40
  16. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  17. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
  18. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  19. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  20. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  21. package/lib/commonjs/i18n/en.json +1 -1
  22. package/lib/commonjs/i18n/fr.json +48 -48
  23. package/lib/commonjs/i18n/hi.json +48 -48
  24. package/lib/commonjs/i18n/it.json +48 -48
  25. package/lib/commonjs/i18n/nl.json +48 -48
  26. package/lib/commonjs/i18n/ru.json +48 -48
  27. package/lib/commonjs/i18n/tr.json +48 -48
  28. package/lib/commonjs/types/types.js.map +1 -1
  29. package/lib/commonjs/utils/compressImage.js +37 -0
  30. package/lib/commonjs/utils/compressImage.js.map +1 -0
  31. package/lib/commonjs/version.json +1 -1
  32. package/lib/module/components/Attachment/AudioAttachment.js +12 -12
  33. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  34. package/lib/module/components/Channel/Channel.js +65 -46
  35. package/lib/module/components/Channel/Channel.js.map +1 -1
  36. package/lib/module/components/Channel/hooks/useCreateChannelContext.js +2 -0
  37. package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  38. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
  39. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  40. package/lib/module/components/MessageInput/FileUploadPreview.js +19 -19
  41. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  42. package/lib/module/components/MessageInput/ImageUploadPreview.js +13 -13
  43. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  44. package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
  45. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  46. package/lib/module/contexts/messageInputContext/MessageInputContext.js +61 -40
  47. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  48. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
  49. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  50. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  51. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  52. package/lib/module/i18n/en.json +1 -1
  53. package/lib/module/i18n/fr.json +48 -48
  54. package/lib/module/i18n/hi.json +48 -48
  55. package/lib/module/i18n/it.json +48 -48
  56. package/lib/module/i18n/nl.json +48 -48
  57. package/lib/module/i18n/ru.json +48 -48
  58. package/lib/module/i18n/tr.json +48 -48
  59. package/lib/module/types/types.js.map +1 -1
  60. package/lib/module/utils/compressImage.js +37 -0
  61. package/lib/module/utils/compressImage.js.map +1 -0
  62. package/lib/module/version.json +1 -1
  63. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +1 -1
  64. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
  65. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
  66. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
  67. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +5 -0
  68. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -23
  69. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +2 -2
  70. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -2
  71. package/lib/typescript/i18n/en.json +1 -1
  72. package/lib/typescript/i18n/fr.json +48 -48
  73. package/lib/typescript/i18n/hi.json +48 -48
  74. package/lib/typescript/i18n/it.json +48 -48
  75. package/lib/typescript/i18n/nl.json +48 -48
  76. package/lib/typescript/i18n/ru.json +48 -48
  77. package/lib/typescript/i18n/tr.json +48 -48
  78. package/lib/typescript/types/types.d.ts +20 -0
  79. package/lib/typescript/utils/compressImage.d.ts +8 -0
  80. package/package.json +2 -2
  81. package/src/components/Attachment/AudioAttachment.tsx +2 -1
  82. package/src/components/Channel/Channel.tsx +32 -8
  83. package/src/components/Channel/hooks/useCreateChannelContext.ts +2 -0
  84. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -9
  85. package/src/components/MessageInput/FileUploadPreview.tsx +1 -2
  86. package/src/components/MessageInput/ImageUploadPreview.tsx +1 -2
  87. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +1 -1
  88. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +1 -1
  89. package/src/contexts/channelContext/ChannelContext.tsx +5 -0
  90. package/src/contexts/messageInputContext/MessageInputContext.tsx +80 -68
  91. package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +3 -3
  92. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -2
  93. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
  94. package/src/contexts/messagesContext/MessagesContext.tsx +2 -2
  95. package/src/i18n/en.json +1 -1
  96. package/src/i18n/fr.json +48 -48
  97. package/src/i18n/hi.json +48 -48
  98. package/src/i18n/it.json +48 -48
  99. package/src/i18n/nl.json +48 -48
  100. package/src/i18n/ru.json +48 -48
  101. package/src/i18n/tr.json +48 -48
  102. package/src/types/types.ts +23 -0
  103. package/src/utils/compressImage.ts +32 -0
  104. package/src/version.json +1 -1
@@ -297,7 +297,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
297
297
  __self: _this,
298
298
  __source: {
299
299
  fileName: _jsxFileName,
300
- lineNumber: 222,
300
+ lineNumber: 223,
301
301
  columnNumber: 5
302
302
  }
303
303
  }, _react["default"].createElement(_reactNative.TouchableOpacity, {
@@ -312,7 +312,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
312
312
  __self: _this,
313
313
  __source: {
314
314
  fileName: _jsxFileName,
315
- lineNumber: 223,
315
+ lineNumber: 224,
316
316
  columnNumber: 7
317
317
  }
318
318
  }, item.paused ? _react["default"].createElement(_icons.Play, {
@@ -322,7 +322,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
322
322
  __self: _this,
323
323
  __source: {
324
324
  fileName: _jsxFileName,
325
- lineNumber: 233,
325
+ lineNumber: 234,
326
326
  columnNumber: 11
327
327
  }
328
328
  }) : _react["default"].createElement(_icons.Pause, {
@@ -332,7 +332,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
332
332
  __self: _this,
333
333
  __source: {
334
334
  fileName: _jsxFileName,
335
- lineNumber: 235,
335
+ lineNumber: 236,
336
336
  columnNumber: 11
337
337
  }
338
338
  })), _react["default"].createElement(_reactNative.View, {
@@ -340,7 +340,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
340
340
  __self: _this,
341
341
  __source: {
342
342
  fileName: _jsxFileName,
343
- lineNumber: 238,
343
+ lineNumber: 239,
344
344
  columnNumber: 7
345
345
  }
346
346
  }, _react["default"].createElement(_reactNative.Text, {
@@ -357,7 +357,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
357
357
  __self: _this,
358
358
  __source: {
359
359
  fileName: _jsxFileName,
360
- lineNumber: 239,
360
+ lineNumber: 240,
361
361
  columnNumber: 9
362
362
  }
363
363
  }, item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)), _react["default"].createElement(_reactNative.View, {
@@ -369,7 +369,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
369
369
  __self: _this,
370
370
  __source: {
371
371
  fileName: _jsxFileName,
372
- lineNumber: 258,
372
+ lineNumber: 259,
373
373
  columnNumber: 9
374
374
  }
375
375
  }, _native.Sound.Player && _react["default"].createElement(_native.Sound.Player, {
@@ -383,7 +383,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
383
383
  __self: _this,
384
384
  __source: {
385
385
  fileName: _jsxFileName,
386
- lineNumber: 267,
386
+ lineNumber: 268,
387
387
  columnNumber: 13
388
388
  }
389
389
  }), _react["default"].createElement(_reactNative.Text, {
@@ -393,7 +393,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
393
393
  __self: _this,
394
394
  __source: {
395
395
  fileName: _jsxFileName,
396
- lineNumber: 277,
396
+ lineNumber: 278,
397
397
  columnNumber: 11
398
398
  }
399
399
  }, progressDuration), _react["default"].createElement(_reactNative.View, {
@@ -401,7 +401,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
401
401
  __self: _this,
402
402
  __source: {
403
403
  fileName: _jsxFileName,
404
- lineNumber: 280,
404
+ lineNumber: 281,
405
405
  columnNumber: 11
406
406
  }
407
407
  }, _react["default"].createElement(_ProgressControl.ProgressControl, {
@@ -415,7 +415,7 @@ var AudioAttachmentWithContext = function AudioAttachmentWithContext(props) {
415
415
  __self: _this,
416
416
  __source: {
417
417
  fileName: _jsxFileName,
418
- lineNumber: 281,
418
+ lineNumber: 282,
419
419
  columnNumber: 13
420
420
  }
421
421
  })))));
@@ -425,7 +425,7 @@ var AudioAttachment = function AudioAttachment(props) {
425
425
  __self: _this,
426
426
  __source: {
427
427
  fileName: _jsxFileName,
428
- lineNumber: 310,
428
+ lineNumber: 311,
429
429
  columnNumber: 3
430
430
  }
431
431
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_dayjs","_interopRequireDefault","_duration","_contexts","_icons","_native","_ProgressControl","_this","_jsxFileName","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","dayjs","extend","duration","FILE_PREVIEW_HEIGHT","styles","StyleSheet","create","fileContainer","borderRadius","borderWidth","flexDirection","height","paddingLeft","paddingRight","fileContentContainer","filenameText","fontSize","fontWeight","fileTextContainer","justifyContent","flatList","marginBottom","maxHeight","overlay","marginLeft","marginRight","progressControlView","flex","progressDurationText","roundedView","alignItems","alignSelf","display","elevation","shadowOffset","width","shadowOpacity","shadowRadius","AudioAttachmentWithContext","props","soundRef","React","useRef","item","onLoad","onPlayPause","onProgress","handleLoad","payload","id","handleProgress","data","currentTime","seekableDuration","handlePlayPause","_ref","_asyncToGenerator2","_regenerator","mark","_callee","isPausedStatusAvailable","wrap","_callee$","_context","prev","next","current","undefined","progress","seek","setPositionAsync","paused","playAsync","pauseAsync","stop","_x","apply","arguments","handleProgressDrag","_ref2","_callee2","position","_soundRef$current","_soundRef$current2","_callee2$","_context2","_x2","handleEnd","onPlaybackStatusUpdate","playbackStatus","isLoaded","error","console","log","durationMillis","positionMillis","isPlaying","isBuffering","didJustFinish","isLooping","useEffect","Sound","Player","initiateSound","_ref3","_callee3","_callee3$","_context3","file","uri","initializeSound","sent","_soundRef$current3","stopAsync","unloadAsync","initalPlayPause","_ref4","_callee4","_callee4$","_context4","_useTheme","useTheme","_useTheme$theme","theme","_useTheme$theme$color","colors","accent_blue","black","grey_dark","static_black","static_white","_useTheme$theme$messa","messageInput","fileUploadPreview","_useTheme$theme$messa2","audioAttachment","progressValueInSeconds","progressDuration","format","lastIndexOfDot","name","lastIndexOf","createElement","View","style","__self","__source","fileName","lineNumber","columnNumber","TouchableOpacity","accessibilityLabel","onPress","backgroundColor","shadowColor","Play","pathFill","Pause","Text","numberOfLines","color","I18nManager","isRTL","writingDirection","slice","onEnd","testID","ProgressControl","filledColor","onProgressDrag","AudioAttachment","_extends2","exports","displayName"],"sources":["AudioAttachment.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport dayjs from 'dayjs';\nimport duration from 'dayjs/plugin/duration';\n\nimport { FileUpload, useTheme } from '../../contexts';\nimport { Pause, Play } from '../../icons';\nimport {\n PlaybackStatus,\n Sound,\n SoundReturnType,\n VideoPayloadData,\n VideoProgressData,\n} from '../../native';\nimport { ProgressControl } from '../ProgressControl/ProgressControl';\n\ndayjs.extend(duration);\n\nconst FILE_PREVIEW_HEIGHT = 70;\n\nconst styles = StyleSheet.create({\n fileContainer: {\n borderRadius: 12,\n borderWidth: 1,\n flexDirection: 'row',\n height: FILE_PREVIEW_HEIGHT,\n paddingLeft: 8,\n paddingRight: 8,\n },\n fileContentContainer: { flexDirection: 'row', paddingRight: 40 },\n filenameText: {\n fontSize: 14,\n fontWeight: 'bold',\n paddingLeft: 10,\n },\n fileTextContainer: {\n justifyContent: 'space-around',\n },\n flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },\n overlay: {\n borderRadius: 12,\n marginLeft: 8,\n marginRight: 8,\n },\n progressControlView: {\n flex: 8,\n },\n progressDurationText: {\n flex: 4,\n fontSize: 12,\n paddingLeft: 10,\n paddingRight: 8,\n },\n roundedView: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: 50,\n display: 'flex',\n elevation: 4,\n height: 36,\n justifyContent: 'center',\n shadowOffset: {\n height: 2,\n width: 0,\n },\n shadowOpacity: 0.23,\n shadowRadius: 2.62,\n width: 36,\n },\n});\n\nexport type AudioAttachmentPropsWithContext = {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID?: string;\n};\n\nconst AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {\n const soundRef = React.useRef<SoundReturnType | null>(null);\n const { item, onLoad, onPlayPause, onProgress } = props;\n\n const handleLoad = (payload: VideoPayloadData) => {\n onLoad(item.id, payload.duration);\n };\n\n const handleProgress = (data: VideoProgressData) => {\n if (data.currentTime && data.seekableDuration) {\n onProgress(item.id, data.currentTime);\n }\n };\n\n const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {\n if (soundRef.current) {\n if (isPausedStatusAvailable === undefined) {\n if (item.progress === 1) {\n // For native CLI\n if (soundRef.current.seek) soundRef.current.seek(0);\n // For expo CLI\n if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);\n }\n if (item.paused) {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n onPlayPause(item.id, false);\n } else {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n onPlayPause(item.id, true);\n }\n } else {\n onPlayPause(item.id, isPausedStatusAvailable);\n }\n }\n };\n\n const handleProgressDrag = async (position: number) => {\n onProgress(item.id, position);\n if (soundRef.current?.seek) soundRef.current.seek(position);\n if (soundRef.current?.setPositionAsync) {\n await soundRef.current.setPositionAsync(position * 1000);\n }\n };\n\n const handleEnd = () => {\n onPlayPause(item.id, true);\n onProgress(item.id, item.duration, true);\n };\n\n const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {\n if (!playbackStatus.isLoaded) {\n // Update your UI for the unloaded state\n if (playbackStatus.error) {\n console.log(`Encountered a fatal error during playback: ${playbackStatus.error}`);\n }\n } else {\n const { durationMillis, positionMillis } = playbackStatus;\n onLoad(item.id, durationMillis / 1000);\n // Update your UI for the loaded state\n if (playbackStatus.isPlaying) {\n // Update your UI for the playing state\n onProgress(item.id, positionMillis / 1000);\n } else {\n // Update your UI for the paused state\n }\n\n if (playbackStatus.isBuffering) {\n // Update your UI for the buffering state\n }\n\n if (playbackStatus.didJustFinish && !playbackStatus.isLooping) {\n // The player has just finished playing and will stop. Maybe you want to play something else?\n // status: opposite of pause,says i am playing\n handleEnd();\n }\n }\n };\n\n useEffect(() => {\n if (Sound.Player === null) {\n const initiateSound = async () => {\n if (item && item.file && item.file.uri) {\n soundRef.current = await Sound.initializeSound(\n { uri: item.file.uri },\n {},\n onPlaybackStatusUpdate,\n );\n }\n };\n initiateSound();\n }\n\n return () => {\n if (soundRef.current?.stopAsync && soundRef.current.unloadAsync) {\n soundRef.current.stopAsync();\n soundRef.current.unloadAsync();\n }\n };\n }, []);\n\n // This is needed for expo applications where the rerender doesn't occur on time thefore you need to update the state of the sound.\n useEffect(() => {\n const initalPlayPause = async () => {\n if (soundRef.current) {\n if (item.paused) {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n } else {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n }\n }\n };\n if (!Sound.Player) {\n initalPlayPause();\n }\n }, [item.paused]);\n\n const {\n theme: {\n colors: { accent_blue, black, grey_dark, static_black, static_white },\n messageInput: {\n fileUploadPreview: {\n audioAttachment: { progressControlView, progressDurationText, roundedView },\n fileContentContainer,\n filenameText,\n fileTextContainer,\n },\n },\n },\n } = useTheme();\n\n const progressValueInSeconds = (item.duration as number) * (item.progress as number);\n\n const progressDuration = progressValueInSeconds\n ? progressValueInSeconds / 3600 >= 1\n ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')\n : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')\n : '00:00';\n\n const lastIndexOfDot = item.file.name.lastIndexOf('.');\n\n return (\n <View style={[styles.fileContentContainer, fileContentContainer]}>\n <TouchableOpacity\n accessibilityLabel='Play Pause Button'\n onPress={() => handlePlayPause()}\n style={[\n styles.roundedView,\n roundedView,\n { backgroundColor: static_white, shadowColor: black },\n ]}\n >\n {item.paused ? (\n <Play height={24} pathFill={static_black} width={24} />\n ) : (\n <Pause height={24} pathFill={static_black} width={24} />\n )}\n </TouchableOpacity>\n <View style={[styles.fileTextContainer, fileTextContainer]}>\n <Text\n accessibilityLabel='File Name'\n numberOfLines={1}\n style={[\n styles.filenameText,\n {\n color: black,\n width:\n 16 - // 16 = horizontal padding\n 40 - // 40 = file icon size\n 24 - // 24 = close icon size\n 24, // 24 = internal padding\n },\n I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },\n filenameText,\n ]}\n >\n {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}\n </Text>\n <View\n style={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n }}\n >\n {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}\n {Sound.Player && (\n <Sound.Player\n onEnd={handleEnd}\n onLoad={handleLoad}\n onProgress={handleProgress}\n paused={item.paused as boolean}\n soundRef={soundRef}\n testID='sound-player'\n uri={item.file.uri}\n />\n )}\n <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>\n {progressDuration}\n </Text>\n <View style={[styles.progressControlView, progressControlView]}>\n <ProgressControl\n duration={item.duration as number}\n filledColor={accent_blue}\n onPlayPause={handlePlayPause}\n onProgressDrag={handleProgressDrag}\n progress={item.progress as number}\n testID='progress-control'\n width={120}\n />\n </View>\n </View>\n </View>\n </View>\n );\n};\n\nexport type AudioAttachmentProps = Partial<AudioAttachmentPropsWithContext> & {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID: string;\n};\n\n/**\n * AudioAttachment\n * UI Component to preview the audio files\n */\nexport const AudioAttachment = (props: AudioAttachmentProps) => (\n <AudioAttachmentWithContext {...props} />\n);\n\nAudioAttachment.displayName = 'AudioAttachment{messageInput{autoAttachment}}';\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAOA,IAAAQ,gBAAA,GAAAR,OAAA;AAAqE,IAAAS,KAAA;EAAAC,YAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAb,wBAAAiB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAA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C"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_dayjs","_interopRequireDefault","_duration","_contexts","_icons","_native","_ProgressControl","_this","_jsxFileName","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","dayjs","extend","duration","FILE_PREVIEW_HEIGHT","styles","StyleSheet","create","fileContainer","borderRadius","borderWidth","flexDirection","height","paddingLeft","paddingRight","fileContentContainer","filenameText","fontSize","fontWeight","fileTextContainer","justifyContent","flatList","marginBottom","maxHeight","overlay","marginLeft","marginRight","progressControlView","flex","progressDurationText","roundedView","alignItems","alignSelf","display","elevation","shadowOffset","width","shadowOpacity","shadowRadius","AudioAttachmentWithContext","props","soundRef","React","useRef","item","onLoad","onPlayPause","onProgress","handleLoad","payload","id","handleProgress","data","currentTime","seekableDuration","handlePlayPause","_ref","_asyncToGenerator2","_regenerator","mark","_callee","isPausedStatusAvailable","wrap","_callee$","_context","prev","next","current","undefined","progress","seek","setPositionAsync","paused","playAsync","pauseAsync","stop","_x","apply","arguments","handleProgressDrag","_ref2","_callee2","position","_soundRef$current","_soundRef$current2","_callee2$","_context2","_x2","handleEnd","onPlaybackStatusUpdate","playbackStatus","isLoaded","error","console","log","durationMillis","positionMillis","isPlaying","isBuffering","didJustFinish","isLooping","useEffect","Sound","Player","initiateSound","_ref3","_callee3","_callee3$","_context3","file","uri","initializeSound","sent","_soundRef$current3","stopAsync","unloadAsync","initalPlayPause","_ref4","_callee4","_callee4$","_context4","_useTheme","useTheme","_useTheme$theme","theme","_useTheme$theme$color","colors","accent_blue","black","grey_dark","static_black","static_white","_useTheme$theme$messa","messageInput","fileUploadPreview","_useTheme$theme$messa2","audioAttachment","progressValueInSeconds","progressDuration","format","lastIndexOfDot","name","lastIndexOf","createElement","View","style","__self","__source","fileName","lineNumber","columnNumber","TouchableOpacity","accessibilityLabel","onPress","backgroundColor","shadowColor","Play","pathFill","Pause","Text","numberOfLines","color","I18nManager","isRTL","writingDirection","slice","onEnd","testID","ProgressControl","filledColor","onProgressDrag","AudioAttachment","_extends2","exports","displayName"],"sources":["AudioAttachment.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport dayjs from 'dayjs';\nimport duration from 'dayjs/plugin/duration';\n\nimport { useTheme } from '../../contexts';\nimport { Pause, Play } from '../../icons';\nimport {\n PlaybackStatus,\n Sound,\n SoundReturnType,\n VideoPayloadData,\n VideoProgressData,\n} from '../../native';\nimport type { FileUpload } from '../../types/types';\nimport { ProgressControl } from '../ProgressControl/ProgressControl';\n\ndayjs.extend(duration);\n\nconst FILE_PREVIEW_HEIGHT = 70;\n\nconst styles = StyleSheet.create({\n fileContainer: {\n borderRadius: 12,\n borderWidth: 1,\n flexDirection: 'row',\n height: FILE_PREVIEW_HEIGHT,\n paddingLeft: 8,\n paddingRight: 8,\n },\n fileContentContainer: { flexDirection: 'row', paddingRight: 40 },\n filenameText: {\n fontSize: 14,\n fontWeight: 'bold',\n paddingLeft: 10,\n },\n fileTextContainer: {\n justifyContent: 'space-around',\n },\n flatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },\n overlay: {\n borderRadius: 12,\n marginLeft: 8,\n marginRight: 8,\n },\n progressControlView: {\n flex: 8,\n },\n progressDurationText: {\n flex: 4,\n fontSize: 12,\n paddingLeft: 10,\n paddingRight: 8,\n },\n roundedView: {\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: 50,\n display: 'flex',\n elevation: 4,\n height: 36,\n justifyContent: 'center',\n shadowOffset: {\n height: 2,\n width: 0,\n },\n shadowOpacity: 0.23,\n shadowRadius: 2.62,\n width: 36,\n },\n});\n\nexport type AudioAttachmentPropsWithContext = {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID?: string;\n};\n\nconst AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {\n const soundRef = React.useRef<SoundReturnType | null>(null);\n const { item, onLoad, onPlayPause, onProgress } = props;\n\n const handleLoad = (payload: VideoPayloadData) => {\n onLoad(item.id, payload.duration);\n };\n\n const handleProgress = (data: VideoProgressData) => {\n if (data.currentTime && data.seekableDuration) {\n onProgress(item.id, data.currentTime);\n }\n };\n\n const handlePlayPause = async (isPausedStatusAvailable?: boolean) => {\n if (soundRef.current) {\n if (isPausedStatusAvailable === undefined) {\n if (item.progress === 1) {\n // For native CLI\n if (soundRef.current.seek) soundRef.current.seek(0);\n // For expo CLI\n if (soundRef.current.setPositionAsync) soundRef.current.setPositionAsync(0);\n }\n if (item.paused) {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n onPlayPause(item.id, false);\n } else {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n onPlayPause(item.id, true);\n }\n } else {\n onPlayPause(item.id, isPausedStatusAvailable);\n }\n }\n };\n\n const handleProgressDrag = async (position: number) => {\n onProgress(item.id, position);\n if (soundRef.current?.seek) soundRef.current.seek(position);\n if (soundRef.current?.setPositionAsync) {\n await soundRef.current.setPositionAsync(position * 1000);\n }\n };\n\n const handleEnd = () => {\n onPlayPause(item.id, true);\n onProgress(item.id, item.duration, true);\n };\n\n const onPlaybackStatusUpdate = (playbackStatus: PlaybackStatus) => {\n if (!playbackStatus.isLoaded) {\n // Update your UI for the unloaded state\n if (playbackStatus.error) {\n console.log(`Encountered a fatal error during playback: ${playbackStatus.error}`);\n }\n } else {\n const { durationMillis, positionMillis } = playbackStatus;\n onLoad(item.id, durationMillis / 1000);\n // Update your UI for the loaded state\n if (playbackStatus.isPlaying) {\n // Update your UI for the playing state\n onProgress(item.id, positionMillis / 1000);\n } else {\n // Update your UI for the paused state\n }\n\n if (playbackStatus.isBuffering) {\n // Update your UI for the buffering state\n }\n\n if (playbackStatus.didJustFinish && !playbackStatus.isLooping) {\n // The player has just finished playing and will stop. Maybe you want to play something else?\n // status: opposite of pause,says i am playing\n handleEnd();\n }\n }\n };\n\n useEffect(() => {\n if (Sound.Player === null) {\n const initiateSound = async () => {\n if (item && item.file && item.file.uri) {\n soundRef.current = await Sound.initializeSound(\n { uri: item.file.uri },\n {},\n onPlaybackStatusUpdate,\n );\n }\n };\n initiateSound();\n }\n\n return () => {\n if (soundRef.current?.stopAsync && soundRef.current.unloadAsync) {\n soundRef.current.stopAsync();\n soundRef.current.unloadAsync();\n }\n };\n }, []);\n\n // This is needed for expo applications where the rerender doesn't occur on time thefore you need to update the state of the sound.\n useEffect(() => {\n const initalPlayPause = async () => {\n if (soundRef.current) {\n if (item.paused) {\n if (soundRef.current.pauseAsync) await soundRef.current.pauseAsync();\n } else {\n if (soundRef.current.playAsync) await soundRef.current.playAsync();\n }\n }\n };\n if (!Sound.Player) {\n initalPlayPause();\n }\n }, [item.paused]);\n\n const {\n theme: {\n colors: { accent_blue, black, grey_dark, static_black, static_white },\n messageInput: {\n fileUploadPreview: {\n audioAttachment: { progressControlView, progressDurationText, roundedView },\n fileContentContainer,\n filenameText,\n fileTextContainer,\n },\n },\n },\n } = useTheme();\n\n const progressValueInSeconds = (item.duration as number) * (item.progress as number);\n\n const progressDuration = progressValueInSeconds\n ? progressValueInSeconds / 3600 >= 1\n ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')\n : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')\n : '00:00';\n\n const lastIndexOfDot = item.file.name.lastIndexOf('.');\n\n return (\n <View style={[styles.fileContentContainer, fileContentContainer]}>\n <TouchableOpacity\n accessibilityLabel='Play Pause Button'\n onPress={() => handlePlayPause()}\n style={[\n styles.roundedView,\n roundedView,\n { backgroundColor: static_white, shadowColor: black },\n ]}\n >\n {item.paused ? (\n <Play height={24} pathFill={static_black} width={24} />\n ) : (\n <Pause height={24} pathFill={static_black} width={24} />\n )}\n </TouchableOpacity>\n <View style={[styles.fileTextContainer, fileTextContainer]}>\n <Text\n accessibilityLabel='File Name'\n numberOfLines={1}\n style={[\n styles.filenameText,\n {\n color: black,\n width:\n 16 - // 16 = horizontal padding\n 40 - // 40 = file icon size\n 24 - // 24 = close icon size\n 24, // 24 = internal padding\n },\n I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },\n filenameText,\n ]}\n >\n {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}\n </Text>\n <View\n style={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n }}\n >\n {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}\n {Sound.Player && (\n <Sound.Player\n onEnd={handleEnd}\n onLoad={handleLoad}\n onProgress={handleProgress}\n paused={item.paused as boolean}\n soundRef={soundRef}\n testID='sound-player'\n uri={item.file.uri}\n />\n )}\n <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>\n {progressDuration}\n </Text>\n <View style={[styles.progressControlView, progressControlView]}>\n <ProgressControl\n duration={item.duration as number}\n filledColor={accent_blue}\n onPlayPause={handlePlayPause}\n onProgressDrag={handleProgressDrag}\n progress={item.progress as number}\n testID='progress-control'\n width={120}\n />\n </View>\n </View>\n </View>\n </View>\n );\n};\n\nexport type AudioAttachmentProps = Partial<AudioAttachmentPropsWithContext> & {\n item: Omit<FileUpload, 'state'>;\n onLoad: (index: string, duration: number) => void;\n onPlayPause: (index: string, pausedStatus?: boolean) => void;\n onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;\n testID: string;\n};\n\n/**\n * AudioAttachment\n * UI Component to preview the audio files\n */\nexport const AudioAttachment = (props: AudioAttachmentProps) => (\n <AudioAttachmentWithContext {...props} />\n);\n\nAudioAttachment.displayName = 'AudioAttachment{messageInput{autoAttachment}}';\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAA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MAAA,YAAAiL,aAAA,CAACvK,gBAAA,CAAAgM,eAAe;IACdrK,QAAQ,EAAEyC,IAAI,CAACzC,QAAmB;IAClCsK,WAAW,EAAE1C,WAAY;IACzBjF,WAAW,EAAES,eAAgB;IAC7BmH,cAAc,EAAE3F,kBAAmB;IACnCV,QAAQ,EAAEzB,IAAI,CAACyB,QAAmB;IAClCkG,MAAM,EAAC,kBAAkB;IACzBnI,KAAK,EAAE,GAAI;IAAA8G,MAAA,EAAAzK,KAAA;IAAA0K,QAAA;MAAAC,QAAA,EAAA1K,YAAA;MAAA2K,UAAA;MAAAC,YAAA;IAAA;EAAA,CACZ,CACG,CACF,CACF,CACF,CAAC;AAEX,CAAC;AAcM,IAAMqB,eAAe,GAAG,SAAlBA,eAAeA,CAAInI,KAA2B;EAAA,OACzD1E,MAAA,YAAAiL,aAAA,CAACxG,0BAA0B,MAAAqI,SAAA,iBAAKpI,KAAK;IAAA0G,MAAA,EAAAzK,KAAA;IAAA0K,QAAA;MAAAC,QAAA,EAAA1K,YAAA;MAAA2K,UAAA;MAAAC,YAAA;IAAA;EAAA,EAAG,CAAC;AAAA,CAC1C;AAACuB,OAAA,CAAAF,eAAA,GAAAA,eAAA;AAEFA,eAAe,CAACG,WAAW,GAAG,+CAA+C"}
@@ -41,6 +41,7 @@ var _icons = require("../../icons");
41
41
  var _native = require("../../native");
42
42
  var dbApi = _interopRequireWildcard(require("../../store/apis"));
43
43
  var _addReactionToLocalState = require("../../utils/addReactionToLocalState");
44
+ var _compressImage = require("../../utils/compressImage");
44
45
  var _DBSyncManager = require("../../utils/DBSyncManager");
45
46
  var _patchMessageTextCommand = require("../../utils/patchMessageTextCommand");
46
47
  var _removeReactionFromLocalState = require("../../utils/removeReactionFromLocalState");
@@ -445,6 +446,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
445
446
  var _useTargetedMessage = (0, _useTargetedMessage2.useTargetedMessage)(),
446
447
  setTargetedMessage = _useTargetedMessage.setTargetedMessage,
447
448
  targetedMessage = _useTargetedMessage.targetedMessage;
449
+ var uploadAbortControllerRef = (0, _react.useRef)(new Map());
448
450
  var channelId = (channel == null ? void 0 : channel.id) || '';
449
451
  (0, _react.useEffect)(function () {
450
452
  var initChannel = function initChannel() {
@@ -1152,45 +1154,55 @@ var ChannelWithContext = function ChannelWithContext(props) {
1152
1154
  var uploadPendingAttachments = function () {
1153
1155
  var _ref16 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee12(message) {
1154
1156
  var _updatedMessage$attac;
1155
- var updatedMessage, i, _updatedMessage$attac2, attachment, file, _file$name, filename, contentType, uploadResponse, response;
1157
+ var updatedMessage, i, _updatedMessage$attac2, attachment, image, file, _image$name, filename, controller, compressedUri, contentType, uploadResponse, _controller, response;
1156
1158
  return _regenerator["default"].wrap(function _callee12$(_context12) {
1157
1159
  while (1) switch (_context12.prev = _context12.next) {
1158
1160
  case 0:
1159
1161
  updatedMessage = (0, _extends2["default"])({}, message);
1160
1162
  if (!((_updatedMessage$attac = updatedMessage.attachments) != null && _updatedMessage$attac.length)) {
1161
- _context12.next = 40;
1163
+ _context12.next = 48;
1162
1164
  break;
1163
1165
  }
1164
1166
  i = 0;
1165
1167
  case 3:
1166
1168
  if (!(i < ((_updatedMessage$attac2 = updatedMessage.attachments) == null ? void 0 : _updatedMessage$attac2.length))) {
1167
- _context12.next = 40;
1169
+ _context12.next = 48;
1168
1170
  break;
1169
1171
  }
1170
1172
  attachment = updatedMessage.attachments[i];
1173
+ image = attachment.originalImage;
1171
1174
  file = attachment.originalFile;
1172
- if (!(attachment.type === 'image' && file != null && file.uri && attachment.image_url && (0, _utils.isLocalUrl)(attachment.image_url))) {
1173
- _context12.next = 22;
1175
+ if (!(attachment.type === 'image' && image != null && image.uri && attachment.image_url && (0, _utils.isLocalUrl)(attachment.image_url))) {
1176
+ _context12.next = 28;
1174
1177
  break;
1175
1178
  }
1176
- filename = (_file$name = file.name) != null ? _file$name : file.uri.replace(/^(file:\/\/|content:\/\/)/, '');
1179
+ filename = (_image$name = image.name) != null ? _image$name : image.uri.replace(/^(file:\/\/|content:\/\/)/, '');
1180
+ controller = uploadAbortControllerRef.current.get(filename);
1181
+ if (controller) {
1182
+ controller.abort();
1183
+ uploadAbortControllerRef.current["delete"](filename);
1184
+ }
1185
+ _context12.next = 13;
1186
+ return (0, _compressImage.compressedImageURI)(image, compressImageQuality);
1187
+ case 13:
1188
+ compressedUri = _context12.sent;
1177
1189
  contentType = (0, _mimeTypes.lookup)(filename) || 'multipart/form-data';
1178
1190
  if (!doImageUploadRequest) {
1179
- _context12.next = 15;
1191
+ _context12.next = 21;
1180
1192
  break;
1181
1193
  }
1182
- _context12.next = 12;
1183
- return doImageUploadRequest(file, channel);
1184
- case 12:
1185
- _context12.t0 = _context12.sent;
1186
1194
  _context12.next = 18;
1195
+ return doImageUploadRequest(image, channel);
1196
+ case 18:
1197
+ _context12.t0 = _context12.sent;
1198
+ _context12.next = 24;
1187
1199
  break;
1188
- case 15:
1189
- _context12.next = 17;
1190
- return channel.sendImage(file.uri, filename, contentType);
1191
- case 17:
1200
+ case 21:
1201
+ _context12.next = 23;
1202
+ return channel.sendImage(compressedUri, filename, contentType);
1203
+ case 23:
1192
1204
  _context12.t0 = _context12.sent;
1193
- case 18:
1205
+ case 24:
1194
1206
  uploadResponse = _context12.t0;
1195
1207
  attachment.image_url = uploadResponse.file;
1196
1208
  delete attachment.originalFile;
@@ -1199,27 +1211,32 @@ var ChannelWithContext = function ChannelWithContext(props) {
1199
1211
  cid: channel.cid
1200
1212
  })
1201
1213
  });
1202
- case 22:
1214
+ case 28:
1203
1215
  if (!((attachment.type === 'file' || attachment.type === 'audio' || attachment.type === 'video') && attachment.asset_url && (0, _utils.isLocalUrl)(attachment.asset_url) && file != null && file.uri)) {
1204
- _context12.next = 37;
1216
+ _context12.next = 45;
1205
1217
  break;
1206
1218
  }
1219
+ _controller = uploadAbortControllerRef.current.get(file.name);
1220
+ if (_controller) {
1221
+ _controller.abort();
1222
+ uploadAbortControllerRef.current["delete"](file.name);
1223
+ }
1207
1224
  if (!doDocUploadRequest) {
1208
- _context12.next = 29;
1225
+ _context12.next = 37;
1209
1226
  break;
1210
1227
  }
1211
- _context12.next = 26;
1228
+ _context12.next = 34;
1212
1229
  return doDocUploadRequest(file, channel);
1213
- case 26:
1230
+ case 34:
1214
1231
  _context12.t1 = _context12.sent;
1215
- _context12.next = 32;
1232
+ _context12.next = 40;
1216
1233
  break;
1217
- case 29:
1218
- _context12.next = 31;
1234
+ case 37:
1235
+ _context12.next = 39;
1219
1236
  return channel.sendFile(file.uri, file.name, file.mimeType);
1220
- case 31:
1237
+ case 39:
1221
1238
  _context12.t1 = _context12.sent;
1222
- case 32:
1239
+ case 40:
1223
1240
  response = _context12.t1;
1224
1241
  attachment.asset_url = response.file;
1225
1242
  if (response.thumb_url) {
@@ -1231,13 +1248,13 @@ var ChannelWithContext = function ChannelWithContext(props) {
1231
1248
  cid: channel.cid
1232
1249
  })
1233
1250
  });
1234
- case 37:
1251
+ case 45:
1235
1252
  i++;
1236
1253
  _context12.next = 3;
1237
1254
  break;
1238
- case 40:
1255
+ case 48:
1239
1256
  return _context12.abrupt("return", updatedMessage);
1240
- case 41:
1257
+ case 49:
1241
1258
  case "end":
1242
1259
  return _context12.stop();
1243
1260
  }
@@ -1556,11 +1573,12 @@ var ChannelWithContext = function ChannelWithContext(props) {
1556
1573
  var editMessage = function editMessage(updatedMessage) {
1557
1574
  return doUpdateMessageRequest ? doUpdateMessageRequest((channel == null ? void 0 : channel.cid) || '', updatedMessage) : client.updateMessage(updatedMessage);
1558
1575
  };
1559
- var setEditingState = function setEditingState(message) {
1560
- setEditing(message);
1576
+ var setEditingState = function setEditingState(messageOrBoolean) {
1577
+ clearQuotedMessageState();
1578
+ setEditing(messageOrBoolean);
1561
1579
  };
1562
- var setQuotedMessageState = function setQuotedMessageState(message) {
1563
- setQuotedMessage(message);
1580
+ var setQuotedMessageState = function setQuotedMessageState(messageOrBoolean) {
1581
+ setQuotedMessage(messageOrBoolean);
1564
1582
  };
1565
1583
  var clearEditingState = function clearEditingState() {
1566
1584
  return setEditing(false);
@@ -1865,6 +1883,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
1865
1883
  StickyHeader: StickyHeader,
1866
1884
  targetedMessage: targetedMessage,
1867
1885
  threadList: threadList,
1886
+ uploadAbortControllerRef: uploadAbortControllerRef,
1868
1887
  watcherCount: watcherCount,
1869
1888
  watchers: watchers
1870
1889
  });
@@ -2037,7 +2056,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2037
2056
  __self: _this,
2038
2057
  __source: {
2039
2058
  fileName: _jsxFileName,
2040
- lineNumber: 2029,
2059
+ lineNumber: 2053,
2041
2060
  columnNumber: 12
2042
2061
  }
2043
2062
  });
@@ -2051,7 +2070,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2051
2070
  __self: _this,
2052
2071
  __source: {
2053
2072
  fileName: _jsxFileName,
2054
- lineNumber: 2034,
2073
+ lineNumber: 2058,
2055
2074
  columnNumber: 7
2056
2075
  }
2057
2076
  }, t('Please select a channel first'));
@@ -2064,7 +2083,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2064
2083
  __self: _this,
2065
2084
  __source: {
2066
2085
  fileName: _jsxFileName,
2067
- lineNumber: 2041,
2086
+ lineNumber: 2065,
2068
2087
  columnNumber: 5
2069
2088
  }
2070
2089
  }), _react["default"].createElement(_ChannelContext.ChannelProvider, {
@@ -2072,7 +2091,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2072
2091
  __self: _this,
2073
2092
  __source: {
2074
2093
  fileName: _jsxFileName,
2075
- lineNumber: 2047,
2094
+ lineNumber: 2071,
2076
2095
  columnNumber: 7
2077
2096
  }
2078
2097
  }, _react["default"].createElement(_OwnCapabilitiesContext.OwnCapabilitiesProvider, {
@@ -2080,7 +2099,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2080
2099
  __self: _this,
2081
2100
  __source: {
2082
2101
  fileName: _jsxFileName,
2083
- lineNumber: 2048,
2102
+ lineNumber: 2072,
2084
2103
  columnNumber: 9
2085
2104
  }
2086
2105
  }, _react["default"].createElement(_TypingContext.TypingProvider, {
@@ -2088,7 +2107,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2088
2107
  __self: _this,
2089
2108
  __source: {
2090
2109
  fileName: _jsxFileName,
2091
- lineNumber: 2049,
2110
+ lineNumber: 2073,
2092
2111
  columnNumber: 11
2093
2112
  }
2094
2113
  }, _react["default"].createElement(_PaginatedMessageListContext.PaginatedMessageListProvider, {
@@ -2096,7 +2115,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2096
2115
  __self: _this,
2097
2116
  __source: {
2098
2117
  fileName: _jsxFileName,
2099
- lineNumber: 2050,
2118
+ lineNumber: 2074,
2100
2119
  columnNumber: 13
2101
2120
  }
2102
2121
  }, _react["default"].createElement(_MessagesContext.MessagesProvider, {
@@ -2104,7 +2123,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2104
2123
  __self: _this,
2105
2124
  __source: {
2106
2125
  fileName: _jsxFileName,
2107
- lineNumber: 2051,
2126
+ lineNumber: 2075,
2108
2127
  columnNumber: 15
2109
2128
  }
2110
2129
  }, _react["default"].createElement(_ThreadContext.ThreadProvider, {
@@ -2112,7 +2131,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2112
2131
  __self: _this,
2113
2132
  __source: {
2114
2133
  fileName: _jsxFileName,
2115
- lineNumber: 2052,
2134
+ lineNumber: 2076,
2116
2135
  columnNumber: 17
2117
2136
  }
2118
2137
  }, _react["default"].createElement(_SuggestionsContext.SuggestionsProvider, {
@@ -2120,7 +2139,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2120
2139
  __self: _this,
2121
2140
  __source: {
2122
2141
  fileName: _jsxFileName,
2123
- lineNumber: 2053,
2142
+ lineNumber: 2077,
2124
2143
  columnNumber: 19
2125
2144
  }
2126
2145
  }, _react["default"].createElement(_MessageInputContext.MessageInputProvider, {
@@ -2128,7 +2147,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2128
2147
  __self: _this,
2129
2148
  __source: {
2130
2149
  fileName: _jsxFileName,
2131
- lineNumber: 2054,
2150
+ lineNumber: 2078,
2132
2151
  columnNumber: 21
2133
2152
  }
2134
2153
  }, _react["default"].createElement(_reactNative.View, {
@@ -2138,7 +2157,7 @@ var ChannelWithContext = function ChannelWithContext(props) {
2138
2157
  __self: _this,
2139
2158
  __source: {
2140
2159
  fileName: _jsxFileName,
2141
- lineNumber: 2055,
2160
+ lineNumber: 2079,
2142
2161
  columnNumber: 23
2143
2162
  }
2144
2163
  }, children))))))))));
@@ -2189,7 +2208,7 @@ var Channel = function Channel(props) {
2189
2208
  __self: _this,
2190
2209
  __source: {
2191
2210
  fileName: _jsxFileName,
2192
- lineNumber: 2112,
2211
+ lineNumber: 2136,
2193
2212
  columnNumber: 5
2194
2213
  }
2195
2214
  }));