@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,132 +1,107 @@
|
|
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
|
-
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 react_native_svg_1 = require("react-native-svg");
|
1
|
+
import { dp } from '@smart-link/rn-ui';
|
2
|
+
import React, { memo } from 'react';
|
3
|
+
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
4
|
+
import { Svg, Path } from 'react-native-svg';
|
30
5
|
const notifyTypeIcon = {
|
31
|
-
conference: ({ color, size }) => (<
|
32
|
-
<
|
33
|
-
</
|
34
|
-
todo: ({ color, size }) => (<
|
35
|
-
<
|
36
|
-
</
|
37
|
-
toread: ({ color, size }) => (<
|
38
|
-
<
|
39
|
-
</
|
40
|
-
supervise: ({ color, size }) => (<
|
41
|
-
<
|
42
|
-
<
|
43
|
-
</
|
44
|
-
calendarSchedule: ({ color, size }) => (<
|
45
|
-
<
|
46
|
-
</
|
6
|
+
conference: ({ color, size }) => (<Svg viewBox={'0 0 1024 1024'} fill={color} width={size} height={size}>
|
7
|
+
<Path d="M12.5 2.5c-5.5 0-10 4.5-10 10s4.5 10 10 10 10-4.5 10-10-4.5-10-10-10zm0 17.5c-4.5 0-8.5-3.5-8.5-8.5s3.5-8.5 8.5-8."/>
|
8
|
+
</Svg>),
|
9
|
+
todo: ({ color, size }) => (<Svg viewBox={'0 0 1024 1024'} fill={color} width={size} height={size}>
|
10
|
+
<Path d="M584.32 244.416h-154.272c-43.392 0-77.152-33.76-77.152-77.152s33.76-77.152 77.152-77.152h154.272c43.392 0 77.152 33.76 77.152 77.152s-33.76 77.152-77.152 77.152z m159.104 332.672c-96.416 0-178.4 81.952-178.4 178.4s81.952 178.4 178.4 178.4 178.4-81.952 178.4-178.4c0-101.248-81.952-178.4-178.4-178.4z m77.152 231.424h-101.248c-14.464 0-24.096-9.632-24.096-24.096V688c0-14.464 9.632-24.096 24.096-24.096s24.096 9.632 24.096 24.096v67.488h77.152c14.464 0 24.096 9.632 24.096 24.096 0 19.296-9.632 28.928-24.096 28.928zM796.48 167.264h-43.392c0 9.632 4.832 19.296 4.832 24.096 0 57.856-48.224 101.248-101.248 101.248h-308.576c-57.856 0-101.248-48.224-101.248-101.248 0-9.632 0-19.296 4.832-24.096H203.456c-57.856 0-101.248 43.392-101.248 101.248v515.904c0 57.856 43.392 101.248 101.248 101.248h347.136c-24.096-38.56-38.56-81.952-38.56-130.176 0-125.344 101.248-231.424 231.424-231.424 57.856 0 115.712 24.096 154.272 62.688V268.544c0-57.856-48.224-101.248-101.248-101.248zM449.312 678.336H280.576c-24.096 0-38.56-19.296-38.56-38.56s19.296-38.56 38.56-38.56h163.936c24.096 0 43.392 19.296 43.392 38.56s-19.296 38.56-38.56 38.56z m115.712-168.736h-284.48c-24.096 0-38.56-19.296-38.56-38.56 0-24.096 19.296-43.392 38.56-43.392h279.648c24.096 0 38.56 19.296 38.56 38.56 4.832 24.096-14.464 43.392-33.76 43.392z"/>
|
11
|
+
</Svg>),
|
12
|
+
toread: ({ color, size }) => (<Svg viewBox={'0 0 1024 1024'} fill={color} width={size} height={size}>
|
13
|
+
<Path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"/>
|
14
|
+
</Svg>),
|
15
|
+
supervise: ({ color, size }) => (<Svg viewBox={'0 0 1024 1024'} fill={color} width={size} height={size}>
|
16
|
+
<Path d="M300.8 268.8c-25.6 0-44.8-25.6-44.8-51.2V76.8c0-25.6 19.2-51.2 51.2-51.2 25.6 0 51.2 19.2 51.2 51.2v140.8c-6.4 25.6-25.6 51.2-57.6 51.2zM736 268.8c-25.6 0-51.2-19.2-51.2-51.2V76.8c0-25.6 19.2-51.2 51.2-51.2 25.6 0 51.2 19.2 51.2 51.2v140.8c0 25.6-25.6 51.2-51.2 51.2z"/>
|
17
|
+
<Path d="M883.2 102.4h-83.2v115.2c0 38.4-32 64-64 64-38.4 0-64-32-64-64V102.4H371.2v115.2c0 38.4-32 64-64 64s-64-32-64-64V102.4H160c-51.2 0-89.6 38.4-89.6 89.6v160h902.4V192c0-51.2-38.4-89.6-89.6-89.6zM70.4 403.2v396.8c0 51.2 38.4 89.6 89.6 89.6h723.2c51.2 0 89.6-38.4 89.6-89.6V403.2H70.4zM768 768H275.2c-19.2 0-32-12.8-32-32 0-12.8 12.8-32 32-32H768c19.2 0 32 12.8 32 32-6.4 19.2-19.2 32-32 32z m25.6-217.6c0 19.2-12.8 32-32 32H275.2c-19.2 0-32-12.8-32-32s12.8-32 32-32H768c12.8 6.4 25.6 19.2 25.6 32z"/>
|
18
|
+
</Svg>),
|
19
|
+
calendarSchedule: ({ color, size }) => (<Svg viewBox={'0 0 1024 1024'} fill={color} width={size} height={size}>
|
20
|
+
<Path d="M715.33 515.17L667.16 467 448.79 685.37l-94.39-94.39-48.17 48.17 142.81 142.81 266.29-266.79z m109.31-360.94h-44.02V64h-90.23v90.23H333.61V64h-90.23v90.23h-44.02c-25.19 0-46.46 8.81-64.07 26.17-17.61 17.61-26.17 38.88-26.17 64.07v625.29c0 25.19 8.8 46.46 26.17 64.07C152.9 951.44 174.17 960 199.36 960h625.29c25.19 0 46.46-8.81 64.07-26.17 17.61-17.61 26.17-38.88 26.17-64.07V244.47c0-25.19-8.8-46.46-26.17-64.07-17.62-17.37-38.89-26.17-64.08-26.17z m0 715.52H199.36V378.71h625.29v491.04z"/>
|
21
|
+
</Svg>),
|
47
22
|
};
|
48
23
|
const BusiNotifyCard = ({ payload }) => {
|
49
24
|
const Icon = notifyTypeIcon[payload.busiType] || notifyTypeIcon.todo;
|
50
25
|
const color = payload.read ? '#ea1f2d' : '#333';
|
51
|
-
return (<
|
52
|
-
<
|
53
|
-
<Icon color={color} size={
|
54
|
-
<
|
55
|
-
</
|
26
|
+
return (<TouchableOpacity style={styles.root} activeOpacity={0.5}>
|
27
|
+
<View style={styles.busiTypeContainer}>
|
28
|
+
<Icon color={color} size={dp(24)}/>
|
29
|
+
<Text style={[styles.busiType, { color }]}>{payload.busiTypeText}</Text>
|
30
|
+
</View>
|
56
31
|
|
57
|
-
<
|
58
|
-
{payload.columns.length > 0 && (<
|
59
|
-
{payload.columns.map(column => (<
|
60
|
-
<
|
61
|
-
{column.userId ? (<
|
62
|
-
<
|
63
|
-
</
|
64
|
-
</
|
65
|
-
</
|
66
|
-
{payload.content && <
|
67
|
-
{payload.busiStatusText && <
|
68
|
-
</
|
32
|
+
<Text style={styles.title}>{payload.title}</Text>
|
33
|
+
{payload.columns.length > 0 && (<View style={styles.columns}>
|
34
|
+
{payload.columns.map(column => (<View key={column.key} style={styles.column}>
|
35
|
+
<Text style={styles.label}>{column.label}:</Text>
|
36
|
+
{column.userId ? (<TouchableOpacity>
|
37
|
+
<Text style={[styles.value, { color: '#208aff' }]}>{column.value}</Text>
|
38
|
+
</TouchableOpacity>) : (<Text style={styles.value}>{column.value}</Text>)}
|
39
|
+
</View>))}
|
40
|
+
</View>)}
|
41
|
+
{payload.content && <Text style={styles.content}>{payload.content}</Text>}
|
42
|
+
{payload.busiStatusText && <Text style={[styles.busiStatusText, { color }]}>{payload.busiStatusText}</Text>}
|
43
|
+
</TouchableOpacity>);
|
69
44
|
};
|
70
|
-
const styles =
|
45
|
+
const styles = StyleSheet.create({
|
71
46
|
root: {
|
72
|
-
marginTop:
|
73
|
-
marginBottom: -
|
47
|
+
marginTop: dp(12),
|
48
|
+
marginBottom: -dp(32),
|
74
49
|
marginHorizontal: '5%',
|
75
50
|
width: '90%',
|
76
|
-
borderRadius:
|
77
|
-
padding:
|
51
|
+
borderRadius: dp(4),
|
52
|
+
padding: dp(20),
|
78
53
|
shadowColor: 'rgba(0, 0, 0, 0.4)',
|
79
54
|
backgroundColor: '#fff',
|
80
55
|
shadowOffset: {
|
81
56
|
width: 1,
|
82
|
-
height:
|
57
|
+
height: dp(6),
|
83
58
|
},
|
84
|
-
shadowRadius:
|
59
|
+
shadowRadius: dp(6),
|
85
60
|
shadowOpacity: 1,
|
86
61
|
elevation: 2,
|
87
62
|
},
|
88
63
|
busiTypeContainer: {
|
89
64
|
flexDirection: 'row',
|
90
65
|
alignItems: 'center',
|
91
|
-
marginBottom:
|
66
|
+
marginBottom: dp(6),
|
92
67
|
},
|
93
68
|
busiType: {
|
94
|
-
fontSize:
|
69
|
+
fontSize: dp(14),
|
95
70
|
color: '#333333',
|
96
|
-
marginLeft:
|
71
|
+
marginLeft: dp(6),
|
97
72
|
},
|
98
73
|
title: {
|
99
|
-
fontSize:
|
74
|
+
fontSize: dp(14),
|
100
75
|
color: '#333333',
|
101
|
-
marginBottom:
|
76
|
+
marginBottom: dp(6),
|
102
77
|
},
|
103
78
|
content: {},
|
104
79
|
busiStatusText: {
|
105
80
|
alignSelf: 'flex-end',
|
106
|
-
fontSize:
|
107
|
-
lineHeight:
|
81
|
+
fontSize: dp(15),
|
82
|
+
lineHeight: dp(22),
|
108
83
|
color: '#333333',
|
109
84
|
},
|
110
85
|
columns: {},
|
111
86
|
column: {
|
112
87
|
flexDirection: 'row',
|
113
|
-
marginBottom:
|
88
|
+
marginBottom: dp(6),
|
114
89
|
},
|
115
90
|
label: {
|
116
|
-
width:
|
91
|
+
width: dp(80),
|
117
92
|
letterSpacing: 2,
|
118
|
-
height:
|
119
|
-
fontSize:
|
120
|
-
lineHeight:
|
93
|
+
height: dp(24),
|
94
|
+
fontSize: dp(15),
|
95
|
+
lineHeight: dp(24),
|
121
96
|
color: '#666666',
|
122
97
|
overflow: 'hidden',
|
123
98
|
},
|
124
99
|
value: {
|
125
|
-
height:
|
126
|
-
fontSize:
|
127
|
-
lineHeight:
|
100
|
+
height: dp(24),
|
101
|
+
fontSize: dp(15),
|
102
|
+
lineHeight: dp(24),
|
128
103
|
color: '#333333',
|
129
104
|
overflow: 'hidden',
|
130
105
|
},
|
131
106
|
});
|
132
|
-
|
107
|
+
export default memo(BusiNotifyCard);
|
@@ -1,44 +1,19 @@
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
const init_1 = require("../../../init");
|
27
|
-
const file_1 = require("../../../utils/file");
|
28
|
-
const react_1 = __importStar(require("react"));
|
29
|
-
const react_native_1 = require("react-native");
|
1
|
+
import { getImManager } from '../../../init';
|
2
|
+
import { download, toAbsolutePath } from '../../../utils/file';
|
3
|
+
import React, { useEffect, useState } from 'react';
|
4
|
+
import { ImageBackground } from 'react-native';
|
30
5
|
const ChatBg = ({ fileId, children }) => {
|
31
|
-
const [localPath, setLocalPath] =
|
32
|
-
|
6
|
+
const [localPath, setLocalPath] = useState('');
|
7
|
+
useEffect(() => {
|
33
8
|
if (fileId && fileId !== 'bg0') {
|
34
|
-
const imManager =
|
9
|
+
const imManager = getImManager();
|
35
10
|
imManager.loadResourceFromCache(fileId).then(resp => {
|
36
11
|
if (resp) {
|
37
12
|
setLocalPath(resp);
|
38
13
|
}
|
39
14
|
else {
|
40
15
|
// 下载资源
|
41
|
-
|
16
|
+
download({
|
42
17
|
fileId,
|
43
18
|
resourceType: 'background',
|
44
19
|
filename: fileId + '.png',
|
@@ -58,8 +33,8 @@ const ChatBg = ({ fileId, children }) => {
|
|
58
33
|
if (!fileId || fileId === 'bg0' || !localPath) {
|
59
34
|
return children;
|
60
35
|
}
|
61
|
-
return (<
|
36
|
+
return (<ImageBackground style={{ flex: 1 }} resizeMode='cover' source={{ uri: toAbsolutePath(localPath) }}>
|
62
37
|
{children}
|
63
|
-
</
|
38
|
+
</ImageBackground>);
|
64
39
|
};
|
65
|
-
|
40
|
+
export default ChatBg;
|
@@ -1,94 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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 im_base_1 = require("@smart-link/im-base");
|
30
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
31
|
-
const react_1 = __importStar(require("react"));
|
32
|
-
const react_native_1 = require("react-native");
|
33
|
-
const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar/ChatAvatar"));
|
34
|
-
const useFormatMsgTime_1 = __importDefault(require("../../../hooks/useFormatMsgTime"));
|
35
|
-
const BusiNotifyCard_1 = __importDefault(require("./BusiNotifyCard"));
|
36
|
-
const PayloadNotify_1 = __importDefault(require("./Payload/PayloadNotify"));
|
37
|
-
const MessagePayload_1 = __importDefault(require("./MessagePayload"));
|
38
|
-
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
1
|
+
import { ConversationType, MessageStatus, PayloadType, isNotifyMessage, MessagePanelActions, } from '@smart-link/im-base';
|
2
|
+
import { Checkbox, dp, useTheme } from '@smart-link/rn-ui';
|
3
|
+
import React, { memo } from 'react';
|
4
|
+
import { View, Text, StyleSheet, TouchableOpacity, Dimensions, ActivityIndicator, TouchableWithoutFeedback, } from 'react-native';
|
5
|
+
import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
|
6
|
+
import useFormatMsgTime from '../../../hooks/useFormatMsgTime';
|
7
|
+
import BusiNotifyCard from './BusiNotifyCard';
|
8
|
+
import PayloadNotify from './Payload/PayloadNotify';
|
9
|
+
import MessagePayload from './MessagePayload';
|
10
|
+
import useTranslation from '../../../hooks/useTranslation';
|
39
11
|
//@ts-ignore
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
const { width: screenWidth } =
|
12
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
13
|
+
import { getImManager } from '../../../init';
|
14
|
+
import MessageReceiptStatus from './MessageReceiptStatus';
|
15
|
+
import MessageUndo from "../../../pages/message/components/MessageUndo";
|
16
|
+
const { width: screenWidth } = Dimensions.get('window');
|
45
17
|
const MessageItem = ({ isMultiple, multipleSelect, conversation, message, mine, showTimeLine, onPressPopover, onLongPressPopover, onLayoutItem, }) => {
|
46
|
-
const theme =
|
47
|
-
const { t } = (
|
48
|
-
const time = (
|
49
|
-
const isNotify =
|
50
|
-
const isB2C = (conversation === null || conversation === void 0 ? void 0 : conversation.type) ===
|
51
|
-
const isC2C = (conversation === null || conversation === void 0 ? void 0 : conversation.type) ===
|
18
|
+
const theme = useTheme();
|
19
|
+
const { t } = useTranslation();
|
20
|
+
const time = useFormatMsgTime(message.messageTime);
|
21
|
+
const isNotify = isNotifyMessage(message.payloadType);
|
22
|
+
const isB2C = (conversation === null || conversation === void 0 ? void 0 : conversation.type) === ConversationType.B2C;
|
23
|
+
const isC2C = (conversation === null || conversation === void 0 ? void 0 : conversation.type) === ConversationType.C2C;
|
52
24
|
const isMultipleChecked = !!(multipleSelect === null || multipleSelect === void 0 ? void 0 : multipleSelect[message.messageSeq]);
|
53
|
-
const notArrow = [
|
54
|
-
const isUndo = message.messageStatus ===
|
25
|
+
const notArrow = [PayloadType.PICTURE, PayloadType.VIDEO].includes(message.payloadType);
|
26
|
+
const isUndo = message.messageStatus === MessageStatus.UNDO || message.payloadType === PayloadType.CONVERSATION_MESSAGE_UNDO;
|
55
27
|
const isMessagePayload = !isB2C && !isNotify && !isUndo;
|
56
|
-
return (<
|
28
|
+
return (<View style={styles.root} onLayout={(e) => {
|
57
29
|
onLayoutItem(message, e);
|
58
30
|
}}>
|
59
|
-
{showTimeLine && <
|
60
|
-
{isB2C && <
|
61
|
-
{isNotify && <
|
62
|
-
{isUndo && <
|
31
|
+
{showTimeLine && <Text style={styles.time}>{time}</Text>}
|
32
|
+
{isB2C && <BusiNotifyCard payload={message.payload}/>}
|
33
|
+
{isNotify && <PayloadNotify {...message}/>}
|
34
|
+
{isUndo && <MessageUndo messageSeq={message.messageSeq} text={mine ? t('youWithdrawMsg') : `"${message.messageFromName}" ${t('withdrawMsg')}`} undoText={message.payload.text} haveBackgroundImage={false} edit={mine && message.payloadType === 'text'}/>}
|
63
35
|
{isMessagePayload && (<>
|
64
|
-
{isMultiple && (<
|
65
|
-
|
36
|
+
{isMultiple && (<TouchableWithoutFeedback onPress={() => {
|
37
|
+
getImManager().store.dispatch(MessagePanelActions.onMultipleSelect(message.messageSeq));
|
66
38
|
}}>
|
67
|
-
<
|
68
|
-
</
|
69
|
-
<
|
39
|
+
<View style={styles.multipleWrap}/>
|
40
|
+
</TouchableWithoutFeedback>)}
|
41
|
+
<View style={[
|
70
42
|
styles.bubble,
|
71
43
|
{
|
72
44
|
flexDirection: mine ? 'row-reverse' : 'row',
|
73
45
|
justifyContent: 'flex-start',
|
74
46
|
},
|
75
47
|
]}>
|
76
|
-
{mine && isMultiple && (<
|
77
|
-
<
|
78
|
-
<
|
48
|
+
{mine && isMultiple && (<Checkbox checked={isMultipleChecked} style={[styles.multipleCheckbox]}/>)}
|
49
|
+
<ChatAvatar name={message.messageFromName} id={message.messageFrom} size={dp(40)}/>
|
50
|
+
<View style={[
|
79
51
|
{
|
80
52
|
alignContent: 'flex-end',
|
81
53
|
alignItems: mine ? 'flex-end' : 'flex-start',
|
82
|
-
paddingHorizontal: [
|
83
|
-
?
|
54
|
+
paddingHorizontal: [PayloadType.PICTURE, PayloadType.VIDEO].includes(message.payloadType)
|
55
|
+
? dp(10)
|
84
56
|
: 0,
|
85
57
|
},
|
86
58
|
]}>
|
87
|
-
{!mine && message.conversationType !==
|
88
|
-
marginLeft: notArrow ? 0 :
|
89
|
-
}]}>{message.messageFromName}</
|
90
|
-
<
|
91
|
-
<
|
59
|
+
{!mine && message.conversationType !== ConversationType.C2C && (<Text style={[styles.name, {
|
60
|
+
marginLeft: notArrow ? 0 : dp(10),
|
61
|
+
}]}>{message.messageFromName}</Text>)}
|
62
|
+
<View>
|
63
|
+
<MessagePayload style={[
|
92
64
|
styles.payload,
|
93
65
|
{
|
94
66
|
justifyContent: mine ? 'flex-end' : 'flex-start',
|
@@ -103,23 +75,23 @@ const MessageItem = ({ isMultiple, multipleSelect, conversation, message, mine,
|
|
103
75
|
e.preventDefault();
|
104
76
|
onLongPressPopover(message, e.nativeEvent);
|
105
77
|
}}/>
|
106
|
-
{isC2C && mine && <
|
107
|
-
</
|
108
|
-
</
|
109
|
-
{message.messageStatus ===
|
110
|
-
<
|
111
|
-
</
|
112
|
-
{mine && message.messageStatus ===
|
113
|
-
{!mine && isMultiple && (<
|
114
|
-
</
|
78
|
+
{isC2C && mine && <MessageReceiptStatus {...message}/>}
|
79
|
+
</View>
|
80
|
+
</View>
|
81
|
+
{message.messageStatus === MessageStatus.EMIT_ERROR && (<Text style={{ alignSelf: 'center' }}>
|
82
|
+
<Icon name="info" size={dp(20)} color={theme.errorColor}/>
|
83
|
+
</Text>)}
|
84
|
+
{mine && message.messageStatus === MessageStatus.EMITTING && (<ActivityIndicator size="small" color={'#666'} animating={true}/>)}
|
85
|
+
{!mine && isMultiple && (<Checkbox checked={isMultipleChecked} style={[styles.multipleCheckbox, styles.multipleCheckboxRight]}/>)}
|
86
|
+
</View>
|
115
87
|
</>)}
|
116
|
-
{message.messageStatus ===
|
117
|
-
<
|
118
|
-
<
|
119
|
-
<
|
120
|
-
<
|
88
|
+
{message.messageStatus === MessageStatus.EMIT_ERROR && (<>
|
89
|
+
<View style={{ height: dp(10) }}/>
|
90
|
+
<View style={styles.errorInfo}>
|
91
|
+
<Text style={styles.errorInfoText}>{t('sendMsgFail')}</Text>
|
92
|
+
<TouchableOpacity activeOpacity={0.5} onPress={() => {
|
121
93
|
var _a;
|
122
|
-
const imManager =
|
94
|
+
const imManager = getImManager();
|
123
95
|
imManager.resendMessage(conversation, message).then(() => { });
|
124
96
|
console.log('resendMessage');
|
125
97
|
((_a = imManager.flatListRef) === null || _a === void 0 ? void 0 : _a.current).scrollToOffset({
|
@@ -127,60 +99,60 @@ const MessageItem = ({ isMultiple, multipleSelect, conversation, message, mine,
|
|
127
99
|
offset: 0,
|
128
100
|
});
|
129
101
|
}}>
|
130
|
-
<
|
131
|
-
</
|
132
|
-
</
|
102
|
+
<Text style={styles.errorInfoSend}>{t('resendMsg')}</Text>
|
103
|
+
</TouchableOpacity>
|
104
|
+
</View>
|
133
105
|
</>)}
|
134
|
-
</
|
106
|
+
</View>);
|
135
107
|
};
|
136
|
-
const styles =
|
108
|
+
const styles = StyleSheet.create({
|
137
109
|
root: {
|
138
|
-
marginTop:
|
139
|
-
paddingHorizontal:
|
110
|
+
marginTop: dp(10),
|
111
|
+
paddingHorizontal: dp(10),
|
140
112
|
position: 'relative',
|
141
113
|
},
|
142
114
|
time: {
|
143
|
-
fontSize:
|
115
|
+
fontSize: dp(12),
|
144
116
|
textAlign: 'center',
|
145
117
|
},
|
146
118
|
bubble: {
|
147
|
-
paddingTop:
|
119
|
+
paddingTop: dp(10),
|
148
120
|
zIndex: 1,
|
149
121
|
position: 'relative',
|
150
122
|
},
|
151
123
|
multipleCheckbox: {
|
152
|
-
marginTop:
|
124
|
+
marginTop: dp(10),
|
153
125
|
},
|
154
126
|
multipleCheckboxRight: {
|
155
|
-
marginTop:
|
127
|
+
marginTop: dp(10),
|
156
128
|
position: 'absolute',
|
157
129
|
right: 0,
|
158
|
-
top:
|
130
|
+
top: dp(20),
|
159
131
|
},
|
160
132
|
name: {
|
161
|
-
fontSize:
|
133
|
+
fontSize: dp(12),
|
162
134
|
},
|
163
135
|
notify: {},
|
164
136
|
payload: {
|
165
|
-
maxWidth: screenWidth -
|
137
|
+
maxWidth: screenWidth - dp(110),
|
166
138
|
minHeight: 20,
|
167
|
-
marginHorizontal:
|
168
|
-
borderRadius:
|
139
|
+
marginHorizontal: dp(10),
|
140
|
+
borderRadius: dp(5),
|
169
141
|
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
170
142
|
shadowOffset: {
|
171
143
|
width: 0,
|
172
|
-
height:
|
144
|
+
height: dp(2),
|
173
145
|
},
|
174
|
-
shadowRadius:
|
146
|
+
shadowRadius: dp(3),
|
175
147
|
shadowOpacity: 1,
|
176
148
|
elevation: 6,
|
177
149
|
position: 'relative',
|
178
150
|
},
|
179
151
|
plain: {
|
180
152
|
color: '#000',
|
181
|
-
fontSize:
|
182
|
-
paddingHorizontal:
|
183
|
-
paddingVertical:
|
153
|
+
fontSize: dp(14),
|
154
|
+
paddingHorizontal: dp(12),
|
155
|
+
paddingVertical: dp(10),
|
184
156
|
},
|
185
157
|
errorInfo: {
|
186
158
|
flexDirection: 'row',
|
@@ -188,13 +160,13 @@ const styles = react_native_1.StyleSheet.create({
|
|
188
160
|
},
|
189
161
|
errorInfoText: {
|
190
162
|
color: '#808080',
|
191
|
-
fontSize:
|
163
|
+
fontSize: dp(13),
|
192
164
|
},
|
193
165
|
errorInfoSend: {
|
194
166
|
paddingHorizontal: 5,
|
195
167
|
color: '#208aff',
|
196
168
|
textDecorationLine: 'underline',
|
197
|
-
fontSize:
|
169
|
+
fontSize: dp(13),
|
198
170
|
},
|
199
171
|
multipleWrap: {
|
200
172
|
position: 'absolute',
|
@@ -203,4 +175,4 @@ const styles = react_native_1.StyleSheet.create({
|
|
203
175
|
zIndex: 99,
|
204
176
|
},
|
205
177
|
});
|
206
|
-
|
178
|
+
export default memo(MessageItem);
|