@smart-link/rn-im 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/addressList.js +6 -17
- package/dist/api/backup.js +8 -20
- package/dist/api/file.js +6 -35
- package/dist/api/user.js +6 -16
- package/dist/components/CachedImage.js +14 -42
- package/dist/components/Camera/Camera.js +26 -54
- package/dist/components/Camera/CameraCapture.js +99 -128
- package/dist/components/Camera/CameraResult.js +33 -61
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
- package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
- package/dist/components/ChatAvatar/index.js +2 -23
- package/dist/components/Favicon.js +6 -34
- package/dist/components/FormatTimeText.js +5 -10
- package/dist/components/Highlighter.js +9 -34
- package/dist/components/IndicatorText.js +14 -39
- package/dist/components/LocalImage.js +7 -32
- package/dist/components/NetworkUnconnected.js +14 -42
- package/dist/components/PopoverWrapper.js +22 -47
- package/dist/components/VideoPlayer.js +111 -138
- package/dist/components/styles.js +10 -13
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +8 -10
- package/dist/hooks/useDownloadSource.js +7 -12
- package/dist/hooks/useFormatMsgTime.js +5 -13
- package/dist/hooks/useImReady.js +7 -10
- package/dist/hooks/useImSelector.js +34 -48
- package/dist/hooks/useTranslation.js +5 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -28
- package/dist/init.js +30 -40
- package/dist/interface.js +1 -2
- package/dist/locales/en/addressList.js +1 -3
- package/dist/locales/index.js +4 -27
- package/dist/locales/lao/addressList.js +1 -3
- package/dist/locales/zh/addressList.js +1 -3
- package/dist/pages/address-list/AddressList.js +33 -61
- package/dist/pages/address-list/CardInfo.js +10 -18
- package/dist/pages/address-list/ChooseContact.js +50 -78
- package/dist/pages/address-list/Icons.js +7 -14
- package/dist/pages/address-list/Organization.js +59 -89
- package/dist/pages/address-list/UserDetail.js +55 -83
- package/dist/pages/address-list/UserJobs.js +31 -33
- package/dist/pages/address-list/UserSearch.js +29 -54
- package/dist/pages/address-list/addressList.routes.js +11 -16
- package/dist/pages/collection/Collection.js +53 -81
- package/dist/pages/collection/ContentFactory.js +53 -82
- package/dist/pages/collection/collection.routes.js +3 -9
- package/dist/pages/conversation/ForwardToConversation.js +63 -91
- package/dist/pages/conversation/List.js +74 -102
- package/dist/pages/conversation/components/ConversationCard.js +52 -81
- package/dist/pages/conversation/components/ConversationOption.js +27 -55
- package/dist/pages/conversation/conversation.routes.js +17 -23
- package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
- package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
- package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
- package/dist/pages/conversation/setting/OptionConversation.js +20 -48
- package/dist/pages/conversation/setting/OptionGroup.js +20 -48
- package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
- package/dist/pages/conversation/setting/Setting.js +49 -54
- package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
- package/dist/pages/index.js +7 -27
- package/dist/pages/message/ChooseMember.js +56 -84
- package/dist/pages/message/MessageBackup/Bar.js +18 -43
- package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/index.js +3 -12
- package/dist/pages/message/MessageBackup/utils.js +14 -22
- package/dist/pages/message/MessageList.js +141 -134
- package/dist/pages/message/MessageRecord.js +49 -73
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.js +82 -110
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.js +96 -120
- package/dist/pages/message/components/MessagePayload.js +36 -64
- package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
- package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
- package/dist/pages/message/components/MessageUndo.js +18 -48
- package/dist/pages/message/components/MultipleBar/index.js +48 -76
- package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
- package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
- package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
- package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
- package/dist/pages/message/components/Payload/PayloadText.js +39 -67
- package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +31 -61
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +129 -158
- package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
- package/dist/pages/message/components/UploadProgress.js +12 -37
- package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
- package/dist/pages/message/components/messageBar/Icons.js +56 -74
- package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
- package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
- package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
- package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
- package/dist/pages/message/components/messageBar/index.js +2 -23
- package/dist/pages/message/message.routes.js +11 -40
- package/dist/pages/search/Search.js +38 -66
- package/dist/pages/search/SearchChatRecords.js +64 -92
- package/dist/pages/search/SearchFile.js +68 -96
- package/dist/pages/search/SearchManager.js +60 -65
- package/dist/pages/search/SearchPicturePage.js +16 -44
- package/dist/pages/search/components/ChatRecords.js +46 -74
- package/dist/pages/search/components/MyGroupChat.js +41 -69
- package/dist/pages/search/components/PictureMulipleBar.js +35 -63
- package/dist/pages/search/components/SearchFileList.js +59 -64
- package/dist/pages/search/components/SearchPictures.js +68 -98
- package/dist/pages/search/components/SearchShareLinkList.js +50 -55
- package/dist/pages/search/components/SearchUser.js +25 -53
- package/dist/pages/search/components/useSearchMessage.js +12 -16
- package/dist/pages/search/search.routes.js +11 -17
- package/dist/pages/search/utils.js +4 -12
- package/dist/pages/types.js +1 -2
- package/dist/slice/contact/contact.action.js +1 -2
- package/dist/slice/contact/contact.slice.js +7 -11
- package/dist/slice/index.js +7 -13
- package/dist/slice/panel/panel.slice.d.ts +2 -1
- package/dist/slice/panel/panel.slice.js +8 -7
- package/dist/slice/video/video.action.d.ts +1 -0
- package/dist/slice/video/video.action.js +56 -38
- package/dist/slice/video/video.slice.d.ts +1 -1
- package/dist/slice/video/video.slice.js +7 -8
- package/dist/utils/audio.d.ts +3 -0
- package/dist/utils/audio.js +10 -0
- package/dist/utils/color.js +2 -9
- package/dist/utils/common-action-sheet.js +9 -14
- package/dist/utils/cookie.js +6 -14
- package/dist/utils/emoji.js +9 -12
- package/dist/utils/file-icon.js +33 -60
- package/dist/utils/file-operate.js +1 -2
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +74 -87
- package/dist/utils/golden-rectangle.js +3 -7
- package/dist/utils/phone.js +13 -22
- package/dist/utils/request.js +7 -15
- package/dist/utils/scroll.js +5 -9
- package/dist/utils/summary.js +4 -11
- package/dist/utils/take-camera.js +12 -19
- package/dist/utils/text-mix.js +4 -11
- package/dist/utils/upload.js +20 -41
- package/package.json +6 -7
@@ -1,74 +1,69 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
|
10
|
-
const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/MaterialIcons"));
|
11
|
-
const SearchPictures_1 = __importDefault(require("./components/SearchPictures"));
|
12
|
-
const SearchShareLinkList_1 = __importDefault(require("./components/SearchShareLinkList"));
|
13
|
-
const SearchFileList_1 = __importDefault(require("./components/SearchFileList"));
|
1
|
+
import { dp, HeaderBar, NavigationPage, SearchInput, SegmentedView, useNavigation, CaihText, } from "@smart-link/rn-ui";
|
2
|
+
import React from "react";
|
3
|
+
import { StyleSheet, TouchableOpacity } from "react-native";
|
4
|
+
import useTranslation from "../../hooks/useTranslation";
|
5
|
+
import MaterialIcon from "react-native-vector-icons/MaterialIcons";
|
6
|
+
import SearchPictures from "./components/SearchPictures";
|
7
|
+
import SearchShareLinkList from "./components/SearchShareLinkList";
|
8
|
+
import SearchFileList from "./components/SearchFileList";
|
14
9
|
const SearchManager = ({ navigation, route: { params } }) => {
|
15
|
-
const { t } = (
|
10
|
+
const { t } = useTranslation();
|
16
11
|
const { conversation } = params;
|
17
|
-
const [keyword, setKeyword] =
|
18
|
-
const [activeIndex, setActiveIndex] =
|
19
|
-
const [multiple, setMultiple] =
|
20
|
-
return (<
|
12
|
+
const [keyword, setKeyword] = React.useState('');
|
13
|
+
const [activeIndex, setActiveIndex] = React.useState(0);
|
14
|
+
const [multiple, setMultiple] = React.useState(false);
|
15
|
+
return (<NavigationPage noPadding>
|
21
16
|
<Header showSearch={activeIndex !== 0} showMultiple={activeIndex === 0} showBack={activeIndex === 0} value={keyword} onSubmitEditing={setKeyword} multiple={multiple} onMultiple={() => {
|
22
17
|
setMultiple(!multiple);
|
23
18
|
}}/>
|
24
|
-
<
|
25
|
-
<
|
26
|
-
<
|
27
|
-
</
|
28
|
-
<
|
29
|
-
<
|
30
|
-
</
|
31
|
-
<
|
32
|
-
<
|
33
|
-
</
|
34
|
-
</
|
35
|
-
</
|
19
|
+
<SegmentedView style={styles.segmented} barStyle={styles.segmentedBar} justifyItem={'fixed'} indicatorType={'boxWidth'} type={'carousel'} onChange={setActiveIndex}>
|
20
|
+
<SegmentedView.Sheet title={t('pictureChats')} titleStyle={styles.sheetTitle} activeTitleStyle={styles.sheetTitleActive}>
|
21
|
+
<SearchPictures conversationId={conversation.id} multiple={multiple}/>
|
22
|
+
</SegmentedView.Sheet>
|
23
|
+
<SegmentedView.Sheet title={t('linkChats')} titleStyle={styles.sheetTitle} activeTitleStyle={styles.sheetTitleActive}>
|
24
|
+
<SearchShareLinkList keyword={keyword} conversationId={conversation.id}/>
|
25
|
+
</SegmentedView.Sheet>
|
26
|
+
<SegmentedView.Sheet title={t('fileChats')} titleStyle={styles.sheetTitle} activeTitleStyle={styles.sheetTitleActive}>
|
27
|
+
<SearchFileList keyword={keyword} conversationId={conversation.id}/>
|
28
|
+
</SegmentedView.Sheet>
|
29
|
+
</SegmentedView>
|
30
|
+
</NavigationPage>);
|
36
31
|
};
|
37
|
-
const styles =
|
32
|
+
const styles = StyleSheet.create({
|
38
33
|
segmented: {
|
39
34
|
flex: 1,
|
40
35
|
backgroundColor: '#fff',
|
41
36
|
},
|
42
37
|
segmentedBar: {
|
43
|
-
paddingTop:
|
44
|
-
paddingHorizontal:
|
38
|
+
paddingTop: dp(5),
|
39
|
+
paddingHorizontal: dp(15),
|
45
40
|
},
|
46
41
|
sheetTitle: {
|
47
|
-
fontSize:
|
48
|
-
lineHeight:
|
49
|
-
borderRadius:
|
42
|
+
fontSize: dp(14),
|
43
|
+
lineHeight: dp(16),
|
44
|
+
borderRadius: dp(3),
|
50
45
|
},
|
51
46
|
sheetTitleActive: {
|
52
|
-
fontSize:
|
53
|
-
lineHeight:
|
54
|
-
borderRadius:
|
47
|
+
fontSize: dp(14),
|
48
|
+
lineHeight: dp(16),
|
49
|
+
borderRadius: dp(3),
|
55
50
|
},
|
56
51
|
});
|
57
52
|
const Header = ({ value, showSearch, showMultiple, showBack, onSubmitEditing, multiple, onMultiple }) => {
|
58
|
-
const navigation =
|
59
|
-
const input =
|
60
|
-
const { t } = (
|
61
|
-
return <
|
53
|
+
const navigation = useNavigation();
|
54
|
+
const input = React.useRef(null);
|
55
|
+
const { t } = useTranslation();
|
56
|
+
return <HeaderBar style={{
|
62
57
|
alignItems: 'center',
|
63
58
|
justifyContent: 'space-between',
|
64
59
|
}}>
|
65
|
-
{showSearch && <
|
66
|
-
height:
|
60
|
+
{showSearch && <SearchInput ref={input} value={value} numberOfLines={1} style={{
|
61
|
+
height: dp(32),
|
67
62
|
flex: 1,
|
68
|
-
borderRadius:
|
63
|
+
borderRadius: dp(4),
|
69
64
|
}} inputStyle={{
|
70
|
-
fontSize:
|
71
|
-
height:
|
65
|
+
fontSize: dp(14),
|
66
|
+
height: dp(32),
|
72
67
|
flex: 1,
|
73
68
|
}} placeholder={t('search')} onSubmitEditing={() => {
|
74
69
|
var _a;
|
@@ -77,35 +72,35 @@ const Header = ({ value, showSearch, showMultiple, showBack, onSubmitEditing, mu
|
|
77
72
|
onSubmitEditing(text);
|
78
73
|
}} maxLength={20} returnKeyType="search"/>}
|
79
74
|
|
80
|
-
{showSearch && <
|
81
|
-
height:
|
75
|
+
{showSearch && <TouchableOpacity style={{
|
76
|
+
height: dp(32),
|
82
77
|
alignItems: 'center',
|
83
78
|
justifyContent: 'center',
|
84
|
-
paddingLeft:
|
79
|
+
paddingLeft: dp(16),
|
85
80
|
}} onPress={() => {
|
86
81
|
navigation.goBack();
|
87
82
|
}}>
|
88
|
-
<
|
89
|
-
</
|
83
|
+
<CaihText color="#fff">{t('cancel')}</CaihText>
|
84
|
+
</TouchableOpacity>}
|
90
85
|
|
91
|
-
{showBack && <
|
92
|
-
height:
|
86
|
+
{showBack && <TouchableOpacity style={{
|
87
|
+
height: dp(32),
|
93
88
|
alignItems: 'center',
|
94
89
|
justifyContent: 'center',
|
95
|
-
paddingLeft: showMultiple ? 0 :
|
90
|
+
paddingLeft: showMultiple ? 0 : dp(16),
|
96
91
|
}} onPress={() => {
|
97
92
|
navigation.goBack();
|
98
93
|
}}>
|
99
|
-
<
|
100
|
-
</
|
101
|
-
{showMultiple && <
|
102
|
-
height:
|
94
|
+
<MaterialIcon name="arrow-back-ios" size={dp(20)} color="#fff"/>
|
95
|
+
</TouchableOpacity>}
|
96
|
+
{showMultiple && <TouchableOpacity style={{
|
97
|
+
height: dp(32),
|
103
98
|
alignItems: 'center',
|
104
99
|
justifyContent: 'center',
|
105
|
-
paddingLeft:
|
100
|
+
paddingLeft: dp(16),
|
106
101
|
}} onPress={onMultiple}>
|
107
|
-
<
|
108
|
-
</
|
109
|
-
</
|
102
|
+
<CaihText color="#fff">{multiple ? t('cancel') : t('multiple')}</CaihText>
|
103
|
+
</TouchableOpacity>}
|
104
|
+
</HeaderBar>;
|
110
105
|
};
|
111
|
-
|
106
|
+
export default SearchManager;
|
@@ -1,56 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const react_1 = __importStar(require("react"));
|
30
|
-
const react_native_1 = require("react-native");
|
31
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
32
|
-
const useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
|
33
|
-
const SearchPictures_1 = __importDefault(require("./components/SearchPictures"));
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import { Text, TouchableOpacity } from 'react-native';
|
3
|
+
import { dp, NavigationPage } from '@smart-link/rn-ui';
|
4
|
+
import useTranslation from '../../hooks/useTranslation';
|
5
|
+
import SearchPictures from './components/SearchPictures';
|
34
6
|
const SearchPicturePage = ({ navigation, route: { params } }) => {
|
35
|
-
const { t } = (
|
7
|
+
const { t } = useTranslation();
|
36
8
|
const { conversationId } = params;
|
37
|
-
const [multiple, setMultiple] =
|
38
|
-
const [checkedIds, setCheckedIds] =
|
9
|
+
const [multiple, setMultiple] = useState(false);
|
10
|
+
const [checkedIds, setCheckedIds] = useState([]);
|
39
11
|
const title = t('pictureManager');
|
40
|
-
|
12
|
+
useEffect(() => {
|
41
13
|
navigation.setOptions({
|
42
14
|
title: title,
|
43
15
|
headerRight: ({ tintColor }) => {
|
44
|
-
return (<
|
16
|
+
return (<TouchableOpacity style={{ padding: dp(8) }} onPress={() => {
|
45
17
|
setMultiple(p => !p);
|
46
18
|
}}>
|
47
|
-
<
|
48
|
-
</
|
19
|
+
<Text style={{ color: tintColor }}>{multiple ? t('cancel') : t('multiple')}</Text>
|
20
|
+
</TouchableOpacity>);
|
49
21
|
},
|
50
22
|
});
|
51
23
|
}, [title, navigation, multiple, checkedIds]);
|
52
|
-
return (<
|
53
|
-
<
|
54
|
-
</
|
24
|
+
return (<NavigationPage noPadding>
|
25
|
+
<SearchPictures conversationId={conversationId} multiple={multiple}/>
|
26
|
+
</NavigationPage>);
|
55
27
|
};
|
56
|
-
|
28
|
+
export default SearchPicturePage;
|
@@ -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,25 +7,21 @@ 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
|
-
const init_1 = require("../../../init");
|
41
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
42
|
-
const react_1 = __importStar(require("react"));
|
43
|
-
const react_native_1 = require("react-native");
|
10
|
+
import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
|
11
|
+
import useTranslation from '../../../hooks/useTranslation';
|
12
|
+
import { getImManager } from '../../../init';
|
13
|
+
import { dp, useNavigation } from '@smart-link/rn-ui';
|
14
|
+
import React, { useEffect, useState } from 'react';
|
15
|
+
import { View, Text, FlatList, StyleSheet, TouchableOpacity } from 'react-native';
|
44
16
|
const ChatRecords = ({ keyword }) => {
|
45
|
-
const navigation =
|
46
|
-
const { t } = (
|
47
|
-
const [data, setData] =
|
48
|
-
|
17
|
+
const navigation = useNavigation();
|
18
|
+
const { t } = useTranslation();
|
19
|
+
const [data, setData] = useState([]);
|
20
|
+
useEffect(() => {
|
49
21
|
if (!keyword || keyword === '') {
|
50
22
|
return;
|
51
23
|
}
|
52
|
-
const db =
|
24
|
+
const db = getImManager().db;
|
53
25
|
db.selectConversationMessageCount(keyword).then((list) => __awaiter(void 0, void 0, void 0, function* () {
|
54
26
|
const data = [];
|
55
27
|
for (const item of list) {
|
@@ -62,51 +34,51 @@ const ChatRecords = ({ keyword }) => {
|
|
62
34
|
}));
|
63
35
|
}, [keyword]);
|
64
36
|
if (data.length === 0) {
|
65
|
-
return (<
|
66
|
-
<
|
37
|
+
return (<View style={{ flex: 1 }}>
|
38
|
+
<View style={{
|
67
39
|
flex: 1,
|
68
40
|
justifyContent: 'center',
|
69
41
|
alignItems: 'center',
|
70
42
|
}}>
|
71
|
-
<
|
72
|
-
</
|
73
|
-
</
|
43
|
+
<Text>{t('noSearchResult')}</Text>
|
44
|
+
</View>
|
45
|
+
</View>);
|
74
46
|
}
|
75
47
|
const keyExtractor = (item) => item.id;
|
76
48
|
const renderItem = ({ item }) => {
|
77
49
|
const { id, type, name, count, avatars } = item;
|
78
|
-
return (<
|
50
|
+
return (<TouchableOpacity style={styles.item} activeOpacity={0.5} onPress={() => {
|
79
51
|
navigation.navigate('SearchChatRecords', {
|
80
52
|
conversation: item,
|
81
53
|
keyword,
|
82
54
|
});
|
83
55
|
}}>
|
84
|
-
<
|
85
|
-
<
|
86
|
-
<
|
87
|
-
<
|
56
|
+
<ChatAvatar id={id} size={dp(42)} url={avatars} name={name}/>
|
57
|
+
<View style={styles.width10}/>
|
58
|
+
<View style={styles.left}>
|
59
|
+
<Text style={styles.name} numberOfLines={1}>
|
88
60
|
{name}
|
89
|
-
</
|
90
|
-
<
|
61
|
+
</Text>
|
62
|
+
<Text style={styles.text} numberOfLines={1}>
|
91
63
|
{count + ' ' + t('matchedMessage')}
|
92
|
-
</
|
93
|
-
</
|
94
|
-
</
|
64
|
+
</Text>
|
65
|
+
</View>
|
66
|
+
</TouchableOpacity>);
|
95
67
|
};
|
96
|
-
const itemSeparatorComponent = () => <
|
97
|
-
return (<
|
68
|
+
const itemSeparatorComponent = () => <View style={styles.separator}/>;
|
69
|
+
return (<FlatList contentContainerStyle={styles.list} data={data} numColumns={1} initialNumToRender={1} keyExtractor={keyExtractor} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent}/>);
|
98
70
|
};
|
99
|
-
const styles =
|
71
|
+
const styles = StyleSheet.create({
|
100
72
|
empty: {
|
101
73
|
flex: 1,
|
102
74
|
alignItems: 'center',
|
103
75
|
justifyContent: 'center',
|
104
76
|
},
|
105
77
|
list: {
|
106
|
-
marginVertical:
|
107
|
-
padding:
|
78
|
+
marginVertical: dp(10),
|
79
|
+
padding: dp(15),
|
108
80
|
backgroundColor: '#fff',
|
109
|
-
borderWidth:
|
81
|
+
borderWidth: dp(1),
|
110
82
|
borderStyle: 'solid',
|
111
83
|
borderColor: '#eee',
|
112
84
|
borderLeftWidth: 0,
|
@@ -116,36 +88,36 @@ const styles = react_native_1.StyleSheet.create({
|
|
116
88
|
flexDirection: 'row',
|
117
89
|
},
|
118
90
|
width10: {
|
119
|
-
width:
|
91
|
+
width: dp(10),
|
120
92
|
},
|
121
93
|
left: {
|
122
94
|
justifyContent: 'space-between',
|
123
95
|
},
|
124
96
|
name: {
|
125
|
-
top:
|
126
|
-
width:
|
127
|
-
fontSize:
|
128
|
-
lineHeight:
|
97
|
+
top: dp(1),
|
98
|
+
width: dp(250),
|
99
|
+
fontSize: dp(14),
|
100
|
+
lineHeight: dp(16),
|
129
101
|
color: '#333',
|
130
102
|
},
|
131
103
|
time: {
|
132
|
-
fontSize:
|
133
|
-
lineHeight:
|
104
|
+
fontSize: dp(13),
|
105
|
+
lineHeight: dp(15),
|
134
106
|
color: '#999',
|
135
107
|
position: 'absolute',
|
136
108
|
right: 15,
|
137
109
|
},
|
138
110
|
text: {
|
139
|
-
width:
|
140
|
-
fontSize:
|
141
|
-
lineHeight:
|
111
|
+
width: dp(270),
|
112
|
+
fontSize: dp(13),
|
113
|
+
lineHeight: dp(15),
|
142
114
|
color: '#999',
|
143
115
|
},
|
144
116
|
separator: {
|
145
|
-
marginLeft:
|
146
|
-
marginVertical:
|
147
|
-
height:
|
117
|
+
marginLeft: dp(50),
|
118
|
+
marginVertical: dp(10),
|
119
|
+
height: dp(1),
|
148
120
|
backgroundColor: '#eee',
|
149
121
|
},
|
150
122
|
});
|
151
|
-
|
123
|
+
export default ChatRecords;
|
@@ -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,62 +7,58 @@ 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
|
45
|
-
const
|
46
|
-
const
|
47
|
-
const MyGroupChat = (0, react_1.memo)(({ keyword }) => {
|
48
|
-
const { chatGroups } = (0, useImSelector_1.useChatGroup)();
|
49
|
-
const { t } = (0, useTranslation_1.default)();
|
50
|
-
const navigation = (0, rn_ui_1.useNavigation)();
|
10
|
+
import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
|
11
|
+
import { useChatGroup } from '../../../hooks/useImSelector';
|
12
|
+
import useTranslation from '../../../hooks/useTranslation';
|
13
|
+
import { getImManager } from '../../../init';
|
14
|
+
import { getSummary } from '../../../utils/summary';
|
15
|
+
import { ConversationType } from '@smart-link/im-base';
|
16
|
+
import { dp, useNavigation } from '@smart-link/rn-ui';
|
17
|
+
import React, { memo } from 'react';
|
18
|
+
import { View, StyleSheet, Text, FlatList, TouchableOpacity } from 'react-native';
|
19
|
+
const MyGroupChat = memo(({ keyword }) => {
|
20
|
+
const { chatGroups } = useChatGroup();
|
21
|
+
const { t } = useTranslation();
|
22
|
+
const navigation = useNavigation();
|
51
23
|
const data = chatGroups.filter(item => {
|
52
24
|
return keyword ? item.chatGroupName.includes(keyword) : false;
|
53
25
|
});
|
54
26
|
if (data.length === 0) {
|
55
|
-
return (<
|
56
|
-
<
|
27
|
+
return (<View style={{ flex: 1 }}>
|
28
|
+
<View style={{
|
57
29
|
flex: 1,
|
58
30
|
justifyContent: 'center',
|
59
31
|
alignItems: 'center',
|
60
32
|
}}>
|
61
|
-
<
|
62
|
-
</
|
63
|
-
</
|
33
|
+
<Text>{t('noSearchResult')}</Text>
|
34
|
+
</View>
|
35
|
+
</View>);
|
64
36
|
}
|
65
37
|
const renderItem = ({ item }) => {
|
66
38
|
const { chatGroupId, chatGroupName, avatars } = item;
|
67
|
-
return (<
|
39
|
+
return (<TouchableOpacity style={styles.item} activeOpacity={0.5} onPress={() => __awaiter(void 0, void 0, void 0, function* () {
|
68
40
|
// onPress && onPress(item);
|
69
|
-
yield
|
41
|
+
yield getImManager().initChatGroupConversation(item);
|
70
42
|
navigation.navigate('MessageList');
|
71
43
|
})}>
|
72
|
-
<
|
73
|
-
<
|
74
|
-
<
|
75
|
-
<
|
76
|
-
{
|
77
|
-
</
|
78
|
-
</
|
79
|
-
</
|
44
|
+
<ChatAvatar type={ConversationType.C2G} name={chatGroupName} disabled={true} id={chatGroupId} url={avatars} size={dp(42)}/>
|
45
|
+
<View style={styles.width10}/>
|
46
|
+
<View style={styles.left}>
|
47
|
+
<Text style={styles.name} numberOfLines={1}>
|
48
|
+
{getSummary(chatGroupName, keyword, 20)}
|
49
|
+
</Text>
|
50
|
+
</View>
|
51
|
+
</TouchableOpacity>);
|
80
52
|
};
|
81
|
-
const itemSeparatorComponent = () => <
|
82
|
-
return (<
|
53
|
+
const itemSeparatorComponent = () => <View style={styles.separator}/>;
|
54
|
+
return (<FlatList contentContainerStyle={styles.list} data={data} numColumns={1} keyExtractor={item => item.chatGroupId} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent}/>);
|
83
55
|
});
|
84
|
-
const styles =
|
56
|
+
const styles = StyleSheet.create({
|
85
57
|
list: {
|
86
|
-
marginVertical:
|
87
|
-
padding:
|
58
|
+
marginVertical: dp(10),
|
59
|
+
padding: dp(15),
|
88
60
|
backgroundColor: '#fff',
|
89
|
-
borderWidth:
|
61
|
+
borderWidth: dp(1),
|
90
62
|
borderStyle: 'solid',
|
91
63
|
borderColor: '#eee',
|
92
64
|
borderLeftWidth: 0,
|
@@ -96,7 +68,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
96
68
|
flexDirection: 'row',
|
97
69
|
},
|
98
70
|
width10: {
|
99
|
-
width:
|
71
|
+
width: dp(10),
|
100
72
|
},
|
101
73
|
left: {
|
102
74
|
justifyContent: 'center',
|
@@ -104,14 +76,14 @@ const styles = react_native_1.StyleSheet.create({
|
|
104
76
|
avatars: {},
|
105
77
|
name: {
|
106
78
|
width: 250,
|
107
|
-
fontSize:
|
108
|
-
lineHeight:
|
79
|
+
fontSize: dp(14),
|
80
|
+
lineHeight: dp(16),
|
109
81
|
color: '#333',
|
110
82
|
},
|
111
83
|
separator: {
|
112
|
-
marginLeft:
|
113
|
-
marginVertical:
|
114
|
-
height:
|
84
|
+
marginLeft: dp(50),
|
85
|
+
marginVertical: dp(10),
|
86
|
+
height: dp(1),
|
115
87
|
backgroundColor: '#eee',
|
116
88
|
},
|
117
89
|
accessory: {
|
@@ -125,4 +97,4 @@ const styles = react_native_1.StyleSheet.create({
|
|
125
97
|
tintColor: '#bebebe',
|
126
98
|
},
|
127
99
|
});
|
128
|
-
|
100
|
+
export default MyGroupChat;
|