@smart-link/rn-im 1.0.23 → 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 +46 -74
- 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 -135
- 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 +4 -8
- 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,83 +1,55 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const react_1 = __importStar(require("react"));
|
30
|
-
const react_native_1 = require("react-native");
|
31
|
-
const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar/ChatAvatar"));
|
32
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
1
|
+
import React, { memo } from 'react';
|
2
|
+
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
|
3
|
+
import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
|
4
|
+
import { dp } from '@smart-link/rn-ui';
|
33
5
|
// @ts-ignore
|
34
|
-
|
35
|
-
const MessageItemQuote =
|
6
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
7
|
+
const MessageItemQuote = memo(props => {
|
36
8
|
const { quoteId, quoteAvatars, quoteTitle, quoteText, onDeleteQuote, } = props;
|
37
|
-
return (<
|
38
|
-
<
|
39
|
-
<
|
40
|
-
<
|
41
|
-
<
|
42
|
-
<
|
43
|
-
</
|
44
|
-
<
|
45
|
-
<
|
46
|
-
</
|
47
|
-
</
|
9
|
+
return (<View style={styles.quote}>
|
10
|
+
<ChatAvatar id={quoteId} url={quoteAvatars} size={dp(32)} name={''}/>
|
11
|
+
<View style={styles.width10}/>
|
12
|
+
<View style={styles.left}>
|
13
|
+
<Text style={styles.name} numberOfLines={1}>{quoteTitle}</Text>
|
14
|
+
<Text style={styles.text} numberOfLines={1}>{quoteText}</Text>
|
15
|
+
</View>
|
16
|
+
<TouchableOpacity style={styles.delete} onPress={onDeleteQuote}>
|
17
|
+
<Icon name="clear" color="#666" size={dp(18)}/>
|
18
|
+
</TouchableOpacity>
|
19
|
+
</View>);
|
48
20
|
});
|
49
|
-
const styles =
|
21
|
+
const styles = StyleSheet.create({
|
50
22
|
quote: {
|
51
23
|
backgroundColor: '#f3f3f3',
|
52
|
-
padding:
|
24
|
+
padding: dp(8),
|
53
25
|
flexDirection: 'row',
|
54
26
|
borderColor: '#eee',
|
55
27
|
borderStyle: 'solid',
|
56
|
-
borderWidth:
|
28
|
+
borderWidth: dp(1),
|
57
29
|
alignItems: 'center',
|
58
30
|
},
|
59
31
|
width10: {
|
60
|
-
width:
|
32
|
+
width: dp(10),
|
61
33
|
},
|
62
34
|
left: {
|
63
35
|
justifyContent: 'space-between'
|
64
36
|
},
|
65
37
|
name: {
|
66
|
-
width:
|
67
|
-
fontSize:
|
68
|
-
lineHeight:
|
38
|
+
width: dp(250),
|
39
|
+
fontSize: dp(12),
|
40
|
+
lineHeight: dp(15),
|
69
41
|
color: '#999',
|
70
42
|
},
|
71
43
|
text: {
|
72
|
-
width:
|
73
|
-
fontSize:
|
74
|
-
lineHeight:
|
44
|
+
width: dp(270),
|
45
|
+
fontSize: dp(12),
|
46
|
+
lineHeight: dp(16),
|
75
47
|
color: '#666',
|
76
48
|
},
|
77
49
|
delete: {
|
78
|
-
paddingTop:
|
79
|
-
right:
|
50
|
+
paddingTop: dp(3),
|
51
|
+
right: dp(10),
|
80
52
|
position: 'absolute',
|
81
53
|
}
|
82
54
|
});
|
83
|
-
|
55
|
+
export default MessageItemQuote;
|
@@ -1,67 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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 FontAwesome_1 = __importDefault(require("react-native-vector-icons/FontAwesome"));
|
33
|
-
const styles_1 = require("../../../components/styles");
|
34
|
-
const init_1 = require("../../../init");
|
35
|
-
const im_base_1 = require("@smart-link/im-base");
|
36
|
-
const MessageItemTips = (0, react_1.memo)(props => {
|
1
|
+
import { dp } from '@smart-link/rn-ui';
|
2
|
+
import React, { memo } from 'react';
|
3
|
+
import { Image, StyleSheet, Text, TouchableOpacity } from 'react-native';
|
4
|
+
import FontAwesome from "react-native-vector-icons/FontAwesome";
|
5
|
+
import { shadowStyle } from "../../../components/styles";
|
6
|
+
import { getImManager, getLogo } from "../../../init";
|
7
|
+
import { MessagePanelActions } from '@smart-link/im-base';
|
8
|
+
const MessageItemTips = memo(props => {
|
37
9
|
const { text, style, } = props;
|
38
|
-
return (<
|
39
|
-
const imManager =
|
40
|
-
imManager.store.dispatch(
|
10
|
+
return (<TouchableOpacity style={[styles.tips, style]} onPress={() => {
|
11
|
+
const imManager = getImManager();
|
12
|
+
imManager.store.dispatch(MessagePanelActions.focusTipsMessage(imManager));
|
41
13
|
}}>
|
42
|
-
<
|
43
|
-
<
|
44
|
-
<
|
45
|
-
<
|
46
|
-
</
|
47
|
-
</
|
14
|
+
<Image style={styles.logo} source={getLogo()}/>
|
15
|
+
<Text style={styles.text}>{text}</Text>
|
16
|
+
<Text style={styles.icon}>
|
17
|
+
<FontAwesome name="angle-double-up" color="#777" size={17}/>
|
18
|
+
</Text>
|
19
|
+
</TouchableOpacity>);
|
48
20
|
});
|
49
|
-
const styles =
|
50
|
-
tips: Object.assign({ top:
|
21
|
+
const styles = StyleSheet.create({
|
22
|
+
tips: Object.assign({ top: dp(35), right: dp(0), position: 'absolute', flexDirection: 'row', height: dp(36), backgroundColor: '#fff', justifyContent: 'space-between', alignItems: 'center', borderColor: '#eee', borderTopLeftRadius: dp(20), borderBottomLeftRadius: dp(20), paddingVertical: dp(4) }, shadowStyle),
|
51
23
|
logo: {
|
52
|
-
marginHorizontal:
|
53
|
-
height:
|
54
|
-
width:
|
24
|
+
marginHorizontal: dp(4),
|
25
|
+
height: dp(30),
|
26
|
+
width: dp(30),
|
55
27
|
justifyContent: 'center',
|
56
|
-
borderRadius:
|
28
|
+
borderRadius: dp(15),
|
57
29
|
},
|
58
30
|
text: {
|
59
|
-
fontSize:
|
60
|
-
lineHeight:
|
31
|
+
fontSize: dp(13),
|
32
|
+
lineHeight: dp(18),
|
61
33
|
color: '#555',
|
62
34
|
},
|
63
35
|
icon: {
|
64
|
-
marginHorizontal:
|
36
|
+
marginHorizontal: dp(4),
|
65
37
|
}
|
66
38
|
});
|
67
|
-
|
39
|
+
export default MessageItemTips;
|
@@ -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,38 +7,34 @@ 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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
const elements_1 = require("@react-navigation/elements");
|
52
|
-
const useImSelector_1 = require("../../../hooks/useImSelector");
|
53
|
-
const file_1 = require("../../../utils/file");
|
54
|
-
const ReceiptBack_1 = require("../../../pages/message/components/ReceiptBack");
|
10
|
+
import React, { memo, useRef } from 'react';
|
11
|
+
import { Animated, Text, StyleSheet, TouchableOpacity, View, TouchableWithoutFeedback, Dimensions, UIManager, StatusBar, Modal, } from 'react-native';
|
12
|
+
import Clipboard from '@react-native-clipboard/clipboard';
|
13
|
+
import { getMessageActionKeys, MessageActions, MessagePanelActions, MessageStatus, PayloadType, ConversationType, } from '@smart-link/im-base';
|
14
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
15
|
+
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
|
16
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
17
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
18
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
19
|
+
import { dp, Toast, useNavigation, Modal as Dialog } from '@smart-link/rn-ui';
|
20
|
+
import useTranslation from '../../../hooks/useTranslation';
|
21
|
+
import { ConfirmActionSheet } from '../../../utils/common-action-sheet';
|
22
|
+
import { getImManager } from '../../../init';
|
23
|
+
import { useHeaderHeight } from '@react-navigation/elements';
|
24
|
+
import { usePanel } from '../../../hooks/useImSelector';
|
25
|
+
import { saveToAlbum } from '../../../utils/file';
|
26
|
+
import { ReceiptBack } from "../../../pages/message/components/ReceiptBack";
|
55
27
|
const getMessageAction = (t, message, navigation, setLoading) => {
|
56
28
|
if (!message)
|
57
29
|
return [];
|
58
|
-
const actions =
|
30
|
+
const actions = getMessageActionKeys(message.payloadType);
|
59
31
|
const items = [
|
60
32
|
{
|
61
33
|
key: 'copy',
|
62
34
|
title: t('copy'),
|
63
|
-
icon: <
|
35
|
+
icon: <AntDesign name="copy1" size={dp(20)} color={'#333'}/>,
|
64
36
|
onPress: () => {
|
65
|
-
|
37
|
+
Clipboard.setString(message.payload.text);
|
66
38
|
},
|
67
39
|
},
|
68
40
|
// {
|
@@ -76,28 +48,28 @@ const getMessageAction = (t, message, navigation, setLoading) => {
|
|
76
48
|
{
|
77
49
|
key: 'forward',
|
78
50
|
title: t('forward'),
|
79
|
-
icon: <
|
51
|
+
icon: <FontAwesome5 name="reply" size={dp(19)} color={'#333'}/>,
|
80
52
|
onPress: () => {
|
81
|
-
|
53
|
+
getImManager().store.dispatch(MessageActions.setForwardMessage(message));
|
82
54
|
navigation.navigate('ForwardToConversation');
|
83
55
|
},
|
84
56
|
},
|
85
57
|
{
|
86
58
|
key: 'delete',
|
87
59
|
title: t('delete'),
|
88
|
-
icon: <
|
60
|
+
icon: <MaterialCommunityIcons name="delete-forever" size={dp(23)} color={'#333'}/>,
|
89
61
|
onPress: () => {
|
90
|
-
|
91
|
-
yield
|
62
|
+
ConfirmActionSheet(t('confirmDeleteMessage'), () => __awaiter(void 0, void 0, void 0, function* () {
|
63
|
+
yield getImManager().deleteMessage(message);
|
92
64
|
}), t);
|
93
65
|
},
|
94
66
|
},
|
95
67
|
{
|
96
68
|
key: 'reply',
|
97
69
|
title: t('reply'),
|
98
|
-
icon: <
|
70
|
+
icon: <MaterialCommunityIcons name="message-processing" size={dp(20)} color={'#333'}/>,
|
99
71
|
onPress: () => {
|
100
|
-
const imManager =
|
72
|
+
const imManager = getImManager();
|
101
73
|
imManager.replyMessage(message);
|
102
74
|
setTimeout(() => {
|
103
75
|
var _a, _b;
|
@@ -116,17 +88,17 @@ const getMessageAction = (t, message, navigation, setLoading) => {
|
|
116
88
|
{
|
117
89
|
key: 'undo',
|
118
90
|
title: t('undo'),
|
119
|
-
icon: <
|
91
|
+
icon: <FontAwesome name="undo" size={dp(20)} color={'#333'}/>,
|
120
92
|
onPress: () => __awaiter(void 0, void 0, void 0, function* () {
|
121
|
-
|
93
|
+
ConfirmActionSheet(t('confirmUndoMessage'), () => __awaiter(void 0, void 0, void 0, function* () {
|
122
94
|
try {
|
123
95
|
setLoading(true);
|
124
|
-
yield
|
96
|
+
yield getImManager().undoMessage(message);
|
125
97
|
setLoading(false);
|
126
98
|
}
|
127
99
|
catch (e) {
|
128
100
|
setLoading(false);
|
129
|
-
|
101
|
+
Toast.error(t('undoFail'));
|
130
102
|
}
|
131
103
|
}), t);
|
132
104
|
}),
|
@@ -134,10 +106,10 @@ const getMessageAction = (t, message, navigation, setLoading) => {
|
|
134
106
|
{
|
135
107
|
key: 'feedback',
|
136
108
|
title: t('feedback'),
|
137
|
-
icon: <
|
109
|
+
icon: <MaterialIcons name="feedback" size={dp(20)} color={'#333'}/>,
|
138
110
|
onPress: () => __awaiter(void 0, void 0, void 0, function* () {
|
139
|
-
|
140
|
-
content: <
|
111
|
+
Dialog.open({
|
112
|
+
content: <ReceiptBack message={message}/>,
|
141
113
|
maskClosable: true,
|
142
114
|
footer: {
|
143
115
|
cancelButton: false,
|
@@ -149,34 +121,38 @@ const getMessageAction = (t, message, navigation, setLoading) => {
|
|
149
121
|
{
|
150
122
|
key: 'collect',
|
151
123
|
title: t('collect'),
|
152
|
-
icon: <
|
124
|
+
icon: <FontAwesome name="star" size={dp(20)} color={'#333'}/>,
|
153
125
|
onPress: () => {
|
154
|
-
|
126
|
+
getImManager().collectMessage(message);
|
155
127
|
},
|
156
128
|
},
|
157
129
|
{
|
158
130
|
key: 'saveToAlbum',
|
159
131
|
title: t('savePicture'),
|
160
|
-
icon: <
|
132
|
+
icon: <AntDesign name="save" size={dp(20)} color={'#333'}/>,
|
161
133
|
onPress: () => __awaiter(void 0, void 0, void 0, function* () {
|
162
|
-
yield
|
134
|
+
yield saveToAlbum(getImManager(), localPath);
|
163
135
|
}),
|
164
136
|
},
|
165
137
|
{
|
166
138
|
key: 'download',
|
167
139
|
title: t('download'),
|
168
|
-
icon: <
|
140
|
+
icon: <AntDesign name="download" size={dp(20)} color={'#333'}/>,
|
169
141
|
onPress: () => __awaiter(void 0, void 0, void 0, function* () {
|
170
|
-
const imManager =
|
171
|
-
imManager.store.dispatch(
|
142
|
+
const imManager = getImManager();
|
143
|
+
imManager.store.dispatch(MessagePanelActions.downloadFile(imManager, message, () => {
|
144
|
+
Toast.success(t('downloaded'));
|
145
|
+
}, () => {
|
146
|
+
Toast.error(t('downloadError'));
|
147
|
+
}));
|
172
148
|
}),
|
173
149
|
},
|
174
150
|
{
|
175
151
|
key: 'multiple',
|
176
152
|
title: t('multiple'),
|
177
|
-
icon: <
|
153
|
+
icon: <MaterialCommunityIcons name="playlist-check" size={dp(22)} color={'#333'}/>,
|
178
154
|
onPress: () => {
|
179
|
-
|
155
|
+
getImManager().store.dispatch(MessagePanelActions.startMultipleSelect(message));
|
180
156
|
},
|
181
157
|
},
|
182
158
|
];
|
@@ -186,72 +162,72 @@ const getMessageAction = (t, message, navigation, setLoading) => {
|
|
186
162
|
// avatars,
|
187
163
|
// text,
|
188
164
|
localPath, }, conversationId, conversationType, } = message;
|
189
|
-
const imManager =
|
165
|
+
const imManager = getImManager();
|
190
166
|
return items.filter(item => {
|
191
167
|
const { key } = item;
|
192
168
|
//if (isMyMessage && key === 'reply') return false;
|
193
|
-
if (messageStatus ===
|
169
|
+
if (messageStatus === MessageStatus.EMITTING) {
|
194
170
|
return false;
|
195
171
|
}
|
196
172
|
if ((!isMyMessage ||
|
197
|
-
messageStatus ===
|
173
|
+
messageStatus === MessageStatus.EMIT_ERROR ||
|
198
174
|
new Date().getTime() - messageTime > imManager.undoLimitTime) &&
|
199
175
|
key === 'undo')
|
200
176
|
return false;
|
201
|
-
if (payloadType ===
|
177
|
+
if (payloadType === PayloadType.FILE && localPath && key === 'download') {
|
202
178
|
return false;
|
203
179
|
}
|
204
|
-
if ((!isMyMessage || conversationType !==
|
180
|
+
if ((!isMyMessage || conversationType !== ConversationType.C2C) && key === 'feedback') {
|
205
181
|
return false;
|
206
182
|
}
|
207
183
|
return actions.includes(item.key);
|
208
184
|
});
|
209
185
|
};
|
210
186
|
const renderOperations = (items, close) => {
|
211
|
-
return (<
|
187
|
+
return (<View style={styles.operationWrap}>
|
212
188
|
{items.map((item, index) => {
|
213
|
-
return (<
|
189
|
+
return (<TouchableOpacity key={index} onPress={() => {
|
214
190
|
item.onPress && item.onPress();
|
215
191
|
close && close();
|
216
192
|
}}>
|
217
|
-
<
|
193
|
+
<View style={styles.operationItem}>
|
218
194
|
{item.icon}
|
219
|
-
<
|
220
|
-
</
|
221
|
-
</
|
195
|
+
<Text style={styles.operationText}>{item.title}</Text>
|
196
|
+
</View>
|
197
|
+
</TouchableOpacity>);
|
222
198
|
})}
|
223
|
-
</
|
199
|
+
</View>);
|
224
200
|
};
|
225
201
|
const MessageOption = ({ visible, message, nativeEvent, onClose, setLoading }) => {
|
226
202
|
var _a;
|
227
|
-
const { t } = (
|
228
|
-
const headerHeight =
|
229
|
-
const { messageBarHeight } =
|
230
|
-
const navigation =
|
203
|
+
const { t } = useTranslation();
|
204
|
+
const headerHeight = useHeaderHeight();
|
205
|
+
const { messageBarHeight } = usePanel();
|
206
|
+
const navigation = useNavigation();
|
231
207
|
const items = getMessageAction(t, message, navigation, setLoading);
|
232
|
-
const translateX =
|
233
|
-
const translateY =
|
234
|
-
const scale =
|
235
|
-
const opacity =
|
236
|
-
const { width: screenWidth, height: screenHeight } =
|
237
|
-
const padding =
|
208
|
+
const translateX = useRef(new Animated.Value(0)).current;
|
209
|
+
const translateY = useRef(new Animated.Value(0)).current;
|
210
|
+
const scale = useRef(new Animated.Value(0)).current;
|
211
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
212
|
+
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
213
|
+
const padding = dp(12);
|
238
214
|
// 视窗范围
|
239
215
|
const displayArea = {
|
240
216
|
x: padding,
|
241
217
|
y: padding,
|
242
218
|
width: screenWidth - padding * 2,
|
243
|
-
height: screenHeight - headerHeight - messageBarHeight - ((_a =
|
219
|
+
height: screenHeight - headerHeight - messageBarHeight - ((_a = StatusBar.currentHeight) !== null && _a !== void 0 ? _a : 0) - padding * 2,
|
244
220
|
};
|
245
221
|
const showAnimation = (x, y) => {
|
246
222
|
translateX.setValue(x);
|
247
223
|
translateY.setValue(y);
|
248
|
-
|
249
|
-
|
224
|
+
Animated.parallel([
|
225
|
+
Animated.timing(scale, {
|
250
226
|
toValue: 1,
|
251
227
|
duration: 150,
|
252
228
|
useNativeDriver: true,
|
253
229
|
}),
|
254
|
-
|
230
|
+
Animated.timing(opacity, {
|
255
231
|
toValue: 1,
|
256
232
|
duration: 150,
|
257
233
|
useNativeDriver: true,
|
@@ -259,13 +235,13 @@ const MessageOption = ({ visible, message, nativeEvent, onClose, setLoading }) =
|
|
259
235
|
]).start();
|
260
236
|
};
|
261
237
|
const hideAnimation = () => {
|
262
|
-
|
263
|
-
|
238
|
+
Animated.parallel([
|
239
|
+
Animated.timing(scale, {
|
264
240
|
toValue: 0,
|
265
241
|
duration: 150,
|
266
242
|
useNativeDriver: true,
|
267
243
|
}),
|
268
|
-
|
244
|
+
Animated.timing(opacity, {
|
269
245
|
toValue: 0,
|
270
246
|
duration: 150,
|
271
247
|
useNativeDriver: true,
|
@@ -285,7 +261,7 @@ const MessageOption = ({ visible, message, nativeEvent, onClose, setLoading }) =
|
|
285
261
|
if (nativeEvent) {
|
286
262
|
// 测量点击位置的元素
|
287
263
|
// @ts-ignore
|
288
|
-
|
264
|
+
UIManager.measure(nativeEvent.target, (x, y, width, height, pageX, pageY) => {
|
289
265
|
console.log('measure', x, y, width, height, pageX, pageY);
|
290
266
|
let targetY = 0;
|
291
267
|
if (pageY + height + contentHeight > displayArea.height) {
|
@@ -306,11 +282,11 @@ const MessageOption = ({ visible, message, nativeEvent, onClose, setLoading }) =
|
|
306
282
|
};
|
307
283
|
if (!items.length)
|
308
284
|
return null;
|
309
|
-
return (<
|
310
|
-
<
|
311
|
-
<
|
312
|
-
</
|
313
|
-
<
|
285
|
+
return (<Modal visible={visible} transparent onRequestClose={onHide}>
|
286
|
+
<TouchableWithoutFeedback onPress={onHide}>
|
287
|
+
<View style={StyleSheet.absoluteFill}/>
|
288
|
+
</TouchableWithoutFeedback>
|
289
|
+
<Animated.View style={[
|
314
290
|
styles.popWrap,
|
315
291
|
{
|
316
292
|
transform: [
|
@@ -328,19 +304,19 @@ const MessageOption = ({ visible, message, nativeEvent, onClose, setLoading }) =
|
|
328
304
|
},
|
329
305
|
]} onLayout={onLayout}>
|
330
306
|
{renderOperations(items, onClose)}
|
331
|
-
</
|
332
|
-
</
|
307
|
+
</Animated.View>
|
308
|
+
</Modal>);
|
333
309
|
};
|
334
|
-
const styles =
|
310
|
+
const styles = StyleSheet.create({
|
335
311
|
popWrap: {
|
336
|
-
maxWidth:
|
337
|
-
borderRadius:
|
338
|
-
paddingTop:
|
312
|
+
maxWidth: dp(280),
|
313
|
+
borderRadius: dp(5),
|
314
|
+
paddingTop: dp(10),
|
339
315
|
backgroundColor: '#fff',
|
340
316
|
shadowOffset: { width: 1, height: 2 },
|
341
317
|
shadowColor: 'rgba(0, 0, 0, 0.1)',
|
342
318
|
shadowOpacity: 1,
|
343
|
-
shadowRadius:
|
319
|
+
shadowRadius: dp(5),
|
344
320
|
elevation: 10,
|
345
321
|
},
|
346
322
|
operationWrap: {
|
@@ -348,16 +324,16 @@ const styles = react_native_1.StyleSheet.create({
|
|
348
324
|
flexWrap: 'wrap',
|
349
325
|
},
|
350
326
|
operationItem: {
|
351
|
-
width:
|
352
|
-
height:
|
353
|
-
paddingHorizontal:
|
327
|
+
width: dp(272 / 4),
|
328
|
+
height: dp(40),
|
329
|
+
paddingHorizontal: dp(2),
|
354
330
|
justifyContent: 'space-between',
|
355
331
|
alignItems: 'center',
|
356
|
-
marginBottom:
|
332
|
+
marginBottom: dp(10),
|
357
333
|
},
|
358
334
|
operationText: {
|
359
|
-
fontSize:
|
360
|
-
lineHeight:
|
335
|
+
fontSize: dp(12),
|
336
|
+
lineHeight: dp(15),
|
361
337
|
},
|
362
338
|
});
|
363
|
-
|
339
|
+
export default memo(MessageOption);
|