@sendbird/uikit-react-native 3.2.0 → 3.4.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.
- package/lib/commonjs/components/ChannelInput/EditInput.js +2 -11
- package/lib/commonjs/components/ChannelInput/EditInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/SendInput.js +2 -11
- package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/index.js +30 -3
- package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js +148 -116
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
- package/lib/commonjs/components/FileViewer/FileViewerContent.js +140 -0
- package/lib/commonjs/components/FileViewer/FileViewerContent.js.map +1 -0
- package/lib/commonjs/components/FileViewer/FileViewerFooter.js +82 -0
- package/lib/commonjs/components/FileViewer/FileViewerFooter.js.map +1 -0
- package/lib/commonjs/components/FileViewer/FileViewerHeader.js +93 -0
- package/lib/commonjs/components/FileViewer/FileViewerHeader.js.map +1 -0
- package/lib/commonjs/components/FileViewer/index.js +133 -0
- package/lib/commonjs/components/FileViewer/index.js.map +1 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +34 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelHeader.js +14 -4
- package/lib/commonjs/domain/groupChannel/component/GroupChannelHeader.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +11 -9
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js +4 -1
- package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js.map +1 -1
- package/lib/commonjs/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js +4 -2
- package/lib/commonjs/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +18 -16
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/index.js +4 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +7 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/promise.js +138 -0
- package/lib/commonjs/utils/promise.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelInput/EditInput.js +3 -12
- package/lib/module/components/ChannelInput/EditInput.js.map +1 -1
- package/lib/module/components/ChannelInput/SendInput.js +3 -12
- package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/module/components/ChannelInput/index.js +32 -5
- package/lib/module/components/ChannelInput/index.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +148 -116
- package/lib/module/components/ChannelMessageList/index.js.map +1 -1
- package/lib/module/components/FileViewer/FileViewerContent.js +130 -0
- package/lib/module/components/FileViewer/FileViewerContent.js.map +1 -0
- package/lib/module/components/FileViewer/FileViewerFooter.js +74 -0
- package/lib/module/components/FileViewer/FileViewerFooter.js.map +1 -0
- package/lib/module/components/FileViewer/FileViewerHeader.js +85 -0
- package/lib/module/components/FileViewer/FileViewerHeader.js.map +1 -0
- package/lib/module/components/FileViewer/index.js +123 -0
- package/lib/module/components/FileViewer/index.js.map +1 -0
- package/lib/module/components/GroupChannelMessageRenderer/index.js +34 -2
- package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelHeader.js +15 -5
- package/lib/module/domain/groupChannel/component/GroupChannelHeader.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +11 -9
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/messageSearch/component/MessageSearchHeader.js +4 -1
- package/lib/module/domain/messageSearch/component/MessageSearchHeader.js.map +1 -1
- package/lib/module/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js +4 -2
- package/lib/module/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +19 -17
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +5 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/promise.js +132 -0
- package/lib/module/utils/promise.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/ChannelInput/index.d.ts +2 -0
- package/lib/typescript/src/components/ChannelMessageList/index.d.ts +4 -1
- package/lib/typescript/src/components/FileViewer/FileViewerContent.d.ts +13 -0
- package/lib/typescript/src/components/FileViewer/FileViewerFooter.d.ts +9 -0
- package/lib/typescript/src/components/FileViewer/FileViewerHeader.d.ts +10 -0
- package/lib/typescript/src/components/{FileViewer.d.ts → FileViewer/index.d.ts} +5 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/index.d.ts +3 -0
- package/lib/typescript/src/components/OpenChannelMessageRenderer/index.d.ts +2 -0
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +2 -2
- package/lib/typescript/src/domain/groupChannel/types.d.ts +5 -2
- package/lib/typescript/src/types.d.ts +4 -0
- package/lib/typescript/src/utils/promise.d.ts +7 -0
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +8 -7
- package/src/components/ChannelInput/EditInput.tsx +3 -15
- package/src/components/ChannelInput/SendInput.tsx +2 -9
- package/src/components/ChannelInput/index.tsx +27 -4
- package/src/components/ChannelMessageList/index.tsx +145 -115
- package/src/components/FileViewer/FileViewerContent.tsx +141 -0
- package/src/components/FileViewer/FileViewerFooter.tsx +73 -0
- package/src/components/FileViewer/FileViewerHeader.tsx +86 -0
- package/src/components/FileViewer/index.tsx +139 -0
- package/src/components/GroupChannelMessageRenderer/index.tsx +34 -2
- package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +3 -2
- package/src/domain/groupChannel/component/GroupChannelHeader.tsx +14 -3
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +8 -6
- package/src/domain/groupChannel/types.ts +6 -2
- package/src/domain/messageSearch/component/MessageSearchHeader.tsx +4 -1
- package/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.tsx +4 -2
- package/src/fragments/createGroupChannelFragment.tsx +25 -15
- package/src/index.ts +5 -1
- package/src/types.ts +5 -0
- package/src/utils/promise.ts +139 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/components/FileViewer.js +0 -300
- package/lib/commonjs/components/FileViewer.js.map +0 -1
- package/lib/module/components/FileViewer.js +0 -291
- package/lib/module/components/FileViewer.js.map +0 -1
- package/src/components/FileViewer.tsx +0 -288
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import { ReactNativeZoomableView } from '@openspacelabs/react-native-zoomable-view';
|
|
3
|
+
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { StyleSheet, useWindowDimensions } from 'react-native';
|
|
5
|
+
import { Box, Image, LoadingSpinner, createStyleSheet, useHeaderStyle, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
6
|
+
import { useIIFE } from '@sendbird/uikit-utils';
|
|
7
|
+
import { usePlatformService } from '../../hooks/useContext';
|
|
8
|
+
import SBUUtils from '../../libs/SBUUtils';
|
|
9
|
+
const FileViewerContent = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
type,
|
|
12
|
+
src,
|
|
13
|
+
topInset = 0,
|
|
14
|
+
bottomInset = 0,
|
|
15
|
+
maxZoom = 4,
|
|
16
|
+
minZoom = 1,
|
|
17
|
+
onPress
|
|
18
|
+
} = _ref;
|
|
19
|
+
const [loading, setLoading] = useState(true);
|
|
20
|
+
const {
|
|
21
|
+
defaultHeight
|
|
22
|
+
} = useHeaderStyle();
|
|
23
|
+
const {
|
|
24
|
+
mediaService
|
|
25
|
+
} = usePlatformService();
|
|
26
|
+
const {
|
|
27
|
+
palette
|
|
28
|
+
} = useUIKitTheme();
|
|
29
|
+
const source = {
|
|
30
|
+
uri: src
|
|
31
|
+
};
|
|
32
|
+
const onLoadEnd = () => setLoading(false);
|
|
33
|
+
const mediaViewer = useIIFE(() => {
|
|
34
|
+
switch (type) {
|
|
35
|
+
case 'image':
|
|
36
|
+
{
|
|
37
|
+
return /*#__PURE__*/React.createElement(ZoomableImageView, {
|
|
38
|
+
source: source,
|
|
39
|
+
style: StyleSheet.absoluteFill,
|
|
40
|
+
resizeMode: 'contain',
|
|
41
|
+
onLoadEnd: onLoadEnd,
|
|
42
|
+
zoomProps: {
|
|
43
|
+
minZoom,
|
|
44
|
+
maxZoom,
|
|
45
|
+
onTouchEnd: onPress
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
case 'video':
|
|
50
|
+
case 'audio':
|
|
51
|
+
{
|
|
52
|
+
return /*#__PURE__*/React.createElement(mediaService.VideoComponent, {
|
|
53
|
+
source: source,
|
|
54
|
+
style: [StyleSheet.absoluteFill, {
|
|
55
|
+
top: topInset,
|
|
56
|
+
bottom: defaultHeight + bottomInset
|
|
57
|
+
}],
|
|
58
|
+
resizeMode: 'contain',
|
|
59
|
+
onLoad: onLoadEnd
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
{
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
69
|
+
style: styles.container
|
|
70
|
+
}, mediaViewer, loading && /*#__PURE__*/React.createElement(LoadingSpinner, {
|
|
71
|
+
style: {
|
|
72
|
+
position: 'absolute'
|
|
73
|
+
},
|
|
74
|
+
size: 40,
|
|
75
|
+
color: palette.primary300
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
const ZoomableImageView = _ref2 => {
|
|
79
|
+
let {
|
|
80
|
+
zoomProps,
|
|
81
|
+
...props
|
|
82
|
+
} = _ref2;
|
|
83
|
+
const {
|
|
84
|
+
width,
|
|
85
|
+
height
|
|
86
|
+
} = useWindowDimensions();
|
|
87
|
+
const imageSize = useRef();
|
|
88
|
+
const [contentSizeProps, setContentSizeProps] = useState({
|
|
89
|
+
contentWidth: width,
|
|
90
|
+
contentHeight: height
|
|
91
|
+
});
|
|
92
|
+
useLayoutEffect(() => {
|
|
93
|
+
SBUUtils.safeRun(async () => {
|
|
94
|
+
if (props.source.uri) {
|
|
95
|
+
const image = imageSize.current ?? (await SBUUtils.getImageSize(props.source.uri));
|
|
96
|
+
imageSize.current = image;
|
|
97
|
+
const viewRatio = width / height;
|
|
98
|
+
const imageRatio = image.width / image.height;
|
|
99
|
+
const fitDirection = viewRatio > imageRatio ? 'height' : 'width';
|
|
100
|
+
const ratio = fitDirection === 'height' ? height / image.height : width / image.width;
|
|
101
|
+
const actualSize = {
|
|
102
|
+
width: image.width * ratio,
|
|
103
|
+
height: image.height * ratio
|
|
104
|
+
};
|
|
105
|
+
setContentSizeProps({
|
|
106
|
+
contentWidth: actualSize.width,
|
|
107
|
+
contentHeight: actualSize.height
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}, [props.source.uri, width, height]);
|
|
112
|
+
return /*#__PURE__*/React.createElement(ReactNativeZoomableView, _extends({
|
|
113
|
+
visualTouchFeedbackEnabled: false,
|
|
114
|
+
style: {
|
|
115
|
+
width,
|
|
116
|
+
height
|
|
117
|
+
},
|
|
118
|
+
initialZoom: 1
|
|
119
|
+
}, contentSizeProps, zoomProps), /*#__PURE__*/React.createElement(Image, props));
|
|
120
|
+
};
|
|
121
|
+
const styles = createStyleSheet({
|
|
122
|
+
container: {
|
|
123
|
+
zIndex: -1,
|
|
124
|
+
flex: 1,
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
justifyContent: 'center'
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
export default FileViewerContent;
|
|
130
|
+
//# sourceMappingURL=FileViewerContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNativeZoomableView","React","useLayoutEffect","useRef","useState","StyleSheet","useWindowDimensions","Box","Image","LoadingSpinner","createStyleSheet","useHeaderStyle","useUIKitTheme","useIIFE","usePlatformService","SBUUtils","FileViewerContent","_ref","type","src","topInset","bottomInset","maxZoom","minZoom","onPress","loading","setLoading","defaultHeight","mediaService","palette","source","uri","onLoadEnd","mediaViewer","createElement","ZoomableImageView","style","absoluteFill","resizeMode","zoomProps","onTouchEnd","VideoComponent","top","bottom","onLoad","styles","container","position","size","color","primary300","_ref2","props","width","height","imageSize","contentSizeProps","setContentSizeProps","contentWidth","contentHeight","safeRun","image","current","getImageSize","viewRatio","imageRatio","fitDirection","ratio","actualSize","_extends","visualTouchFeedbackEnabled","initialZoom","zIndex","flex","alignItems","justifyContent"],"sources":["FileViewerContent.tsx"],"sourcesContent":["import { ReactNativeZoomableView, ReactNativeZoomableViewProps } from '@openspacelabs/react-native-zoomable-view';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport { ImageProps, ImageStyle, ImageURISource, StyleProp, StyleSheet, useWindowDimensions } from 'react-native';\n\nimport {\n Box,\n Image,\n LoadingSpinner,\n createStyleSheet,\n useHeaderStyle,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { FileType, useIIFE } from '@sendbird/uikit-utils';\n\nimport { usePlatformService } from '../../hooks/useContext';\nimport SBUUtils from '../../libs/SBUUtils';\n\ntype Props = {\n type: FileType;\n src: string;\n topInset?: number;\n bottomInset?: number;\n maxZoom?: number;\n minZoom?: number;\n onPress?: () => void;\n};\nconst FileViewerContent = ({ type, src, topInset = 0, bottomInset = 0, maxZoom = 4, minZoom = 1, onPress }: Props) => {\n const [loading, setLoading] = useState(true);\n\n const { defaultHeight } = useHeaderStyle();\n const { mediaService } = usePlatformService();\n const { palette } = useUIKitTheme();\n\n const source = { uri: src };\n const onLoadEnd = () => setLoading(false);\n const mediaViewer = useIIFE(() => {\n switch (type) {\n case 'image': {\n return (\n <ZoomableImageView\n source={source}\n style={StyleSheet.absoluteFill}\n resizeMode={'contain'}\n onLoadEnd={onLoadEnd}\n zoomProps={{\n minZoom,\n maxZoom,\n onTouchEnd: onPress,\n }}\n />\n );\n }\n\n case 'video':\n case 'audio': {\n return (\n <mediaService.VideoComponent\n source={source}\n style={[StyleSheet.absoluteFill, { top: topInset, bottom: defaultHeight + bottomInset }]}\n resizeMode={'contain'}\n onLoad={onLoadEnd}\n />\n );\n }\n\n default: {\n return null;\n }\n }\n });\n\n return (\n <Box style={styles.container}>\n {mediaViewer}\n {loading && <LoadingSpinner style={{ position: 'absolute' }} size={40} color={palette.primary300} />}\n </Box>\n );\n};\n\nconst ZoomableImageView = ({\n zoomProps,\n ...props\n}: {\n source: ImageURISource;\n style: StyleProp<ImageStyle>;\n resizeMode: ImageProps['resizeMode'];\n onLoadEnd: () => void;\n zoomProps?: ReactNativeZoomableViewProps;\n}) => {\n const { width, height } = useWindowDimensions();\n\n const imageSize = useRef<{ width: number; height: number }>();\n const [contentSizeProps, setContentSizeProps] = useState<ReactNativeZoomableViewProps>({\n contentWidth: width,\n contentHeight: height,\n });\n\n useLayoutEffect(() => {\n SBUUtils.safeRun(async () => {\n if (props.source.uri) {\n const image = imageSize.current ?? (await SBUUtils.getImageSize(props.source.uri));\n imageSize.current = image;\n\n const viewRatio = width / height;\n const imageRatio = image.width / image.height;\n\n const fitDirection = viewRatio > imageRatio ? 'height' : 'width';\n const ratio = fitDirection === 'height' ? height / image.height : width / image.width;\n const actualSize = { width: image.width * ratio, height: image.height * ratio };\n\n setContentSizeProps({\n contentWidth: actualSize.width,\n contentHeight: actualSize.height,\n });\n }\n });\n }, [props.source.uri, width, height]);\n\n return (\n <ReactNativeZoomableView\n visualTouchFeedbackEnabled={false}\n style={{ width, height }}\n initialZoom={1}\n {...contentSizeProps}\n {...zoomProps}\n >\n <Image {...props} />\n </ReactNativeZoomableView>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n zIndex: -1,\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport default FileViewerContent;\n"],"mappings":";AAAA,SAASA,uBAAuB,QAAsC,2CAA2C;AACjH,OAAOC,KAAK,IAAIC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAA4DC,UAAU,EAAEC,mBAAmB,QAAQ,cAAc;AAEjH,SACEC,GAAG,EACHC,KAAK,EACLC,cAAc,EACdC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,QACR,yCAAyC;AAChD,SAAmBC,OAAO,QAAQ,uBAAuB;AAEzD,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,OAAOC,QAAQ,MAAM,qBAAqB;AAW1C,MAAMC,iBAAiB,GAAGC,IAAA,IAA4F;EAAA,IAA3F;IAAEC,IAAI;IAAEC,GAAG;IAAEC,QAAQ,GAAG,CAAC;IAAEC,WAAW,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC;EAAe,CAAC,GAAAP,IAAA;EAC/G,MAAM,CAACQ,OAAO,EAAEC,UAAU,CAAC,GAAGtB,QAAQ,CAAC,IAAI,CAAC;EAE5C,MAAM;IAAEuB;EAAc,C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ES,UAAU,CAACd;QAC5B,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACF,KAAK,CAACtB,MAAM,CAACC,GAAG,EAAEsB,KAAK,EAAEC,MAAM,CAAC,CAAC;EAErC,oBACErD,KAAA,CAAAiC,aAAA,CAAClC,uBAAuB,EAAAqE,QAAA;IACtBC,0BAA0B,EAAE,KAAM;IAClClC,KAAK,EAAE;MAAEiB,KAAK;MAAEC;IAAO,CAAE;IACzBiB,WAAW,EAAE;EAAE,GACXf,gBAAgB,EAChBjB,SAAS,gBAEbtC,KAAA,CAAAiC,aAAA,CAAC1B,KAAK,EAAK4C,KAAK,CAAI,CACI;AAE9B,CAAC;AAED,MAAMP,MAAM,GAAGnC,gBAAgB,CAAC;EAC9BoC,SAAS,EAAE;IACT0B,MAAM,EAAE,CAAC,CAAC;IACVC,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAe3D,iBAAiB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { Box, Icon, PressBox, createStyleSheet, useHeaderStyle, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
+
const FileViewerFooter = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
bottomInset,
|
|
7
|
+
deleteShown,
|
|
8
|
+
onPressDelete,
|
|
9
|
+
onPressDownload
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
palette
|
|
13
|
+
} = useUIKitTheme();
|
|
14
|
+
const {
|
|
15
|
+
defaultHeight
|
|
16
|
+
} = useHeaderStyle();
|
|
17
|
+
const {
|
|
18
|
+
left,
|
|
19
|
+
right
|
|
20
|
+
} = useSafeAreaInsets();
|
|
21
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
22
|
+
style: [styles.container, {
|
|
23
|
+
paddingLeft: styles.container.paddingHorizontal + left,
|
|
24
|
+
paddingRight: styles.container.paddingHorizontal + right,
|
|
25
|
+
paddingBottom: bottomInset,
|
|
26
|
+
height: defaultHeight + bottomInset,
|
|
27
|
+
backgroundColor: palette.overlay01
|
|
28
|
+
}]
|
|
29
|
+
}, /*#__PURE__*/React.createElement(PressBox, {
|
|
30
|
+
activeOpacity: 0.75,
|
|
31
|
+
onPress: onPressDownload,
|
|
32
|
+
style: styles.buttonContainer
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
icon: 'download',
|
|
35
|
+
size: 24,
|
|
36
|
+
color: palette.onBackgroundDark01
|
|
37
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
38
|
+
style: styles.titleContainer
|
|
39
|
+
}), /*#__PURE__*/React.createElement(PressBox, {
|
|
40
|
+
activeOpacity: 0.75,
|
|
41
|
+
onPress: onPressDelete,
|
|
42
|
+
style: styles.buttonContainer,
|
|
43
|
+
disabled: !deleteShown
|
|
44
|
+
}, deleteShown && /*#__PURE__*/React.createElement(Icon, {
|
|
45
|
+
icon: 'delete',
|
|
46
|
+
size: 24,
|
|
47
|
+
color: palette.onBackgroundDark01
|
|
48
|
+
})));
|
|
49
|
+
};
|
|
50
|
+
const styles = createStyleSheet({
|
|
51
|
+
container: {
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
paddingHorizontal: 12
|
|
60
|
+
},
|
|
61
|
+
buttonContainer: {
|
|
62
|
+
width: 32,
|
|
63
|
+
height: 32,
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center'
|
|
66
|
+
},
|
|
67
|
+
titleContainer: {
|
|
68
|
+
flex: 1,
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
justifyContent: 'center'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
export default FileViewerFooter;
|
|
74
|
+
//# sourceMappingURL=FileViewerFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useSafeAreaInsets","Box","Icon","PressBox","createStyleSheet","useHeaderStyle","useUIKitTheme","FileViewerFooter","_ref","bottomInset","deleteShown","onPressDelete","onPressDownload","palette","defaultHeight","left","right","createElement","style","styles","container","paddingLeft","paddingHorizontal","paddingRight","paddingBottom","height","backgroundColor","overlay01","activeOpacity","onPress","buttonContainer","icon","size","color","onBackgroundDark01","titleContainer","disabled","position","bottom","flexDirection","alignItems","justifyContent","width","flex"],"sources":["FileViewerFooter.tsx"],"sourcesContent":["import React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport {\n Box,\n Icon,\n PressBox,\n createStyleSheet,\n useHeaderStyle,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\n\ntype Props = {\n bottomInset: number;\n deleteShown: boolean;\n onPressDelete: () => void;\n onPressDownload: () => void;\n};\n\nconst FileViewerFooter = ({ bottomInset, deleteShown, onPressDelete, onPressDownload }: Props) => {\n const { palette } = useUIKitTheme();\n const { defaultHeight } = useHeaderStyle();\n const { left, right } = useSafeAreaInsets();\n\n return (\n <Box\n style={[\n styles.container,\n {\n paddingLeft: styles.container.paddingHorizontal + left,\n paddingRight: styles.container.paddingHorizontal + right,\n paddingBottom: bottomInset,\n height: defaultHeight + bottomInset,\n backgroundColor: palette.overlay01,\n },\n ]}\n >\n <PressBox activeOpacity={0.75} onPress={onPressDownload} style={styles.buttonContainer}>\n <Icon icon={'download'} size={24} color={palette.onBackgroundDark01} />\n </PressBox>\n <Box style={styles.titleContainer} />\n <PressBox activeOpacity={0.75} onPress={onPressDelete} style={styles.buttonContainer} disabled={!deleteShown}>\n {deleteShown && <Icon icon={'delete'} size={24} color={palette.onBackgroundDark01} />}\n </PressBox>\n </Box>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 12,\n },\n buttonContainer: {\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n },\n titleContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport default FileViewerFooter;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SACEC,GAAG,EACHC,IAAI,EACJC,QAAQ,EACRC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,QACR,yCAAyC;AAShD,MAAMC,gBAAgB,GAAGC,IAAA,IAAyE;EAAA,IAAxE;IAAEC,WAAW;IAAEC,WAAW;IAAEC,aAAa;IAAEC;EAAuB,CAAC,GAAAJ,IAAA;EAC3F,MAAM;IAAEK;EAAQ,CAAC,GAAGP,aAAa,EAAE;EACnC,MAAM;IAAEQ;EAAc,CAAC,GAAGT,cAAc,EAAE;EAC1C,MAAM;IAAEU,IAAI;IAAEC;EAAM,CAAC,GAAGhB,iBAAiB,EAAE;EAE3C,oBACED,KAAA,CAAAkB,aAAA,CAAChB,GAAG;IACFiB,KAAK,EAAE,CACLC,MAAM,CAACC,SAAS,EAChB;MACEC,WAAW,EAAEF,MAAM,CAACC,SAAS,CAACE,iBAAiB,GAAGP,IAAI;MACtDQ,YAAY,EAAEJ,MAAM,CAACC,SAAS,CAACE,iBAAiB,GAAGN,KAAK;MACxDQ,aAAa,EAAEf,WAAW;MAC1BgB,MAAM,EAAEX,aAAa,GAAGL,WAAW;MACnCiB,eAAe,EAAEb,OAAO,CAACc;IAC3B,CAAC;EACD,gBAEF5B,KAAA,CAAAkB,aAAA,CAACd,QAAQ;IAACyB,aAAa,EAAE,IAAK;IAACC,OAAO,EAAEjB,eAAgB;IAACM,KAAK,EAAEC,MAAM,CAACW;EAAgB,gBACrF/B,KAAA,CAAAkB,aAAA,CAACf,IAAI;IAAC6B,IAAI,EAAE,UAAW;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAEpB,OAAO,CAACqB;EAAmB,EAAG,CAC9D,eACXnC,KAAA,CAAAkB,aAAA,CAAChB,GAAG;IAACiB,KAAK,EAAEC,MAAM,CAACgB;EAAe,EAAG,eACrCpC,KAAA,CAAAkB,aAAA,CAACd,QAAQ;IAACyB,aAAa,EAAE,IAAK;IAACC,OAAO,EAAElB,aAAc;IAACO,KAAK,EAAEC,MAAM,CAACW,eAAgB;IAACM,QAAQ,EAAE,CAAC1B;EAAY,GAC1GA,WAAW,iBAAIX,KAAA,CAAAkB,aAAA,CAACf,IAAI;IAAC6B,IAAI,EAAE,QAAS;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAEpB,OAAO,CAACqB;EAAmB,EAAG,CAC5E,CACP;AAEV,CAAC;AAED,MAAMf,MAAM,GAAGf,gBAAgB,CAAC;EAC9BgB,SAAS,EAAE;IACTiB,QAAQ,EAAE,UAAU;IACpBtB,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRsB,MAAM,EAAE,CAAC;IACTC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBnB,iBAAiB,EAAE;EACrB,CAAC;EACDQ,eAAe,EAAE;IACfY,KAAK,EAAE,EAAE;IACTjB,MAAM,EAAE,EAAE;IACVe,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDN,cAAc,EAAE;IACdQ,IAAI,EAAE,CAAC;IACPH,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAelC,gBAAgB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { Box, Icon, PressBox, Text, createStyleSheet, useHeaderStyle, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
+
import { truncate } from '@sendbird/uikit-utils';
|
|
5
|
+
const FileViewerHeader = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
headerShown = true,
|
|
8
|
+
topInset,
|
|
9
|
+
onClose,
|
|
10
|
+
subtitle,
|
|
11
|
+
title
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
palette
|
|
15
|
+
} = useUIKitTheme();
|
|
16
|
+
const {
|
|
17
|
+
defaultHeight
|
|
18
|
+
} = useHeaderStyle();
|
|
19
|
+
const {
|
|
20
|
+
left,
|
|
21
|
+
right
|
|
22
|
+
} = useSafeAreaInsets();
|
|
23
|
+
if (!headerShown) return null;
|
|
24
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
25
|
+
style: [styles.container, {
|
|
26
|
+
paddingLeft: styles.container.paddingHorizontal + left,
|
|
27
|
+
paddingRight: styles.container.paddingHorizontal + right,
|
|
28
|
+
paddingTop: topInset,
|
|
29
|
+
height: defaultHeight + topInset,
|
|
30
|
+
backgroundColor: palette.overlay01
|
|
31
|
+
}]
|
|
32
|
+
}, /*#__PURE__*/React.createElement(PressBox, {
|
|
33
|
+
activeOpacity: 0.75,
|
|
34
|
+
onPress: onClose,
|
|
35
|
+
style: styles.buttonContainer
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
37
|
+
icon: 'close',
|
|
38
|
+
size: 24,
|
|
39
|
+
color: palette.onBackgroundDark01
|
|
40
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
41
|
+
style: styles.titleContainer
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
43
|
+
h2: true,
|
|
44
|
+
color: palette.onBackgroundDark01,
|
|
45
|
+
style: styles.title,
|
|
46
|
+
numberOfLines: 1
|
|
47
|
+
}, truncate(title, {
|
|
48
|
+
mode: 'mid',
|
|
49
|
+
maxLen: 18
|
|
50
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
51
|
+
caption2: true,
|
|
52
|
+
color: palette.onBackgroundDark01,
|
|
53
|
+
numberOfLines: 1
|
|
54
|
+
}, subtitle)), /*#__PURE__*/React.createElement(Box, {
|
|
55
|
+
style: styles.buttonContainer
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
const styles = createStyleSheet({
|
|
59
|
+
container: {
|
|
60
|
+
top: 0,
|
|
61
|
+
left: 0,
|
|
62
|
+
right: 0,
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
paddingHorizontal: 12
|
|
68
|
+
},
|
|
69
|
+
buttonContainer: {
|
|
70
|
+
width: 32,
|
|
71
|
+
height: 32,
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
justifyContent: 'center'
|
|
74
|
+
},
|
|
75
|
+
titleContainer: {
|
|
76
|
+
flex: 1,
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
justifyContent: 'center'
|
|
79
|
+
},
|
|
80
|
+
title: {
|
|
81
|
+
marginBottom: 2
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export default FileViewerHeader;
|
|
85
|
+
//# sourceMappingURL=FileViewerHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useSafeAreaInsets","Box","Icon","PressBox","Text","createStyleSheet","useHeaderStyle","useUIKitTheme","truncate","FileViewerHeader","_ref","headerShown","topInset","onClose","subtitle","title","palette","defaultHeight","left","right","createElement","style","styles","container","paddingLeft","paddingHorizontal","paddingRight","paddingTop","height","backgroundColor","overlay01","activeOpacity","onPress","buttonContainer","icon","size","color","onBackgroundDark01","titleContainer","h2","numberOfLines","mode","maxLen","caption2","top","position","flexDirection","alignItems","justifyContent","width","flex","marginBottom"],"sources":["FileViewerHeader.tsx"],"sourcesContent":["import React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport {\n Box,\n Icon,\n PressBox,\n Text,\n createStyleSheet,\n useHeaderStyle,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { truncate } from '@sendbird/uikit-utils';\n\ntype Props = {\n headerShown?: boolean;\n topInset: number;\n onClose: () => void;\n title: string;\n subtitle: string;\n};\n\nconst FileViewerHeader = ({ headerShown = true, topInset, onClose, subtitle, title }: Props) => {\n const { palette } = useUIKitTheme();\n const { defaultHeight } = useHeaderStyle();\n const { left, right } = useSafeAreaInsets();\n\n if (!headerShown) return null;\n\n return (\n <Box\n style={[\n styles.container,\n {\n paddingLeft: styles.container.paddingHorizontal + left,\n paddingRight: styles.container.paddingHorizontal + right,\n paddingTop: topInset,\n height: defaultHeight + topInset,\n backgroundColor: palette.overlay01,\n },\n ]}\n >\n <PressBox activeOpacity={0.75} onPress={onClose} style={styles.buttonContainer}>\n <Icon icon={'close'} size={24} color={palette.onBackgroundDark01} />\n </PressBox>\n <Box style={styles.titleContainer}>\n <Text h2 color={palette.onBackgroundDark01} style={styles.title} numberOfLines={1}>\n {truncate(title, { mode: 'mid', maxLen: 18 })}\n </Text>\n <Text caption2 color={palette.onBackgroundDark01} numberOfLines={1}>\n {subtitle}\n </Text>\n </Box>\n <Box style={styles.buttonContainer} />\n </Box>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n top: 0,\n left: 0,\n right: 0,\n position: 'absolute',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 12,\n },\n buttonContainer: {\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n },\n titleContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: {\n marginBottom: 2,\n },\n});\n\nexport default FileViewerHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SACEC,GAAG,EACHC,IAAI,EACJC,QAAQ,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AAI;IAACmC,EAAE;IAACH,KAAK,EAAEpB,OAAO,CAACqB,kBAAmB;IAAChB,KAAK,EAAEC,MAAM,CAACP,KAAM;IAACyB,aAAa,EAAE;EAAE,GAC/EhC,QAAQ,CAACO,KAAK,EAAE;IAAE0B,IAAI,EAAE,KAAK;IAAEC,MAAM,EAAE;EAAG,CAAC,CAAC,CACxC,eACP3C,KAAA,CAAAqB,aAAA,CAAChB,IAAI;IAACuC,QAAQ;IAACP,KAAK,EAAEpB,OAAO,CAACqB,kBAAmB;IAACG,aAAa,EAAE;EAAE,GAChE1B,QAAQ,CACJ,CACH,eACNf,KAAA,CAAAqB,aAAA,CAACnB,GAAG;IAACoB,KAAK,EAAEC,MAAM,CAACW;EAAgB,EAAG,CAClC;AAEV,CAAC;AAED,MAAMX,MAAM,GAAGjB,gBAAgB,CAAC;EAC9BkB,SAAS,EAAE;IACTqB,GAAG,EAAE,CAAC;IACN1B,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACR0B,QAAQ,EAAE,UAAU;IACpBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBvB,iBAAiB,EAAE;EACrB,CAAC;EACDQ,eAAe,EAAE;IACfgB,KAAK,EAAE,EAAE;IACTrB,MAAM,EAAE,EAAE;IACVmB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDV,cAAc,EAAE;IACdY,IAAI,EAAE,CAAC;IACPH,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDjC,KAAK,EAAE;IACLoC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAe1C,gBAAgB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { StatusBar } from 'react-native';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import { Box, useAlert, useHeaderStyle, useToast, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
5
|
+
import { Logger, getFileExtension, getFileType, isMyMessage, toMegabyte } from '@sendbird/uikit-utils';
|
|
6
|
+
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
7
|
+
import FileViewerContent from './FileViewerContent';
|
|
8
|
+
import FileViewerFooter from './FileViewerFooter';
|
|
9
|
+
import FileViewerHeader from './FileViewerHeader';
|
|
10
|
+
const FileViewer = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
headerShown = true,
|
|
13
|
+
maxZoom = 3,
|
|
14
|
+
minZoom = 1,
|
|
15
|
+
headerTopInset,
|
|
16
|
+
fileMessage,
|
|
17
|
+
onClose,
|
|
18
|
+
onPressDownload,
|
|
19
|
+
onPressDelete,
|
|
20
|
+
deleteMessage
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
topInset,
|
|
24
|
+
statusBarTranslucent
|
|
25
|
+
} = useHeaderStyle();
|
|
26
|
+
const {
|
|
27
|
+
bottom
|
|
28
|
+
} = useSafeAreaInsets();
|
|
29
|
+
const {
|
|
30
|
+
palette
|
|
31
|
+
} = useUIKitTheme();
|
|
32
|
+
const {
|
|
33
|
+
alert
|
|
34
|
+
} = useAlert();
|
|
35
|
+
const {
|
|
36
|
+
show
|
|
37
|
+
} = useToast();
|
|
38
|
+
const {
|
|
39
|
+
fileService
|
|
40
|
+
} = usePlatformService();
|
|
41
|
+
const {
|
|
42
|
+
currentUser
|
|
43
|
+
} = useSendbirdChat();
|
|
44
|
+
const {
|
|
45
|
+
STRINGS
|
|
46
|
+
} = useLocalization();
|
|
47
|
+
const fileType = getFileType(fileMessage.type || getFileExtension(fileMessage.url));
|
|
48
|
+
const canDelete = isMyMessage(fileMessage, currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId);
|
|
49
|
+
const basicTopInset = statusBarTranslucent ? topInset : 0;
|
|
50
|
+
const onPressDeleteButton = () => {
|
|
51
|
+
if (!canDelete) return;
|
|
52
|
+
if (onPressDelete) {
|
|
53
|
+
onPressDelete(fileMessage);
|
|
54
|
+
} else {
|
|
55
|
+
alert({
|
|
56
|
+
title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE,
|
|
57
|
+
buttons: [{
|
|
58
|
+
text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL
|
|
59
|
+
}, {
|
|
60
|
+
text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_OK,
|
|
61
|
+
style: 'destructive',
|
|
62
|
+
onPress: () => {
|
|
63
|
+
deleteMessage().then(() => {
|
|
64
|
+
onClose();
|
|
65
|
+
}).catch(() => {
|
|
66
|
+
show(STRINGS.TOAST.DELETE_MSG_ERROR, 'error');
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const onPressDownloadButton = () => {
|
|
74
|
+
if (onPressDownload) {
|
|
75
|
+
onPressDownload(fileMessage);
|
|
76
|
+
} else {
|
|
77
|
+
if (toMegabyte(fileMessage.size) > 4) {
|
|
78
|
+
show(STRINGS.TOAST.DOWNLOAD_START, 'success');
|
|
79
|
+
}
|
|
80
|
+
fileService.save({
|
|
81
|
+
fileUrl: fileMessage.url,
|
|
82
|
+
fileName: fileMessage.name,
|
|
83
|
+
fileType: fileMessage.type
|
|
84
|
+
}).then(response => {
|
|
85
|
+
show(STRINGS.TOAST.DOWNLOAD_OK, 'success');
|
|
86
|
+
Logger.log('File saved to', response);
|
|
87
|
+
}).catch(err => {
|
|
88
|
+
show(STRINGS.TOAST.DOWNLOAD_ERROR, 'error');
|
|
89
|
+
Logger.log('File save failure', err);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (fileType === 'file') onClose();
|
|
95
|
+
}, []);
|
|
96
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
97
|
+
flex: 1,
|
|
98
|
+
backgroundColor: palette.background700
|
|
99
|
+
}, /*#__PURE__*/React.createElement(StatusBar, {
|
|
100
|
+
barStyle: 'light-content',
|
|
101
|
+
animated: true
|
|
102
|
+
}), /*#__PURE__*/React.createElement(FileViewerHeader, {
|
|
103
|
+
topInset: headerTopInset ?? basicTopInset,
|
|
104
|
+
headerShown: headerShown,
|
|
105
|
+
title: STRINGS.FILE_VIEWER.TITLE(fileMessage),
|
|
106
|
+
subtitle: STRINGS.FILE_VIEWER.SUBTITLE(fileMessage),
|
|
107
|
+
onClose: onClose
|
|
108
|
+
}), /*#__PURE__*/React.createElement(FileViewerContent, {
|
|
109
|
+
topInset: headerTopInset ?? basicTopInset,
|
|
110
|
+
bottomInset: bottom,
|
|
111
|
+
type: fileType,
|
|
112
|
+
src: fileMessage.url,
|
|
113
|
+
maxZoom: maxZoom,
|
|
114
|
+
minZoom: minZoom
|
|
115
|
+
}), /*#__PURE__*/React.createElement(FileViewerFooter, {
|
|
116
|
+
bottomInset: bottom,
|
|
117
|
+
deleteShown: canDelete,
|
|
118
|
+
onPressDelete: onPressDeleteButton,
|
|
119
|
+
onPressDownload: onPressDownloadButton
|
|
120
|
+
}));
|
|
121
|
+
};
|
|
122
|
+
export default FileViewer;
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","StatusBar","useSafeAreaInsets","Box","useAlert","useHeaderStyle","useToast","useUIKitTheme","Logger","getFileExtension","getFileType","isMyMessage","toMegabyte","useLocalization","usePlatformService","useSendbirdChat","FileViewerContent","FileViewerFooter","FileViewerHeader","FileViewer","_ref","headerShown","maxZoom","minZoom","headerTopInset","fileMessage","onClose","onPressDownload","onPressDelete","deleteMessage","topInset","statusBarTranslucent","bottom","palette","alert","show","fileService","currentUser","STRINGS","fileType","type","url","canDelete","userId","basicTopInset","onPressDeleteButton","title","LABELS","CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE","buttons","text","CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL","CHANNEL_MESSAGE_DELETE_CONFIRM_OK","style","onPress","then","catch","TOAST","DELETE_MSG_ERROR","onPressDownloadButton","size","DOWNLOAD_START","save","fileUrl","fileName","name","response","DOWNLOAD_OK","log","err","DOWNLOAD_ERROR","createElement","flex","backgroundColor","background700","barStyle","animated","FILE_VIEWER","TITLE","subtitle","SUBTITLE","bottomInset","src","deleteShown"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StatusBar } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { Box, useAlert, useHeaderStyle, useToast, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdFileMessage } from '@sendbird/uikit-utils';\nimport { Logger, getFileExtension, getFileType, isMyMessage, toMegabyte } from '@sendbird/uikit-utils';\n\nimport { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';\nimport FileViewerContent from './FileViewerContent';\nimport FileViewerFooter from './FileViewerFooter';\nimport FileViewerHeader from './FileViewerHeader';\n\ntype Props = {\n fileMessage: SendbirdFileMessage;\n deleteMessage: () => Promise<void>;\n\n onClose: () => void;\n onPressDownload?: (message: SendbirdFileMessage) => void;\n onPressDelete?: (message: SendbirdFileMessage) => void;\n\n headerShown?: boolean;\n headerTopInset?: number;\n\n /** This prop is only available on the Image viewer */\n minZoom?: number;\n /** This prop is only available on the Image viewer */\n maxZoom?: number;\n};\n\nconst FileViewer = ({\n headerShown = true,\n maxZoom = 3,\n minZoom = 1,\n headerTopInset,\n fileMessage,\n onClose,\n onPressDownload,\n onPressDelete,\n deleteMessage,\n}: Props) => {\n const { topInset, statusBarTranslucent } = useHeaderStyle();\n const { bottom } = useSafeAreaInsets();\n const { palette } = useUIKitTheme();\n const { alert } = useAlert();\n const { show } = useToast();\n\n const { fileService } = usePlatformService();\n const { currentUser } = useSendbirdChat();\n const { STRINGS } = useLocalization();\n\n const fileType = getFileType(fileMessage.type || getFileExtension(fileMessage.url));\n const canDelete = isMyMessage(fileMessage, currentUser?.userId);\n const basicTopInset = statusBarTranslucent ? topInset : 0;\n\n const onPressDeleteButton = () => {\n if (!canDelete) return;\n\n if (onPressDelete) {\n onPressDelete(fileMessage);\n } else {\n alert({\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE,\n buttons: [\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL,\n },\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_OK,\n style: 'destructive',\n onPress: () => {\n deleteMessage()\n .then(() => {\n onClose();\n })\n .catch(() => {\n show(STRINGS.TOAST.DELETE_MSG_ERROR, 'error');\n });\n },\n },\n ],\n });\n }\n };\n\n const onPressDownloadButton = () => {\n if (onPressDownload) {\n onPressDownload(fileMessage);\n } else {\n if (toMegabyte(fileMessage.size) > 4) {\n show(STRINGS.TOAST.DOWNLOAD_START, 'success');\n }\n\n fileService\n .save({ fileUrl: fileMessage.url, fileName: fileMessage.name, fileType: fileMessage.type })\n .then((response) => {\n show(STRINGS.TOAST.DOWNLOAD_OK, 'success');\n Logger.log('File saved to', response);\n })\n .catch((err) => {\n show(STRINGS.TOAST.DOWNLOAD_ERROR, 'error');\n Logger.log('File save failure', err);\n });\n }\n };\n\n useEffect(() => {\n if (fileType === 'file') onClose();\n }, []);\n\n return (\n <Box flex={1} backgroundColor={palette.background700}>\n <StatusBar barStyle={'light-content'} animated />\n <FileViewerHeader\n topInset={headerTopInset ?? basicTopInset}\n headerShown={headerShown}\n title={STRINGS.FILE_VIEWER.TITLE(fileMessage)}\n subtitle={STRINGS.FILE_VIEWER.SUBTITLE(fileMessage)}\n onClose={onClose}\n />\n <FileViewerContent\n topInset={headerTopInset ?? basicTopInset}\n bottomInset={bottom}\n type={fileType}\n src={fileMessage.url}\n maxZoom={maxZoom}\n minZoom={minZoom}\n />\n <FileViewerFooter\n bottomInset={bottom}\n deleteShown={canDelete}\n onPressDelete={onPressDeleteButton}\n onPressDownload={onPressDownloadButton}\n />\n </Box>\n );\n};\n\nexport default FileViewer;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,GAAG,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yCAAyC;AAEhH,SAASC,MAAM,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,WAAW,EAAEC,UAAU,QAAQ,uBAAuB;AAEtG,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAwB;AAC7F,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AAmBjD,MAAMC,UAAU,GAAGC,IAAA,IAUN;EAAA,IAVO;IAClBC,WAAW,GAAG,IAAI;IAClBC,OAAO,GAAG,CAAC;IACXC,OAAO,GAAG,CAAC;IACXC,cAAc;IACdC,WAAW;IACXC,OAAO;IACPC,eAAe;IACfC,aAAa;IACbC;EACK,CAAC,GAAAT,IAAA;EACN,MAAM;IAAEU,QAAQ;IAAEC;EAAqB,CAAC,GAAG1B,cAAc,EAAE;EAC3D,MAAM;IAAE2B;EAAO,CAAC,GAAG9B,iBAAiB,EAAE;EACtC,MAAM;IAAE+B;EAAQ,CAAC,GAAG1B,aAAa,EAAE;EACnC,MAAM;IAAE2B;EAAM,CAAC,GAAG9B,QAAQ,EAAE;EAC5B,MAAM;IAAE+B;EAAK,CAAC,GAAG7B,QAAQ,EAAE;EAE3B,MAAM;IAAE8B;EAAY,CAAC,GAAGtB,kBAAkB,EAAE;EAC5C,MAAM;IAAEuB;EAAY,CAAC,GAAGtB,eAAe,EAAE;EACzC,MAAM;I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QAAQ,EAAEN,cAAc,IAAIoB,aAAc;IAC1CqC,WAAW,EAAEjD,MAAO;IACpBQ,IAAI,EAAED,QAAS;IACf2C,GAAG,EAAEzD,WAAW,CAACgB,GAAI;IACrBnB,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA;EAAQ,EACjB,eACFxB,KAAA,CAAAwE,aAAA,CAACtD,gBAAgB;IACfgE,WAAW,EAAEjD,MAAO;IACpBmD,WAAW,EAAEzC,SAAU;IACvBd,aAAa,EAAEiB,mBAAoB;IACnClB,eAAe,EAAEgC;EAAsB,EACvC,CACE;AAEV,CAAC;AAED,eAAexC,UAAU"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import React, { useRef } from 'react';
|
|
3
|
-
import { Box, GroupChannelMessage, Text, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
2
|
+
import React, { useContext, useEffect, useRef } from 'react';
|
|
3
|
+
import { Box, GroupChannelMessage, Text, TypingIndicatorBubble, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
4
4
|
import { calcMessageGrouping, getMessageType, isMyMessage, isVoiceMessage, shouldRenderParentMessage, shouldRenderReaction, useIIFE } from '@sendbird/uikit-utils';
|
|
5
5
|
import { VOICE_MESSAGE_META_ARRAY_DURATION_KEY } from '../../constants';
|
|
6
|
+
import { GroupChannelContexts } from '../../domain/groupChannel/module/moduleContext';
|
|
6
7
|
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
7
8
|
import SBUUtils from '../../libs/SBUUtils';
|
|
9
|
+
import { TypingIndicatorType } from '../../types';
|
|
8
10
|
import { ReactionAddons } from '../ReactionAddons';
|
|
9
11
|
import GroupChannelMessageDateSeparator from './GroupChannelMessageDateSeparator';
|
|
10
12
|
import GroupChannelMessageFocusAnimation from './GroupChannelMessageFocusAnimation';
|
|
@@ -296,5 +298,35 @@ const GroupChannelMessageRenderer = _ref => {
|
|
|
296
298
|
focused: focused
|
|
297
299
|
}, renderMessage()));
|
|
298
300
|
};
|
|
301
|
+
export const GroupChannelTypingIndicatorBubble = () => {
|
|
302
|
+
const {
|
|
303
|
+
sbOptions
|
|
304
|
+
} = useSendbirdChat();
|
|
305
|
+
const {
|
|
306
|
+
publish
|
|
307
|
+
} = useContext(GroupChannelContexts.PubSub);
|
|
308
|
+
const {
|
|
309
|
+
typingUsers
|
|
310
|
+
} = useContext(GroupChannelContexts.TypingIndicator);
|
|
311
|
+
const shouldRenderBubble = useIIFE(() => {
|
|
312
|
+
if (typingUsers.length === 0) return false;
|
|
313
|
+
if (!sbOptions.uikit.groupChannel.channel.enableTypingIndicator) return false;
|
|
314
|
+
if (!sbOptions.uikit.groupChannel.channel.typingIndicatorTypes.has(TypingIndicatorType.Bubble)) return false;
|
|
315
|
+
return true;
|
|
316
|
+
});
|
|
317
|
+
useEffect(() => {
|
|
318
|
+
if (shouldRenderBubble) publish({
|
|
319
|
+
type: 'TYPING_BUBBLE_RENDERED'
|
|
320
|
+
});
|
|
321
|
+
}, [shouldRenderBubble]);
|
|
322
|
+
if (!shouldRenderBubble) return null;
|
|
323
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
324
|
+
paddingHorizontal: 16,
|
|
325
|
+
marginTop: 4,
|
|
326
|
+
marginBottom: 16
|
|
327
|
+
}, /*#__PURE__*/React.createElement(TypingIndicatorBubble, {
|
|
328
|
+
typingUsers: typingUsers
|
|
329
|
+
}));
|
|
330
|
+
};
|
|
299
331
|
export default /*#__PURE__*/React.memo(GroupChannelMessageRenderer);
|
|
300
332
|
//# sourceMappingURL=index.js.map
|