@smart-link/rn-im 1.0.24 → 1.1.1
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.d.ts +16 -15
- package/dist/api/addressList.js +15 -1
- package/dist/api/user.js +1 -1
- package/dist/components/Camera/Camera.js +3 -2
- package/dist/components/Camera/CameraCapture.js +61 -12
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +3 -3
- package/dist/components/ChatAvatar/ChatAvatar.js +51 -49
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +19 -46
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +22 -10
- package/dist/components/Favicon.js +1 -1
- package/dist/components/LocalImage.js +3 -1
- package/dist/components/styles.d.ts +7 -1
- package/dist/components/styles.js +16 -11
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +1 -0
- package/dist/hooks/useAnimatedValue.d.ts +2 -0
- package/dist/hooks/useAnimatedValue.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/init.d.ts +2 -2
- package/dist/init.js +8 -5
- package/dist/interface.d.ts +15 -0
- package/dist/pages/address-list/AddressList.js +22 -40
- package/dist/pages/address-list/ChooseContact.js +209 -45
- package/dist/pages/address-list/MyGroups.d.ts +6 -0
- package/dist/pages/address-list/MyGroups.js +90 -0
- package/dist/pages/address-list/Organization.d.ts +0 -7
- package/dist/pages/address-list/Organization.js +24 -108
- package/dist/pages/address-list/UserDetail.js +5 -5
- package/dist/pages/address-list/UserSearch.js +6 -7
- package/dist/pages/address-list/addressList.routes.d.ts +9 -0
- package/dist/pages/address-list/addressList.routes.js +8 -0
- package/dist/pages/address-list/components/Icons.d.ts +8 -0
- package/dist/pages/address-list/components/Icons.js +15 -0
- package/dist/pages/address-list/components/OrgPath.d.ts +12 -0
- package/dist/pages/address-list/components/OrgPath.js +59 -0
- package/dist/pages/address-list/components/RenderUserItem.d.ts +9 -0
- package/dist/pages/address-list/components/RenderUserItem.js +14 -0
- package/dist/pages/address-list/{UserJobs.js → components/UserJobs.js} +2 -2
- package/dist/pages/address-list/useGroupCategory.d.ts +2 -0
- package/dist/pages/address-list/useGroupCategory.js +11 -0
- package/dist/pages/address-list/useRoleList.d.ts +2 -0
- package/dist/pages/address-list/useRoleList.js +11 -0
- package/dist/pages/collection/Collection.js +52 -8
- package/dist/pages/collection/ContentFactory.js +50 -3
- package/dist/pages/conversation/ForwardToConversation.js +4 -2
- package/dist/pages/conversation/List.js +15 -7
- package/dist/pages/conversation/components/ConversationCard.js +1 -7
- package/dist/pages/conversation/setting/OptionAvatars.d.ts +1 -1
- package/dist/pages/conversation/setting/OptionAvatars.js +0 -1
- package/dist/pages/conversation/setting/OptionGroup.d.ts +2 -2
- package/dist/pages/conversation/setting/OptionGroup.js +4 -4
- package/dist/pages/conversation/setting/OptionGroupManage.js +4 -8
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +37 -18
- package/dist/pages/conversation/setting/Setting.js +5 -5
- package/dist/pages/conversation/setting/SettingChatBg.js +32 -16
- package/dist/pages/message/ChooseMember.js +2 -2
- package/dist/pages/message/FileSelector.d.ts +6 -0
- package/dist/pages/message/FileSelector.js +272 -0
- package/dist/pages/message/MessageList.js +81 -43
- package/dist/pages/message/MessageRecord.js +34 -23
- package/dist/pages/message/components/MessageItem.d.ts +7 -7
- package/dist/pages/message/components/MessageItem.js +29 -20
- package/dist/pages/message/components/MessageOption.d.ts +7 -3
- package/dist/pages/message/components/MessageOption.js +14 -16
- package/dist/pages/message/components/MessagePayload.d.ts +2 -1
- package/dist/pages/message/components/MessagePictureAlbum.js +6 -4
- package/dist/pages/message/components/Payload/PayloadFile.d.ts +1 -1
- package/dist/pages/message/components/Payload/PayloadFile.js +34 -16
- package/dist/pages/message/components/Payload/PayloadMultiple.js +12 -8
- package/dist/pages/message/components/Payload/PayloadNotify.js +14 -5
- package/dist/pages/message/components/Payload/PayloadPicture.d.ts +1 -1
- package/dist/pages/message/components/Payload/PayloadPicture.js +9 -7
- package/dist/pages/message/components/Payload/PayloadText.js +7 -8
- package/dist/pages/message/components/Payload/PayloadVideo.js +2 -1
- package/dist/pages/message/components/Payload/PayloadVoice.js +7 -13
- package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +2 -1
- package/dist/pages/message/components/Payload/PayloadWrapper.js +46 -20
- package/dist/pages/message/components/Payload/type.d.ts +3 -1
- package/dist/pages/message/components/ReceiptBack.js +2 -2
- package/dist/pages/message/components/TextMixMessage.d.ts +2 -0
- package/dist/pages/message/components/TextMixMessage.js +10 -3
- package/dist/pages/message/components/TextMixQuote.js +10 -15
- package/dist/pages/message/components/TextMixQuoteMessage.d.ts +2 -1
- package/dist/pages/message/components/TextMixQuoteMessage.js +5 -5
- package/dist/pages/message/components/UploadProgress.d.ts +1 -1
- package/dist/pages/message/components/UploadProgress.js +1 -1
- package/dist/pages/message/components/messageBar/EmojiPanel.js +8 -9
- package/dist/pages/message/components/messageBar/MessageBar.d.ts +1 -1
- package/dist/pages/message/components/messageBar/MessageBar.js +14 -12
- package/dist/pages/message/components/messageBar/MessageInput.d.ts +1 -0
- package/dist/pages/message/components/messageBar/MessageInput.js +19 -1
- package/dist/pages/message/components/messageBar/OptionPanel.js +22 -44
- package/dist/pages/message/message.routes.js +10 -0
- package/dist/pages/search/components/SearchUser.js +2 -2
- package/dist/pages/types.d.ts +6 -2
- package/dist/slice/contact/contact.slice.js +1 -0
- package/dist/slice/video/video.action.js +9 -1
- package/dist/utils/common-action-sheet.d.ts +1 -0
- package/dist/utils/common-action-sheet.js +18 -0
- package/dist/utils/file-icon.js +29 -2
- package/dist/utils/file.d.ts +21 -2
- package/dist/utils/file.js +209 -42
- package/dist/utils/phone.d.ts +1 -1
- package/dist/utils/phone.js +1 -9
- package/dist/utils/request.d.ts +2 -1
- package/dist/utils/request.js +17 -6
- package/dist/utils/upload.d.ts +2 -4
- package/dist/utils/upload.js +13 -49
- package/package.json +5 -5
- package/dist/pages/address-list/Icons.d.ts +0 -5
- package/dist/pages/address-list/Icons.js +0 -9
- package/dist/slice/contact/contact.action.d.ts +0 -1
- package/dist/slice/contact/contact.action.js +0 -1
- package/dist/utils/cookie.d.ts +0 -2
- package/dist/utils/cookie.js +0 -25
- package/dist/utils/file-operate.d.ts +0 -1
- package/dist/utils/file-operate.js +0 -3
- package/dist/utils/text-mix.d.ts +0 -9
- package/dist/utils/text-mix.js +0 -75
- /package/dist/pages/address-list/{CardInfo.d.ts → components/CardInfo.d.ts} +0 -0
- /package/dist/pages/address-list/{CardInfo.js → components/CardInfo.js} +0 -0
- /package/dist/pages/address-list/{UserJobs.d.ts → components/UserJobs.d.ts} +0 -0
package/dist/default-assets.d.ts
CHANGED
package/dist/default-assets.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * from './pages';
|
|
|
4
4
|
export * from './slice';
|
|
5
5
|
export * from './locales';
|
|
6
6
|
export * from './hooks/useImSelector';
|
|
7
|
+
export * from './utils/file';
|
|
7
8
|
export { default as ChatAvatar } from './components/ChatAvatar/ChatAvatar';
|
|
8
9
|
export { default as VideoPlayer } from './components/VideoPlayer';
|
package/dist/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export * from './pages';
|
|
|
4
4
|
export * from './slice';
|
|
5
5
|
export * from './locales';
|
|
6
6
|
export * from './hooks/useImSelector';
|
|
7
|
+
export * from './utils/file';
|
|
7
8
|
export { default as ChatAvatar } from './components/ChatAvatar/ChatAvatar';
|
|
8
9
|
export { default as VideoPlayer } from './components/VideoPlayer';
|
package/dist/init.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImManager, IUser, SocketStore } from '@smart-link/im-base';
|
|
1
|
+
import { ImManager, IUser, SocketStore, Storage } from '@smart-link/im-base';
|
|
2
2
|
import { ImageRequireSource } from 'react-native';
|
|
3
3
|
interface IMSdkOptions {
|
|
4
4
|
user: IUser;
|
|
@@ -11,7 +11,7 @@ interface IMSdkOptions {
|
|
|
11
11
|
logo: ImageRequireSource;
|
|
12
12
|
}
|
|
13
13
|
export declare const initImSdk: ({ user, storage, store, server, logo: outLogo, t, logout, undoLimitTime }: IMSdkOptions) => Promise<ImManager>;
|
|
14
|
-
export declare const initRequest: (server: string) => void;
|
|
14
|
+
export declare const initRequest: (server: string, storage: Storage) => void;
|
|
15
15
|
export declare const getImManager: () => ImManager;
|
|
16
16
|
export declare const getLogo: () => number;
|
|
17
17
|
export {};
|
package/dist/init.js
CHANGED
|
@@ -16,7 +16,6 @@ import uploadFile from './utils/upload';
|
|
|
16
16
|
import { download, initDir } from './utils/file';
|
|
17
17
|
import { dp, Toast } from '@smart-link/rn-ui';
|
|
18
18
|
import { cloneDeep } from "lodash-es";
|
|
19
|
-
import { clearCookies } from "./utils/cookie";
|
|
20
19
|
let imManager;
|
|
21
20
|
let logo;
|
|
22
21
|
export const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, undoLimitTime }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -41,7 +40,9 @@ export const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logo
|
|
|
41
40
|
t,
|
|
42
41
|
undoLimitTime: undoLimitTime || 1000 * 60 * 5,
|
|
43
42
|
defaultAvatars: defaultAvatars,
|
|
44
|
-
logout,
|
|
43
|
+
logout: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
yield logout();
|
|
45
|
+
}),
|
|
45
46
|
uploadFile: (file, onProgress) => {
|
|
46
47
|
return uploadFile(file.localPath, file.type, onProgress);
|
|
47
48
|
},
|
|
@@ -97,15 +98,17 @@ export const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logo
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
},
|
|
101
|
+
getCookieString() {
|
|
102
|
+
return storage.getItem('cookies');
|
|
103
|
+
},
|
|
100
104
|
onDestroyed() {
|
|
101
105
|
console.log('IM onDestroyed');
|
|
102
|
-
clearCookies();
|
|
103
106
|
},
|
|
104
107
|
});
|
|
105
108
|
return imManager;
|
|
106
109
|
});
|
|
107
|
-
export const initRequest = (server) => {
|
|
108
|
-
createRequest(server);
|
|
110
|
+
export const initRequest = (server, storage) => {
|
|
111
|
+
createRequest(server, storage);
|
|
109
112
|
};
|
|
110
113
|
export const getImManager = () => imManager;
|
|
111
114
|
export const getLogo = () => logo;
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosProgressEvent } from "axios";
|
|
1
2
|
export type IGroupCategory = {
|
|
2
3
|
groupCategoryId: string;
|
|
3
4
|
groupCategoryName: string;
|
|
@@ -45,3 +46,17 @@ export type IGroup = {
|
|
|
45
46
|
parent: boolean;
|
|
46
47
|
userCount: number;
|
|
47
48
|
};
|
|
49
|
+
export type IRole = {
|
|
50
|
+
roleId: string;
|
|
51
|
+
roleName: string;
|
|
52
|
+
};
|
|
53
|
+
export type IPathItem = {
|
|
54
|
+
path: string;
|
|
55
|
+
isDir: boolean;
|
|
56
|
+
childrenCount?: number;
|
|
57
|
+
name: string;
|
|
58
|
+
thumbPath?: string;
|
|
59
|
+
time?: number;
|
|
60
|
+
size?: number;
|
|
61
|
+
};
|
|
62
|
+
export type UploadProgressFn = (progressEvent: AxiosProgressEvent) => void;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { dp, ListRow, NavigationPage, SearchBar, useTheme } from '@smart-link/rn-ui';
|
|
2
|
-
import React
|
|
3
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, Text, StyleSheet, Image } from 'react-native';
|
|
4
4
|
import useTranslation from '../../hooks/useTranslation';
|
|
5
|
-
import { Unfold } from './Icons';
|
|
6
|
-
import { listGroupCategory } from '../../api/addressList';
|
|
5
|
+
import { Group, Unfold } from './components/Icons';
|
|
7
6
|
import { useAuth } from '../../hooks/useImSelector';
|
|
7
|
+
import useGroupCategory from "./useGroupCategory";
|
|
8
|
+
import { getLogo } from "../../init";
|
|
8
9
|
const AddressList = ({ navigation }) => {
|
|
9
|
-
const [groupCategoryList, setGroupCategoryList] = useState([]);
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const theme = useTheme();
|
|
12
12
|
const { user } = useAuth();
|
|
13
|
-
const compName = (user === null || user === void 0 ? void 0 : user.
|
|
14
|
-
|
|
15
|
-
listGroupCategory({ appType: null }).then(({ data }) => {
|
|
16
|
-
setGroupCategoryList(data);
|
|
17
|
-
});
|
|
18
|
-
}, []);
|
|
13
|
+
const compName = (user === null || user === void 0 ? void 0 : user.rootGroupName) || (user === null || user === void 0 ? void 0 : user.userName) || '';
|
|
14
|
+
const groupCategoryList = useGroupCategory();
|
|
19
15
|
const onPressSearch = () => {
|
|
20
16
|
console.log('_onPressSearch');
|
|
21
17
|
navigation.navigate('UserSearch', {});
|
|
@@ -27,34 +23,28 @@ const AddressList = ({ navigation }) => {
|
|
|
27
23
|
<View style={{ height: 10 }}/>
|
|
28
24
|
<SearchBar style={{ marginHorizontal: 10 }} onSearch={onPressSearch}/>
|
|
29
25
|
<View style={{ height: 8 }}/>
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{/* // onPress={() => this.navigator.push({view: <MyGroupsPage/>})}*/}
|
|
42
|
-
{/* topSeparator="full"*/}
|
|
43
|
-
{/*/>*/}
|
|
26
|
+
<ListRow title={<View style={[styles.orgLine]}>
|
|
27
|
+
<View style={[styles.iconView, {
|
|
28
|
+
backgroundColor: theme.primaryColor,
|
|
29
|
+
borderRadius: 3,
|
|
30
|
+
}]}>
|
|
31
|
+
<Group size={22} color="#fff"/>
|
|
32
|
+
</View>
|
|
33
|
+
<Text style={styles.title}>{t('groupChat')}</Text>
|
|
34
|
+
</View>} topSeparator="full" onPress={() => {
|
|
35
|
+
navigation.navigate('MyGroups');
|
|
36
|
+
}}/>
|
|
44
37
|
|
|
45
38
|
<View style={{ height: 15 }}/>
|
|
46
39
|
|
|
47
40
|
<ListRow title={<View style={styles.orgLine}>
|
|
48
|
-
|
|
49
|
-
{/* source={Tenant.config.logoOrg || Tenant.config.logo}/>*/}
|
|
41
|
+
<Image style={{ width: 30, height: 30, borderRadius: 3 }} source={getLogo()}/>
|
|
50
42
|
<Text style={styles.compName}>{compName}</Text>
|
|
51
43
|
</View>}/>
|
|
52
44
|
|
|
53
45
|
{groupCategoryList.map(item => {
|
|
54
46
|
return (<ListRow key={item.groupCategoryId} title={<View style={styles.orgLine}>
|
|
55
|
-
<
|
|
56
|
-
<Unfold size={18} color={theme.primaryColor}/>
|
|
57
|
-
</Text>
|
|
47
|
+
<Unfold size={18} color={theme.primaryColor}/>
|
|
58
48
|
<Text style={styles.title}>{item.groupCategoryName}</Text>
|
|
59
49
|
</View>} onPress={() => handleGroupCategory(item)} topSeparator="full"/>);
|
|
60
50
|
})}
|
|
@@ -85,7 +75,6 @@ const styles = StyleSheet.create({
|
|
|
85
75
|
textAlignVertical: 'center',
|
|
86
76
|
},
|
|
87
77
|
orgLine: {
|
|
88
|
-
width: dp(350),
|
|
89
78
|
flexDirection: 'row',
|
|
90
79
|
alignItems: 'center',
|
|
91
80
|
},
|
|
@@ -104,19 +93,12 @@ const styles = StyleSheet.create({
|
|
|
104
93
|
width: 30,
|
|
105
94
|
height: 30,
|
|
106
95
|
borderRadius: 3,
|
|
107
|
-
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center'
|
|
108
98
|
},
|
|
109
99
|
icon: {
|
|
110
|
-
lineHeight: 30,
|
|
111
100
|
textAlign: 'center',
|
|
112
101
|
},
|
|
113
|
-
smallIcon: {
|
|
114
|
-
width: 30,
|
|
115
|
-
height: 30,
|
|
116
|
-
lineHeight: 30,
|
|
117
|
-
textAlign: 'center',
|
|
118
|
-
textAlignVertical: 'center',
|
|
119
|
-
},
|
|
120
102
|
title: {
|
|
121
103
|
marginLeft: 10,
|
|
122
104
|
textAlignVertical: 'center',
|
|
@@ -7,36 +7,46 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import React, { useEffect, useState } from 'react';
|
|
11
|
-
import { StyleSheet, View, Text, TouchableOpacity, ScrollView } from 'react-native';
|
|
12
|
-
import { dp, ListRow, NavigationPage,
|
|
13
|
-
import useTranslation from '../../hooks/useTranslation';
|
|
14
|
-
import { useContact, useConversation } from '../../hooks/useImSelector';
|
|
15
|
-
import { getImManager } from '../../init';
|
|
10
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
+
import { StyleSheet, View, Text, TouchableOpacity, ScrollView, Image } from 'react-native';
|
|
12
|
+
import { dp, ListRow, Loading, NavigationPage, SearchBar, Toast, useTheme } from '@smart-link/rn-ui';
|
|
13
|
+
import useTranslation, { useTranslationAddrList } from '../../hooks/useTranslation';
|
|
14
|
+
import { useAuth, useContact, useConversation } from '../../hooks/useImSelector';
|
|
15
|
+
import { getImManager, getLogo } from '../../init';
|
|
16
16
|
import { ConversationActions } from '@smart-link/im-base';
|
|
17
17
|
import { onSelectUser, resetState, onDefaultCheckedUser } from '../../slice/contact/contact.slice';
|
|
18
|
-
import { RenderUserItem } from './Organization';
|
|
19
18
|
import { useDispatch } from 'react-redux';
|
|
20
|
-
import { queryUserByIds
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
locale: 'selectByCharacters',
|
|
29
|
-
},
|
|
30
|
-
];
|
|
19
|
+
import { queryUserByIds } from '../../api/user';
|
|
20
|
+
import useGroupCategory from "./useGroupCategory";
|
|
21
|
+
import { Unfold } from "./components/Icons";
|
|
22
|
+
import OrgPath from "./components/OrgPath";
|
|
23
|
+
import useRoleList from "./useRoleList";
|
|
24
|
+
import RenderUserItem from "./components/RenderUserItem";
|
|
25
|
+
import { listRoleUser, listTree, listUser } from "../../api/addressList";
|
|
26
|
+
import to from "await-to-js";
|
|
31
27
|
const ChooseContact = ({ navigation, route: { params } }) => {
|
|
32
|
-
const { checkedIds = [] } = params;
|
|
28
|
+
const { checkedIds = [], disableIds = [] } = params;
|
|
33
29
|
const { t } = useTranslation();
|
|
30
|
+
const { t: a } = useTranslationAddrList();
|
|
31
|
+
const { user } = useAuth();
|
|
34
32
|
const dispatch = useDispatch();
|
|
35
33
|
const { currentConversation } = useConversation();
|
|
36
34
|
const { selectUsers, choosePurpose } = useContact();
|
|
37
|
-
const
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const [rootEntry, setRootEntry] = useState();
|
|
37
|
+
const [orgPath, setOrgPath] = useState([
|
|
38
|
+
{
|
|
39
|
+
id: 'root',
|
|
40
|
+
name: a('contact'),
|
|
41
|
+
}
|
|
42
|
+
]);
|
|
43
|
+
const [loading, setLoading] = useState(false);
|
|
44
|
+
const groupCatId = useRef('');
|
|
45
|
+
const [orgList, setOrgList] = useState([]);
|
|
38
46
|
const [userList, setUserList] = useState([]);
|
|
39
47
|
const selectCount = Object.keys(selectUsers).length;
|
|
48
|
+
const groupCategoryList = useGroupCategory();
|
|
49
|
+
const roleList = useRoleList();
|
|
40
50
|
useEffect(() => {
|
|
41
51
|
navigation.setOptions({
|
|
42
52
|
title: t('selectContacts'),
|
|
@@ -87,32 +97,190 @@ const ChooseContact = ({ navigation, route: { params } }) => {
|
|
|
87
97
|
});
|
|
88
98
|
}
|
|
89
99
|
}, [checkedIds]);
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
const changeOrg = (org, index) => {
|
|
101
|
+
console.log(org);
|
|
102
|
+
if (org.id === 'root') {
|
|
103
|
+
setRootEntry(undefined);
|
|
104
|
+
}
|
|
105
|
+
if (org.type === 'org') {
|
|
106
|
+
queryOrgAndUser(org.id);
|
|
107
|
+
}
|
|
108
|
+
let tmp = orgPath.slice(0, index + 1);
|
|
109
|
+
setOrgPath(tmp);
|
|
110
|
+
};
|
|
111
|
+
const queryUserByRole = useCallback((roleId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
setOrgList([]);
|
|
113
|
+
setUserList([]);
|
|
114
|
+
setLoading(true);
|
|
115
|
+
const [err, resp] = yield to(listRoleUser(roleId));
|
|
116
|
+
setLoading(false);
|
|
117
|
+
if (err) {
|
|
118
|
+
Toast.error(a('requestFail'));
|
|
92
119
|
return;
|
|
93
120
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
setUserList(resp.data || []);
|
|
122
|
+
}), []);
|
|
123
|
+
const queryOrgAndUser = useCallback((groupId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
+
setOrgList([]);
|
|
125
|
+
setUserList([]);
|
|
126
|
+
setLoading(true);
|
|
127
|
+
const [err, results] = yield to(Promise.all([
|
|
128
|
+
listTree({
|
|
129
|
+
groupCatId: groupCatId.current,
|
|
130
|
+
parentId: groupId,
|
|
131
|
+
groupStatus: 'valid',
|
|
132
|
+
queryChild: false,
|
|
133
|
+
}),
|
|
134
|
+
listUser({
|
|
135
|
+
groupCategoryId: groupCatId.current,
|
|
136
|
+
groupId: groupId,
|
|
137
|
+
userStatus: 'valid',
|
|
138
|
+
pageNum: 1,
|
|
139
|
+
pageSize: 1000,
|
|
140
|
+
queryAll: false,
|
|
141
|
+
})
|
|
142
|
+
]));
|
|
143
|
+
setLoading(false);
|
|
144
|
+
if (err) {
|
|
145
|
+
console.log(err);
|
|
146
|
+
Toast.error(a('requestFail'));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
setOrgList(results[0].data || []);
|
|
150
|
+
setUserList(results[1].data || []);
|
|
151
|
+
}), []);
|
|
152
|
+
const onPressSearch = useCallback(() => {
|
|
153
|
+
console.log('onPressSearch: ');
|
|
154
|
+
navigation.navigate('UserSearch', { checkable: true });
|
|
155
|
+
}, [navigation]);
|
|
101
156
|
return (<NavigationPage noPadding scroll={false}>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
157
|
+
{orgPath.length === 1 && <>
|
|
158
|
+
<View style={{ height: dp(10) }}/>
|
|
159
|
+
<ListRow title={<View style={styles.orgLine}>
|
|
160
|
+
<Image style={{ width: 30, height: 30, borderRadius: 3 }} source={getLogo()}/>
|
|
161
|
+
<Text style={styles.compName}>{user.rootGroupName}</Text>
|
|
162
|
+
</View>}/>
|
|
163
|
+
<ListRow title={<View style={styles.orgLine}>
|
|
164
|
+
<Unfold size={18} color={theme.primaryColor}/>
|
|
165
|
+
<Text style={styles.title}>{a('selectByDepartments')}</Text>
|
|
166
|
+
</View>} onPress={() => {
|
|
167
|
+
setRootEntry('org');
|
|
168
|
+
setOrgPath(prev => [
|
|
169
|
+
...prev,
|
|
170
|
+
{
|
|
171
|
+
id: 'org',
|
|
172
|
+
name: a('selectByDepartments')
|
|
173
|
+
}
|
|
174
|
+
]);
|
|
175
|
+
}}/>
|
|
176
|
+
<ListRow title={<View style={styles.orgLine}>
|
|
177
|
+
<Unfold size={18} color={theme.primaryColor}/>
|
|
178
|
+
<Text style={styles.title}>{a('myOrg')}</Text>
|
|
179
|
+
</View>} onPress={() => {
|
|
180
|
+
setRootEntry('org');
|
|
181
|
+
const ids = user.groupIdPath.split(',');
|
|
182
|
+
const names = user.groupNamePath.split(' / ');
|
|
183
|
+
const newPath = ids.map((id, index) => {
|
|
184
|
+
return {
|
|
185
|
+
id,
|
|
186
|
+
name: names[index],
|
|
187
|
+
type: 'org'
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
setOrgPath(prev => [
|
|
191
|
+
...prev,
|
|
192
|
+
{
|
|
193
|
+
id: 'org',
|
|
194
|
+
name: a('selectByDepartments')
|
|
195
|
+
},
|
|
196
|
+
...newPath,
|
|
197
|
+
]);
|
|
198
|
+
queryOrgAndUser(ids.at(-1));
|
|
199
|
+
}}/>
|
|
200
|
+
<ListRow title={<View style={styles.orgLine}>
|
|
201
|
+
<Unfold size={18} color={theme.primaryColor}/>
|
|
202
|
+
<Text style={styles.title}>{a('selectByCharacters')}</Text>
|
|
203
|
+
</View>} onPress={() => {
|
|
204
|
+
setRootEntry('role');
|
|
205
|
+
setOrgPath(prev => [
|
|
206
|
+
...prev,
|
|
207
|
+
{
|
|
208
|
+
id: 'role',
|
|
209
|
+
name: a('selectByCharacters')
|
|
210
|
+
}
|
|
211
|
+
]);
|
|
212
|
+
}}/>
|
|
213
|
+
</>}
|
|
107
214
|
<View style={{ flex: 1 }}>
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
215
|
+
{orgPath.length > 1
|
|
216
|
+
&& <><View style={{ paddingVertical: 8, paddingHorizontal: 10 }}>
|
|
217
|
+
<SearchBar onSearch={onPressSearch}/>
|
|
218
|
+
</View>
|
|
219
|
+
<OrgPath orgPath={orgPath} onChange={changeOrg}/>
|
|
220
|
+
</>}
|
|
221
|
+
{/*组织分类*/}
|
|
222
|
+
{rootEntry === 'org' && orgPath.length === 2 && <ScrollView contentContainerStyle={{ paddingBottom: 20 }}>
|
|
223
|
+
{groupCategoryList.map(item => {
|
|
224
|
+
return (<ListRow key={item.groupCategoryId} title={<View style={styles.orgLine}>
|
|
225
|
+
<Unfold size={18} color={theme.primaryColor}/>
|
|
226
|
+
<Text style={styles.title}>{item.groupCategoryName}</Text>
|
|
227
|
+
</View>} onPress={() => __awaiter(void 0, void 0, void 0, function* () {
|
|
228
|
+
setOrgPath(prev => [
|
|
229
|
+
...prev,
|
|
230
|
+
{
|
|
231
|
+
id: item.groupRootIds,
|
|
232
|
+
name: item.groupCategoryName,
|
|
233
|
+
},
|
|
234
|
+
]);
|
|
235
|
+
groupCatId.current = item.groupCategoryId;
|
|
236
|
+
yield queryOrgAndUser(item.groupRootIds);
|
|
237
|
+
})} topSeparator="full"/>);
|
|
238
|
+
})}
|
|
239
|
+
</ScrollView>}
|
|
240
|
+
{rootEntry === 'role' && orgPath.length === 2 &&
|
|
241
|
+
<ScrollView contentContainerStyle={{ paddingBottom: 20 }}>
|
|
242
|
+
{roleList.map(item => {
|
|
243
|
+
return (<ListRow key={item.roleId} title={item.roleName} onPress={() => {
|
|
244
|
+
setOrgPath(prev => [
|
|
245
|
+
...prev,
|
|
246
|
+
{
|
|
247
|
+
id: item.roleId,
|
|
248
|
+
name: item.roleName,
|
|
249
|
+
type: 'role'
|
|
250
|
+
},
|
|
251
|
+
]);
|
|
252
|
+
queryUserByRole(item.roleId);
|
|
253
|
+
}} topSeparator="full"/>);
|
|
254
|
+
})}
|
|
255
|
+
</ScrollView>}
|
|
256
|
+
|
|
257
|
+
{orgPath.length >= 3 && <>
|
|
258
|
+
{(userList.length > 0 || orgList.length > 0) ? (<ScrollView contentContainerStyle={{ paddingBottom: 20 }}>
|
|
259
|
+
{orgList.map((item) => (<ListRow key={item.groupId} title={item.groupName} onPress={() => {
|
|
260
|
+
setOrgPath(prev => [
|
|
261
|
+
...prev,
|
|
262
|
+
{
|
|
263
|
+
id: item.groupId,
|
|
264
|
+
name: item.groupName
|
|
265
|
+
}
|
|
266
|
+
]);
|
|
267
|
+
queryOrgAndUser(item.groupId);
|
|
268
|
+
}} topSeparator="full"/>))}
|
|
269
|
+
{userList.map((item) => {
|
|
270
|
+
const disabled = disableIds.includes(item.userId);
|
|
271
|
+
return <ListRow key={item.userId} disabled={disabled} activeOpacity={disabled ? 1 : 0.2} onPress={() => {
|
|
272
|
+
if (disabled) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
dispatch(onSelectUser(item));
|
|
276
|
+
}} title={<RenderUserItem disabled={disabled} checkable checked={!!selectUsers[item.userId]} data={item}/>} topSeparator="full" accessory="none"/>;
|
|
277
|
+
})}
|
|
278
|
+
</ScrollView>) : (<View style={[styles.noData]}>
|
|
279
|
+
<Text>{t('noData')}</Text>
|
|
280
|
+
</View>)}
|
|
281
|
+
</>}
|
|
115
282
|
</View>
|
|
283
|
+
<Loading loading={loading} loadingText={a('loading')}/>
|
|
116
284
|
</NavigationPage>);
|
|
117
285
|
};
|
|
118
286
|
const styles = StyleSheet.create({
|
|
@@ -122,7 +290,6 @@ const styles = StyleSheet.create({
|
|
|
122
290
|
textAlignVertical: 'center',
|
|
123
291
|
},
|
|
124
292
|
orgLine: {
|
|
125
|
-
width: dp(350),
|
|
126
293
|
flexDirection: 'row',
|
|
127
294
|
alignItems: 'center',
|
|
128
295
|
},
|
|
@@ -141,16 +308,13 @@ const styles = StyleSheet.create({
|
|
|
141
308
|
width: 30,
|
|
142
309
|
height: 30,
|
|
143
310
|
borderRadius: 3,
|
|
144
|
-
// backgroundColor: Theme.primaryColorThin
|
|
145
311
|
},
|
|
146
312
|
icon: {
|
|
147
|
-
lineHeight: 30,
|
|
148
313
|
textAlign: 'center',
|
|
149
314
|
},
|
|
150
315
|
smallIcon: {
|
|
151
316
|
width: 30,
|
|
152
317
|
height: 30,
|
|
153
|
-
lineHeight: 30,
|
|
154
318
|
textAlign: 'center',
|
|
155
319
|
textAlignVertical: 'center',
|
|
156
320
|
},
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { NativeStackScreenProps } from "@react-navigation/native-stack/lib/typescript/src/types";
|
|
3
|
+
import { IMPageParamList } from "../types";
|
|
4
|
+
type MyGroupsProps = NativeStackScreenProps<IMPageParamList, 'MyGroups'>;
|
|
5
|
+
declare const MyGroups: ({ navigation }: MyGroupsProps) => React.JSX.Element;
|
|
6
|
+
export default MyGroups;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
import { dp, NavigationPage } from "@smart-link/rn-ui";
|
|
12
|
+
import { StyleSheet, FlatList, TouchableOpacity, View, Text } from "react-native";
|
|
13
|
+
import { useChatGroup } from "../../hooks/useImSelector";
|
|
14
|
+
import ChatAvatar from "../../components/ChatAvatar";
|
|
15
|
+
import { ConversationActions, GroupActions } from "@smart-link/im-base";
|
|
16
|
+
import { useEffect } from "react";
|
|
17
|
+
import { getImManager } from "../../init";
|
|
18
|
+
import useTranslation from "../../hooks/useTranslation";
|
|
19
|
+
import { startCreateGroup } from "../../slice/contact/contact.slice";
|
|
20
|
+
const MyGroups = ({ navigation }) => {
|
|
21
|
+
const { chatGroups } = useChatGroup();
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const imManager = getImManager();
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
navigation.setOptions({
|
|
26
|
+
title: t('myGroups'),
|
|
27
|
+
headerRight: () => <TouchableOpacity onPress={() => {
|
|
28
|
+
imManager.store.dispatch(startCreateGroup());
|
|
29
|
+
navigation.navigate('ChooseContact', {
|
|
30
|
+
chooseOrg: true,
|
|
31
|
+
checkMode: 'multi',
|
|
32
|
+
});
|
|
33
|
+
}}>
|
|
34
|
+
<Text style={{ color: '#fff', fontSize: dp(12) }}>{t('createGroupChat')}</Text>
|
|
35
|
+
</TouchableOpacity>,
|
|
36
|
+
});
|
|
37
|
+
imManager.store.dispatch(GroupActions.loadMyGroups());
|
|
38
|
+
}, [t, navigation]);
|
|
39
|
+
const keyExtractor = (item) => item.chatGroupId;
|
|
40
|
+
const renderItem = ({ item }) => {
|
|
41
|
+
const { chatGroupId, chatGroupName, avatars, } = item;
|
|
42
|
+
return <TouchableOpacity style={styles.item} activeOpacity={0.5} onPress={() => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
yield imManager.store.dispatch(ConversationActions.initChatGroupConversation(imManager, item));
|
|
44
|
+
navigation.navigate('MessageList');
|
|
45
|
+
})}>
|
|
46
|
+
<ChatAvatar name={chatGroupName} disabled={true} id={chatGroupName} url={avatars} size={dp(48)} type="c2g"/>
|
|
47
|
+
<View style={styles.width10}/>
|
|
48
|
+
<View style={styles.left}>
|
|
49
|
+
<Text style={styles.name} numberOfLines={1}>{chatGroupName}</Text>
|
|
50
|
+
</View>
|
|
51
|
+
</TouchableOpacity>;
|
|
52
|
+
};
|
|
53
|
+
const itemSeparatorComponent = () => <View style={styles.separator}/>;
|
|
54
|
+
return (<NavigationPage noPadding>
|
|
55
|
+
<FlatList contentContainerStyle={styles.list} data={chatGroups} numColumns={1} keyExtractor={keyExtractor} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent}/>
|
|
56
|
+
</NavigationPage>);
|
|
57
|
+
};
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
list: {
|
|
60
|
+
backgroundColor: '#fff',
|
|
61
|
+
borderWidth: dp(1),
|
|
62
|
+
borderStyle: 'solid',
|
|
63
|
+
borderColor: '#eee',
|
|
64
|
+
borderLeftWidth: 0,
|
|
65
|
+
borderRightWidth: 0,
|
|
66
|
+
},
|
|
67
|
+
item: {
|
|
68
|
+
paddingHorizontal: dp(15),
|
|
69
|
+
paddingVertical: dp(15),
|
|
70
|
+
flexDirection: 'row',
|
|
71
|
+
},
|
|
72
|
+
width10: {
|
|
73
|
+
width: dp(10),
|
|
74
|
+
},
|
|
75
|
+
left: {
|
|
76
|
+
justifyContent: 'center'
|
|
77
|
+
},
|
|
78
|
+
name: {
|
|
79
|
+
width: dp(250),
|
|
80
|
+
fontSize: dp(15),
|
|
81
|
+
lineHeight: dp(16),
|
|
82
|
+
color: '#333',
|
|
83
|
+
},
|
|
84
|
+
separator: {
|
|
85
|
+
marginLeft: dp(72),
|
|
86
|
+
height: dp(1),
|
|
87
|
+
backgroundColor: '#eee'
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
export default MyGroups;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { NativeStackScreenProps } from '@react-navigation/native-stack/lib/typescript/src/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IMPageParamList } from '../types';
|
|
4
|
-
import { IUser } from '@smart-link/im-base';
|
|
5
4
|
type OrganizationProps = NativeStackScreenProps<IMPageParamList, 'Organization'>;
|
|
6
5
|
declare const Organization: ({ navigation, route: { params } }: OrganizationProps) => React.JSX.Element;
|
|
7
|
-
export declare const RenderUserItem: (props: {
|
|
8
|
-
data: IUser;
|
|
9
|
-
checkable?: boolean;
|
|
10
|
-
checked?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}) => React.JSX.Element;
|
|
13
6
|
export default Organization;
|