@smart-link/rn-im 1.0.23 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/file-dir.jpg +0 -0
- 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 +22 -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 +2 -0
- package/dist/default-assets.js +9 -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.d.ts +9 -0
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- 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 +50 -56
- 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/FileSelector.d.ts +6 -0
- package/dist/pages/message/FileSelector.js +235 -0
- 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 +151 -141
- package/dist/pages/message/MessageRecord.js +74 -87
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.d.ts +2 -1
- package/dist/pages/message/components/MessageItem.js +85 -112
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.d.ts +7 -3
- package/dist/pages/message/components/MessageOption.js +107 -134
- package/dist/pages/message/components/MessagePayload.d.ts +2 -1
- 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.d.ts +1 -1
- package/dist/pages/message/components/Payload/PayloadFile.js +44 -68
- package/dist/pages/message/components/Payload/PayloadMultiple.js +46 -70
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.d.ts +1 -1
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -50
- 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 +30 -57
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +2 -1
- package/dist/pages/message/components/Payload/PayloadWrapper.js +24 -44
- package/dist/pages/message/components/Payload/type.d.ts +2 -1
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +30 -60
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +128 -162
- package/dist/pages/message/components/TextMixQuoteMessage.js +19 -47
- 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 -107
- 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 +21 -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.d.ts +4 -2
- package/dist/pages/types.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 +64 -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 +10 -2
- package/dist/utils/file.js +188 -88
- 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
- package/dist/slice/contact/contact.action.d.ts +0 -1
- package/dist/slice/contact/contact.action.js +0 -2
@@ -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,41 +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
|
-
const
|
46
|
-
const PayloadWrapper_1 = __importDefault(require("./PayloadWrapper"));
|
47
|
-
const file_icon_1 = require("../../../../utils/file-icon");
|
48
|
-
const useTranslation_1 = __importDefault(require("../../../../hooks/useTranslation"));
|
49
|
-
const PayloadFile = ({ payload, messageSeq, direction, showArrow = true, isRecord, messageStatus, sendSize, style, onLongPress }) => {
|
10
|
+
import { dp, Toast } from '@smart-link/rn-ui';
|
11
|
+
import FileViewer from 'react-native-file-viewer';
|
12
|
+
import React, { memo, useRef, useState } from 'react';
|
13
|
+
import { View, Text, StyleSheet, Dimensions, } from 'react-native';
|
14
|
+
import { numberToFileSize, toAbsolutePath } from '../../../../utils/file';
|
15
|
+
import { MessageStatus } from '@smart-link/im-base';
|
16
|
+
import UploadProgress from '../UploadProgress';
|
17
|
+
import { getImManager } from '../../../../init';
|
18
|
+
import PayloadWrapper from './PayloadWrapper';
|
19
|
+
import { findSvgIcon } from '../../../../utils/file-icon';
|
20
|
+
import useTranslation from "../../../../hooks/useTranslation";
|
21
|
+
const PayloadFile = ({ payload, messageSeq, direction, showArrow = true, isRecord, messageStatus, jobId, sendSize, style, onLongPress }) => {
|
50
22
|
const ext = payload.filename.split('.').pop();
|
51
|
-
const Icon =
|
52
|
-
const path =
|
53
|
-
const downloading =
|
54
|
-
const { t } = (
|
55
|
-
const
|
23
|
+
const Icon = findSvgIcon(ext);
|
24
|
+
const path = useRef('');
|
25
|
+
const downloading = useRef(false);
|
26
|
+
const { t } = useTranslation();
|
27
|
+
const width = Dimensions.get('window').width * 0.75 - dp(24);
|
28
|
+
const [download, setDownload] = useState({
|
56
29
|
progress: 0,
|
57
30
|
status: 'pending',
|
58
31
|
});
|
59
32
|
const openWithLocal = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
60
33
|
try {
|
61
|
-
yield
|
34
|
+
yield FileViewer.open(toAbsolutePath(path));
|
62
35
|
}
|
63
36
|
catch (e) {
|
64
|
-
|
37
|
+
Toast.warning(t('fileOpenFail'));
|
65
38
|
}
|
66
39
|
});
|
67
40
|
const pressFile = () => __awaiter(void 0, void 0, void 0, function* () {
|
68
|
-
const imManager =
|
41
|
+
const imManager = getImManager();
|
69
42
|
const download = () => __awaiter(void 0, void 0, void 0, function* () {
|
70
43
|
try {
|
71
44
|
const localPath = yield imManager.download({
|
@@ -76,7 +49,7 @@ const PayloadFile = ({ payload, messageSeq, direction, showArrow = true, isRecor
|
|
76
49
|
onProgress: (e) => {
|
77
50
|
setDownload({
|
78
51
|
progress: e.loaded,
|
79
|
-
status: 'downloading',
|
52
|
+
status: e.loaded === payload.size ? 'done' : 'downloading',
|
80
53
|
});
|
81
54
|
}
|
82
55
|
});
|
@@ -88,7 +61,7 @@ const PayloadFile = ({ payload, messageSeq, direction, showArrow = true, isRecor
|
|
88
61
|
return localPath;
|
89
62
|
}
|
90
63
|
catch (e) {
|
91
|
-
|
64
|
+
Toast.error(t('downloadError'));
|
92
65
|
setDownload({
|
93
66
|
progress: 0,
|
94
67
|
status: 'pending',
|
@@ -108,6 +81,10 @@ const PayloadFile = ({ payload, messageSeq, direction, showArrow = true, isRecor
|
|
108
81
|
return;
|
109
82
|
downloading.current = true;
|
110
83
|
localPath = yield download();
|
84
|
+
setDownload({
|
85
|
+
progress: payload.size,
|
86
|
+
status: 'done',
|
87
|
+
});
|
111
88
|
imManager.updateResource({ url: payload.fileId, localPath });
|
112
89
|
yield openWithLocal(localPath);
|
113
90
|
return;
|
@@ -120,38 +97,37 @@ const PayloadFile = ({ payload, messageSeq, direction, showArrow = true, isRecor
|
|
120
97
|
return;
|
121
98
|
downloading.current = true;
|
122
99
|
const localPath = yield download();
|
123
|
-
|
100
|
+
getImManager().db.updateMessage({
|
124
101
|
messageSeq,
|
125
102
|
payload: Object.assign(Object.assign({}, payload), { localPath: localPath }),
|
126
103
|
});
|
127
104
|
yield openWithLocal(localPath);
|
128
105
|
}
|
129
106
|
});
|
130
|
-
return (<
|
131
|
-
<
|
107
|
+
return (<PayloadWrapper direction={direction} showArrow={showArrow} onLongPress={onLongPress} style={[style, styles.file, { width: width + dp(12) }]} onPress={pressFile}>
|
108
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', flex: 1 }}>
|
132
109
|
<Icon style={styles.fileIcon}/>
|
133
|
-
<
|
134
|
-
<
|
135
|
-
<
|
136
|
-
</
|
137
|
-
</
|
138
|
-
<
|
139
|
-
<
|
140
|
-
</
|
110
|
+
<View style={{ flex: 1 }}>
|
111
|
+
<Text numberOfLines={1} ellipsizeMode="middle">{payload.filename}</Text>
|
112
|
+
<Text style={styles.size}>{numberToFileSize(payload.size)} {payload.localPath ? t('downloaded') : ''}</Text>
|
113
|
+
</View>
|
114
|
+
</View>
|
115
|
+
<UploadProgress show={download.status === 'downloading'} width={width} sendSize={download.progress} totalSize={payload.size}/>
|
116
|
+
<UploadProgress show={messageStatus === MessageStatus.EMITTING || Boolean(jobId)} width={width} sendSize={sendSize || 0} totalSize={payload.size}/>
|
117
|
+
</PayloadWrapper>);
|
141
118
|
};
|
142
|
-
const styles =
|
119
|
+
const styles = StyleSheet.create({
|
143
120
|
file: {
|
144
|
-
|
121
|
+
flexDirection: 'column',
|
145
122
|
alignItems: 'center',
|
146
|
-
padding:
|
147
|
-
borderRadius:
|
148
|
-
width: react_native_1.Dimensions.get('window').width * 0.75,
|
123
|
+
padding: dp(6),
|
124
|
+
borderRadius: dp(8)
|
149
125
|
},
|
150
126
|
fileIcon: {
|
151
|
-
marginRight:
|
127
|
+
marginRight: dp(8),
|
152
128
|
},
|
153
129
|
size: {
|
154
130
|
color: '#999',
|
155
131
|
},
|
156
132
|
});
|
157
|
-
|
133
|
+
export default memo(PayloadFile);
|
@@ -1,103 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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 styles_1 = require("../../../../components/styles");
|
30
|
-
const useTranslation_1 = __importDefault(require("../../../../hooks/useTranslation"));
|
31
|
-
const init_1 = require("../../../../init");
|
32
|
-
const im_base_1 = require("@smart-link/im-base");
|
33
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
34
|
-
const react_1 = __importStar(require("react"));
|
35
|
-
const react_native_1 = require("react-native");
|
36
|
-
const PayloadWrapper_1 = __importDefault(require("./PayloadWrapper"));
|
37
|
-
const { width } = react_native_1.Dimensions.get('window');
|
38
|
-
const PayloadMultiple = (0, react_1.memo)(({ payload, messageSeq, direction, showArrow = true, style, onLongPress }) => {
|
39
|
-
const navigation = (0, rn_ui_1.useNavigation)();
|
1
|
+
import { borderStyle, shadowStyle } from '../../../../components/styles';
|
2
|
+
import useTranslation from '../../../../hooks/useTranslation';
|
3
|
+
import { getImManager } from '../../../../init';
|
4
|
+
import { buildSimpleText, ConversationType, MessageListActions } from '@smart-link/im-base';
|
5
|
+
import { dp, useNavigation } from '@smart-link/rn-ui';
|
6
|
+
import React, { memo } from 'react';
|
7
|
+
import { View, StyleSheet, Text, Dimensions } from 'react-native';
|
8
|
+
import PayloadWrapper from './PayloadWrapper';
|
9
|
+
const { width } = Dimensions.get('window');
|
10
|
+
const PayloadMultiple = memo(({ payload, messageSeq, direction, showArrow = true, style, onLongPress }) => {
|
11
|
+
const navigation = useNavigation();
|
40
12
|
const { type, toName, fromName, selectedMessages } = payload;
|
41
|
-
const { t } = (
|
42
|
-
const imManager =
|
13
|
+
const { t } = useTranslation();
|
14
|
+
const imManager = getImManager();
|
43
15
|
const messages = selectedMessages.length > 4 ? [...selectedMessages.slice(0, 4), 'more'] : selectedMessages;
|
44
|
-
const title = type ===
|
16
|
+
const title = type === ConversationType.C2C
|
45
17
|
? t('multipleChatRecordTitle', { fromName, toName })
|
46
18
|
: t('multipleChatRecordTitleGroup');
|
47
|
-
return (<
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
19
|
+
return (<PayloadWrapper direction={direction} showArrow={showArrow} style={[style, styles.wrap]} onPress={() => {
|
20
|
+
imManager.store.dispatch(MessageListActions.addMessageListData(imManager, messageSeq, selectedMessages));
|
21
|
+
navigation.navigate({
|
22
|
+
name: 'MessageRecord',
|
23
|
+
key: Date.now().toString(),
|
24
|
+
params: {
|
25
|
+
messageSeq,
|
26
|
+
title,
|
27
|
+
},
|
52
28
|
});
|
53
29
|
}} onLongPress={onLongPress}>
|
54
|
-
<
|
30
|
+
<Text style={styles.titleText} numberOfLines={2}>
|
55
31
|
{title}
|
56
|
-
</
|
57
|
-
<
|
32
|
+
</Text>
|
33
|
+
<View style={styles.content}>
|
58
34
|
{messages.map((message, index) => {
|
59
|
-
return message === 'more' ? (<
|
35
|
+
return message === 'more' ? (<Text key={index} style={styles.itemTextMore}>
|
60
36
|
......
|
61
|
-
</
|
62
|
-
{message.messageFromName + ': ' +
|
63
|
-
</
|
37
|
+
</Text>) : (<Text key={index} style={styles.itemText} numberOfLines={1} ellipsizeMode="middle">
|
38
|
+
{message.messageFromName + ': ' + buildSimpleText(imManager, message.payloadType, message.payload)}
|
39
|
+
</Text>);
|
64
40
|
})}
|
65
|
-
</
|
66
|
-
<
|
67
|
-
<
|
68
|
-
</
|
41
|
+
</View>
|
42
|
+
<View style={styles.line}/>
|
43
|
+
<Text style={styles.footerText}>{t('multipleChatRecord')}</Text>
|
44
|
+
</PayloadWrapper>);
|
69
45
|
});
|
70
|
-
const styles =
|
71
|
-
wrap: Object.assign(Object.assign({ minWidth:
|
46
|
+
const styles = StyleSheet.create({
|
47
|
+
wrap: Object.assign(Object.assign({ minWidth: dp(200), maxWidth: width - 120, padding: dp(12), paddingBottom: dp(6) }, borderStyle), shadowStyle),
|
72
48
|
titleText: {
|
73
49
|
color: '#333',
|
74
|
-
fontSize:
|
75
|
-
lineHeight:
|
50
|
+
fontSize: dp(14),
|
51
|
+
lineHeight: dp(18),
|
76
52
|
},
|
77
53
|
content: {
|
78
|
-
paddingVertical:
|
54
|
+
paddingVertical: dp(5),
|
79
55
|
},
|
80
56
|
item: {
|
81
57
|
justifyContent: 'center',
|
82
58
|
},
|
83
59
|
itemText: {
|
84
60
|
color: '#999',
|
85
|
-
fontSize:
|
61
|
+
fontSize: dp(13),
|
86
62
|
},
|
87
63
|
itemTextMore: {
|
88
64
|
color: '#999',
|
89
|
-
fontSize:
|
65
|
+
fontSize: dp(13),
|
90
66
|
},
|
91
67
|
footerText: {
|
92
68
|
color: '#777',
|
93
|
-
fontSize:
|
69
|
+
fontSize: dp(13),
|
94
70
|
},
|
95
71
|
line: {
|
96
|
-
marginTop:
|
97
|
-
marginBottom:
|
72
|
+
marginTop: dp(5),
|
73
|
+
marginBottom: dp(5),
|
98
74
|
backgroundColor: '#eee',
|
99
75
|
width: '100%',
|
100
|
-
height:
|
76
|
+
height: dp(1),
|
101
77
|
},
|
102
78
|
});
|
103
|
-
|
79
|
+
export default PayloadMultiple;
|
@@ -1,99 +1,71 @@
|
|
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 useTranslation_1 = __importDefault(require("../../../../hooks/useTranslation"));
|
30
|
-
const im_base_1 = require("@smart-link/im-base");
|
31
|
-
const react_1 = __importStar(require("react"));
|
32
|
-
const react_native_1 = require("react-native");
|
1
|
+
import useTranslation from '../../../../hooks/useTranslation';
|
2
|
+
import { PayloadType } from '@smart-link/im-base';
|
3
|
+
import React, { memo } from 'react';
|
4
|
+
import { View, Text, StyleSheet } from 'react-native';
|
33
5
|
const DetailChange = ({ payload }) => {
|
34
|
-
const { t } = (
|
6
|
+
const { t } = useTranslation();
|
35
7
|
const changeKeys = {
|
36
8
|
noticeChange: 'chatGroupNoticeChange',
|
37
9
|
nameChange: 'chatGroupNameChange',
|
38
10
|
};
|
39
|
-
return <
|
11
|
+
return <Text style={styles.text}>{t(changeKeys[payload.changeKey], payload)}</Text>;
|
40
12
|
};
|
41
13
|
const MemberInvite = ({ payload }) => {
|
42
|
-
const { t } = (
|
43
|
-
return (<
|
14
|
+
const { t } = useTranslation();
|
15
|
+
return (<Text style={styles.text}>
|
44
16
|
{t('chatGroupInviteMember', { userName: payload.inviterName, content: payload.inviteesName.join('、') })}
|
45
|
-
</
|
17
|
+
</Text>);
|
46
18
|
};
|
47
19
|
const MemberRemove = ({ payload }) => {
|
48
|
-
const { t } = (
|
49
|
-
return <
|
20
|
+
const { t } = useTranslation();
|
21
|
+
return <Text style={styles.text}>{t('chatGroupRemoveMember', { content: payload.names.join('、') })}</Text>;
|
50
22
|
};
|
51
23
|
const MemberBeenRemove = ({ payload }) => {
|
52
|
-
const { t } = (
|
53
|
-
return <
|
24
|
+
const { t } = useTranslation();
|
25
|
+
return <Text style={styles.text}>{t('chatGroupBeenRemoveMember')}</Text>;
|
54
26
|
};
|
55
27
|
const MemberLeave = ({ payload }) => {
|
56
|
-
const { t } = (
|
57
|
-
return <
|
28
|
+
const { t } = useTranslation();
|
29
|
+
return <Text style={styles.text}>{t('chatGroupMemberLeave', { userName: payload.userName })}</Text>;
|
58
30
|
};
|
59
31
|
const GroupInviteSwitch = ({ payload }) => {
|
60
|
-
const { t } = (
|
32
|
+
const { t } = useTranslation();
|
61
33
|
console.log('GroupInviteSwitch:');
|
62
|
-
return (<
|
34
|
+
return (<Text style={styles.text}>
|
63
35
|
{t(payload.switchCode === 'on' ? 'groupInviteValidateEnable' : 'groupInviteValidateDisable')}
|
64
|
-
</
|
36
|
+
</Text>);
|
65
37
|
};
|
66
38
|
const PayloadNotify = ({ payload, payloadType }) => {
|
67
39
|
console.log('PayloadNotify: ', payload, payloadType);
|
68
40
|
const { content: text } = payload;
|
69
41
|
let content;
|
70
42
|
switch (payloadType) {
|
71
|
-
case
|
43
|
+
case PayloadType.GROUP_DETAIL_CHANGE:
|
72
44
|
content = <DetailChange payload={payload}/>;
|
73
45
|
break;
|
74
|
-
case
|
46
|
+
case PayloadType.GROUP_MEMBER_INVITE:
|
75
47
|
content = <MemberInvite payload={payload}/>;
|
76
48
|
break;
|
77
|
-
case
|
49
|
+
case PayloadType.GROUP_MEMBER_REMOVE_NOTICE:
|
78
50
|
content = <MemberRemove payload={payload}/>;
|
79
51
|
break;
|
80
|
-
case
|
52
|
+
case PayloadType.GROUP_MEMBER_BEEN_REMOVED:
|
81
53
|
content = <MemberBeenRemove payload={payload}/>;
|
82
54
|
break;
|
83
|
-
case
|
55
|
+
case PayloadType.GROUP_INVITE_VALIDATE_SWITCH:
|
84
56
|
content = <GroupInviteSwitch payload={payload}/>;
|
85
57
|
break;
|
86
|
-
case
|
58
|
+
case PayloadType.GROUP_MEMBER_LEAVE:
|
87
59
|
content = <MemberLeave payload={payload}/>;
|
88
60
|
break;
|
89
61
|
default:
|
90
|
-
content = <
|
62
|
+
content = <Text style={styles.text}>{text}</Text>;
|
91
63
|
break;
|
92
64
|
}
|
93
|
-
return <
|
65
|
+
return <View style={styles.content}>{content}</View>;
|
94
66
|
};
|
95
|
-
const styles =
|
67
|
+
const styles = StyleSheet.create({
|
96
68
|
content: { marginHorizontal: '10%', paddingVertical: 10, alignItems: 'center' },
|
97
69
|
text: { color: '#999', textAlign: 'center' },
|
98
70
|
});
|
99
|
-
|
71
|
+
export default memo(PayloadNotify);
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { PayloadProps } from "./type";
|
3
|
-
declare const _default: React.MemoExoticComponent<({ payload, onLoad, ...retProps }: PayloadProps) => React.JSX.Element>;
|
3
|
+
declare const _default: React.MemoExoticComponent<({ payload, onLoad, isRecord, ...retProps }: PayloadProps) => React.JSX.Element>;
|
4
4
|
export default _default;
|
@@ -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 __rest = (this && this.__rest) || function (s, e) {
|
26
2
|
var t = {};
|
27
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -33,45 +9,40 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
33
9
|
}
|
34
10
|
return t;
|
35
11
|
};
|
36
|
-
|
37
|
-
|
38
|
-
};
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
const
|
46
|
-
const PayloadWrapper_1 = __importDefault(require("./PayloadWrapper"));
|
47
|
-
const react_native_fast_image_1 = __importDefault(require("react-native-fast-image"));
|
48
|
-
const useDownloadSource_1 = __importDefault(require("../../../../hooks/useDownloadSource"));
|
49
|
-
const file_1 = require("../../../../utils/file");
|
50
|
-
const { width: screenWidth } = react_native_1.Dimensions.get('window');
|
12
|
+
import React, { memo, useEffect } from 'react';
|
13
|
+
import { Dimensions, View } from 'react-native';
|
14
|
+
import { SvgFromUri } from 'react-native-svg';
|
15
|
+
import { calculate } from '../../../../utils/golden-rectangle';
|
16
|
+
import { borderStyle, shadowStyle } from '../../../../components/styles';
|
17
|
+
import { dp } from '@smart-link/rn-ui';
|
18
|
+
import PayloadWrapper from './PayloadWrapper';
|
19
|
+
import Image from 'react-native-fast-image';
|
20
|
+
import { toAbsolutePath } from "../../../../utils/file";
|
21
|
+
const { width: screenWidth } = Dimensions.get('window');
|
51
22
|
const PayloadPicture = (_a) => {
|
52
|
-
var { payload, onLoad } = _a, retProps = __rest(_a, ["payload", "onLoad"]);
|
23
|
+
var { payload, onLoad, isRecord } = _a, retProps = __rest(_a, ["payload", "onLoad", "isRecord"]);
|
53
24
|
const ext = payload.filename.split('.').pop();
|
54
|
-
const localPath =
|
55
|
-
|
25
|
+
const { localPath } = payload;
|
26
|
+
useEffect(() => {
|
56
27
|
if (localPath) {
|
57
28
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(localPath);
|
58
29
|
}
|
59
30
|
}, [onLoad, localPath]);
|
60
|
-
const size =
|
31
|
+
const size = calculate(payload.height || dp(163), payload.width || dp(100), 200);
|
61
32
|
if (!localPath) {
|
62
|
-
return <
|
33
|
+
return <View style={[borderStyle, size, { alignItems: 'center', justifyContent: 'center', backgroundColor: 'rgba(0,0,0, 0.8)' }]}/>;
|
63
34
|
}
|
64
35
|
let content;
|
65
36
|
if (/svg/i.test(ext)) {
|
66
|
-
content = <
|
37
|
+
content = <SvgFromUri style={[borderStyle]} uri={toAbsolutePath(localPath)} viewBox={'0 0 1024 1024'} width={screenWidth * 0.4} height={screenWidth * 0.4}/>;
|
67
38
|
}
|
68
39
|
else {
|
69
|
-
content = <
|
70
|
-
uri:
|
40
|
+
content = <Image resizeMode="cover" style={[borderStyle, size]} source={{
|
41
|
+
uri: toAbsolutePath(localPath),
|
71
42
|
}}/>;
|
72
43
|
}
|
73
|
-
return <
|
44
|
+
return <PayloadWrapper style={shadowStyle} {...retProps}>
|
74
45
|
{content}
|
75
|
-
</
|
46
|
+
</PayloadWrapper>;
|
76
47
|
};
|
77
|
-
|
48
|
+
export default memo(PayloadPicture);
|