@smart-link/rn-im 1.0.23 → 1.0.26

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 (170) hide show
  1. package/assets/file-dir.jpg +0 -0
  2. package/dist/api/addressList.js +6 -17
  3. package/dist/api/backup.js +8 -20
  4. package/dist/api/file.js +6 -35
  5. package/dist/api/user.js +6 -16
  6. package/dist/components/CachedImage.js +14 -42
  7. package/dist/components/Camera/Camera.js +26 -54
  8. package/dist/components/Camera/CameraCapture.js +99 -128
  9. package/dist/components/Camera/CameraResult.js +33 -61
  10. package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
  11. package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
  12. package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
  13. package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
  14. package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
  15. package/dist/components/ChatAvatar/ChatAvatarLocal.js +22 -25
  16. package/dist/components/ChatAvatar/index.js +2 -23
  17. package/dist/components/Favicon.js +6 -34
  18. package/dist/components/FormatTimeText.js +5 -10
  19. package/dist/components/Highlighter.js +9 -34
  20. package/dist/components/IndicatorText.js +14 -39
  21. package/dist/components/LocalImage.js +7 -32
  22. package/dist/components/NetworkUnconnected.js +14 -42
  23. package/dist/components/PopoverWrapper.js +22 -47
  24. package/dist/components/VideoPlayer.js +111 -138
  25. package/dist/components/styles.js +10 -13
  26. package/dist/default-assets.d.ts +2 -0
  27. package/dist/default-assets.js +9 -10
  28. package/dist/hooks/useDownloadSource.js +7 -12
  29. package/dist/hooks/useFormatMsgTime.js +5 -13
  30. package/dist/hooks/useImReady.js +7 -10
  31. package/dist/hooks/useImSelector.js +34 -48
  32. package/dist/hooks/useTranslation.js +5 -10
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +8 -28
  35. package/dist/init.js +30 -40
  36. package/dist/interface.d.ts +9 -0
  37. package/dist/interface.js +1 -2
  38. package/dist/locales/en/addressList.js +1 -3
  39. package/dist/locales/index.js +4 -27
  40. package/dist/locales/lao/addressList.js +1 -3
  41. package/dist/locales/zh/addressList.js +1 -3
  42. package/dist/pages/address-list/AddressList.js +33 -61
  43. package/dist/pages/address-list/CardInfo.js +10 -18
  44. package/dist/pages/address-list/ChooseContact.js +50 -78
  45. package/dist/pages/address-list/Icons.js +7 -14
  46. package/dist/pages/address-list/Organization.js +59 -89
  47. package/dist/pages/address-list/UserDetail.js +55 -83
  48. package/dist/pages/address-list/UserJobs.js +31 -33
  49. package/dist/pages/address-list/UserSearch.js +29 -54
  50. package/dist/pages/address-list/addressList.routes.js +11 -16
  51. package/dist/pages/collection/Collection.js +53 -81
  52. package/dist/pages/collection/ContentFactory.js +53 -82
  53. package/dist/pages/collection/collection.routes.js +3 -9
  54. package/dist/pages/conversation/ForwardToConversation.js +63 -91
  55. package/dist/pages/conversation/List.js +74 -102
  56. package/dist/pages/conversation/components/ConversationCard.js +46 -74
  57. package/dist/pages/conversation/components/ConversationOption.js +27 -55
  58. package/dist/pages/conversation/conversation.routes.js +17 -23
  59. package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
  60. package/dist/pages/conversation/setting/OptionAvatars.d.ts +1 -1
  61. package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
  62. package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
  63. package/dist/pages/conversation/setting/OptionConversation.js +20 -48
  64. package/dist/pages/conversation/setting/OptionGroup.d.ts +1 -1
  65. package/dist/pages/conversation/setting/OptionGroup.js +20 -48
  66. package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
  67. package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
  68. package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
  69. package/dist/pages/conversation/setting/Setting.js +50 -56
  70. package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
  71. package/dist/pages/index.js +7 -27
  72. package/dist/pages/message/ChooseMember.js +56 -84
  73. package/dist/pages/message/FileSelector.d.ts +6 -0
  74. package/dist/pages/message/FileSelector.js +235 -0
  75. package/dist/pages/message/MessageBackup/Bar.js +18 -43
  76. package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
  77. package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
  78. package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
  79. package/dist/pages/message/MessageBackup/index.js +3 -12
  80. package/dist/pages/message/MessageBackup/utils.js +14 -22
  81. package/dist/pages/message/MessageList.js +151 -141
  82. package/dist/pages/message/MessageRecord.js +74 -87
  83. package/dist/pages/message/components/BusiNotifyCard.js +60 -85
  84. package/dist/pages/message/components/ChatBg.js +11 -36
  85. package/dist/pages/message/components/MessageItem.d.ts +2 -1
  86. package/dist/pages/message/components/MessageItem.js +85 -112
  87. package/dist/pages/message/components/MessageItemQuote.js +30 -58
  88. package/dist/pages/message/components/MessageItemTips.js +27 -55
  89. package/dist/pages/message/components/MessageOption.d.ts +7 -3
  90. package/dist/pages/message/components/MessageOption.js +107 -134
  91. package/dist/pages/message/components/MessagePayload.d.ts +2 -1
  92. package/dist/pages/message/components/MessagePayload.js +36 -64
  93. package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
  94. package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
  95. package/dist/pages/message/components/MessageUndo.js +18 -48
  96. package/dist/pages/message/components/MultipleBar/index.js +48 -76
  97. package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
  98. package/dist/pages/message/components/Payload/PayloadFile.d.ts +1 -1
  99. package/dist/pages/message/components/Payload/PayloadFile.js +44 -68
  100. package/dist/pages/message/components/Payload/PayloadMultiple.js +46 -70
  101. package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
  102. package/dist/pages/message/components/Payload/PayloadPicture.d.ts +1 -1
  103. package/dist/pages/message/components/Payload/PayloadPicture.js +21 -50
  104. package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
  105. package/dist/pages/message/components/Payload/PayloadText.js +39 -67
  106. package/dist/pages/message/components/Payload/PayloadVideo.js +30 -57
  107. package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
  108. package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +2 -1
  109. package/dist/pages/message/components/Payload/PayloadWrapper.js +24 -44
  110. package/dist/pages/message/components/Payload/type.d.ts +2 -1
  111. package/dist/pages/message/components/Payload/type.js +1 -2
  112. package/dist/pages/message/components/ReceiptBack.js +30 -60
  113. package/dist/pages/message/components/TextMixMessage.js +13 -38
  114. package/dist/pages/message/components/TextMixQuote.js +128 -162
  115. package/dist/pages/message/components/TextMixQuoteMessage.js +19 -47
  116. package/dist/pages/message/components/UploadProgress.js +12 -37
  117. package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
  118. package/dist/pages/message/components/messageBar/Icons.js +56 -74
  119. package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
  120. package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
  121. package/dist/pages/message/components/messageBar/OptionPanel.js +54 -107
  122. package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
  123. package/dist/pages/message/components/messageBar/index.js +2 -23
  124. package/dist/pages/message/message.routes.js +21 -40
  125. package/dist/pages/search/Search.js +38 -66
  126. package/dist/pages/search/SearchChatRecords.js +64 -92
  127. package/dist/pages/search/SearchFile.js +68 -96
  128. package/dist/pages/search/SearchManager.js +60 -65
  129. package/dist/pages/search/SearchPicturePage.js +16 -44
  130. package/dist/pages/search/components/ChatRecords.js +46 -74
  131. package/dist/pages/search/components/MyGroupChat.js +41 -69
  132. package/dist/pages/search/components/PictureMulipleBar.js +35 -63
  133. package/dist/pages/search/components/SearchFileList.js +59 -64
  134. package/dist/pages/search/components/SearchPictures.js +68 -98
  135. package/dist/pages/search/components/SearchShareLinkList.js +50 -55
  136. package/dist/pages/search/components/SearchUser.js +25 -53
  137. package/dist/pages/search/components/useSearchMessage.js +12 -16
  138. package/dist/pages/search/search.routes.js +11 -17
  139. package/dist/pages/search/utils.js +4 -12
  140. package/dist/pages/types.d.ts +4 -2
  141. package/dist/pages/types.js +1 -2
  142. package/dist/slice/contact/contact.slice.js +4 -8
  143. package/dist/slice/index.js +7 -13
  144. package/dist/slice/panel/panel.slice.d.ts +2 -1
  145. package/dist/slice/panel/panel.slice.js +8 -7
  146. package/dist/slice/video/video.action.d.ts +1 -0
  147. package/dist/slice/video/video.action.js +64 -38
  148. package/dist/slice/video/video.slice.d.ts +1 -1
  149. package/dist/slice/video/video.slice.js +7 -8
  150. package/dist/utils/audio.d.ts +3 -0
  151. package/dist/utils/audio.js +10 -0
  152. package/dist/utils/color.js +2 -9
  153. package/dist/utils/common-action-sheet.js +9 -14
  154. package/dist/utils/cookie.js +6 -14
  155. package/dist/utils/emoji.js +9 -12
  156. package/dist/utils/file-icon.js +33 -60
  157. package/dist/utils/file-operate.js +1 -2
  158. package/dist/utils/file.d.ts +10 -2
  159. package/dist/utils/file.js +188 -88
  160. package/dist/utils/golden-rectangle.js +3 -7
  161. package/dist/utils/phone.js +13 -22
  162. package/dist/utils/request.js +7 -15
  163. package/dist/utils/scroll.js +5 -9
  164. package/dist/utils/summary.js +4 -11
  165. package/dist/utils/take-camera.js +12 -19
  166. package/dist/utils/text-mix.js +4 -11
  167. package/dist/utils/upload.js +20 -41
  168. package/package.json +6 -7
  169. package/dist/slice/contact/contact.action.d.ts +0 -1
  170. package/dist/slice/contact/contact.action.js +0 -2
