@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,101 +7,97 @@ 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
|
-
const
|
44
|
-
const UserJobs_1 = __importDefault(require("./UserJobs"));
|
45
|
-
const ChatAvatar_1 = __importDefault(require("../../components/ChatAvatar/ChatAvatar"));
|
46
|
-
const addressList_1 = require("../../api/addressList");
|
47
|
-
const { width } = react_native_1.Dimensions.get('window');
|
10
|
+
import { Button, dp, NavigationPage } from '@smart-link/rn-ui';
|
11
|
+
import React, { useEffect, useState } from 'react';
|
12
|
+
import { StyleSheet, Text, View, Dimensions } from 'react-native';
|
13
|
+
import { useTranslationAddrList } from '../../hooks/useTranslation';
|
14
|
+
import { getImManager } from '../../init';
|
15
|
+
import { CardInfo, Line } from './CardInfo';
|
16
|
+
import UserJobs from './UserJobs';
|
17
|
+
import ChatAvatar from '../../components/ChatAvatar/ChatAvatar';
|
18
|
+
import { queryUser } from '../../api/addressList';
|
19
|
+
const { width } = Dimensions.get('window');
|
48
20
|
const UserDetail = ({ navigation, route: { params } }) => {
|
49
|
-
const [detail, setDetail] =
|
50
|
-
const { t } =
|
51
|
-
|
21
|
+
const [detail, setDetail] = useState({});
|
22
|
+
const { t } = useTranslationAddrList();
|
23
|
+
useEffect(() => {
|
52
24
|
navigation.setOptions({ title: t('userDetail') });
|
53
|
-
|
25
|
+
queryUser(params.userId).then(({ data }) => {
|
54
26
|
console.log('userDetail: ', data[0]);
|
55
27
|
setDetail(data[0]);
|
56
28
|
});
|
57
29
|
}, [params.userId]);
|
58
30
|
const openChatPanel = () => __awaiter(void 0, void 0, void 0, function* () {
|
59
|
-
yield
|
31
|
+
yield getImManager().initUserConversation(detail);
|
60
32
|
navigation.navigate('MessageList');
|
61
33
|
});
|
62
|
-
return (<
|
63
|
-
<
|
64
|
-
<
|
65
|
-
<
|
66
|
-
<
|
67
|
-
<
|
34
|
+
return (<NavigationPage noPadding scroll>
|
35
|
+
<CardInfo>
|
36
|
+
<Line>
|
37
|
+
<ChatAvatar id={detail.userId} size={dp(60)} name={detail.userName} url={detail.avatars} priority={'outside'} disabled/>
|
38
|
+
<View style={styles.accountInfo}>
|
39
|
+
<Text style={styles.username} numberOfLines={2}>
|
68
40
|
{detail.userName}
|
69
|
-
</
|
70
|
-
<
|
71
|
-
lineHeight:
|
72
|
-
fontSize:
|
41
|
+
</Text>
|
42
|
+
<Text style={{
|
43
|
+
lineHeight: dp(16),
|
44
|
+
fontSize: dp(12),
|
73
45
|
color: '#6e6e6e',
|
74
46
|
}}>
|
75
47
|
{t('userCode')}:{detail.userCode || t('noAdd')}
|
76
|
-
</
|
77
|
-
<
|
78
|
-
lineHeight:
|
79
|
-
fontSize:
|
48
|
+
</Text>
|
49
|
+
<Text style={{
|
50
|
+
lineHeight: dp(16),
|
51
|
+
fontSize: dp(12),
|
80
52
|
color: '#6e6e6e',
|
81
53
|
}}>
|
82
54
|
{t('mobile')}:{detail.mobile || t('noAdd')}
|
83
|
-
</
|
84
|
-
<
|
85
|
-
lineHeight:
|
86
|
-
fontSize:
|
55
|
+
</Text>
|
56
|
+
<Text style={{
|
57
|
+
lineHeight: dp(16),
|
58
|
+
fontSize: dp(12),
|
87
59
|
color: '#6e6e6e',
|
88
60
|
}}>
|
89
61
|
{t('email')}:{detail.email || t('noAdd')}
|
90
|
-
</
|
91
|
-
</
|
92
|
-
</
|
93
|
-
</
|
62
|
+
</Text>
|
63
|
+
</View>
|
64
|
+
</Line>
|
65
|
+
</CardInfo>
|
94
66
|
|
95
|
-
<
|
67
|
+
<UserJobs jobs={detail.groups}/>
|
96
68
|
|
97
|
-
<
|
69
|
+
<View style={{ height: dp(20) }}/>
|
98
70
|
|
99
|
-
<
|
100
|
-
<
|
71
|
+
<View style={styles.button}>
|
72
|
+
<Button type="primary" onPress={openChatPanel}>
|
101
73
|
{t('sendNews')}
|
102
|
-
</
|
103
|
-
</
|
74
|
+
</Button>
|
75
|
+
</View>
|
104
76
|
|
105
|
-
<
|
106
|
-
</
|
77
|
+
<View style={{ height: dp(20) }}/>
|
78
|
+
</NavigationPage>);
|
107
79
|
};
|
108
|
-
const styles =
|
80
|
+
const styles = StyleSheet.create({
|
109
81
|
lineIcon: {
|
110
|
-
width:
|
82
|
+
width: dp(40),
|
111
83
|
textAlign: 'center',
|
112
84
|
},
|
113
85
|
accountInfo: {
|
114
|
-
marginLeft:
|
115
|
-
width: width -
|
86
|
+
marginLeft: dp(20),
|
87
|
+
width: width - dp(80 + 20 + 10),
|
116
88
|
},
|
117
89
|
username: {
|
118
|
-
lineHeight:
|
119
|
-
fontSize:
|
90
|
+
lineHeight: dp(25),
|
91
|
+
fontSize: dp(18),
|
120
92
|
fontWeight: '500',
|
121
93
|
textAlignVertical: 'center',
|
122
94
|
},
|
123
95
|
button: {
|
124
|
-
marginHorizontal:
|
96
|
+
marginHorizontal: dp(20),
|
125
97
|
},
|
126
98
|
btnText: {
|
127
|
-
paddingVertical:
|
128
|
-
fontSize:
|
99
|
+
paddingVertical: dp(4),
|
100
|
+
fontSize: dp(16),
|
129
101
|
},
|
130
102
|
});
|
131
|
-
|
103
|
+
export default UserDetail;
|
@@ -1,50 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const useTranslation_1 = require("../../hooks/useTranslation");
|
6
|
-
const CardInfo_1 = require("./CardInfo");
|
1
|
+
import { dp, useTheme } from '@smart-link/rn-ui';
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
3
|
+
import { useTranslationAddrList } from '../../hooks/useTranslation';
|
4
|
+
import { CardInfo, Line } from './CardInfo';
|
7
5
|
const UserJobs = (props) => {
|
8
6
|
const { jobs } = props;
|
9
|
-
const { t } =
|
10
|
-
const theme =
|
7
|
+
const { t } = useTranslationAddrList();
|
8
|
+
const theme = useTheme();
|
11
9
|
const styles = makeStyles(theme);
|
12
|
-
return (<
|
10
|
+
return (<CardInfo>
|
13
11
|
{(jobs === null || jobs === void 0 ? void 0 : jobs.length) > 0 &&
|
14
12
|
jobs.map(job => {
|
15
13
|
let isMainJob = job.majorFlag === 'y';
|
16
|
-
return (<
|
17
|
-
<
|
18
|
-
<
|
14
|
+
return (<Line key={job.groupId}>
|
15
|
+
<View style={isMainJob ? styles.mainJob : styles.partJob}>
|
16
|
+
<Text style={{ color: isMainJob ? '#fff' : theme.primaryColor }}>
|
19
17
|
{isMainJob ? t('job') : t('otherJob')}
|
20
|
-
</
|
21
|
-
</
|
22
|
-
<
|
23
|
-
<
|
24
|
-
<
|
25
|
-
</
|
26
|
-
<
|
27
|
-
<
|
28
|
-
</
|
29
|
-
</
|
30
|
-
</
|
18
|
+
</Text>
|
19
|
+
</View>
|
20
|
+
<View style={{ flexDirection: 'column', flex: 1 }}>
|
21
|
+
<View style={{ marginLeft: 0 }}>
|
22
|
+
<Text style={{ color: '#393939' }}>{job.groupNamePath}</Text>
|
23
|
+
</View>
|
24
|
+
<View style={{ marginBottom: 5 }}>
|
25
|
+
<Text style={{ color: '#393939' }}>{job.postName}</Text>
|
26
|
+
</View>
|
27
|
+
</View>
|
28
|
+
</Line>);
|
31
29
|
})}
|
32
|
-
</
|
30
|
+
</CardInfo>);
|
33
31
|
};
|
34
|
-
const makeStyles = (theme) =>
|
32
|
+
const makeStyles = (theme) => StyleSheet.create({
|
35
33
|
mainJob: {
|
36
|
-
padding:
|
37
|
-
borderRadius:
|
38
|
-
marginRight:
|
34
|
+
padding: dp(4),
|
35
|
+
borderRadius: dp(3),
|
36
|
+
marginRight: dp(10),
|
39
37
|
backgroundColor: theme.primaryColor,
|
40
38
|
},
|
41
39
|
partJob: {
|
42
|
-
padding:
|
43
|
-
borderRadius:
|
44
|
-
marginRight:
|
40
|
+
padding: dp(3),
|
41
|
+
borderRadius: dp(3),
|
42
|
+
marginRight: dp(10),
|
45
43
|
borderColor: theme.primaryColor,
|
46
|
-
borderWidth:
|
44
|
+
borderWidth: dp(1),
|
47
45
|
backgroundColor: '#fff',
|
48
46
|
},
|
49
47
|
});
|
50
|
-
|
48
|
+
export default UserJobs;
|
@@ -1,52 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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 useTranslation_1 = require("../../hooks/useTranslation");
|
30
|
-
const Organization_1 = require("./Organization");
|
31
|
-
const addressList_1 = require("../../api/addressList");
|
32
|
-
const init_1 = require("../../init");
|
33
|
-
const react_redux_1 = require("react-redux");
|
34
|
-
const contact_slice_1 = require("../../slice/contact/contact.slice");
|
35
|
-
const useImSelector_1 = require("../../hooks/useImSelector");
|
36
|
-
const UserSearch = (0, react_1.memo)(({ navigation, route: { params } }) => {
|
37
|
-
const [keyword, setKeyword] = (0, react_1.useState)('');
|
38
|
-
const { selectUsers } = (0, useImSelector_1.useContact)();
|
1
|
+
import { NavigationPage, ListRow, HeaderSearchBar } from '@smart-link/rn-ui';
|
2
|
+
import React, { memo, useEffect, useState } from 'react';
|
3
|
+
import { Text, View, StyleSheet } from 'react-native';
|
4
|
+
import { useTranslationAddrList } from '../../hooks/useTranslation';
|
5
|
+
import { RenderUserItem } from './Organization';
|
6
|
+
import { searchUser } from '../../api/addressList';
|
7
|
+
import { getImManager } from '../../init';
|
8
|
+
import { useDispatch } from 'react-redux';
|
9
|
+
import { onSelectUser } from '../../slice/contact/contact.slice';
|
10
|
+
import { useContact } from '../../hooks/useImSelector';
|
11
|
+
const UserSearch = memo(({ navigation, route: { params } }) => {
|
12
|
+
const [keyword, setKeyword] = useState('');
|
13
|
+
const { selectUsers } = useContact();
|
39
14
|
const { checkable } = params || {};
|
40
|
-
const [userList, setUserList] =
|
41
|
-
const { t } =
|
42
|
-
const imManager =
|
43
|
-
const dispatch =
|
15
|
+
const [userList, setUserList] = useState([]);
|
16
|
+
const { t } = useTranslationAddrList();
|
17
|
+
const imManager = getImManager();
|
18
|
+
const dispatch = useDispatch();
|
44
19
|
const selectCount = Object.keys(selectUsers).length;
|
45
|
-
|
20
|
+
useEffect(() => {
|
46
21
|
if (!keyword || keyword === '') {
|
47
22
|
return;
|
48
23
|
}
|
49
|
-
|
24
|
+
searchUser({
|
50
25
|
userNameLike: keyword,
|
51
26
|
tenantId: imManager.user.tenantId,
|
52
27
|
}).then(({ data }) => {
|
@@ -57,26 +32,26 @@ const UserSearch = (0, react_1.memo)(({ navigation, route: { params } }) => {
|
|
57
32
|
navigation.navigate('UserDetail', { userId: item.userId, userAccount: item.userAccount });
|
58
33
|
};
|
59
34
|
return (<>
|
60
|
-
<
|
61
|
-
<
|
62
|
-
{userList.length > 0 ? (userList.map((item) => (<
|
35
|
+
<HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
|
36
|
+
<NavigationPage noPadding scroll={userList.length > 0}>
|
37
|
+
{userList.length > 0 ? (userList.map((item) => (<ListRow key={item.userId} onPress={() => {
|
63
38
|
if (checkable) {
|
64
|
-
dispatch(
|
39
|
+
dispatch(onSelectUser(item));
|
65
40
|
}
|
66
41
|
else {
|
67
42
|
handleUser(item);
|
68
43
|
}
|
69
|
-
}} title={<
|
70
|
-
<
|
71
|
-
</
|
72
|
-
</
|
44
|
+
}} title={<RenderUserItem checkable={checkable} checked={!!selectUsers[item.userId]} data={item}/>} topSeparator="full"/>))) : (<View style={[styles.noData]}>
|
45
|
+
<Text>{t('noData')}</Text>
|
46
|
+
</View>)}
|
47
|
+
</NavigationPage>
|
73
48
|
</>);
|
74
49
|
});
|
75
|
-
const styles =
|
50
|
+
const styles = StyleSheet.create({
|
76
51
|
noData: {
|
77
52
|
flex: 1,
|
78
53
|
justifyContent: 'center',
|
79
54
|
alignItems: 'center',
|
80
55
|
},
|
81
56
|
});
|
82
|
-
|
57
|
+
export default UserSearch;
|
@@ -1,31 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
const UserDetail_1 = __importDefault(require("./UserDetail"));
|
7
|
-
const UserSearch_1 = __importDefault(require("./UserSearch"));
|
8
|
-
const ChooseContact_1 = __importDefault(require("./ChooseContact"));
|
9
|
-
const Organization_1 = __importDefault(require("./Organization"));
|
10
|
-
const AddressList_1 = __importDefault(require("./AddressList"));
|
1
|
+
import UserDetail from './UserDetail';
|
2
|
+
import UserSearch from './UserSearch';
|
3
|
+
import ChooseContact from './ChooseContact';
|
4
|
+
import Organization from './Organization';
|
5
|
+
import AddressList from './AddressList';
|
11
6
|
const addressListRoutes = [
|
12
7
|
{
|
13
8
|
name: 'AddressList',
|
14
|
-
component:
|
9
|
+
component: AddressList,
|
15
10
|
options: {
|
16
11
|
title: ''
|
17
12
|
},
|
18
13
|
},
|
19
14
|
{
|
20
15
|
name: 'Organization',
|
21
|
-
component:
|
16
|
+
component: Organization,
|
22
17
|
options: {
|
23
18
|
title: ''
|
24
19
|
},
|
25
20
|
},
|
26
21
|
{
|
27
22
|
name: 'ChooseContact',
|
28
|
-
component:
|
23
|
+
component: ChooseContact,
|
29
24
|
options: {
|
30
25
|
animation: 'fade',
|
31
26
|
title: ''
|
@@ -33,18 +28,18 @@ const addressListRoutes = [
|
|
33
28
|
},
|
34
29
|
{
|
35
30
|
name: 'UserDetail',
|
36
|
-
component:
|
31
|
+
component: UserDetail,
|
37
32
|
options: {
|
38
33
|
title: ''
|
39
34
|
},
|
40
35
|
},
|
41
36
|
{
|
42
37
|
name: 'UserSearch',
|
43
|
-
component:
|
38
|
+
component: UserSearch,
|
44
39
|
options: {
|
45
40
|
animation: 'fade',
|
46
41
|
headerShown: false,
|
47
42
|
},
|
48
43
|
},
|
49
44
|
];
|
50
|
-
|
45
|
+
export default addressListRoutes;
|
@@ -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,80 +7,76 @@ 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
|
-
const ContentFactory_1 = __importDefault(require("./ContentFactory"));
|
45
|
-
const styles_1 = require("../../components/styles");
|
46
|
-
const FormatTimeText_1 = __importDefault(require("../../components/FormatTimeText"));
|
47
|
-
const common_action_sheet_1 = require("../../utils/common-action-sheet");
|
10
|
+
import { NavigationPage, dp, useNavigation, HeaderSearchBar } from '@smart-link/rn-ui';
|
11
|
+
import React, { useEffect, useState } from 'react';
|
12
|
+
import { Text, TouchableOpacity, View, StyleSheet, FlatList } from 'react-native';
|
13
|
+
import useTranslation from '../../hooks/useTranslation';
|
14
|
+
import { getImManager } from '../../init';
|
15
|
+
import { useCollection, useConversation } from '../../hooks/useImSelector';
|
16
|
+
import ContentFactory from './ContentFactory';
|
17
|
+
import { borderStyle, shadowStyle } from '../../components/styles';
|
18
|
+
import FormatTimeText from '../../components/FormatTimeText';
|
19
|
+
import { ConfirmActionSheet } from '../../utils/common-action-sheet';
|
48
20
|
const Collection = () => {
|
49
|
-
const { t } = (
|
50
|
-
const [keyword, setKeyword] =
|
51
|
-
const { currentConversation } =
|
52
|
-
const { collections } =
|
53
|
-
const navigation =
|
54
|
-
|
55
|
-
|
21
|
+
const { t } = useTranslation();
|
22
|
+
const [keyword, setKeyword] = useState('');
|
23
|
+
const { currentConversation } = useConversation();
|
24
|
+
const { collections } = useCollection();
|
25
|
+
const navigation = useNavigation();
|
26
|
+
useEffect(() => {
|
27
|
+
getImManager().selectCollections(keyword);
|
56
28
|
}, [keyword]);
|
57
29
|
const onPressCollection = (collection) => {
|
58
|
-
|
30
|
+
ConfirmActionSheet(t('sendTo') + (currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.name), () => __awaiter(void 0, void 0, void 0, function* () {
|
59
31
|
// TODO: 发送收藏消息
|
60
|
-
yield
|
32
|
+
yield getImManager().sendCollectionMessage(collection);
|
61
33
|
navigation.goBack();
|
62
34
|
}), t);
|
63
35
|
};
|
64
36
|
const keyExtractor = (item) => item.messageSeq;
|
65
|
-
const itemSeparatorComponent = () => <
|
37
|
+
const itemSeparatorComponent = () => <View style={styles.h10}/>;
|
66
38
|
const renderItem = ({ item }) => {
|
67
39
|
const { conversationName, messageTime } = item;
|
68
|
-
return (<
|
40
|
+
return (<TouchableOpacity activeOpacity={0.5} style={styles.item} onPress={() => {
|
69
41
|
onPressCollection(item);
|
70
42
|
}}>
|
71
|
-
<
|
72
|
-
<
|
73
|
-
<
|
74
|
-
<
|
43
|
+
<ContentFactory collection={item} keyword={keyword}/>
|
44
|
+
<View style={styles.h10}/>
|
45
|
+
<View style={styles.row}>
|
46
|
+
<Text style={styles.title} numberOfLines={1}>
|
75
47
|
{conversationName + ' '}
|
76
|
-
</
|
77
|
-
<
|
78
|
-
</
|
79
|
-
</
|
48
|
+
</Text>
|
49
|
+
<FormatTimeText style={styles.time} time={messageTime}/>
|
50
|
+
</View>
|
51
|
+
</TouchableOpacity>);
|
80
52
|
};
|
81
53
|
return (<>
|
82
|
-
<
|
83
|
-
<
|
84
|
-
{collections.length > 0 && (<
|
85
|
-
{collections.length === 0 && (<
|
86
|
-
<
|
54
|
+
<HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
|
55
|
+
<NavigationPage scroll={false} noPadding>
|
56
|
+
{collections.length > 0 && (<FlatList contentContainerStyle={styles.list} numColumns={1} data={collections} keyExtractor={keyExtractor} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent}/>)}
|
57
|
+
{collections.length === 0 && (<View style={{ flex: 1 }}>
|
58
|
+
<View style={{
|
87
59
|
flex: 1,
|
88
60
|
justifyContent: 'center',
|
89
61
|
alignItems: 'center',
|
90
|
-
height:
|
62
|
+
height: dp(80),
|
91
63
|
}}>
|
92
|
-
<
|
93
|
-
</
|
94
|
-
</
|
95
|
-
</
|
64
|
+
<Text>{t('emptyCollect')}</Text>
|
65
|
+
</View>
|
66
|
+
</View>)}
|
67
|
+
</NavigationPage>
|
96
68
|
</>);
|
97
69
|
};
|
98
|
-
const styles =
|
70
|
+
const styles = StyleSheet.create({
|
99
71
|
collection: {
|
100
72
|
flex: 1,
|
101
73
|
},
|
102
74
|
list: {
|
103
|
-
paddingVertical:
|
104
|
-
paddingHorizontal:
|
75
|
+
paddingVertical: dp(10),
|
76
|
+
paddingHorizontal: dp(12),
|
105
77
|
},
|
106
|
-
item: Object.assign(Object.assign({ minHeight:
|
107
|
-
search: Object.assign({ backgroundColor: '#fff', padding:
|
78
|
+
item: Object.assign(Object.assign({ minHeight: dp(80), padding: dp(15), backgroundColor: '#fff', borderColor: '#eee' }, shadowStyle), borderStyle),
|
79
|
+
search: Object.assign({ backgroundColor: '#fff', padding: dp(10), borderBottomWidth: dp(1), borderColor: '#e9e9e9' }, shadowStyle),
|
108
80
|
empty: {
|
109
81
|
flex: 1,
|
110
82
|
backgroundColor: '#fff',
|
@@ -112,25 +84,25 @@ const styles = react_native_1.StyleSheet.create({
|
|
112
84
|
justifyContent: 'center',
|
113
85
|
},
|
114
86
|
h10: {
|
115
|
-
height:
|
87
|
+
height: dp(10),
|
116
88
|
},
|
117
89
|
h15: {
|
118
|
-
height:
|
90
|
+
height: dp(15),
|
119
91
|
},
|
120
92
|
row: {
|
121
93
|
flexDirection: 'row',
|
122
94
|
},
|
123
95
|
title: {
|
124
|
-
maxWidth:
|
96
|
+
maxWidth: dp(230),
|
125
97
|
color: '#666',
|
126
|
-
fontSize:
|
127
|
-
lineHeight:
|
98
|
+
fontSize: dp(13),
|
99
|
+
lineHeight: dp(20),
|
128
100
|
},
|
129
101
|
time: {
|
130
|
-
marginLeft:
|
102
|
+
marginLeft: dp(10),
|
131
103
|
color: '#666',
|
132
|
-
fontSize:
|
133
|
-
lineHeight:
|
104
|
+
fontSize: dp(13),
|
105
|
+
lineHeight: dp(20),
|
134
106
|
},
|
135
107
|
});
|
136
|
-
|
108
|
+
export default Collection;
|