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