@@ -1,39 +1,14 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const rn_ui_1 = require("@smart-link/rn-ui");
27
- const react_1 = __importStar(require("react"));
28
- const react_native_1 = require("react-native");
29
- const MessageInput = (0, react_1.forwardRef)(({ onChangeText, onKeyPress, style }, ref) => {
30
- const inputRef = (0, react_1.useRef)(null);
31
- const [text, setText] = (0, react_1.useState)('');
32
- const [showSoftInputOnFocus, setShowSoftInputOnFocus] = (0, react_1.useState)(true);
33
- const innerText = (0, react_1.useRef)('');
34
- const [selection, setSelection] = (0, react_1.useState)({ start: 0, end: 0 });
35
- const selectionIos = (0, react_1.useRef)({ start: 0, end: 0 });
36
- (0, react_1.useImperativeHandle)(ref, () => ({
1
+ import { dp } from '@smart-link/rn-ui';
2
+ import React, { forwardRef, memo, useImperativeHandle, useRef, useState, } from 'react';
3
+ import { TextInput, View, StyleSheet, Platform } from 'react-native';
4
+ const MessageInput = forwardRef(({ onChangeText, onKeyPress, style }, ref) => {
5
+ const inputRef = useRef(null);
6
+ const [text, setText] = useState('');
7
+ const [showSoftInputOnFocus, setShowSoftInputOnFocus] = useState(true);
8
+ const innerText = useRef('');
9
+ const [selection, setSelection] = useState({ start: 0, end: 0 });
10
+ const selectionIos = useRef({ start: 0, end: 0 });
11
+ useImperativeHandle(ref, () => ({
37
12
  isFocused: () => {
38
13
  var _a, _b;
39
14
  return (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) !== null && _b !== void 0 ? _b : false;
@@ -75,7 +50,7 @@ const MessageInput = (0, react_1.forwardRef)(({ onChangeText, onKeyPress, style
75
50
  start: start + emoji.length,
76
51
  end: start + emoji.length,
77
52
  });
78
- if (react_native_1.Platform.OS === 'ios') {
53
+ if (Platform.OS === 'ios') {
79
54
  selectionIos.current = {
80
55
  start: start + emoji.length,
81
56
  end: start + emoji.length,
@@ -95,7 +70,7 @@ const MessageInput = (0, react_1.forwardRef)(({ onChangeText, onKeyPress, style
95
70
  start: n.length,
96
71
  end: n.length,
97
72
  });
98
- if (react_native_1.Platform.OS === 'ios') {
73
+ if (Platform.OS === 'ios') {
99
74
  selectionIos.current = {
100
75
  start: n.length,
101
76
  end: n.length,
@@ -163,8 +138,8 @@ const MessageInput = (0, react_1.forwardRef)(({ onChangeText, onKeyPress, style
163
138
  }
164
139
  },
165
140
  }), [selection, onChangeText]);
166
- return (<react_native_1.View style={[styles.container, style]}>
167
- <react_native_1.TextInput ref={inputRef} selection={react_native_1.Platform.OS === 'android' ? selection : undefined} multiline showSoftInputOnFocus={showSoftInputOnFocus} style={styles.textInput} value={text} onKeyPress={onKeyPress} onChangeText={n => {
141
+ return (<View style={[styles.container, style]}>
142
+ <TextInput ref={inputRef} selection={Platform.OS === 'android' ? selection : undefined} multiline showSoftInputOnFocus={showSoftInputOnFocus} style={styles.textInput} value={text} onKeyPress={onKeyPress} onChangeText={n => {
168
143
  innerText.current = n;
169
144
  setText(n);
170
145
  onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(n);
@@ -172,32 +147,32 @@ const MessageInput = (0, react_1.forwardRef)(({ onChangeText, onKeyPress, style
172
147
  setSelection(nativeEvent.selection);
173
148
  selectionIos.current = nativeEvent.selection;
174
149
  }}/>
175
- </react_native_1.View>);
150
+ </View>);
176
151
  });
177
- const styles = react_native_1.StyleSheet.create({
152
+ const styles = StyleSheet.create({
178
153
  container: {
179
154
  flex: 1,
180
155
  position: 'relative',
181
- marginVertical: (0, rn_ui_1.dp)(6),
182
- maxHeight: (0, rn_ui_1.dp)(120),
156
+ marginVertical: dp(6),
157
+ maxHeight: dp(120),
183
158
  },
184
159
  textInput: {
185
- borderRadius: (0, rn_ui_1.dp)(4),
160
+ borderRadius: dp(4),
186
161
  backgroundColor: '#fff',
187
- fontSize: (0, rn_ui_1.dp)(15),
188
- minHeight: react_native_1.Platform.select({
189
- ios: (0, rn_ui_1.dp)(32),
190
- android: (0, rn_ui_1.dp)(28),
162
+ fontSize: dp(15),
163
+ minHeight: Platform.select({
164
+ ios: dp(32),
165
+ android: dp(28),
191
166
  }),
192
- lineHeight: react_native_1.Platform.select({
193
- ios: (0, rn_ui_1.dp)(20),
194
- android: (0, rn_ui_1.dp)(20),
167
+ lineHeight: Platform.select({
168
+ ios: dp(20),
169
+ android: dp(20),
195
170
  }),
196
- paddingHorizontal: (0, rn_ui_1.dp)(5),
197
- paddingVertical: react_native_1.Platform.select({
171
+ paddingHorizontal: dp(5),
172
+ paddingVertical: Platform.select({
198
173
  ios: 6,
199
174
  android: 4,
200
175
  }),
201
176
  },
202
177
  });
203
- exports.default = (0, react_1.memo)(MessageInput);
178
+ export default memo(MessageInput);
@@ -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,34 +7,29 @@ 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
- const rn_ui_1 = require("@smart-link/rn-ui");
39
- const DocumentPicker = __importStar(require("@react-native-documents/picker"));
40
- const react_1 = __importStar(require("react"));
41
- const react_native_1 = require("react-native");
42
- const useImSelector_1 = require("../../../../hooks/useImSelector");
43
- const useTranslation_1 = __importDefault(require("../../../../hooks/useTranslation"));
44
- const init_1 = require("../../../../init");
45
- const Icons_1 = require("./Icons");
46
- const react_native_image_crop_picker_1 = __importDefault(require("react-native-image-crop-picker"));
47
- const contact_slice_1 = require("../../../../slice/contact/contact.slice");
48
- const file_1 = require("../../../../utils/file");
49
- const scroll_1 = require("../../../../utils/scroll");
50
- const take_camera_1 = require("../../../../utils/take-camera");
51
- const FontAwesome_1 = __importDefault(require("react-native-vector-icons/FontAwesome"));
52
- const OPTION_SIZE = (react_native_1.Dimensions.get('screen').width - 20) / 4;
10
+ import { dp, useNavigation } from '@smart-link/rn-ui';
11
+ import React, { forwardRef, memo, useImperativeHandle, useState } from 'react';
12
+ import { View, Text, FlatList, TouchableOpacity, Dimensions, StyleSheet, Animated } from 'react-native';
13
+ import { useConversation } from '../../../../hooks/useImSelector';
14
+ import useTranslation from '../../../../hooks/useTranslation';
15
+ import { getImManager } from '../../../../init';
16
+ import { FileIcon, PhotosIcon, ShootingIcon, UserIcon } from './Icons';
17
+ import ImagePicker from 'react-native-image-crop-picker';
18
+ import { startSendContact } from '../../../../slice/contact/contact.slice';
19
+ import { copyFile } from '../../../../utils/file';
20
+ import { scrollToBottom } from '../../../../utils/scroll';
21
+ import { takeCamera } from '../../../../utils/take-camera';
22
+ import FontAwesome from "react-native-vector-icons/FontAwesome";
23
+ const OPTION_SIZE = (Dimensions.get('screen').width - 20) / 4;
53
24
  const keyExtractor = (item) => item.id;
54
- const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
55
- const navigation = (0, rn_ui_1.useNavigation)();
56
- const [visible, setVisible] = (0, react_1.useState)(false);
57
- const { currentConversation } = (0, useImSelector_1.useConversation)();
58
- const [heightAnim] = (0, react_1.useState)(new react_native_1.Animated.Value(0));
59
- const { t } = (0, useTranslation_1.default)();
60
- const imManager = (0, init_1.getImManager)();
61
- (0, react_1.useImperativeHandle)(ref, () => ({
25
+ const OptionPanel = forwardRef((props, ref) => {
26
+ const navigation = useNavigation();
27
+ const [visible, setVisible] = useState(false);
28
+ const { currentConversation } = useConversation();
29
+ const [heightAnim] = useState(new Animated.Value(0));
30
+ const { t } = useTranslation();
31
+ const imManager = getImManager();
32
+ useImperativeHandle(ref, () => ({
62
33
  getVisible: () => visible,
63
34
  show: height => {
64
35
  heightAnim.setValue(height);
@@ -70,29 +41,29 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
70
41
  },
71
42
  }), [visible]);
72
43
  const sendPicture = (data) => __awaiter(void 0, void 0, void 0, function* () {
73
- (0, scroll_1.scrollToBottom)();
74
- yield (0, init_1.getImManager)().sendPictureMessage(Object.assign({}, currentConversation), data);
44
+ scrollToBottom();
45
+ yield getImManager().sendPictureMessage(Object.assign({}, currentConversation), data);
75
46
  });
76
47
  const sendVideo = (data) => __awaiter(void 0, void 0, void 0, function* () {
77
- (0, scroll_1.scrollToBottom)();
78
- yield (0, init_1.getImManager)().sendVideoMessage(Object.assign({}, currentConversation), data);
48
+ scrollToBottom();
49
+ yield getImManager().sendVideoMessage(Object.assign({}, currentConversation), data);
79
50
  });
80
51
  const sendFile = (data) => __awaiter(void 0, void 0, void 0, function* () {
81
- (0, scroll_1.scrollToBottom)();
82
- const destPath = yield (0, file_1.copyFile)(data.localPath, data.filename, 'file');
83
- yield (0, init_1.getImManager)().sendFileMessage(Object.assign({}, currentConversation), Object.assign(Object.assign({}, data), { localPath: destPath }));
52
+ scrollToBottom();
53
+ const destPath = yield copyFile(data.localPath, data.filename, 'file');
54
+ yield getImManager().sendFileMessage(Object.assign({}, currentConversation), Object.assign(Object.assign({}, data), { localPath: destPath }));
84
55
  });
85
56
  const openAlbum = () => __awaiter(void 0, void 0, void 0, function* () {
86
57
  try {
87
- const images = yield react_native_image_crop_picker_1.default.openPicker({
58
+ const images = yield ImagePicker.openPicker({
88
59
  mediaType: 'photo',
89
60
  multiple: true,
90
61
  compressImageQuality: 0.7,
91
62
  compressImageMaxWidth: 1080,
92
63
  });
93
64
  console.log(images);
94
- images.map(item => {
95
- sendPicture({
65
+ for (const item of images) {
66
+ yield sendPicture({
96
67
  filename: item.filename,
97
68
  size: item.size,
98
69
  localPath: item.path,
@@ -101,7 +72,7 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
101
72
  width: item.width,
102
73
  height: item.height,
103
74
  });
104
- });
75
+ }
105
76
  }
106
77
  catch (e) {
107
78
  console.log(e);
@@ -109,7 +80,7 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
109
80
  });
110
81
  const openCamera = () => __awaiter(void 0, void 0, void 0, function* () {
111
82
  try {
112
- yield (0, take_camera_1.takeCamera)(currentConversation);
83
+ yield takeCamera(currentConversation);
113
84
  }
114
85
  catch (e) {
115
86
  console.log(e);
@@ -117,31 +88,7 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
117
88
  });
118
89
  const pickFile = () => __awaiter(void 0, void 0, void 0, function* () {
119
90
  try {
120
- const files = yield DocumentPicker.pick({
121
- type: [DocumentPicker.types.allFiles],
122
- });
123
- const fileInfo = files[0];
124
- console.log('chooseFile: ', fileInfo);
125
- if (!fileInfo.uri) {
126
- rn_ui_1.Toast.error(t("failedToObtainFilePath"));
127
- return;
128
- }
129
- const ext = (0, file_1.getExtensionFromMime)(fileInfo.type);
130
- if (!ext) {
131
- rn_ui_1.Toast.error(t("unsupportedFileTypes"));
132
- return;
133
- }
134
- if (!fileInfo.name.endsWith(ext)) {
135
- fileInfo.name = fileInfo.name + ext;
136
- }
137
- yield sendFile({
138
- // ios 中文名称编码了,需要解码
139
- localPath: decodeURI(fileInfo.uri),
140
- filename: fileInfo.name,
141
- size: fileInfo.size,
142
- type: fileInfo.type,
143
- lastModified: Date.now(),
144
- });
91
+ navigation.navigate('FileSelector');
145
92
  }
146
93
  catch (e) {
147
94
  console.log(e);
@@ -150,13 +97,13 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
150
97
  const options = [
151
98
  {
152
99
  id: 'picture-o',
153
- icon: <Icons_1.PhotosIcon size={30}/>,
100
+ icon: <PhotosIcon size={30}/>,
154
101
  text: t('imgOrDoc'),
155
102
  onPress: openAlbum,
156
103
  },
157
104
  {
158
105
  id: 'camera',
159
- icon: <Icons_1.ShootingIcon size={40}/>,
106
+ icon: <ShootingIcon size={40}/>,
160
107
  text: t('camera'),
161
108
  onPress: openCamera,
162
109
  },
@@ -176,13 +123,13 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
176
123
  // },
177
124
  {
178
125
  id: 'file',
179
- icon: <Icons_1.FileIcon size={40}/>,
126
+ icon: <FileIcon size={40}/>,
180
127
  text: t('file'),
181
128
  onPress: pickFile,
182
129
  },
183
130
  {
184
131
  id: 'star',
185
- icon: <FontAwesome_1.default name="star" color="#000" size={32}/>,
132
+ icon: <FontAwesome name="star" color="#000" size={32}/>,
186
133
  text: t('collect'),
187
134
  onPress: () => {
188
135
  navigation.navigate('Collection');
@@ -190,33 +137,33 @@ const OptionPanel = (0, react_1.forwardRef)((props, ref) => {
190
137
  },
191
138
  {
192
139
  id: 'user',
193
- icon: <Icons_1.UserIcon size={34}/>,
140
+ icon: <UserIcon size={34}/>,
194
141
  text: t('contact'),
195
142
  onPress: () => {
196
- (0, init_1.getImManager)().store.dispatch((0, contact_slice_1.startSendContact)());
143
+ getImManager().store.dispatch(startSendContact());
197
144
  navigation.navigate('ChooseContact', { checkMode: 'single' });
198
145
  },
199
146
  },
200
147
  ];
201
- const renderItem = ({ item }) => (<react_native_1.TouchableOpacity style={style.item} onPress={item.onPress}>
202
- <react_native_1.View style={style.icon}>{item.icon}</react_native_1.View>
203
- <react_native_1.Text style={style.text}>{item.text}</react_native_1.Text>
204
- </react_native_1.TouchableOpacity>);
205
- return (<react_native_1.Animated.View style={{
148
+ const renderItem = ({ item }) => (<TouchableOpacity style={style.item} onPress={item.onPress}>
149
+ <View style={style.icon}>{item.icon}</View>
150
+ <Text style={style.text}>{item.text}</Text>
151
+ </TouchableOpacity>);
152
+ return (<Animated.View style={{
206
153
  height: heightAnim,
207
154
  position: 'relative',
208
155
  paddingBottom: visible ? 20 : 0,
209
156
  }} pointerEvents="auto">
210
- <react_native_1.FlatList numColumns={4} initialNumToRender={8} data={options} style={{
157
+ <FlatList numColumns={4} initialNumToRender={8} data={options} style={{
211
158
  flex: 1,
212
159
  }}
213
160
  // @ts-ignore
214
161
  keyExtractor={keyExtractor} contentContainerStyle={{
215
162
  paddingHorizontal: 10,
216
163
  }} pointerEvents="auto" keyboardShouldPersistTaps={'handled'} renderItem={renderItem} scrollEnabled/>
217
- </react_native_1.Animated.View>);
164
+ </Animated.View>);
218
165
  });
219
- const style = react_native_1.StyleSheet.create({
166
+ const style = StyleSheet.create({
220
167
  item: {
221
168
  width: OPTION_SIZE,
222
169
  height: OPTION_SIZE + 5,
@@ -227,15 +174,15 @@ const style = react_native_1.StyleSheet.create({
227
174
  display: 'flex',
228
175
  alignItems: 'center',
229
176
  justifyContent: 'center',
230
- width: (0, rn_ui_1.dp)(60),
231
- height: (0, rn_ui_1.dp)(60),
177
+ width: dp(60),
178
+ height: dp(60),
232
179
  marginBottom: 5,
233
180
  backgroundColor: '#fff',
234
- borderRadius: (0, rn_ui_1.dp)(10),
181
+ borderRadius: dp(10),
235
182
  },
236
183
  text: {
237
- fontSize: (0, rn_ui_1.dp)(14),
184
+ fontSize: dp(14),
238
185
  color: '#333',
239
186
  },
240
187
  });
241
- exports.default = (0, react_1.memo)(OptionPanel);
188
+ export default memo(OptionPanel);