@smart-link/rn-im 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/addressList.js +6 -17
- package/dist/api/backup.js +8 -20
- package/dist/api/file.js +6 -35
- package/dist/api/user.js +6 -16
- package/dist/components/CachedImage.js +14 -42
- package/dist/components/Camera/Camera.js +26 -54
- package/dist/components/Camera/CameraCapture.js +99 -128
- package/dist/components/Camera/CameraResult.js +33 -61
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
- package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
- package/dist/components/ChatAvatar/index.js +2 -23
- package/dist/components/Favicon.js +6 -34
- package/dist/components/FormatTimeText.js +5 -10
- package/dist/components/Highlighter.js +9 -34
- package/dist/components/IndicatorText.js +14 -39
- package/dist/components/LocalImage.js +7 -32
- package/dist/components/NetworkUnconnected.js +14 -42
- package/dist/components/PopoverWrapper.js +22 -47
- package/dist/components/VideoPlayer.js +111 -138
- package/dist/components/styles.js +10 -13
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +8 -10
- package/dist/hooks/useDownloadSource.js +7 -12
- package/dist/hooks/useFormatMsgTime.js +5 -13
- package/dist/hooks/useImReady.js +7 -10
- package/dist/hooks/useImSelector.js +34 -48
- package/dist/hooks/useTranslation.js +5 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -28
- package/dist/init.js +30 -40
- package/dist/interface.js +1 -2
- package/dist/locales/en/addressList.js +1 -3
- package/dist/locales/index.js +4 -27
- package/dist/locales/lao/addressList.js +1 -3
- package/dist/locales/zh/addressList.js +1 -3
- package/dist/pages/address-list/AddressList.js +33 -61
- package/dist/pages/address-list/CardInfo.js +10 -18
- package/dist/pages/address-list/ChooseContact.js +50 -78
- package/dist/pages/address-list/Icons.js +7 -14
- package/dist/pages/address-list/Organization.js +59 -89
- package/dist/pages/address-list/UserDetail.js +55 -83
- package/dist/pages/address-list/UserJobs.js +31 -33
- package/dist/pages/address-list/UserSearch.js +29 -54
- package/dist/pages/address-list/addressList.routes.js +11 -16
- package/dist/pages/collection/Collection.js +53 -81
- package/dist/pages/collection/ContentFactory.js +53 -82
- package/dist/pages/collection/collection.routes.js +3 -9
- package/dist/pages/conversation/ForwardToConversation.js +63 -91
- package/dist/pages/conversation/List.js +74 -102
- package/dist/pages/conversation/components/ConversationCard.js +46 -74
- package/dist/pages/conversation/components/ConversationOption.js +27 -55
- package/dist/pages/conversation/conversation.routes.js +17 -23
- package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
- package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
- package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
- package/dist/pages/conversation/setting/OptionConversation.js +20 -48
- package/dist/pages/conversation/setting/OptionGroup.js +20 -48
- package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
- package/dist/pages/conversation/setting/Setting.js +49 -54
- package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
- package/dist/pages/index.js +7 -27
- package/dist/pages/message/ChooseMember.js +56 -84
- package/dist/pages/message/MessageBackup/Bar.js +18 -43
- package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/index.js +3 -12
- package/dist/pages/message/MessageBackup/utils.js +14 -22
- package/dist/pages/message/MessageList.js +141 -135
- package/dist/pages/message/MessageRecord.js +49 -73
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.js +82 -110
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.js +96 -120
- package/dist/pages/message/components/MessagePayload.js +36 -64
- package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
- package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
- package/dist/pages/message/components/MessageUndo.js +18 -48
- package/dist/pages/message/components/MultipleBar/index.js +48 -76
- package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
- package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
- package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
- package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
- package/dist/pages/message/components/Payload/PayloadText.js +39 -67
- package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +31 -61
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +129 -158
- package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
- package/dist/pages/message/components/UploadProgress.js +12 -37
- package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
- package/dist/pages/message/components/messageBar/Icons.js +56 -74
- package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
- package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
- package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
- package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
- package/dist/pages/message/components/messageBar/index.js +2 -23
- package/dist/pages/message/message.routes.js +11 -40
- package/dist/pages/search/Search.js +38 -66
- package/dist/pages/search/SearchChatRecords.js +64 -92
- package/dist/pages/search/SearchFile.js +68 -96
- package/dist/pages/search/SearchManager.js +60 -65
- package/dist/pages/search/SearchPicturePage.js +16 -44
- package/dist/pages/search/components/ChatRecords.js +46 -74
- package/dist/pages/search/components/MyGroupChat.js +41 -69
- package/dist/pages/search/components/PictureMulipleBar.js +35 -63
- package/dist/pages/search/components/SearchFileList.js +59 -64
- package/dist/pages/search/components/SearchPictures.js +68 -98
- package/dist/pages/search/components/SearchShareLinkList.js +50 -55
- package/dist/pages/search/components/SearchUser.js +25 -53
- package/dist/pages/search/components/useSearchMessage.js +12 -16
- package/dist/pages/search/search.routes.js +11 -17
- package/dist/pages/search/utils.js +4 -12
- package/dist/pages/types.js +1 -2
- package/dist/slice/contact/contact.action.js +1 -2
- package/dist/slice/contact/contact.slice.js +4 -8
- package/dist/slice/index.js +7 -13
- package/dist/slice/panel/panel.slice.d.ts +2 -1
- package/dist/slice/panel/panel.slice.js +8 -7
- package/dist/slice/video/video.action.d.ts +1 -0
- package/dist/slice/video/video.action.js +56 -38
- package/dist/slice/video/video.slice.d.ts +1 -1
- package/dist/slice/video/video.slice.js +7 -8
- package/dist/utils/audio.d.ts +3 -0
- package/dist/utils/audio.js +10 -0
- package/dist/utils/color.js +2 -9
- package/dist/utils/common-action-sheet.js +9 -14
- package/dist/utils/cookie.js +6 -14
- package/dist/utils/emoji.js +9 -12
- package/dist/utils/file-icon.js +33 -60
- package/dist/utils/file-operate.js +1 -2
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +74 -87
- package/dist/utils/golden-rectangle.js +3 -7
- package/dist/utils/phone.js +13 -22
- package/dist/utils/request.js +7 -15
- package/dist/utils/scroll.js +5 -9
- package/dist/utils/summary.js +4 -11
- package/dist/utils/take-camera.js +12 -19
- package/dist/utils/text-mix.js +4 -11
- package/dist/utils/upload.js +20 -41
- package/package.json +6 -7
@@ -1,37 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const
|
15
|
-
const
|
16
|
-
const OptionCancelGroup_1 = __importDefault(require("../../../pages/conversation/setting/OptionCancelGroup"));
|
17
|
-
const contact_slice_1 = require("../../../slice/contact/contact.slice");
|
18
|
-
const native_1 = require("@react-navigation/native");
|
19
|
-
const { MEMBER, MGR, OWNER } = im_base_1.MemberLevel;
|
20
|
-
const { LIAISON } = im_base_1.GroupType;
|
1
|
+
import { ConversationActions, ConversationType, GroupType, MemberLevel, } from '@smart-link/im-base';
|
2
|
+
import { NavigationPage, Space, Toast } from '@smart-link/rn-ui';
|
3
|
+
import { useEffect } from 'react';
|
4
|
+
import { useChatGroup, useConversation } from '../../../hooks/useImSelector';
|
5
|
+
import useTranslation from '../../../hooks/useTranslation';
|
6
|
+
import OptionAvatars from './OptionAvatars';
|
7
|
+
import OptionConversation from './OptionConversation';
|
8
|
+
import { ConfirmActionSheet, ConfirmActionSheets } from '../../../utils/common-action-sheet';
|
9
|
+
import { getImManager } from '../../../init';
|
10
|
+
import OptionGroup from '../../../pages/conversation/setting/OptionGroup';
|
11
|
+
import OptionCancelGroup from '../../../pages/conversation/setting/OptionCancelGroup';
|
12
|
+
import { startAddMember, startCreateGroup } from '../../../slice/contact/contact.slice';
|
13
|
+
import { StackActions } from '@react-navigation/native';
|
14
|
+
const { MEMBER, MGR, OWNER } = MemberLevel;
|
15
|
+
const { LIAISON } = GroupType;
|
21
16
|
// 最大显示人数
|
22
17
|
const MAX_SHOW_MEMBER_COUNT = 23;
|
23
18
|
const ConversationSetting = ({ navigation }) => {
|
24
|
-
const { t } = (
|
19
|
+
const { t } = useTranslation();
|
25
20
|
// const {allMembers} = useMessage();
|
26
|
-
const { currentConversation } =
|
27
|
-
const { groupDetail } =
|
21
|
+
const { currentConversation } = useConversation();
|
22
|
+
const { groupDetail } = useChatGroup();
|
28
23
|
const title = t('chatSetting');
|
29
24
|
const memberTotalCount = (groupDetail === null || groupDetail === void 0 ? void 0 : groupDetail.memberTotalCount) || 0;
|
30
25
|
const groupMemberList = (groupDetail === null || groupDetail === void 0 ? void 0 : groupDetail.groupMemberList) || [];
|
31
26
|
// 设置标题
|
32
|
-
|
27
|
+
useEffect(() => {
|
33
28
|
let newTitle = title;
|
34
|
-
if ((currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.type) ===
|
29
|
+
if ((currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.type) === ConversationType.C2G && memberTotalCount) {
|
35
30
|
newTitle += `(${memberTotalCount})`;
|
36
31
|
}
|
37
32
|
navigation.setOptions({
|
@@ -41,12 +36,12 @@ const ConversationSetting = ({ navigation }) => {
|
|
41
36
|
if (!currentConversation) {
|
42
37
|
return null;
|
43
38
|
}
|
44
|
-
const imManager =
|
39
|
+
const imManager = getImManager();
|
45
40
|
const settingEnableNoDisturb = (value) => {
|
46
|
-
imManager.store.dispatch(
|
41
|
+
imManager.store.dispatch(ConversationActions.settingEnableNoDisturb(imManager, value));
|
47
42
|
};
|
48
43
|
const settingEnableTop = (value) => {
|
49
|
-
imManager.store.dispatch(
|
44
|
+
imManager.store.dispatch(ConversationActions.settingEnableTop(imManager, value));
|
50
45
|
};
|
51
46
|
const toSearchMessage = () => {
|
52
47
|
navigation.navigate('SearchChatRecords', {
|
@@ -54,7 +49,7 @@ const ConversationSetting = ({ navigation }) => {
|
|
54
49
|
});
|
55
50
|
};
|
56
51
|
const clearMessage = () => {
|
57
|
-
|
52
|
+
ConfirmActionSheet(t('clearChatRecords'), () => {
|
58
53
|
imManager.clearMessages(currentConversation.id);
|
59
54
|
}, t);
|
60
55
|
};
|
@@ -63,13 +58,13 @@ const ConversationSetting = ({ navigation }) => {
|
|
63
58
|
const isMgr = memberLevel === MGR || memberLevel === OWNER;
|
64
59
|
// 离开群组
|
65
60
|
const leaveGroup = () => {
|
66
|
-
|
61
|
+
ConfirmActionSheets({
|
67
62
|
title: t('leaveGroup'),
|
68
63
|
confirm: () => {
|
69
|
-
imManager.store.dispatch(
|
70
|
-
navigation.dispatch(
|
64
|
+
imManager.store.dispatch(ConversationActions.doLeaveGroup(imManager, { chatGroupId: id }, () => {
|
65
|
+
navigation.dispatch(StackActions.popToTop());
|
71
66
|
}, () => {
|
72
|
-
|
67
|
+
Toast.error(t('leaveGroupFail'));
|
73
68
|
}));
|
74
69
|
},
|
75
70
|
t,
|
@@ -113,28 +108,28 @@ const ConversationSetting = ({ navigation }) => {
|
|
113
108
|
};
|
114
109
|
let content = null;
|
115
110
|
switch (type) {
|
116
|
-
case
|
111
|
+
case ConversationType.C2C:
|
117
112
|
content = (<>
|
118
|
-
<
|
113
|
+
<OptionAvatars list={id ? [
|
119
114
|
{
|
120
115
|
userId: id,
|
121
116
|
userName: name,
|
122
117
|
avatars,
|
123
118
|
},
|
124
119
|
] : []} showAdd={true} showDelete={false} showMore={false} addUser={() => {
|
125
|
-
|
120
|
+
getImManager().store.dispatch(startCreateGroup());
|
126
121
|
navigation.navigate('ChooseContact', {
|
127
122
|
chooseOrg: true,
|
128
123
|
checkMode: 'multi',
|
129
124
|
checkedIds: [id],
|
130
125
|
});
|
131
126
|
}}/>
|
132
|
-
<
|
133
|
-
<
|
134
|
-
<
|
127
|
+
<Space size={'m'}/>
|
128
|
+
<OptionConversation enableNoDisturb={enableNoDisturb} enableTop={enableTop} settingEnableNoDisturb={settingEnableNoDisturb} settingEnableTop={settingEnableTop} toImageBackground={toImageBackground} clearMessage={clearMessage} toSearchMessage={toSearchMessage} showBackgroundSetting toSearchFile={toSearchFile} toSearchPicture={toSearchPicture} toSearchManagePage={toSearchManagePage}/>
|
129
|
+
<Space size={'m'}/>
|
135
130
|
</>);
|
136
131
|
break;
|
137
|
-
case
|
132
|
+
case ConversationType.C2G:
|
138
133
|
let avatarList = groupMemberList
|
139
134
|
.map(item => {
|
140
135
|
var _a;
|
@@ -147,9 +142,9 @@ const ConversationSetting = ({ navigation }) => {
|
|
147
142
|
})
|
148
143
|
.splice(0, MAX_SHOW_MEMBER_COUNT);
|
149
144
|
content = (<>
|
150
|
-
<
|
145
|
+
<OptionAvatars list={avatarList} showTitle memberTotalCount={memberTotalCount} showAdd showMore={isMgr ? avatarList.length > 8 : avatarList.length > 9} isMgr={isMgr} addUser={() => {
|
151
146
|
// 添加成员
|
152
|
-
|
147
|
+
getImManager().store.dispatch(startAddMember());
|
153
148
|
navigation.navigate('ChooseContact', {
|
154
149
|
chooseOrg: true,
|
155
150
|
checkMode: 'multi',
|
@@ -157,23 +152,23 @@ const ConversationSetting = ({ navigation }) => {
|
|
157
152
|
}} removeUser={removeUser} toMoreMember={() => {
|
158
153
|
navigation.navigate('OptionGroupMoreMember');
|
159
154
|
}}/>
|
160
|
-
<
|
161
|
-
<
|
162
|
-
<
|
163
|
-
<
|
164
|
-
<
|
165
|
-
{groupType !== LIAISON && <
|
155
|
+
<Space size={'m'}/>
|
156
|
+
<OptionGroup id={id} name={name} memberLevel={memberLevel} avatars={avatars} notice={notice} enableInviteValidate={enableInviteValidate} toEditGroupName={() => toEditGroupNameOrNotice('groupName')} toEditGroupNotice={() => toEditGroupNameOrNotice('groupNotice')} toGroupMgr={toGroupMgr}/>
|
157
|
+
<Space size={'m'}/>
|
158
|
+
<OptionConversation enableNoDisturb={enableNoDisturb} enableTop={enableTop} settingEnableNoDisturb={settingEnableNoDisturb} settingEnableTop={settingEnableTop} toImageBackground={toImageBackground} clearMessage={clearMessage} toSearchMessage={toSearchMessage} toSearchFile={toSearchFile} toSearchPicture={toSearchPicture} toSearchManagePage={toSearchManagePage}/>
|
159
|
+
<Space size={'m'}/>
|
160
|
+
{groupType !== LIAISON && <OptionCancelGroup leaveGroup={leaveGroup}/>}
|
166
161
|
</>);
|
167
162
|
break;
|
168
|
-
case
|
169
|
-
content = (<
|
163
|
+
case ConversationType.B2C:
|
164
|
+
content = (<OptionConversation enableNoDisturb={enableNoDisturb} enableTop={enableTop} showSearch={false} showBackgroundSetting={false} settingEnableNoDisturb={settingEnableNoDisturb} settingEnableTop={settingEnableTop} toImageBackground={toImageBackground} clearMessage={clearMessage} toSearchMessage={toSearchMessage}/>);
|
170
165
|
break;
|
171
166
|
default:
|
172
167
|
break;
|
173
168
|
}
|
174
|
-
return (<
|
175
|
-
<
|
169
|
+
return (<NavigationPage scroll noPadding>
|
170
|
+
<Space size="m"/>
|
176
171
|
{content}
|
177
|
-
</
|
172
|
+
</NavigationPage>);
|
178
173
|
};
|
179
|
-
|
174
|
+
export default ConversationSetting;
|
@@ -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,30 +7,26 @@ 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 im_base_1 = require("@smart-link/im-base");
|
44
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
45
|
-
const react_1 = __importStar(require("react"));
|
46
|
-
const react_native_image_crop_picker_1 = __importDefault(require("react-native-image-crop-picker"));
|
10
|
+
import { useConversation } from '../../../hooks/useImSelector';
|
11
|
+
import useTranslation from '../../../hooks/useTranslation';
|
12
|
+
import { getImManager } from '../../../init';
|
13
|
+
import uploadFile from '../../../utils/upload';
|
14
|
+
import { StackActions } from '@react-navigation/native';
|
15
|
+
import { ConversationActions, updateOptionSetting } from '@smart-link/im-base';
|
16
|
+
import { ListRow, NavigationPage, Space, Toast } from '@smart-link/rn-ui';
|
17
|
+
import React, { useEffect } from 'react';
|
18
|
+
import ImagePicker from 'react-native-image-crop-picker';
|
47
19
|
const SettingChatBg = ({ navigation }) => {
|
48
|
-
const { t } = (
|
49
|
-
const { currentConversation } =
|
50
|
-
|
20
|
+
const { t } = useTranslation();
|
21
|
+
const { currentConversation } = useConversation();
|
22
|
+
useEffect(() => {
|
51
23
|
navigation.setOptions({ title: t('selectChatBackground') });
|
52
24
|
}, [navigation, t]);
|
53
25
|
const openAlbum = () => __awaiter(void 0, void 0, void 0, function* () {
|
54
26
|
let toast;
|
55
27
|
let image;
|
56
28
|
try {
|
57
|
-
image = yield
|
29
|
+
image = yield ImagePicker.openPicker({
|
58
30
|
mediaType: 'photo',
|
59
31
|
multiple: false,
|
60
32
|
compressImageQuality: 0.7,
|
@@ -66,17 +38,17 @@ const SettingChatBg = ({ navigation }) => {
|
|
66
38
|
return;
|
67
39
|
}
|
68
40
|
try {
|
69
|
-
toast =
|
70
|
-
const fileId = yield (
|
71
|
-
yield
|
41
|
+
toast = Toast.loading();
|
42
|
+
const fileId = yield uploadFile(image.path, image.mime);
|
43
|
+
yield updateOptionSetting({
|
72
44
|
type: currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.type,
|
73
45
|
conversationId: currentConversation.id,
|
74
46
|
optionKey: 'imageBackground',
|
75
47
|
optionValue: fileId,
|
76
48
|
});
|
77
|
-
const imManager =
|
78
|
-
imManager.store.dispatch(
|
79
|
-
imManager.store.dispatch(
|
49
|
+
const imManager = getImManager();
|
50
|
+
imManager.store.dispatch(ConversationActions.setCurrentConversation(Object.assign(Object.assign({}, currentConversation), { imageBackground: fileId })));
|
51
|
+
imManager.store.dispatch(ConversationActions.updateConversation({
|
80
52
|
id: currentConversation.id,
|
81
53
|
imageBackground: fileId,
|
82
54
|
}));
|
@@ -90,17 +62,17 @@ const SettingChatBg = ({ navigation }) => {
|
|
90
62
|
localPath: image.path,
|
91
63
|
});
|
92
64
|
toast.close();
|
93
|
-
navigation.dispatch(
|
65
|
+
navigation.dispatch(StackActions.pop(2));
|
94
66
|
}
|
95
67
|
catch (e) {
|
96
68
|
console.log(e);
|
97
69
|
toast === null || toast === void 0 ? void 0 : toast.close();
|
98
|
-
|
70
|
+
Toast.error(t('settingFail'));
|
99
71
|
}
|
100
72
|
});
|
101
|
-
return (<
|
102
|
-
<
|
103
|
-
<
|
104
|
-
</
|
73
|
+
return (<NavigationPage noPadding>
|
74
|
+
<Space size="m"/>
|
75
|
+
<ListRow title={t('chooseFromAlbum')} onPress={openAlbum} accessory="none"/>
|
76
|
+
</NavigationPage>);
|
105
77
|
};
|
106
|
-
|
78
|
+
export default SettingChatBg;
|
package/dist/pages/index.js
CHANGED
@@ -1,27 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
-
};
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
-
exports.imRoutes = void 0;
|
21
|
-
const conversation_routes_1 = require("./conversation/conversation.routes");
|
22
|
-
const message_routes_1 = require("./message/message.routes");
|
23
|
-
const search_routes_1 = require("./search/search.routes");
|
24
|
-
const collection_routes_1 = require("./collection/collection.routes");
|
25
|
-
const addressList_routes_1 = __importDefault(require("./address-list/addressList.routes"));
|
26
|
-
exports.imRoutes = [...conversation_routes_1.conversationRoutes, ...message_routes_1.messageRoutes, ...search_routes_1.searchRoutes, ...collection_routes_1.collectRoutes, ...addressList_routes_1.default];
|
27
|
-
__exportStar(require("./types"), exports);
|
1
|
+
import { conversationRoutes } from './conversation/conversation.routes';
|
2
|
+
import { messageRoutes } from './message/message.routes';
|
3
|
+
import { searchRoutes } from './search/search.routes';
|
4
|
+
import { collectRoutes } from './collection/collection.routes';
|
5
|
+
import addressListRoutes from './address-list/addressList.routes';
|
6
|
+
export const imRoutes = [...conversationRoutes, ...messageRoutes, ...searchRoutes, ...collectRoutes, ...addressListRoutes];
|
7
|
+
export * from './types';
|
@@ -1,49 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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 useImSelector_1 = require("../../hooks/useImSelector");
|
33
|
-
const useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
|
34
|
-
const styles_1 = require("../../components/styles");
|
35
|
-
const ChatAvatar_1 = __importDefault(require("../../components/ChatAvatar/ChatAvatar"));
|
36
|
-
const im_base_1 = require("@smart-link/im-base");
|
37
|
-
const init_1 = require("../../init");
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
2
|
+
import { StyleSheet, TouchableOpacity, View, Text, FlatList } from 'react-native';
|
3
|
+
import { Checkbox, dp, NavigationPage, SearchInput, Space } from '@smart-link/rn-ui';
|
4
|
+
import { useChatGroup, useConversation } from '../../hooks/useImSelector';
|
5
|
+
import useTranslation from '../../hooks/useTranslation';
|
6
|
+
import { shadowStyle } from '../../components/styles';
|
7
|
+
import ChatAvatar from '../../components/ChatAvatar/ChatAvatar';
|
8
|
+
import { ConversationActions, ForwardActions, MessageActions } from '@smart-link/im-base';
|
9
|
+
import { getImManager } from '../../init';
|
38
10
|
const ChooseMember = ({ navigation, route: { params } }) => {
|
39
|
-
const { groupDetail } =
|
40
|
-
const { allMembers } =
|
41
|
-
const [keyword, seKeyword] =
|
42
|
-
const [checked, setChecked] =
|
43
|
-
const { t } = (
|
11
|
+
const { groupDetail } = useChatGroup();
|
12
|
+
const { allMembers } = useConversation();
|
13
|
+
const [keyword, seKeyword] = useState('');
|
14
|
+
const [checked, setChecked] = useState([]);
|
15
|
+
const { t } = useTranslation();
|
44
16
|
const { memberLevel } = groupDetail;
|
45
|
-
const imManager =
|
46
|
-
const list =
|
17
|
+
const imManager = getImManager();
|
18
|
+
const list = useMemo(() => {
|
47
19
|
if (params.atOther && ['owner', 'mgr'].includes(memberLevel)) {
|
48
20
|
return [
|
49
21
|
{
|
@@ -56,20 +28,20 @@ const ChooseMember = ({ navigation, route: { params } }) => {
|
|
56
28
|
return allMembers.filter(item => item.userId !== imManager.user.userId && (keyword ? item.memberName.includes(keyword) : true));
|
57
29
|
}
|
58
30
|
}, [params.atOther, allMembers, keyword]);
|
59
|
-
|
31
|
+
useEffect(() => {
|
60
32
|
navigation.setOptions({
|
61
33
|
headerLeft({ tintColor }) {
|
62
|
-
return (<
|
34
|
+
return (<TouchableOpacity activeOpacity={0.5} style={{ padding: dp(10) }} onPress={() => {
|
63
35
|
navigation.goBack();
|
64
36
|
}}>
|
65
|
-
<
|
66
|
-
</
|
37
|
+
<Text style={{ color: tintColor }}>{t('cancel')}</Text>
|
38
|
+
</TouchableOpacity>);
|
67
39
|
},
|
68
40
|
headerTitle: params.atOther ? t('selectRemainder') : t('selectContacts'),
|
69
41
|
headerRight: ({ tintColor }) => {
|
70
|
-
return (<
|
71
|
-
<
|
72
|
-
</
|
42
|
+
return (<TouchableOpacity activeOpacity={0.5} style={{ padding: dp(10) }} disabled={!checked.length} onPress={confirm}>
|
43
|
+
<Text style={{ color: tintColor }}>{t('confirm')}</Text>
|
44
|
+
</TouchableOpacity>);
|
73
45
|
},
|
74
46
|
});
|
75
47
|
}, [list, params, navigation, t, checked]);
|
@@ -80,10 +52,10 @@ const ChooseMember = ({ navigation, route: { params } }) => {
|
|
80
52
|
if ((_a = imManager.inputRef) === null || _a === void 0 ? void 0 : _a.current) {
|
81
53
|
(_c = (_b = imManager.inputRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.appendInputText(`${members[0].memberName} `);
|
82
54
|
}
|
83
|
-
imManager.store.dispatch(
|
55
|
+
imManager.store.dispatch(MessageActions.addAtUser(members[0]));
|
84
56
|
}
|
85
57
|
if (params.removeMember) {
|
86
|
-
imManager.store.dispatch(
|
58
|
+
imManager.store.dispatch(ConversationActions.removeGroupMembers({
|
87
59
|
selectMemberList: members,
|
88
60
|
}));
|
89
61
|
}
|
@@ -91,7 +63,7 @@ const ChooseMember = ({ navigation, route: { params } }) => {
|
|
91
63
|
};
|
92
64
|
const renderItem = ({ item }) => {
|
93
65
|
const enableTopStyles = item.enableTop === 'on' ? styles.enableTop : null;
|
94
|
-
return (<
|
66
|
+
return (<TouchableOpacity activeOpacity={0.5} style={[styles.row, enableTopStyles]} onPress={() => {
|
95
67
|
if (params.atOther) {
|
96
68
|
setChecked([item.userId]);
|
97
69
|
}
|
@@ -104,30 +76,30 @@ const ChooseMember = ({ navigation, route: { params } }) => {
|
|
104
76
|
}
|
105
77
|
}
|
106
78
|
}}>
|
107
|
-
<
|
108
|
-
<
|
109
|
-
</
|
79
|
+
<View style={{ marginRight: dp(10) }}>
|
80
|
+
<Checkbox style={{ pointerEvents: 'none' }} checked={checked.includes(item.userId)}/>
|
81
|
+
</View>
|
110
82
|
|
111
|
-
<
|
112
|
-
<
|
113
|
-
<
|
83
|
+
<ChatAvatar disabled id={item.userId} url={item.memberAvatars} name={item.memberName} size={dp(40)}/>
|
84
|
+
<View style={styles.width10}/>
|
85
|
+
<Text numberOfLines={1} style={styles.nameText}>
|
114
86
|
{item.memberName}
|
115
|
-
</
|
116
|
-
</
|
87
|
+
</Text>
|
88
|
+
</TouchableOpacity>);
|
117
89
|
};
|
118
|
-
const listFooterComponent = list.length === 0 ? null : <
|
119
|
-
const itemSeparatorComponent = () => <
|
120
|
-
return (<
|
121
|
-
<
|
90
|
+
const listFooterComponent = list.length === 0 ? null : <View style={styles.listFooterLine}/>;
|
91
|
+
const itemSeparatorComponent = () => <View style={styles.separator}/>;
|
92
|
+
return (<NavigationPage noPadding>
|
93
|
+
<SearchInput value={keyword} onChange={text => {
|
122
94
|
seKeyword(text);
|
123
95
|
}} onSubmitEditing={e => {
|
124
|
-
imManager.store.dispatch(
|
96
|
+
imManager.store.dispatch(ForwardActions.loadList(imManager, keyword));
|
125
97
|
}} style={styles.search} placeholder={t('search')}/>
|
126
|
-
<
|
127
|
-
<
|
128
|
-
</
|
98
|
+
<Space size="m"/>
|
99
|
+
<FlatList contentContainerStyle={styles.list} ItemSeparatorComponent={itemSeparatorComponent} ListFooterComponent={listFooterComponent} initialNumToRender={1} numColumns={1} data={list} keyExtractor={item => item.userId} renderItem={renderItem}></FlatList>
|
100
|
+
</NavigationPage>);
|
129
101
|
};
|
130
|
-
const styles =
|
102
|
+
const styles = StyleSheet.create({
|
131
103
|
selector: {
|
132
104
|
flex: 1,
|
133
105
|
backgroundColor: '#fff',
|
@@ -140,41 +112,41 @@ const styles = react_native_1.StyleSheet.create({
|
|
140
112
|
borderColor: '#e9e9e9',
|
141
113
|
},
|
142
114
|
row: {
|
143
|
-
paddingHorizontal:
|
115
|
+
paddingHorizontal: dp(15),
|
144
116
|
flexDirection: 'row',
|
145
117
|
alignItems: 'center',
|
146
|
-
height:
|
118
|
+
height: dp(60),
|
147
119
|
},
|
148
120
|
currChat: {
|
149
121
|
backgroundColor: '#f3f3f3',
|
150
|
-
paddingHorizontal:
|
151
|
-
paddingVertical:
|
122
|
+
paddingHorizontal: dp(15),
|
123
|
+
paddingVertical: dp(5),
|
152
124
|
},
|
153
125
|
currChatText: {
|
154
126
|
color: '#999',
|
155
127
|
},
|
156
128
|
nameText: {
|
157
|
-
width:
|
129
|
+
width: dp(250),
|
158
130
|
color: '#333',
|
159
131
|
},
|
160
132
|
width10: {
|
161
|
-
width:
|
133
|
+
width: dp(10),
|
162
134
|
},
|
163
|
-
search: Object.assign({ backgroundColor: '#fff', padding:
|
135
|
+
search: Object.assign({ backgroundColor: '#fff', padding: dp(10), borderBottomWidth: dp(1), borderColor: '#e9e9e9' }, shadowStyle),
|
164
136
|
heightSpace: {
|
165
|
-
height:
|
137
|
+
height: dp(5),
|
166
138
|
},
|
167
139
|
listHeaderLine: {
|
168
|
-
height:
|
140
|
+
height: dp(1),
|
169
141
|
backgroundColor: '#ececec',
|
170
142
|
},
|
171
143
|
listFooterLine: {
|
172
|
-
height:
|
144
|
+
height: dp(1),
|
173
145
|
backgroundColor: '#ececec',
|
174
146
|
},
|
175
147
|
separator: {
|
176
|
-
marginLeft:
|
177
|
-
height:
|
148
|
+
marginLeft: dp(91),
|
149
|
+
height: dp(1),
|
178
150
|
backgroundColor: '#ececec',
|
179
151
|
},
|
180
152
|
empty: {
|
@@ -183,4 +155,4 @@ const styles = react_native_1.StyleSheet.create({
|
|
183
155
|
justifyContent: 'center',
|
184
156
|
},
|
185
157
|
});
|
186
|
-
|
158
|
+
export default ChooseMember;
|