@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,40 +7,38 @@ 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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
const react_native_permissions_1 = __importStar(require("react-native-permissions"));
|
49
|
-
const file_1 = require("../../../../utils/file");
|
10
|
+
import { dp, Toast } from '@smart-link/rn-ui';
|
11
|
+
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
12
|
+
import { View, Text, StyleSheet, Platform, AppState } from 'react-native';
|
13
|
+
import useTranslation from '../../../../hooks/useTranslation';
|
14
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
15
|
+
import { TopViewGetInstance } from '@smart-link/rn-ui';
|
16
|
+
import { useConversation } from '../../../../hooks/useImSelector';
|
17
|
+
import { getImManager } from '../../../../init';
|
18
|
+
import RNFS from 'react-native-fs';
|
19
|
+
import { AudioEncoderAndroidType, AudioSourceAndroidType, AVEncoderAudioQualityIOSType, AVEncodingOption, OutputFormatAndroidType } from 'react-native-audio-recorder-player';
|
20
|
+
import Permissions, { PERMISSIONS } from 'react-native-permissions';
|
21
|
+
import { getResourcePath } from "../../../../utils/file";
|
22
|
+
import { AudioRecorder } from "../../../../utils/audio";
|
23
|
+
import { uuidv4 } from "react-native-compressor";
|
50
24
|
const btPressInColor = '#ccc', btPressOutColor = '#fff';
|
51
|
-
const audioRecorderPlayer = new react_native_audio_recorder_player_1.default();
|
52
25
|
const audioSet = {
|
53
|
-
AudioEncoderAndroid:
|
54
|
-
|
55
|
-
|
56
|
-
AVEncoderAudioQualityKeyIOS:
|
26
|
+
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
|
27
|
+
AudioSamplingRateAndroid: 44100,
|
28
|
+
AudioSourceAndroid: AudioSourceAndroidType.MIC,
|
29
|
+
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.medium,
|
30
|
+
AVFormatIDKeyIOS: AVEncodingOption.aac,
|
57
31
|
AVNumberOfChannelsKeyIOS: 2,
|
58
|
-
|
32
|
+
OutputFormatAndroid: OutputFormatAndroidType.MPEG_4
|
59
33
|
};
|
60
34
|
const VoiceBar = () => {
|
61
|
-
const { currentConversation } =
|
62
|
-
const { t } = (
|
35
|
+
const { currentConversation } = useConversation();
|
36
|
+
const { t } = useTranslation();
|
63
37
|
const btPressInText = t('pressIn');
|
64
38
|
const btPressOutText = t('pressOut');
|
65
|
-
const [recordText, setRecordText] =
|
66
|
-
const [recordColor, setRecordColor] =
|
67
|
-
const recordManger =
|
39
|
+
const [recordText, setRecordText] = useState(btPressOutText);
|
40
|
+
const [recordColor, setRecordColor] = useState(btPressOutColor);
|
41
|
+
const recordManger = useRef({
|
68
42
|
pageY: 0,
|
69
43
|
recordTime: 0,
|
70
44
|
cancelRecord: false,
|
@@ -87,12 +61,12 @@ const VoiceBar = () => {
|
|
87
61
|
icon: 'mic-none',
|
88
62
|
},
|
89
63
|
};
|
90
|
-
const onResponderGrant =
|
64
|
+
const onResponderGrant = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
91
65
|
if (recordManger.current.recording)
|
92
66
|
return;
|
93
67
|
try {
|
94
68
|
recordManger.current.recording = true;
|
95
|
-
|
69
|
+
AudioRecorder.addRecordBackListener((e) => {
|
96
70
|
recordManger.current.recordTime = e.currentPosition / 1000;
|
97
71
|
if (RecordToast.key) {
|
98
72
|
if (recordManger.current.cancelRecord) {
|
@@ -103,23 +77,23 @@ const VoiceBar = () => {
|
|
103
77
|
}
|
104
78
|
}
|
105
79
|
});
|
106
|
-
const relativePath =
|
107
|
-
const path =
|
80
|
+
const relativePath = getResourcePath(`record_${uuidv4()}.m4a`, 'voice');
|
81
|
+
const path = Platform.select({
|
108
82
|
ios: `file://${relativePath}`,
|
109
83
|
android: relativePath,
|
110
84
|
});
|
111
|
-
yield
|
85
|
+
yield AudioRecorder.startRecorder(path, audioSet, false);
|
112
86
|
}
|
113
87
|
catch (err) {
|
114
|
-
console.
|
88
|
+
console.log('Failed to start recording: ', err);
|
115
89
|
RecordToast.hide();
|
116
|
-
return
|
90
|
+
return Toast.error(t('recordingFail'));
|
117
91
|
}
|
118
92
|
setRecordText(btPressInText);
|
119
93
|
setRecordColor(btPressInColor);
|
120
94
|
RecordToast.show(recordStatus.recording, 0);
|
121
95
|
}), []);
|
122
|
-
const onResponderMove =
|
96
|
+
const onResponderMove = useCallback(({ nativeEvent }) => {
|
123
97
|
if (!recordManger.current.pageY) {
|
124
98
|
recordManger.current.pageY = nativeEvent.pageY;
|
125
99
|
}
|
@@ -133,28 +107,43 @@ const VoiceBar = () => {
|
|
133
107
|
RecordToast.show(recordStatus.recording, recordManger.current.recordTime);
|
134
108
|
}
|
135
109
|
}, []);
|
136
|
-
const onResponderRelease =
|
110
|
+
const onResponderRelease = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
137
111
|
try {
|
112
|
+
if (recordManger.current.recordTime < 1) {
|
113
|
+
AudioRecorder.removeRecordBackListener();
|
114
|
+
RecordToast.show(recordStatus.short, recordManger.current.recordTime);
|
115
|
+
setTimeout(() => {
|
116
|
+
try {
|
117
|
+
AudioRecorder.stopRecorder().then(uri => {
|
118
|
+
console.log('stopRecorder cancel: ', uri);
|
119
|
+
recordManger.current.recording = false;
|
120
|
+
setRecordText(btPressOutText);
|
121
|
+
setRecordColor(btPressOutColor);
|
122
|
+
RecordToast.hide();
|
123
|
+
});
|
124
|
+
}
|
125
|
+
catch (e) {
|
126
|
+
console.log('cancel stop: ', e);
|
127
|
+
recordManger.current.recording = false;
|
128
|
+
setRecordText(btPressOutText);
|
129
|
+
setRecordColor(btPressOutColor);
|
130
|
+
RecordToast.hide();
|
131
|
+
}
|
132
|
+
}, 1000);
|
133
|
+
return;
|
134
|
+
}
|
138
135
|
recordManger.current.recording = false;
|
139
136
|
let filePath;
|
140
137
|
let file;
|
141
138
|
try {
|
142
|
-
filePath = yield
|
143
|
-
file = yield
|
139
|
+
filePath = yield AudioRecorder.stopRecorder();
|
140
|
+
file = yield RNFS.stat(filePath);
|
141
|
+
AudioRecorder.removeRecordBackListener();
|
144
142
|
}
|
145
143
|
catch (err) {
|
146
|
-
console.
|
144
|
+
console.log('Failed to stop recording: ', err);
|
147
145
|
RecordToast.hide();
|
148
|
-
|
149
|
-
setRecordText(btPressOutText);
|
150
|
-
setRecordColor(btPressOutColor);
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
if (recordManger.current.recordTime < 1) {
|
154
|
-
RecordToast.show(recordStatus.short, recordManger.current.recordTime);
|
155
|
-
setTimeout(() => {
|
156
|
-
RecordToast.hide();
|
157
|
-
}, 1000);
|
146
|
+
Toast.error(t('recordingFail'));
|
158
147
|
setRecordText(btPressOutText);
|
159
148
|
setRecordColor(btPressOutColor);
|
160
149
|
return;
|
@@ -164,12 +153,13 @@ const VoiceBar = () => {
|
|
164
153
|
RecordToast.hide();
|
165
154
|
if (!recordManger.current.cancelRecord) {
|
166
155
|
console.log('send');
|
167
|
-
|
156
|
+
const imManager = getImManager();
|
157
|
+
imManager
|
168
158
|
.sendVoiceMessage(Object.assign({}, currentConversation), {
|
169
159
|
localPath: filePath,
|
170
160
|
duration: recordManger.current.recordTime,
|
171
161
|
size: file.size,
|
172
|
-
type: 'audio/
|
162
|
+
type: 'audio/m4a',
|
173
163
|
lastModified: Date.now(),
|
174
164
|
filename: filePath.split('/').pop(),
|
175
165
|
})
|
@@ -185,18 +175,43 @@ const VoiceBar = () => {
|
|
185
175
|
};
|
186
176
|
}
|
187
177
|
catch (err) {
|
188
|
-
console.
|
178
|
+
console.log('Failed to stop recording: ', err);
|
189
179
|
RecordToast.hide();
|
190
180
|
}
|
191
181
|
}), []);
|
192
|
-
|
193
|
-
if (
|
194
|
-
|
182
|
+
useEffect(() => {
|
183
|
+
if (Platform.OS === 'ios') {
|
184
|
+
Permissions.check(PERMISSIONS.IOS.MICROPHONE).then((result) => {
|
185
|
+
if (result !== 'granted') {
|
186
|
+
Permissions.request(PERMISSIONS.IOS.MICROPHONE).then((result) => {
|
187
|
+
if (result !== 'granted') {
|
188
|
+
console.log('Microphone permission not granted');
|
189
|
+
Toast.error(t('noAuth'));
|
190
|
+
}
|
191
|
+
});
|
192
|
+
}
|
193
|
+
});
|
194
|
+
}
|
195
|
+
if (Platform.OS === 'android') {
|
196
|
+
AppState.addEventListener('change', (state) => {
|
197
|
+
if (state === 'background') {
|
198
|
+
RecordToast.hide();
|
199
|
+
recordManger.current.cancelRecord = true;
|
200
|
+
setTimeout(() => {
|
201
|
+
// 防止录音时间过短,停止失败
|
202
|
+
AudioRecorder.stopRecorder().then(r => {
|
203
|
+
console.log('stopRecorder', r);
|
204
|
+
});
|
205
|
+
AudioRecorder.removeRecordBackListener();
|
206
|
+
}, 500);
|
207
|
+
}
|
208
|
+
});
|
209
|
+
Permissions.check(PERMISSIONS.ANDROID.RECORD_AUDIO).then((result) => {
|
195
210
|
if (result !== 'granted') {
|
196
|
-
|
211
|
+
Permissions.request(PERMISSIONS.ANDROID.RECORD_AUDIO).then((result) => {
|
197
212
|
if (result !== 'granted') {
|
198
213
|
console.log('Microphone permission not granted');
|
199
|
-
|
214
|
+
Toast.error(t('noAuth'));
|
200
215
|
}
|
201
216
|
});
|
202
217
|
}
|
@@ -206,31 +221,31 @@ const VoiceBar = () => {
|
|
206
221
|
RecordToast.hide();
|
207
222
|
};
|
208
223
|
}, []);
|
209
|
-
return (<
|
210
|
-
<
|
211
|
-
<
|
212
|
-
</
|
213
|
-
</
|
224
|
+
return (<View style={styles.container}>
|
225
|
+
<View style={[styles.record, { backgroundColor: recordColor }]} onStartShouldSetResponder={() => true} onMoveShouldSetResponder={() => true} onResponderGrant={onResponderGrant} onResponderMove={onResponderMove} onResponderRelease={onResponderRelease} onResponderTerminationRequest={() => false}>
|
226
|
+
<Text style={styles.recordText}>{recordText}</Text>
|
227
|
+
</View>
|
228
|
+
</View>);
|
214
229
|
};
|
215
|
-
const styles =
|
230
|
+
const styles = StyleSheet.create({
|
216
231
|
container: {
|
217
232
|
flex: 1,
|
218
|
-
marginVertical:
|
233
|
+
marginVertical: dp(6),
|
219
234
|
},
|
220
235
|
record: {
|
221
236
|
flex: 1,
|
222
237
|
backgroundColor: '#fff',
|
223
238
|
justifyContent: 'center',
|
224
239
|
alignItems: 'center',
|
225
|
-
borderRadius:
|
240
|
+
borderRadius: dp(3),
|
226
241
|
},
|
227
242
|
recordText: {
|
228
243
|
width: '100%',
|
229
244
|
textAlign: 'center',
|
230
245
|
color: '#666',
|
231
246
|
fontWeight: '500',
|
232
|
-
fontSize:
|
233
|
-
lineHeight:
|
247
|
+
fontSize: dp(15),
|
248
|
+
lineHeight: dp(17),
|
234
249
|
},
|
235
250
|
toastText: {
|
236
251
|
margin: 4,
|
@@ -243,30 +258,37 @@ const styles = react_native_1.StyleSheet.create({
|
|
243
258
|
});
|
244
259
|
class RecordToast {
|
245
260
|
static show(option, time) {
|
261
|
+
if (RecordToast.lock)
|
262
|
+
return;
|
246
263
|
const { text, color, icon } = option;
|
247
|
-
const ToastNode = (<
|
264
|
+
const ToastNode = (<Toast visible={true} onClose={() => {
|
248
265
|
RecordToast.hide();
|
249
|
-
}} content={<
|
250
|
-
<
|
251
|
-
<
|
252
|
-
</
|
266
|
+
}} content={<Text style={[styles.toastText, { color }]}>{text}</Text>} duration={10000} icon={<Text style={styles.toastIcon}>
|
267
|
+
<Icon name={icon} size={70} color={'white'}/>
|
268
|
+
<Text style={{ width: 80 }}>({Math.round(time)}'')</Text>
|
269
|
+
</Text>}/>);
|
253
270
|
if (RecordToast.key) {
|
254
|
-
|
271
|
+
TopViewGetInstance().replace(ToastNode, RecordToast.key);
|
255
272
|
}
|
256
273
|
else {
|
257
|
-
|
274
|
+
// 显示前加锁,防止添加多个实例
|
275
|
+
RecordToast.lock = true;
|
276
|
+
TopViewGetInstance()
|
258
277
|
.add(ToastNode)
|
259
278
|
.then((id) => {
|
260
279
|
RecordToast.key = id;
|
280
|
+
RecordToast.lock = false;
|
261
281
|
});
|
262
282
|
}
|
263
283
|
}
|
264
284
|
static hide() {
|
285
|
+
RecordToast.lock = false;
|
265
286
|
if (!RecordToast.key)
|
266
287
|
return;
|
267
|
-
|
288
|
+
TopViewGetInstance().remove(RecordToast.key);
|
268
289
|
RecordToast.key = null;
|
269
290
|
}
|
270
291
|
}
|
271
292
|
RecordToast.key = null;
|
272
|
-
|
293
|
+
RecordToast.lock = false;
|
294
|
+
export default memo(VoiceBar);
|
@@ -1,23 +1,2 @@
|
|
1
|
-
|
2
|
-
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
-
};
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
-
exports.default = void 0;
|
21
|
-
var MessageBar_1 = require("./MessageBar");
|
22
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(MessageBar_1).default; } });
|
23
|
-
__exportStar(require("./MessageBar"), exports);
|
1
|
+
export { default } from './MessageBar';
|
2
|
+
export * from './MessageBar';
|
@@ -1,47 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
exports.messageRoutes = void 0;
|
30
|
-
const MessageList_1 = __importDefault(require("./MessageList"));
|
31
|
-
const ChooseMember_1 = __importDefault(require("./ChooseMember"));
|
32
|
-
const MessageRecord_1 = __importDefault(require("./MessageRecord"));
|
33
|
-
const MessageBackup_1 = __importStar(require("./MessageBackup"));
|
34
|
-
exports.messageRoutes = [
|
1
|
+
import MessageList from './MessageList';
|
2
|
+
import ChooseMember from './ChooseMember';
|
3
|
+
import MessageRecord from './MessageRecord';
|
4
|
+
import MessageBackup, { StartBackupPage, RestoreBackupPage } from './MessageBackup';
|
5
|
+
export const messageRoutes = [
|
35
6
|
{
|
36
7
|
name: 'MessageList',
|
37
|
-
component:
|
8
|
+
component: MessageList,
|
38
9
|
options: {
|
39
10
|
title: '',
|
40
11
|
},
|
41
12
|
},
|
42
13
|
{
|
43
14
|
name: 'ChooseMember',
|
44
|
-
component:
|
15
|
+
component: ChooseMember,
|
45
16
|
options: {
|
46
17
|
title: '',
|
47
18
|
animation: 'fade_from_bottom',
|
@@ -50,28 +21,28 @@ exports.messageRoutes = [
|
|
50
21
|
},
|
51
22
|
{
|
52
23
|
name: 'MessageRecord',
|
53
|
-
component:
|
24
|
+
component: MessageRecord,
|
54
25
|
options: {
|
55
26
|
title: '',
|
56
27
|
},
|
57
28
|
},
|
58
29
|
{
|
59
30
|
name: 'MessageBackup',
|
60
|
-
component:
|
31
|
+
component: MessageBackup,
|
61
32
|
options: {
|
62
33
|
title: '',
|
63
34
|
},
|
64
35
|
},
|
65
36
|
{
|
66
37
|
name: 'StartBackupPage',
|
67
|
-
component:
|
38
|
+
component: StartBackupPage,
|
68
39
|
options: {
|
69
40
|
title: '',
|
70
41
|
},
|
71
42
|
},
|
72
43
|
{
|
73
44
|
name: 'RestoreBackupPage',
|
74
|
-
component:
|
45
|
+
component: RestoreBackupPage,
|
75
46
|
options: {
|
76
47
|
title: '',
|
77
48
|
},
|
@@ -1,84 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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 useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
|
33
|
-
const SearchUser_1 = __importDefault(require("./components/SearchUser"));
|
34
|
-
const ChatRecords_1 = __importDefault(require("./components/ChatRecords"));
|
35
|
-
const MyGroupChat_1 = __importDefault(require("./components/MyGroupChat"));
|
36
|
-
const init_1 = require("../../init");
|
37
|
-
const im_base_1 = require("@smart-link/im-base");
|
1
|
+
import { NavigationPage, dp, SegmentedView, HeaderSearchBar } from '@smart-link/rn-ui';
|
2
|
+
import React, { useEffect, useState } from 'react';
|
3
|
+
import { InteractionManager, StyleSheet } from 'react-native';
|
4
|
+
import useTranslation from '../../hooks/useTranslation';
|
5
|
+
import SearchUser from './components/SearchUser';
|
6
|
+
import ChatRecords from './components/ChatRecords';
|
7
|
+
import MyGroupChat from './components/MyGroupChat';
|
8
|
+
import { getImManager } from '../../init';
|
9
|
+
import { GroupActions } from '@smart-link/im-base';
|
38
10
|
const Search = ({ route: { params } }) => {
|
39
|
-
const { t } = (
|
40
|
-
const [keyword, setKeyword] =
|
41
|
-
|
42
|
-
|
11
|
+
const { t } = useTranslation();
|
12
|
+
const [keyword, setKeyword] = useState('');
|
13
|
+
useEffect(() => {
|
14
|
+
InteractionManager.runAfterInteractions(() => {
|
43
15
|
var _a;
|
44
|
-
(_a =
|
16
|
+
(_a = getImManager()) === null || _a === void 0 ? void 0 : _a.store.dispatch(GroupActions.loadMyGroups());
|
45
17
|
});
|
46
18
|
}, []);
|
47
19
|
return (<>
|
48
|
-
<
|
49
|
-
<
|
50
|
-
<
|
51
|
-
<
|
52
|
-
<
|
53
|
-
</
|
54
|
-
<
|
55
|
-
<
|
56
|
-
</
|
57
|
-
<
|
58
|
-
<
|
59
|
-
</
|
60
|
-
</
|
61
|
-
</
|
20
|
+
<HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
|
21
|
+
<NavigationPage noPadding>
|
22
|
+
<SegmentedView style={styles.segmented} barStyle={styles.segmentedBar} justifyItem={'scrollable'} indicatorType={'boxWidth'} type={'carousel'}>
|
23
|
+
<SegmentedView.Sheet title={t('contacts')} titleStyle={styles.sheetTitle} activeTitleStyle={styles.sheetTitleActive}>
|
24
|
+
<SearchUser keyword={keyword}/>
|
25
|
+
</SegmentedView.Sheet>
|
26
|
+
<SegmentedView.Sheet title={t('groupChat')} titleStyle={styles.sheetTitle} activeTitleStyle={styles.sheetTitleActive}>
|
27
|
+
<MyGroupChat keyword={keyword}/>
|
28
|
+
</SegmentedView.Sheet>
|
29
|
+
<SegmentedView.Sheet title={t('chatRecord')} titleStyle={styles.sheetTitle} activeTitleStyle={styles.sheetTitleActive}>
|
30
|
+
<ChatRecords keyword={keyword}/>
|
31
|
+
</SegmentedView.Sheet>
|
32
|
+
</SegmentedView>
|
33
|
+
</NavigationPage>
|
62
34
|
</>);
|
63
35
|
};
|
64
|
-
const styles =
|
36
|
+
const styles = StyleSheet.create({
|
65
37
|
segmented: {
|
66
38
|
flex: 1,
|
67
39
|
backgroundColor: '#fff',
|
68
40
|
},
|
69
41
|
segmentedBar: {
|
70
|
-
paddingTop:
|
71
|
-
paddingHorizontal:
|
42
|
+
paddingTop: dp(5),
|
43
|
+
paddingHorizontal: dp(15),
|
72
44
|
},
|
73
45
|
sheetTitle: {
|
74
|
-
fontSize:
|
75
|
-
lineHeight:
|
76
|
-
borderRadius:
|
46
|
+
fontSize: dp(14),
|
47
|
+
lineHeight: dp(16),
|
48
|
+
borderRadius: dp(3),
|
77
49
|
},
|
78
50
|
sheetTitleActive: {
|
79
|
-
fontSize:
|
80
|
-
lineHeight:
|
81
|
-
borderRadius:
|
51
|
+
fontSize: dp(14),
|
52
|
+
lineHeight: dp(16),
|
53
|
+
borderRadius: dp(3),
|
82
54
|
},
|
83
55
|
});
|
84
|
-
|
56
|
+
export default Search;
|