@smart-link/rn-im 1.0.22 → 1.0.24
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/dist/api/addressList.js +6 -17
- package/dist/api/backup.js +8 -20
- package/dist/api/file.js +6 -35
- package/dist/api/user.js +6 -16
- package/dist/components/CachedImage.js +14 -42
- package/dist/components/Camera/Camera.js +26 -54
- package/dist/components/Camera/CameraCapture.js +99 -128
- package/dist/components/Camera/CameraResult.js +33 -61
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
- package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
- package/dist/components/ChatAvatar/index.js +2 -23
- package/dist/components/Favicon.js +6 -34
- package/dist/components/FormatTimeText.js +5 -10
- package/dist/components/Highlighter.js +9 -34
- package/dist/components/IndicatorText.js +14 -39
- package/dist/components/LocalImage.js +7 -32
- package/dist/components/NetworkUnconnected.js +14 -42
- package/dist/components/PopoverWrapper.js +22 -47
- package/dist/components/VideoPlayer.js +111 -138
- package/dist/components/styles.js +10 -13
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +8 -10
- package/dist/hooks/useDownloadSource.js +7 -12
- package/dist/hooks/useFormatMsgTime.js +5 -13
- package/dist/hooks/useImReady.js +7 -10
- package/dist/hooks/useImSelector.js +34 -48
- package/dist/hooks/useTranslation.js +5 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -28
- package/dist/init.js +30 -40
- package/dist/interface.js +1 -2
- package/dist/locales/en/addressList.js +1 -3
- package/dist/locales/index.js +4 -27
- package/dist/locales/lao/addressList.js +1 -3
- package/dist/locales/zh/addressList.js +1 -3
- package/dist/pages/address-list/AddressList.js +33 -61
- package/dist/pages/address-list/CardInfo.js +10 -18
- package/dist/pages/address-list/ChooseContact.js +50 -78
- package/dist/pages/address-list/Icons.js +7 -14
- package/dist/pages/address-list/Organization.js +59 -89
- package/dist/pages/address-list/UserDetail.js +55 -83
- package/dist/pages/address-list/UserJobs.js +31 -33
- package/dist/pages/address-list/UserSearch.js +29 -54
- package/dist/pages/address-list/addressList.routes.js +11 -16
- package/dist/pages/collection/Collection.js +53 -81
- package/dist/pages/collection/ContentFactory.js +53 -82
- package/dist/pages/collection/collection.routes.js +3 -9
- package/dist/pages/conversation/ForwardToConversation.js +63 -91
- package/dist/pages/conversation/List.js +74 -102
- package/dist/pages/conversation/components/ConversationCard.js +52 -81
- package/dist/pages/conversation/components/ConversationOption.js +27 -55
- package/dist/pages/conversation/conversation.routes.js +17 -23
- package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
- package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
- package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
- package/dist/pages/conversation/setting/OptionConversation.js +20 -48
- package/dist/pages/conversation/setting/OptionGroup.js +20 -48
- package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
- package/dist/pages/conversation/setting/Setting.js +49 -54
- package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
- package/dist/pages/index.js +7 -27
- package/dist/pages/message/ChooseMember.js +56 -84
- package/dist/pages/message/MessageBackup/Bar.js +18 -43
- package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/index.js +3 -12
- package/dist/pages/message/MessageBackup/utils.js +14 -22
- package/dist/pages/message/MessageList.js +141 -134
- package/dist/pages/message/MessageRecord.js +49 -73
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.js +82 -110
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.js +96 -120
- package/dist/pages/message/components/MessagePayload.js +36 -64
- package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
- package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
- package/dist/pages/message/components/MessageUndo.js +18 -48
- package/dist/pages/message/components/MultipleBar/index.js +48 -76
- package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
- package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
- package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
- package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
- package/dist/pages/message/components/Payload/PayloadText.js +39 -67
- package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +31 -61
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +129 -158
- package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
- package/dist/pages/message/components/UploadProgress.js +12 -37
- package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
- package/dist/pages/message/components/messageBar/Icons.js +56 -74
- package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
- package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
- package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
- package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
- package/dist/pages/message/components/messageBar/index.js +2 -23
- package/dist/pages/message/message.routes.js +11 -40
- package/dist/pages/search/Search.js +38 -66
- package/dist/pages/search/SearchChatRecords.js +64 -92
- package/dist/pages/search/SearchFile.js +68 -96
- package/dist/pages/search/SearchManager.js +60 -65
- package/dist/pages/search/SearchPicturePage.js +16 -44
- package/dist/pages/search/components/ChatRecords.js +46 -74
- package/dist/pages/search/components/MyGroupChat.js +41 -69
- package/dist/pages/search/components/PictureMulipleBar.js +35 -63
- package/dist/pages/search/components/SearchFileList.js +59 -64
- package/dist/pages/search/components/SearchPictures.js +68 -98
- package/dist/pages/search/components/SearchShareLinkList.js +50 -55
- package/dist/pages/search/components/SearchUser.js +25 -53
- package/dist/pages/search/components/useSearchMessage.js +12 -16
- package/dist/pages/search/search.routes.js +11 -17
- package/dist/pages/search/utils.js +4 -12
- package/dist/pages/types.js +1 -2
- package/dist/slice/contact/contact.action.js +1 -2
- package/dist/slice/contact/contact.slice.js +7 -11
- package/dist/slice/index.js +7 -13
- package/dist/slice/panel/panel.slice.d.ts +2 -1
- package/dist/slice/panel/panel.slice.js +8 -7
- package/dist/slice/video/video.action.d.ts +1 -0
- package/dist/slice/video/video.action.js +56 -38
- package/dist/slice/video/video.slice.d.ts +1 -1
- package/dist/slice/video/video.slice.js +7 -8
- package/dist/utils/audio.d.ts +3 -0
- package/dist/utils/audio.js +10 -0
- package/dist/utils/color.js +2 -9
- package/dist/utils/common-action-sheet.js +9 -14
- package/dist/utils/cookie.js +6 -14
- package/dist/utils/emoji.js +9 -12
- package/dist/utils/file-icon.js +33 -60
- package/dist/utils/file-operate.js +1 -2
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +74 -87
- package/dist/utils/golden-rectangle.js +3 -7
- package/dist/utils/phone.js +13 -22
- package/dist/utils/request.js +7 -15
- package/dist/utils/scroll.js +5 -9
- package/dist/utils/summary.js +4 -11
- package/dist/utils/take-camera.js +12 -19
- package/dist/utils/text-mix.js +4 -11
- package/dist/utils/upload.js +20 -41
- package/package.json +6 -7
@@ -1,27 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -31,36 +7,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
8
|
});
|
33
9
|
};
|
34
|
-
|
35
|
-
|
36
|
-
};
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
const
|
44
|
-
const file_1 = require("../../utils/file");
|
45
|
-
const init_1 = require("../../init");
|
46
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
47
|
-
const react_native_compressor_1 = require("react-native-compressor");
|
48
|
-
const { PICTURE, VIDEO } = im_base_1.ResourceType;
|
10
|
+
import React, { memo, useEffect, useState, useCallback, useRef } from 'react';
|
11
|
+
import { StyleSheet, Text, TouchableOpacity, View, Animated, Dimensions } from 'react-native';
|
12
|
+
import { Camera, useCameraDevice, useCameraFormat, useMicrophonePermission } from 'react-native-vision-camera';
|
13
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
14
|
+
import { numberToTime, ResourceType } from '@smart-link/im-base';
|
15
|
+
import { moveFile, requestSaveFilePermissionIfAndroid, toAbsolutePath } from '../../utils/file';
|
16
|
+
import { getImManager } from '../../init';
|
17
|
+
import { dp, CaihIcon } from '@smart-link/rn-ui';
|
18
|
+
import { createVideoThumbnail, Image, Video, getFileSize, uuidv4 } from 'react-native-compressor';
|
19
|
+
const { PICTURE, VIDEO } = ResourceType;
|
49
20
|
const FlashModeValue = ['on', 'off', 'auto'];
|
50
21
|
const FlashModeIcon = ['flash', 'flash-off', 'flash-auto'];
|
51
22
|
const CameraTypeValue = ['back', 'front'];
|
52
23
|
const CameraTypeIcon = ['camera-retake-outline', 'camera-retake'];
|
53
24
|
const timerHolder = { duration: 0 };
|
54
|
-
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } =
|
55
|
-
const CameraCapture =
|
25
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
26
|
+
const CameraCapture = memo(props => {
|
56
27
|
const { finishTakePicture, finishTakeRecord, cancelCamera } = props;
|
57
|
-
const camera =
|
58
|
-
const [cameraTypeIndex, setCameraTypeIndex] =
|
59
|
-
const [isRecording, setIsRecording] =
|
60
|
-
const [flashModeIndex, setFlashModeIndex] =
|
61
|
-
const microphone =
|
62
|
-
const device =
|
63
|
-
const format =
|
28
|
+
const camera = useRef(null);
|
29
|
+
const [cameraTypeIndex, setCameraTypeIndex] = useState(0);
|
30
|
+
const [isRecording, setIsRecording] = useState(false);
|
31
|
+
const [flashModeIndex, setFlashModeIndex] = useState(2);
|
32
|
+
const microphone = useMicrophonePermission();
|
33
|
+
const device = useCameraDevice(CameraTypeValue[cameraTypeIndex]);
|
34
|
+
const format = useCameraFormat(device, [
|
64
35
|
{ videoAspectRatio: SCREEN_HEIGHT / SCREEN_WIDTH, fps: 60, photoResolution: 'max' },
|
65
36
|
{
|
66
37
|
photoAspectRatio: SCREEN_HEIGHT / SCREEN_WIDTH,
|
@@ -69,7 +40,7 @@ const CameraCapture = (0, react_1.memo)(props => {
|
|
69
40
|
]);
|
70
41
|
const takePicture = () => __awaiter(void 0, void 0, void 0, function* () {
|
71
42
|
if (camera.current && !isRecording) {
|
72
|
-
const success = yield
|
43
|
+
const success = yield requestSaveFilePermissionIfAndroid(getImManager());
|
73
44
|
if (!success) {
|
74
45
|
return;
|
75
46
|
}
|
@@ -83,13 +54,14 @@ const CameraCapture = (0, react_1.memo)(props => {
|
|
83
54
|
});
|
84
55
|
const takeRecord = () => __awaiter(void 0, void 0, void 0, function* () {
|
85
56
|
if (camera.current) {
|
86
|
-
const success = yield
|
57
|
+
const success = yield requestSaveFilePermissionIfAndroid(getImManager());
|
87
58
|
if (!success) {
|
88
59
|
return;
|
89
60
|
}
|
90
61
|
camera.current.startRecording({
|
91
|
-
videoBitRate: '
|
62
|
+
videoBitRate: 'low',
|
92
63
|
videoCodec: 'h264',
|
64
|
+
fileType: 'mp4',
|
93
65
|
onRecordingFinished: (data) => __awaiter(void 0, void 0, void 0, function* () {
|
94
66
|
console.log('onRecordingFinished: ', data);
|
95
67
|
const videoData = yield buildVideoData(data);
|
@@ -110,11 +82,11 @@ const CameraCapture = (0, react_1.memo)(props => {
|
|
110
82
|
setIsRecording(false);
|
111
83
|
}
|
112
84
|
};
|
113
|
-
const switchCameraType =
|
85
|
+
const switchCameraType = useCallback(() => {
|
114
86
|
const index = (cameraTypeIndex + 1) % 2;
|
115
87
|
setCameraTypeIndex(index);
|
116
88
|
}, [cameraTypeIndex]);
|
117
|
-
const switchFlashMode =
|
89
|
+
const switchFlashMode = useCallback(() => {
|
118
90
|
const index = (flashModeIndex + 1) % 3;
|
119
91
|
setFlashModeIndex(index);
|
120
92
|
}, [flashModeIndex]);
|
@@ -126,40 +98,40 @@ const CameraCapture = (0, react_1.memo)(props => {
|
|
126
98
|
}
|
127
99
|
cancelCamera && cancelCamera();
|
128
100
|
};
|
129
|
-
return (<
|
130
|
-
{device ? (<
|
101
|
+
return (<View style={styles.camera}>
|
102
|
+
{device ? (<Camera ref={camera} device={device} format={format} isActive={true} style={styles.preview} photo={true} video={true} audio={microphone.hasPermission} outputOrientation="portrait" onInitialized={() => {
|
131
103
|
console.log('Camera initialized!');
|
132
104
|
}} onError={error => {
|
133
105
|
console.log(error);
|
134
|
-
}}/>) : (<
|
135
|
-
<
|
136
|
-
</
|
106
|
+
}}/>) : (<View style={styles.emptyContainer}>
|
107
|
+
<Text style={styles.text}>Your phone does not have a Camera.</Text>
|
108
|
+
</View>)}
|
137
109
|
|
138
110
|
{isRecording && (<>
|
139
111
|
<Timer style={styles.time}/>
|
140
112
|
<Bounds style={styles.bounds}/>
|
141
113
|
</>)}
|
142
114
|
|
143
|
-
<
|
144
|
-
<
|
145
|
-
</
|
115
|
+
<TouchableOpacity style={styles.switch} onPress={switchCameraType}>
|
116
|
+
<MaterialCommunityIcons name={CameraTypeIcon[cameraTypeIndex]} size={dp(25)} color={'#fff'}/>
|
117
|
+
</TouchableOpacity>
|
146
118
|
|
147
|
-
<
|
148
|
-
<
|
149
|
-
</
|
119
|
+
<TouchableOpacity style={styles.flash} onPress={switchFlashMode}>
|
120
|
+
<MaterialCommunityIcons name={FlashModeIcon[flashModeIndex]} size={dp(25)} color={'#fff'}/>
|
121
|
+
</TouchableOpacity>
|
150
122
|
|
151
|
-
{!isRecording && (<
|
152
|
-
<
|
153
|
-
</
|
123
|
+
{!isRecording && (<TouchableOpacity style={styles.cancel} onPress={onCancel}>
|
124
|
+
<CaihIcon name="arrow-down-outlined" size={dp(30)} color={'#fff'}/>
|
125
|
+
</TouchableOpacity>)}
|
154
126
|
|
155
|
-
<
|
156
|
-
</
|
127
|
+
<TouchableOpacity style={styles.capture} onPress={takePicture} onLongPress={takeRecord} onPressOut={stopRecord}/>
|
128
|
+
</View>);
|
157
129
|
});
|
158
|
-
const Timer =
|
130
|
+
const Timer = memo(props => {
|
159
131
|
const { style } = props;
|
160
|
-
const [duration, setDuration] =
|
132
|
+
const [duration, setDuration] = useState(0);
|
161
133
|
const showPoint = duration % 2 === 0;
|
162
|
-
|
134
|
+
useEffect(() => {
|
163
135
|
const timer = setInterval(() => {
|
164
136
|
timerHolder.duration = timerHolder.duration + 1;
|
165
137
|
setDuration(timerHolder.duration);
|
@@ -169,32 +141,32 @@ const Timer = (0, react_1.memo)(props => {
|
|
169
141
|
timerHolder.duration = 0;
|
170
142
|
};
|
171
143
|
}, []);
|
172
|
-
return (<
|
173
|
-
{showPoint && <
|
174
|
-
<
|
175
|
-
</
|
144
|
+
return (<View style={style}>
|
145
|
+
{showPoint && <View style={styles.point}/>}
|
146
|
+
<Text style={styles.timeText}>{numberToTime(duration / 2)}</Text>
|
147
|
+
</View>);
|
176
148
|
});
|
177
|
-
const Bounds =
|
149
|
+
const Bounds = memo(props => {
|
178
150
|
const { style } = props;
|
179
|
-
const scale = new
|
180
|
-
|
181
|
-
const seq =
|
182
|
-
|
151
|
+
const scale = new Animated.Value(2.2);
|
152
|
+
useEffect(() => {
|
153
|
+
const seq = Animated.sequence([
|
154
|
+
Animated.timing(scale, {
|
183
155
|
toValue: 2.5,
|
184
156
|
duration: 1000,
|
185
157
|
useNativeDriver: true,
|
186
158
|
}),
|
187
|
-
|
159
|
+
Animated.timing(scale, {
|
188
160
|
toValue: 2.2,
|
189
161
|
duration: 1000,
|
190
162
|
useNativeDriver: true,
|
191
163
|
}),
|
192
164
|
]);
|
193
|
-
|
165
|
+
Animated.loop(seq).start();
|
194
166
|
}, [scale]);
|
195
|
-
return <
|
167
|
+
return <Animated.View style={[style, { transform: [{ scale: scale }] }]}/>;
|
196
168
|
});
|
197
|
-
const styles =
|
169
|
+
const styles = StyleSheet.create({
|
198
170
|
camera: {
|
199
171
|
flex: 1,
|
200
172
|
},
|
@@ -205,74 +177,74 @@ const styles = react_native_1.StyleSheet.create({
|
|
205
177
|
},
|
206
178
|
time: {
|
207
179
|
flexDirection: 'row',
|
208
|
-
height:
|
209
|
-
width:
|
180
|
+
height: dp(60),
|
181
|
+
width: dp(150),
|
210
182
|
position: 'absolute',
|
211
|
-
top:
|
183
|
+
top: dp(30),
|
212
184
|
alignSelf: 'center',
|
213
185
|
justifyContent: 'center',
|
214
186
|
alignItems: 'center',
|
215
187
|
},
|
216
188
|
timeText: {
|
217
|
-
fontSize:
|
189
|
+
fontSize: dp(18),
|
218
190
|
color: '#fff',
|
219
191
|
},
|
220
192
|
switch: {
|
221
|
-
height:
|
222
|
-
width:
|
193
|
+
height: dp(60),
|
194
|
+
width: dp(60),
|
223
195
|
position: 'absolute',
|
224
|
-
top:
|
225
|
-
right:
|
196
|
+
top: dp(30),
|
197
|
+
right: dp(15),
|
226
198
|
justifyContent: 'center',
|
227
199
|
alignItems: 'center',
|
228
200
|
},
|
229
201
|
flash: {
|
230
|
-
height:
|
231
|
-
width:
|
202
|
+
height: dp(60),
|
203
|
+
width: dp(60),
|
232
204
|
position: 'absolute',
|
233
|
-
top:
|
234
|
-
right:
|
205
|
+
top: dp(31),
|
206
|
+
right: dp(60),
|
235
207
|
justifyContent: 'center',
|
236
208
|
alignItems: 'center',
|
237
209
|
},
|
238
210
|
cancel: {
|
239
|
-
height:
|
240
|
-
width:
|
211
|
+
height: dp(75),
|
212
|
+
width: dp(75),
|
241
213
|
position: 'absolute',
|
242
|
-
bottom:
|
243
|
-
left:
|
214
|
+
bottom: dp(130),
|
215
|
+
left: dp(50),
|
244
216
|
justifyContent: 'center',
|
245
217
|
alignItems: 'center',
|
246
218
|
},
|
247
219
|
capture: {
|
248
|
-
borderWidth:
|
220
|
+
borderWidth: dp(15),
|
249
221
|
borderColor: '#ddd',
|
250
222
|
backgroundColor: '#fff',
|
251
|
-
borderRadius:
|
252
|
-
height:
|
253
|
-
width:
|
223
|
+
borderRadius: dp(40),
|
224
|
+
height: dp(75),
|
225
|
+
width: dp(75),
|
254
226
|
position: 'absolute',
|
255
|
-
bottom:
|
227
|
+
bottom: dp(130),
|
256
228
|
alignSelf: 'center',
|
257
229
|
justifyContent: 'center',
|
258
230
|
alignItems: 'center',
|
259
231
|
},
|
260
232
|
point: {
|
261
|
-
marginRight:
|
262
|
-
width:
|
263
|
-
height:
|
233
|
+
marginRight: dp(5),
|
234
|
+
width: dp(11),
|
235
|
+
height: dp(11),
|
264
236
|
backgroundColor: '#f2121a',
|
265
|
-
borderRadius:
|
237
|
+
borderRadius: dp(6),
|
266
238
|
position: 'absolute',
|
267
|
-
left:
|
239
|
+
left: dp(30),
|
268
240
|
},
|
269
241
|
bounds: {
|
270
242
|
backgroundColor: '#fff',
|
271
|
-
borderRadius:
|
272
|
-
height:
|
273
|
-
width:
|
243
|
+
borderRadius: dp(40),
|
244
|
+
height: dp(75),
|
245
|
+
width: dp(75),
|
274
246
|
position: 'absolute',
|
275
|
-
bottom:
|
247
|
+
bottom: dp(130),
|
276
248
|
alignSelf: 'center',
|
277
249
|
justifyContent: 'center',
|
278
250
|
alignItems: 'center',
|
@@ -291,17 +263,17 @@ const styles = react_native_1.StyleSheet.create({
|
|
291
263
|
textAlign: 'center',
|
292
264
|
},
|
293
265
|
});
|
294
|
-
function buildPictureData(data) {
|
266
|
+
export function buildPictureData(data) {
|
295
267
|
return __awaiter(this, void 0, void 0, function* () {
|
296
|
-
const uid =
|
268
|
+
const uid = uuidv4();
|
297
269
|
const path = data.path;
|
298
270
|
const ext = path.split('.').pop();
|
299
271
|
const filename = PICTURE + '_' + uid + '.' + ext;
|
300
|
-
const tmp = yield
|
272
|
+
const tmp = yield Image.compress(path, {
|
301
273
|
compressionMethod: 'auto'
|
302
274
|
});
|
303
|
-
const localPath = yield
|
304
|
-
const size = yield
|
275
|
+
const localPath = yield moveFile(tmp, filename, PICTURE);
|
276
|
+
const size = yield getFileSize(localPath);
|
305
277
|
let width = data.width;
|
306
278
|
let height = data.height;
|
307
279
|
if (data.orientation === 'portrait') {
|
@@ -320,24 +292,23 @@ function buildPictureData(data) {
|
|
320
292
|
};
|
321
293
|
});
|
322
294
|
}
|
323
|
-
exports.buildPictureData = buildPictureData;
|
324
295
|
function buildVideoData(data) {
|
325
296
|
return __awaiter(this, void 0, void 0, function* () {
|
326
|
-
const uid =
|
297
|
+
const uid = uuidv4();
|
327
298
|
const path = data.path;
|
328
299
|
try {
|
329
|
-
const compressPath = yield
|
300
|
+
const compressPath = yield Video.compress(toAbsolutePath(path), {
|
330
301
|
compressionMethod: 'auto',
|
331
302
|
maxSize: 1080,
|
332
303
|
});
|
333
304
|
const ext = compressPath.split('.').pop();
|
334
305
|
const filename = VIDEO + '_' + uid + '.' + ext;
|
335
|
-
const size = yield
|
336
|
-
let thumb = yield
|
306
|
+
const size = yield getFileSize(compressPath);
|
307
|
+
let thumb = yield createVideoThumbnail(toAbsolutePath(compressPath));
|
337
308
|
console.log('RNThumbnail', thumb);
|
338
309
|
const imageName = 'thumb_' + uid + '.jpg';
|
339
|
-
const imagePath = yield
|
340
|
-
const localPath = yield
|
310
|
+
const imagePath = yield moveFile(thumb.path, imageName, VIDEO);
|
311
|
+
const localPath = yield moveFile(compressPath, filename, VIDEO);
|
341
312
|
return {
|
342
313
|
filename,
|
343
314
|
localPath: localPath,
|
@@ -357,4 +328,4 @@ function buildVideoData(data) {
|
|
357
328
|
}
|
358
329
|
});
|
359
330
|
}
|
360
|
-
|
331
|
+
export default CameraCapture;
|
@@ -1,62 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
30
|
-
const react_1 = __importStar(require("react"));
|
31
|
-
const react_native_1 = require("react-native");
|
32
|
-
const MaterialCommunityIcons_1 = __importDefault(require("react-native-vector-icons/MaterialCommunityIcons"));
|
1
|
+
import { dp } from '@smart-link/rn-ui';
|
2
|
+
import React, { useEffect } from 'react';
|
3
|
+
import { View, StyleSheet, TouchableOpacity, Image } from 'react-native';
|
4
|
+
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
33
5
|
const CameraResult = (props) => {
|
34
6
|
const { horizontal = false, isVideo = false, source, cancelResult, confirmResult, editResult, } = props;
|
35
7
|
const resizeMode = horizontal ? 'contain' : 'cover';
|
36
|
-
|
8
|
+
useEffect(() => {
|
37
9
|
return () => {
|
38
10
|
console.log('CameraResult unmounted');
|
39
11
|
};
|
40
12
|
}, []);
|
41
|
-
return (<
|
42
|
-
<
|
13
|
+
return (<View style={styles.confirm}>
|
14
|
+
<Image style={styles.pic} resizeMode={resizeMode} source={Object.assign({}, source)}/>
|
43
15
|
|
44
|
-
<
|
45
|
-
<
|
46
|
-
<
|
47
|
-
</
|
16
|
+
<View style={styles.bar}>
|
17
|
+
<TouchableOpacity style={styles.cancel} onPress={cancelResult}>
|
18
|
+
<Icon name='close' size={dp(30)} color={'#666'}/>
|
19
|
+
</TouchableOpacity>
|
48
20
|
|
49
|
-
{!isVideo && <
|
50
|
-
<
|
51
|
-
</
|
21
|
+
{!isVideo && <TouchableOpacity style={styles.cancel} onPress={editResult}>
|
22
|
+
<Icon name='circle-edit-outline' size={dp(30)} color={'#666'}/>
|
23
|
+
</TouchableOpacity>}
|
52
24
|
|
53
|
-
<
|
54
|
-
<
|
55
|
-
</
|
56
|
-
</
|
57
|
-
</
|
25
|
+
<TouchableOpacity style={styles.ok} onPress={confirmResult}>
|
26
|
+
<Icon name='check' size={dp(30)} color={'#666'}/>
|
27
|
+
</TouchableOpacity>
|
28
|
+
</View>
|
29
|
+
</View>);
|
58
30
|
};
|
59
|
-
const styles =
|
31
|
+
const styles = StyleSheet.create({
|
60
32
|
confirm: {
|
61
33
|
flex: 1,
|
62
34
|
backgroundColor: '#000',
|
@@ -69,34 +41,34 @@ const styles = react_native_1.StyleSheet.create({
|
|
69
41
|
position: 'absolute',
|
70
42
|
justifyContent: 'space-between',
|
71
43
|
alignItems: 'center',
|
72
|
-
bottom:
|
73
|
-
left:
|
74
|
-
right:
|
44
|
+
bottom: dp(130),
|
45
|
+
left: dp(20),
|
46
|
+
right: dp(20),
|
75
47
|
flexDirection: 'row',
|
76
48
|
},
|
77
49
|
cancel: {
|
78
50
|
backgroundColor: '#fff',
|
79
|
-
borderRadius:
|
80
|
-
height:
|
81
|
-
width:
|
51
|
+
borderRadius: dp(40),
|
52
|
+
height: dp(80),
|
53
|
+
width: dp(80),
|
82
54
|
justifyContent: 'center',
|
83
55
|
alignItems: 'center',
|
84
56
|
},
|
85
57
|
edit: {
|
86
58
|
backgroundColor: '#fff',
|
87
|
-
borderRadius:
|
88
|
-
height:
|
89
|
-
width:
|
59
|
+
borderRadius: dp(40),
|
60
|
+
height: dp(80),
|
61
|
+
width: dp(80),
|
90
62
|
justifyContent: 'center',
|
91
63
|
alignItems: 'center',
|
92
64
|
},
|
93
65
|
ok: {
|
94
66
|
backgroundColor: '#fff',
|
95
|
-
borderRadius:
|
96
|
-
height:
|
97
|
-
width:
|
67
|
+
borderRadius: dp(40),
|
68
|
+
height: dp(80),
|
69
|
+
width: dp(80),
|
98
70
|
justifyContent: 'center',
|
99
71
|
alignItems: 'center',
|
100
72
|
}
|
101
73
|
});
|
102
|
-
|
74
|
+
export default CameraResult;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ConversationType } from '@smart-link/im-base';
|
3
|
-
import { ChatAvatarIdProps } from "
|
3
|
+
import { ChatAvatarIdProps } from "./ChatAvatarId";
|
4
4
|
type ChatAvatarProps = {
|
5
5
|
id: string;
|
6
6
|
name: string;
|