@smart-link/rn-im 1.0.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/README.md +34 -0
- package/assets/avatars-busi-notify.png +0 -0
- package/assets/avatars-empty.png +0 -0
- package/assets/avatars-group.jpg +0 -0
- package/assets/avatars-man.jpg +0 -0
- package/assets/avatars-woman.jpg +0 -0
- package/assets/cloud-backup-begin.png +0 -0
- package/assets/cloud-backup.png +0 -0
- package/assets/group-mgr.png +0 -0
- package/assets/group-owner.png +0 -0
- package/assets/hook-black-double.png +0 -0
- package/assets/hook-black.png +0 -0
- package/assets/hook-blue-double.png +0 -0
- package/assets/hook-blue.png +0 -0
- package/assets/hook-green.png +0 -0
- package/assets/no_message.png +0 -0
- package/assets/share.jpeg +0 -0
- package/assets/voice-left-playing.gif +0 -0
- package/assets/voice-left.png +0 -0
- package/dist/api/addressList.d.ts +27 -0
- package/dist/api/addressList.js +18 -0
- package/dist/api/backup.d.ts +18 -0
- package/dist/api/backup.js +29 -0
- package/dist/api/file.d.ts +4 -0
- package/dist/api/file.js +49 -0
- package/dist/api/user.d.ts +8 -0
- package/dist/api/user.js +16 -0
- package/dist/components/CachedImage.d.ts +11 -0
- package/dist/components/CachedImage.js +48 -0
- package/dist/components/Camera/Camera.d.ts +10 -0
- package/dist/components/Camera/Camera.js +100 -0
- package/dist/components/Camera/CameraCapture.d.ts +32 -0
- package/dist/components/Camera/CameraCapture.js +360 -0
- package/dist/components/Camera/CameraResult.d.ts +11 -0
- package/dist/components/Camera/CameraResult.js +102 -0
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +15 -0
- package/dist/components/ChatAvatar/ChatAvatar.js +134 -0
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +8 -0
- package/dist/components/ChatAvatar/ChatAvatarId.js +92 -0
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +9 -0
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +76 -0
- package/dist/components/ChatAvatar/index.d.ts +2 -0
- package/dist/components/ChatAvatar/index.js +23 -0
- package/dist/components/Favicon.d.ts +7 -0
- package/dist/components/Favicon.js +74 -0
- package/dist/components/FormatTimeText.d.ts +8 -0
- package/dist/components/FormatTimeText.js +24 -0
- package/dist/components/Highlighter.d.ts +9 -0
- package/dist/components/Highlighter.js +42 -0
- package/dist/components/IndicatorText.d.ts +10 -0
- package/dist/components/IndicatorText.js +47 -0
- package/dist/components/LocalImage.d.ts +10 -0
- package/dist/components/LocalImage.js +37 -0
- package/dist/components/NetworkUnconnected.d.ts +3 -0
- package/dist/components/NetworkUnconnected.js +55 -0
- package/dist/components/PopoverWrapper.d.ts +13 -0
- package/dist/components/PopoverWrapper.js +78 -0
- package/dist/components/VideoPlayer.d.ts +13 -0
- package/dist/components/VideoPlayer.js +288 -0
- package/dist/components/styles.d.ts +19 -0
- package/dist/components/styles.js +23 -0
- package/dist/default-assets.d.ts +18 -0
- package/dist/default-assets.js +22 -0
- package/dist/hooks/useFormatMsgTime.d.ts +4 -0
- package/dist/hooks/useFormatMsgTime.js +53 -0
- package/dist/hooks/useImSelector.d.ts +15 -0
- package/dist/hooks/useImSelector.js +48 -0
- package/dist/hooks/useTranslation.d.ts +13 -0
- package/dist/hooks/useTranslation.js +12 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +28 -0
- package/dist/init.d.ts +17 -0
- package/dist/init.js +116 -0
- package/dist/interface.d.ts +47 -0
- package/dist/interface.js +2 -0
- package/dist/locales/en/addressList.d.ts +3 -0
- package/dist/locales/en/addressList.js +31 -0
- package/dist/locales/index.d.ts +4 -0
- package/dist/locales/index.js +27 -0
- package/dist/locales/lao/addressList.d.ts +3 -0
- package/dist/locales/lao/addressList.js +31 -0
- package/dist/locales/zh/addressList.d.ts +30 -0
- package/dist/locales/zh/addressList.js +32 -0
- package/dist/pages/address-list/AddressList.d.ts +6 -0
- package/dist/pages/address-list/AddressList.js +158 -0
- package/dist/pages/address-list/CardInfo.d.ts +15 -0
- package/dist/pages/address-list/CardInfo.js +42 -0
- package/dist/pages/address-list/ChooseContact.d.ts +6 -0
- package/dist/pages/address-list/ChooseContact.js +197 -0
- package/dist/pages/address-list/Icons.d.ts +5 -0
- package/dist/pages/address-list/Icons.js +16 -0
- package/dist/pages/address-list/Organization.d.ts +13 -0
- package/dist/pages/address-list/Organization.js +221 -0
- package/dist/pages/address-list/UserDetail.d.ts +6 -0
- package/dist/pages/address-list/UserDetail.js +131 -0
- package/dist/pages/address-list/UserJobs.d.ts +6 -0
- package/dist/pages/address-list/UserJobs.js +50 -0
- package/dist/pages/address-list/UserSearch.d.ts +6 -0
- package/dist/pages/address-list/UserSearch.js +82 -0
- package/dist/pages/address-list/addressList.routes.d.ts +50 -0
- package/dist/pages/address-list/addressList.routes.js +50 -0
- package/dist/pages/collection/Collection.d.ts +3 -0
- package/dist/pages/collection/Collection.js +136 -0
- package/dist/pages/collection/ContentFactory.d.ts +6 -0
- package/dist/pages/collection/ContentFactory.js +167 -0
- package/dist/pages/collection/collection.routes.d.ts +9 -0
- package/dist/pages/collection/collection.routes.js +17 -0
- package/dist/pages/conversation/ForwardToConversation.d.ts +6 -0
- package/dist/pages/conversation/ForwardToConversation.js +172 -0
- package/dist/pages/conversation/List.d.ts +6 -0
- package/dist/pages/conversation/List.js +204 -0
- package/dist/pages/conversation/components/ConversationCard.d.ts +12 -0
- package/dist/pages/conversation/components/ConversationCard.js +142 -0
- package/dist/pages/conversation/components/ConversationOption.d.ts +11 -0
- package/dist/pages/conversation/components/ConversationOption.js +99 -0
- package/dist/pages/conversation/conversation.routes.d.ts +2 -0
- package/dist/pages/conversation/conversation.routes.js +74 -0
- package/dist/pages/conversation/setting/GroupTransfer.d.ts +6 -0
- package/dist/pages/conversation/setting/GroupTransfer.js +88 -0
- package/dist/pages/conversation/setting/OptionAvatars.d.ts +22 -0
- package/dist/pages/conversation/setting/OptionAvatars.js +152 -0
- package/dist/pages/conversation/setting/OptionCancelGroup.d.ts +6 -0
- package/dist/pages/conversation/setting/OptionCancelGroup.js +49 -0
- package/dist/pages/conversation/setting/OptionConversation.d.ts +19 -0
- package/dist/pages/conversation/setting/OptionConversation.js +71 -0
- package/dist/pages/conversation/setting/OptionGroup.d.ts +17 -0
- package/dist/pages/conversation/setting/OptionGroup.js +76 -0
- package/dist/pages/conversation/setting/OptionGroupManage.d.ts +6 -0
- package/dist/pages/conversation/setting/OptionGroupManage.js +68 -0
- package/dist/pages/conversation/setting/OptionGroupMoreMember.d.ts +4 -0
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +124 -0
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.d.ts +6 -0
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +149 -0
- package/dist/pages/conversation/setting/Setting.d.ts +6 -0
- package/dist/pages/conversation/setting/Setting.js +184 -0
- package/dist/pages/conversation/setting/SettingChatBg.d.ts +6 -0
- package/dist/pages/conversation/setting/SettingChatBg.js +95 -0
- package/dist/pages/index.d.ts +8 -0
- package/dist/pages/index.js +27 -0
- package/dist/pages/message/ChooseMember.d.ts +6 -0
- package/dist/pages/message/ChooseMember.js +185 -0
- package/dist/pages/message/MessageBackup/Bar.d.ts +8 -0
- package/dist/pages/message/MessageBackup/Bar.js +77 -0
- package/dist/pages/message/MessageBackup/MessageBackup.d.ts +10 -0
- package/dist/pages/message/MessageBackup/MessageBackup.js +133 -0
- package/dist/pages/message/MessageBackup/RestoreBackupPage.d.ts +6 -0
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +135 -0
- package/dist/pages/message/MessageBackup/StartBackupPage.d.ts +6 -0
- package/dist/pages/message/MessageBackup/StartBackupPage.js +135 -0
- package/dist/pages/message/MessageBackup/index.d.ts +3 -0
- package/dist/pages/message/MessageBackup/index.js +12 -0
- package/dist/pages/message/MessageBackup/utils.d.ts +46 -0
- package/dist/pages/message/MessageBackup/utils.js +239 -0
- package/dist/pages/message/MessageList.d.ts +6 -0
- package/dist/pages/message/MessageList.js +175 -0
- package/dist/pages/message/MessageRecord.d.ts +6 -0
- package/dist/pages/message/MessageRecord.js +97 -0
- package/dist/pages/message/components/BusiNotifyCard.d.ts +6 -0
- package/dist/pages/message/components/BusiNotifyCard.js +132 -0
- package/dist/pages/message/components/ChatBg.d.ts +7 -0
- package/dist/pages/message/components/ChatBg.js +65 -0
- package/dist/pages/message/components/MessageItem.d.ts +16 -0
- package/dist/pages/message/components/MessageItem.js +205 -0
- package/dist/pages/message/components/MessageItemQuote.d.ts +7 -0
- package/dist/pages/message/components/MessageItemQuote.js +83 -0
- package/dist/pages/message/components/MessageItemTips.d.ts +9 -0
- package/dist/pages/message/components/MessageItemTips.js +67 -0
- package/dist/pages/message/components/MessageOption.d.ts +11 -0
- package/dist/pages/message/components/MessageOption.js +360 -0
- package/dist/pages/message/components/MessagePayload.d.ts +14 -0
- package/dist/pages/message/components/MessagePayload.js +96 -0
- package/dist/pages/message/components/MessagePictureAlbum.d.ts +10 -0
- package/dist/pages/message/components/MessagePictureAlbum.js +105 -0
- package/dist/pages/message/components/MessageReceiptStatus.d.ts +6 -0
- package/dist/pages/message/components/MessageReceiptStatus.js +61 -0
- package/dist/pages/message/components/MessageUndo.d.ts +10 -0
- package/dist/pages/message/components/MessageUndo.js +75 -0
- package/dist/pages/message/components/MultipleBar/index.d.ts +5 -0
- package/dist/pages/message/components/MultipleBar/index.js +116 -0
- package/dist/pages/message/components/Payload/PayloadContact.d.ts +4 -0
- package/dist/pages/message/components/Payload/PayloadContact.js +86 -0
- package/dist/pages/message/components/Payload/PayloadFile.d.ts +4 -0
- package/dist/pages/message/components/Payload/PayloadFile.js +115 -0
- package/dist/pages/message/components/Payload/PayloadMultiple.d.ts +4 -0
- package/dist/pages/message/components/Payload/PayloadMultiple.js +102 -0
- package/dist/pages/message/components/Payload/PayloadNotify.d.ts +9 -0
- package/dist/pages/message/components/Payload/PayloadNotify.js +92 -0
- package/dist/pages/message/components/Payload/PayloadPicture.d.ts +7 -0
- package/dist/pages/message/components/Payload/PayloadPicture.js +69 -0
- package/dist/pages/message/components/Payload/PayloadShare.d.ts +4 -0
- package/dist/pages/message/components/Payload/PayloadShare.js +100 -0
- package/dist/pages/message/components/Payload/PayloadText.d.ts +4 -0
- package/dist/pages/message/components/Payload/PayloadText.js +128 -0
- package/dist/pages/message/components/Payload/PayloadVideo.d.ts +4 -0
- package/dist/pages/message/components/Payload/PayloadVideo.js +78 -0
- package/dist/pages/message/components/Payload/PayloadVoice.d.ts +6 -0
- package/dist/pages/message/components/Payload/PayloadVoice.js +155 -0
- package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +12 -0
- package/dist/pages/message/components/Payload/PayloadWrapper.js +73 -0
- package/dist/pages/message/components/Payload/type.d.ts +9 -0
- package/dist/pages/message/components/Payload/type.js +2 -0
- package/dist/pages/message/components/ReceiptBack.d.ts +7 -0
- package/dist/pages/message/components/ReceiptBack.js +82 -0
- package/dist/pages/message/components/TextMixMessage.d.ts +9 -0
- package/dist/pages/message/components/TextMixMessage.js +62 -0
- package/dist/pages/message/components/TextMixQuote.d.ts +61 -0
- package/dist/pages/message/components/TextMixQuote.js +276 -0
- package/dist/pages/message/components/TextMixQuoteMessage.d.ts +14 -0
- package/dist/pages/message/components/TextMixQuoteMessage.js +74 -0
- package/dist/pages/message/components/UploadProgress.d.ts +9 -0
- package/dist/pages/message/components/UploadProgress.js +51 -0
- package/dist/pages/message/components/messageBar/EmojiPanel.d.ts +11 -0
- package/dist/pages/message/components/messageBar/EmojiPanel.js +101 -0
- package/dist/pages/message/components/messageBar/Icons.d.ts +18 -0
- package/dist/pages/message/components/messageBar/Icons.js +88 -0
- package/dist/pages/message/components/messageBar/MessageBar.d.ts +12 -0
- package/dist/pages/message/components/messageBar/MessageBar.js +273 -0
- package/dist/pages/message/components/messageBar/MessageInput.d.ts +21 -0
- package/dist/pages/message/components/messageBar/MessageInput.js +203 -0
- package/dist/pages/message/components/messageBar/OptionPanel.d.ts +8 -0
- package/dist/pages/message/components/messageBar/OptionPanel.js +240 -0
- package/dist/pages/message/components/messageBar/VoiceBar.d.ts +3 -0
- package/dist/pages/message/components/messageBar/VoiceBar.js +272 -0
- package/dist/pages/message/components/messageBar/index.d.ts +2 -0
- package/dist/pages/message/components/messageBar/index.js +23 -0
- package/dist/pages/message/message.routes.d.ts +2 -0
- package/dist/pages/message/message.routes.js +79 -0
- package/dist/pages/search/Search.d.ts +6 -0
- package/dist/pages/search/Search.js +84 -0
- package/dist/pages/search/SearchChatRecords.d.ts +3 -0
- package/dist/pages/search/SearchChatRecords.js +173 -0
- package/dist/pages/search/SearchFile.d.ts +3 -0
- package/dist/pages/search/SearchFile.js +202 -0
- package/dist/pages/search/SearchManager.d.ts +6 -0
- package/dist/pages/search/SearchManager.js +111 -0
- package/dist/pages/search/SearchPicturePage.d.ts +6 -0
- package/dist/pages/search/SearchPicturePage.js +56 -0
- package/dist/pages/search/components/ChatRecords.d.ts +6 -0
- package/dist/pages/search/components/ChatRecords.js +151 -0
- package/dist/pages/search/components/MyGroupChat.d.ts +6 -0
- package/dist/pages/search/components/MyGroupChat.js +128 -0
- package/dist/pages/search/components/PictureMulipleBar.d.ts +10 -0
- package/dist/pages/search/components/PictureMulipleBar.js +105 -0
- package/dist/pages/search/components/SearchFileList.d.ts +7 -0
- package/dist/pages/search/components/SearchFileList.js +173 -0
- package/dist/pages/search/components/SearchPictures.d.ts +8 -0
- package/dist/pages/search/components/SearchPictures.js +220 -0
- package/dist/pages/search/components/SearchShareLinkList.d.ts +7 -0
- package/dist/pages/search/components/SearchShareLinkList.js +112 -0
- package/dist/pages/search/components/SearchUser.d.ts +6 -0
- package/dist/pages/search/components/SearchUser.js +83 -0
- package/dist/pages/search/components/useSearchMessage.d.ts +11 -0
- package/dist/pages/search/components/useSearchMessage.js +68 -0
- package/dist/pages/search/search.routes.d.ts +2 -0
- package/dist/pages/search/search.routes.js +48 -0
- package/dist/pages/search/utils.d.ts +12 -0
- package/dist/pages/search/utils.js +42 -0
- package/dist/pages/types.d.ts +70 -0
- package/dist/pages/types.js +2 -0
- package/dist/slice/contact/contact.action.d.ts +1 -0
- package/dist/slice/contact/contact.action.js +2 -0
- package/dist/slice/contact/contact.slice.d.ts +12 -0
- package/dist/slice/contact/contact.slice.js +60 -0
- package/dist/slice/index.d.ts +9 -0
- package/dist/slice/index.js +15 -0
- package/dist/slice/panel/panel.slice.d.ts +8 -0
- package/dist/slice/panel/panel.slice.js +19 -0
- package/dist/slice/video/video.action.d.ts +5 -0
- package/dist/slice/video/video.action.js +65 -0
- package/dist/slice/video/video.slice.d.ts +17 -0
- package/dist/slice/video/video.slice.js +40 -0
- package/dist/utils/color.d.ts +1 -0
- package/dist/utils/color.js +9 -0
- package/dist/utils/common-action-sheet.d.ts +8 -0
- package/dist/utils/common-action-sheet.js +45 -0
- package/dist/utils/cookie.d.ts +1 -0
- package/dist/utils/cookie.js +29 -0
- package/dist/utils/emoji.d.ts +9 -0
- package/dist/utils/emoji.js +627 -0
- package/dist/utils/file-icon.d.ts +7 -0
- package/dist/utils/file-icon.js +80 -0
- package/dist/utils/file-operate.d.ts +1 -0
- package/dist/utils/file-operate.js +4 -0
- package/dist/utils/file.d.ts +23 -0
- package/dist/utils/file.js +255 -0
- package/dist/utils/golden-rectangle.d.ts +4 -0
- package/dist/utils/golden-rectangle.js +34 -0
- package/dist/utils/phone.d.ts +2 -0
- package/dist/utils/phone.js +24 -0
- package/dist/utils/request.d.ts +34 -0
- package/dist/utils/request.js +67 -0
- package/dist/utils/scroll.d.ts +1 -0
- package/dist/utils/scroll.js +12 -0
- package/dist/utils/summary.d.ts +2 -0
- package/dist/utils/summary.js +42 -0
- package/dist/utils/take-camera.d.ts +2 -0
- package/dist/utils/take-camera.js +41 -0
- package/dist/utils/text-mix.d.ts +9 -0
- package/dist/utils/text-mix.js +82 -0
- package/dist/utils/upload.d.ts +5 -0
- package/dist/utils/upload.js +80 -0
- package/package.json +79 -0
@@ -0,0 +1,172 @@
|
|
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
|
+
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");
|
38
|
+
function isChecked(selectList, item) {
|
39
|
+
for (let i = 0; i < selectList.length; i++) {
|
40
|
+
if (item.id === selectList[i].id) {
|
41
|
+
return true;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
const ForwardToConversation = ({ navigation }) => {
|
47
|
+
const { forwardMessage } = (0, useImSelector_1.useMessage)();
|
48
|
+
const { list, selectList } = (0, useImSelector_1.useForward)();
|
49
|
+
const { t } = (0, useTranslation_1.default)();
|
50
|
+
const imManager = (0, init_1.getImManager)();
|
51
|
+
(0, react_1.useEffect)(() => {
|
52
|
+
navigation.setOptions({
|
53
|
+
headerLeft({ tintColor }) {
|
54
|
+
return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={{ padding: (0, rn_ui_1.dp)(10) }} onPress={() => {
|
55
|
+
imManager.store.dispatch(im_base_1.ForwardActions.resetState());
|
56
|
+
navigation.goBack();
|
57
|
+
}}>
|
58
|
+
<react_native_1.Text style={{ color: tintColor }}>{t('cancel')}</react_native_1.Text>
|
59
|
+
</react_native_1.TouchableOpacity>);
|
60
|
+
},
|
61
|
+
headerTitle: t('selectChat'),
|
62
|
+
headerRight: ({ tintColor }) => {
|
63
|
+
const disabled = selectList.length === 0;
|
64
|
+
const selectCountText = disabled ? '' : '(' + selectList.length + ')';
|
65
|
+
return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={{ padding: (0, rn_ui_1.dp)(10) }} disabled={disabled} onPress={() => {
|
66
|
+
imManager.store.dispatch(im_base_1.ForwardActions.forwardMessage(imManager, forwardMessage, selectList, () => {
|
67
|
+
imManager.store.dispatch(im_base_1.ForwardActions.resetState());
|
68
|
+
imManager.store.dispatch(im_base_1.MessageActions.setForwardMessage(null));
|
69
|
+
navigation.goBack();
|
70
|
+
}));
|
71
|
+
}}>
|
72
|
+
<react_native_1.Text style={{ color: tintColor }}>
|
73
|
+
{t('confirm')} {selectCountText}
|
74
|
+
</react_native_1.Text>
|
75
|
+
</react_native_1.TouchableOpacity>);
|
76
|
+
},
|
77
|
+
});
|
78
|
+
}, [navigation, t, forwardMessage, selectList]);
|
79
|
+
(0, react_1.useEffect)(() => {
|
80
|
+
imManager.store.dispatch(im_base_1.ForwardActions.loadList(imManager, ''));
|
81
|
+
}, []);
|
82
|
+
const renderItem = ({ item }) => {
|
83
|
+
const checked = isChecked(selectList, item);
|
84
|
+
const enableTopStyles = item.enableTop === 'on' ? styles.enableTop : null;
|
85
|
+
return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={[styles.row, enableTopStyles]} onPress={() => {
|
86
|
+
imManager.store.dispatch(im_base_1.ForwardActions.onSelect(item, !checked));
|
87
|
+
}}>
|
88
|
+
<react_native_1.View style={{ marginRight: (0, rn_ui_1.dp)(10) }}>
|
89
|
+
<rn_ui_1.Checkbox style={{ pointerEvents: 'none' }} checked={checked}/>
|
90
|
+
</react_native_1.View>
|
91
|
+
|
92
|
+
<ChatAvatar_1.default disabled id={item.id} priority="outside" url={item.avatars} name={item.name} size={(0, rn_ui_1.dp)(40)} type={item.type}/>
|
93
|
+
<react_native_1.View style={styles.width10}/>
|
94
|
+
<react_native_1.Text numberOfLines={1} style={styles.nameText}>
|
95
|
+
{item.name}
|
96
|
+
</react_native_1.Text>
|
97
|
+
</react_native_1.TouchableOpacity>);
|
98
|
+
};
|
99
|
+
const listHeaderComponent = list.length === 0 ? null : (<>
|
100
|
+
<react_native_1.View style={styles.currChat}>
|
101
|
+
<react_native_1.Text style={styles.currChatText}>{t('recentChat')}</react_native_1.Text>
|
102
|
+
</react_native_1.View>
|
103
|
+
<react_native_1.View style={styles.listHeaderLine}/>
|
104
|
+
</>);
|
105
|
+
const listFooterComponent = list.length === 0 ? null : <react_native_1.View style={styles.listFooterLine}/>;
|
106
|
+
const itemSeparatorComponent = () => <react_native_1.View style={styles.separator}/>;
|
107
|
+
console.log(list);
|
108
|
+
return (<rn_ui_1.NavigationPage noPadding>
|
109
|
+
<rn_ui_1.SearchInput onSubmitEditing={e => {
|
110
|
+
imManager.store.dispatch(im_base_1.ForwardActions.loadList(imManager, e.nativeEvent.text));
|
111
|
+
}} placeholder={t('search')}/>
|
112
|
+
<rn_ui_1.Space size="m"/>
|
113
|
+
<react_native_1.FlatList contentContainerStyle={styles.list} ItemSeparatorComponent={itemSeparatorComponent} ListHeaderComponent={listHeaderComponent} ListFooterComponent={listFooterComponent} initialNumToRender={1} numColumns={1} data={list} keyExtractor={item => item.id} renderItem={renderItem}></react_native_1.FlatList>
|
114
|
+
</rn_ui_1.NavigationPage>);
|
115
|
+
};
|
116
|
+
const styles = react_native_1.StyleSheet.create({
|
117
|
+
selector: {
|
118
|
+
flex: 1,
|
119
|
+
backgroundColor: '#fff',
|
120
|
+
},
|
121
|
+
list: {
|
122
|
+
backgroundColor: '#fff',
|
123
|
+
},
|
124
|
+
enableTop: {
|
125
|
+
backgroundColor: '#f2f2f2',
|
126
|
+
borderColor: '#e9e9e9',
|
127
|
+
},
|
128
|
+
row: {
|
129
|
+
paddingHorizontal: (0, rn_ui_1.dp)(15),
|
130
|
+
flexDirection: 'row',
|
131
|
+
alignItems: 'center',
|
132
|
+
height: (0, rn_ui_1.dp)(60),
|
133
|
+
},
|
134
|
+
currChat: {
|
135
|
+
backgroundColor: '#f3f3f3',
|
136
|
+
paddingHorizontal: (0, rn_ui_1.dp)(15),
|
137
|
+
paddingVertical: (0, rn_ui_1.dp)(5),
|
138
|
+
},
|
139
|
+
currChatText: {
|
140
|
+
color: '#999',
|
141
|
+
},
|
142
|
+
nameText: {
|
143
|
+
width: (0, rn_ui_1.dp)(250),
|
144
|
+
color: '#333',
|
145
|
+
},
|
146
|
+
width10: {
|
147
|
+
width: (0, rn_ui_1.dp)(10),
|
148
|
+
},
|
149
|
+
search: Object.assign({ backgroundColor: '#fff', padding: (0, rn_ui_1.dp)(10), borderBottomWidth: (0, rn_ui_1.dp)(1), borderColor: '#e9e9e9' }, styles_1.shadowStyle),
|
150
|
+
heightSpace: {
|
151
|
+
height: (0, rn_ui_1.dp)(5),
|
152
|
+
},
|
153
|
+
listHeaderLine: {
|
154
|
+
height: (0, rn_ui_1.dp)(1),
|
155
|
+
backgroundColor: '#ececec',
|
156
|
+
},
|
157
|
+
listFooterLine: {
|
158
|
+
height: (0, rn_ui_1.dp)(1),
|
159
|
+
backgroundColor: '#ececec',
|
160
|
+
},
|
161
|
+
separator: {
|
162
|
+
marginLeft: (0, rn_ui_1.dp)(91),
|
163
|
+
height: (0, rn_ui_1.dp)(1),
|
164
|
+
backgroundColor: '#ececec',
|
165
|
+
},
|
166
|
+
empty: {
|
167
|
+
flex: 1,
|
168
|
+
alignItems: 'center',
|
169
|
+
justifyContent: 'center',
|
170
|
+
},
|
171
|
+
});
|
172
|
+
exports.default = (0, react_1.memo)(ForwardToConversation);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { NativeStackScreenProps } from '@react-navigation/native-stack/lib/typescript/src/types';
|
2
|
+
import React from 'react';
|
3
|
+
import { IMPageParamList } from '../../pages';
|
4
|
+
type ConversationListProps = NativeStackScreenProps<IMPageParamList, 'ConversationList'>;
|
5
|
+
declare const List: ({ navigation }: ConversationListProps) => React.JSX.Element;
|
6
|
+
export default List;
|
@@ -0,0 +1,204 @@
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
+
});
|
33
|
+
};
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
36
|
+
};
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
38
|
+
const im_base_1 = require("@smart-link/im-base");
|
39
|
+
const rn_ui_1 = require("@smart-link/rn-ui");
|
40
|
+
const react_1 = __importStar(require("react"));
|
41
|
+
const react_native_1 = require("react-native");
|
42
|
+
const IndicatorText_1 = __importDefault(require("../../components/IndicatorText"));
|
43
|
+
const NetworkUnconnected_1 = __importDefault(require("../../components/NetworkUnconnected"));
|
44
|
+
const useImSelector_1 = require("../../hooks/useImSelector");
|
45
|
+
const useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
|
46
|
+
const init_1 = require("../../init");
|
47
|
+
const ConversationCard_1 = __importDefault(require("./components/ConversationCard"));
|
48
|
+
const ConversationOption_1 = __importDefault(require("./components/ConversationOption"));
|
49
|
+
const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/MaterialIcons"));
|
50
|
+
const contact_slice_1 = require("../../slice/contact/contact.slice");
|
51
|
+
const List = ({ navigation }) => {
|
52
|
+
const { t } = (0, useTranslation_1.default)();
|
53
|
+
const { connectStatus, conversations, onlineMap } = (0, useImSelector_1.useConversation)();
|
54
|
+
const [nativeEvent, setNativeEvent] = (0, react_1.useState)();
|
55
|
+
const [popoverVisible, setPopoverVisible] = (0, react_1.useState)(false);
|
56
|
+
const [conversation, setConversation] = (0, react_1.useState)();
|
57
|
+
(0, react_1.useEffect)(() => {
|
58
|
+
let headerTitle = t('message');
|
59
|
+
switch (connectStatus) {
|
60
|
+
case im_base_1.ConnectStatus.CONNECTING:
|
61
|
+
headerTitle = () => <IndicatorText_1.default text={t('connecting') + '...'}/>;
|
62
|
+
break;
|
63
|
+
case im_base_1.ConnectStatus.CONNECT_PARAM_ERROR:
|
64
|
+
headerTitle = t('connectFail');
|
65
|
+
break;
|
66
|
+
case im_base_1.ConnectStatus.CONNECT_ERROR:
|
67
|
+
headerTitle = t('serverConnectionFailed');
|
68
|
+
break;
|
69
|
+
case im_base_1.ConnectStatus.CONNECT_TIMEOUT:
|
70
|
+
headerTitle = t('serverConnectionTimeout');
|
71
|
+
break;
|
72
|
+
case im_base_1.ConnectStatus.SYNC_SUBSCRIBE_LIST:
|
73
|
+
headerTitle = () => <IndicatorText_1.default text={t('receipting') + '...'}/>;
|
74
|
+
break;
|
75
|
+
case im_base_1.ConnectStatus.UN_CONNECT:
|
76
|
+
headerTitle = t('message') + '(' + t('unConnect') + ')';
|
77
|
+
break;
|
78
|
+
}
|
79
|
+
navigation.setOptions({
|
80
|
+
headerTitle,
|
81
|
+
headerRight: () => (<rn_ui_1.Popover type="dark" placement="bottom" layout="vertical" duration={100} options={[
|
82
|
+
{
|
83
|
+
icon: <MaterialIcons_1.default name="person-add"/>,
|
84
|
+
content: t('createGroupChat'),
|
85
|
+
onPress: () => {
|
86
|
+
(0, init_1.getImManager)().store.dispatch((0, contact_slice_1.startCreateGroup)());
|
87
|
+
navigation.navigate('ChooseContact', {
|
88
|
+
chooseOrg: true,
|
89
|
+
checkMode: 'multi',
|
90
|
+
});
|
91
|
+
},
|
92
|
+
},
|
93
|
+
{
|
94
|
+
icon: <MaterialIcons_1.default name="qr-code-scanner"/>,
|
95
|
+
content: t('scan'),
|
96
|
+
onPress: () => {
|
97
|
+
navigation.navigate('ScanCode');
|
98
|
+
},
|
99
|
+
},
|
100
|
+
]} contentStyle={{ borderRadius: (0, rn_ui_1.dp)(6) }}>
|
101
|
+
<react_native_1.TouchableOpacity style={{ marginHorizontal: (0, rn_ui_1.dp)(10), padding: (0, rn_ui_1.dp)(9) }}>
|
102
|
+
<rn_ui_1.CaihIcon name="picker-add" size={(0, rn_ui_1.dp)(19)} color={'#f6f6f6'}/>
|
103
|
+
</react_native_1.TouchableOpacity>
|
104
|
+
</rn_ui_1.Popover>),
|
105
|
+
});
|
106
|
+
}, [t, navigation, connectStatus]);
|
107
|
+
const handleSearch = () => {
|
108
|
+
navigation.navigate('Search');
|
109
|
+
};
|
110
|
+
const onPressCard = (conversation) => __awaiter(void 0, void 0, void 0, function* () {
|
111
|
+
setPopoverVisible(false);
|
112
|
+
try {
|
113
|
+
// 设置更新已读数量
|
114
|
+
const imManager = (0, init_1.getImManager)();
|
115
|
+
yield imManager.store.dispatch(im_base_1.ConversationActions.initConversation(imManager, conversation));
|
116
|
+
navigation.navigate('MessageList');
|
117
|
+
}
|
118
|
+
catch (e) {
|
119
|
+
console.log('e: ', e);
|
120
|
+
}
|
121
|
+
});
|
122
|
+
const onLongPressCard = (conversation, nativeEvent) => {
|
123
|
+
react_native_1.Vibration.vibrate(10);
|
124
|
+
setPopoverVisible(true);
|
125
|
+
setNativeEvent(nativeEvent);
|
126
|
+
setConversation(conversation);
|
127
|
+
};
|
128
|
+
const listHeaderComponent = () => (<>
|
129
|
+
<rn_ui_1.SearchBar onSearch={handleSearch} style={styles.searchBar}/>
|
130
|
+
<react_native_1.View style={styles.line}/>
|
131
|
+
{connectStatus === im_base_1.ConnectStatus.CONNECT_ERROR && (<>
|
132
|
+
<NetworkUnconnected_1.default />
|
133
|
+
<react_native_1.View style={styles.line}/>
|
134
|
+
</>)}
|
135
|
+
{/*{TenantConfig.config.showOrgChat && <OrgGroupBar onPressOrgGroupBar={onPressOrgGroupBar} />}*/}
|
136
|
+
<react_native_1.View style={styles.line}/>
|
137
|
+
</>);
|
138
|
+
const listFooterComponent = () => <react_native_1.View style={styles.line}/>;
|
139
|
+
const keyExtractor = (item) => item.id;
|
140
|
+
const renderItem = ({ item }) => {
|
141
|
+
return (
|
142
|
+
// @ts-ignore
|
143
|
+
<ConversationCard_1.default selected={item.id === (conversation === null || conversation === void 0 ? void 0 : conversation.id)} conversation={item} onPressCard={onPressCard} onLongPressCard={onLongPressCard} status={onlineMap[item.id]}/>);
|
144
|
+
};
|
145
|
+
const itemSeparatorComponent = ({ leadingItem }) => {
|
146
|
+
for (let i = 0; i < conversations.length; i++) {
|
147
|
+
if (conversations[i].enableTop === 'off') {
|
148
|
+
break;
|
149
|
+
}
|
150
|
+
if (leadingItem.id === conversations[i].id && conversations[i].enableTop === 'on') {
|
151
|
+
return (<react_native_1.View style={styles.separatorBg}>
|
152
|
+
<react_native_1.View style={styles.separator}/>
|
153
|
+
</react_native_1.View>);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
return <react_native_1.View style={styles.separator}/>;
|
157
|
+
};
|
158
|
+
const getItemLayout = (_, index) => ({
|
159
|
+
length: (0, rn_ui_1.dp)(81),
|
160
|
+
offset: (0, rn_ui_1.dp)(81) * index + (0, rn_ui_1.dp)(57),
|
161
|
+
index,
|
162
|
+
});
|
163
|
+
return (<react_native_1.View style={{ flex: 1 }}>
|
164
|
+
<react_native_1.FlatList contentContainerStyle={styles.contentContainerStyle} keyboardShouldPersistTaps={'handled'} data={conversations} ListHeaderComponent={listHeaderComponent} ListFooterComponent={listFooterComponent} ItemSeparatorComponent={itemSeparatorComponent} getItemLayout={getItemLayout} renderItem={renderItem} numColumns={1} keyExtractor={keyExtractor}/>
|
165
|
+
<ConversationOption_1.default conversation={conversation} nativeEvent={nativeEvent} visible={popoverVisible} onClose={() => {
|
166
|
+
setPopoverVisible(false);
|
167
|
+
setConversation(undefined);
|
168
|
+
}}/>
|
169
|
+
</react_native_1.View>);
|
170
|
+
};
|
171
|
+
const styles = react_native_1.StyleSheet.create({
|
172
|
+
contentContainerStyle: {
|
173
|
+
backgroundColor: '#fff',
|
174
|
+
},
|
175
|
+
searchBar: {
|
176
|
+
marginHorizontal: (0, rn_ui_1.dp)(10),
|
177
|
+
marginVertical: (0, rn_ui_1.dp)(10),
|
178
|
+
},
|
179
|
+
line: {
|
180
|
+
height: (0, rn_ui_1.dp)(1),
|
181
|
+
backgroundColor: '#ececec',
|
182
|
+
},
|
183
|
+
separator: {
|
184
|
+
marginLeft: (0, rn_ui_1.dp)(80),
|
185
|
+
height: (0, rn_ui_1.dp)(1),
|
186
|
+
backgroundColor: '#ececec',
|
187
|
+
},
|
188
|
+
separatorBg: {
|
189
|
+
backgroundColor: '#f2f2f2',
|
190
|
+
},
|
191
|
+
backButton: {
|
192
|
+
backgroundColor: '#ddd',
|
193
|
+
height: (0, rn_ui_1.dp)(50),
|
194
|
+
width: (0, rn_ui_1.dp)(50),
|
195
|
+
borderRadius: (0, rn_ui_1.dp)(25),
|
196
|
+
opacity: 0.5,
|
197
|
+
justifyContent: 'center',
|
198
|
+
alignItems: 'center',
|
199
|
+
position: 'absolute',
|
200
|
+
bottom: (0, rn_ui_1.dp)(15),
|
201
|
+
right: (0, rn_ui_1.dp)(15),
|
202
|
+
},
|
203
|
+
});
|
204
|
+
exports.default = List;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { IConversation } from '@smart-link/im-base';
|
2
|
+
import React from 'react';
|
3
|
+
import { NativeTouchEvent } from 'react-native';
|
4
|
+
declare const ConversationCard: React.NamedExoticComponent<ConversationCardProps>;
|
5
|
+
export interface ConversationCardProps {
|
6
|
+
status?: 'online' | 'offline';
|
7
|
+
selected?: boolean;
|
8
|
+
conversation: IConversation;
|
9
|
+
onPressCard?: (conversation: IConversation) => void;
|
10
|
+
onLongPressCard?: (conversation: IConversation, event: NativeTouchEvent) => void;
|
11
|
+
}
|
12
|
+
export default ConversationCard;
|
@@ -0,0 +1,142 @@
|
|
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
|
+
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 im_base_1 = require("@smart-link/im-base");
|
30
|
+
const rn_ui_1 = require("@smart-link/rn-ui");
|
31
|
+
const react_1 = __importStar(require("react"));
|
32
|
+
const react_native_1 = require("react-native");
|
33
|
+
const FontAwesome5_1 = __importDefault(require("react-native-vector-icons/FontAwesome5"));
|
34
|
+
const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/MaterialIcons"));
|
35
|
+
const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar/ChatAvatar"));
|
36
|
+
const useFormatMsgTime_1 = __importDefault(require("../../../hooks/useFormatMsgTime"));
|
37
|
+
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
38
|
+
const ConversationCard = (0, react_1.memo)(props => {
|
39
|
+
const { status, selected, conversation, onPressCard, onLongPressCard } = props;
|
40
|
+
const { t } = (0, useTranslation_1.default)();
|
41
|
+
const { id, type, avatars, name, text, draftText, errorText, enableNoDisturb, enableTop, tipsList, time, unreadCount } = conversation;
|
42
|
+
const enableTopStyles = enableTop === 'on' ? styles.enableTop : null;
|
43
|
+
const showPoint = enableNoDisturb === 'on' && unreadCount > 0;
|
44
|
+
const countText = showPoint && unreadCount > 0 ? t('unreadCount', { unreadCount }) : '';
|
45
|
+
const content = (0, im_base_1.getConversationContent)(text, errorText, draftText, tipsList, countText, t);
|
46
|
+
const contentStyles = content.tips ? styles.contentRedStyles : null;
|
47
|
+
const formatTime = (0, useFormatMsgTime_1.default)(time, true);
|
48
|
+
return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={[styles.card, enableTopStyles, selected && styles.selected]} onPress={() => {
|
49
|
+
onPressCard && onPressCard(conversation);
|
50
|
+
}} onLongPress={({ nativeEvent }) => {
|
51
|
+
onLongPressCard && onLongPressCard(conversation, nativeEvent);
|
52
|
+
}}>
|
53
|
+
<react_native_1.View style={{ height: (0, rn_ui_1.dp)(50), width: (0, rn_ui_1.dp)(50), marginRight: (0, rn_ui_1.dp)(16) }}>
|
54
|
+
<rn_ui_1.Badge text={unreadCount} dot={showPoint}>
|
55
|
+
<ChatAvatar_1.default disabled type={type} id={id} size={(0, rn_ui_1.dp)(48)} name={name} url={avatars}/>
|
56
|
+
</rn_ui_1.Badge>
|
57
|
+
{status && <react_native_1.View style={styles.status}>
|
58
|
+
<MaterialIcons_1.default size={(0, rn_ui_1.dp)(14)} color={status === 'online' ? '#4caf50' : '#616161'} name={status === 'online' ? 'check-circle' : 'not-interested'}/>
|
59
|
+
</react_native_1.View>}
|
60
|
+
</react_native_1.View>
|
61
|
+
|
62
|
+
<react_native_1.View style={{ flexDirection: 'column', flex: 1 }}>
|
63
|
+
<react_native_1.View style={styles.swipe}>
|
64
|
+
<react_native_1.Text style={styles.name} numberOfLines={1}>
|
65
|
+
{name}
|
66
|
+
</react_native_1.Text>
|
67
|
+
<react_native_1.Text style={styles.time}>{formatTime}</react_native_1.Text>
|
68
|
+
</react_native_1.View>
|
69
|
+
|
70
|
+
<react_native_1.View style={styles.row}>
|
71
|
+
<react_native_1.Text style={styles.message} numberOfLines={1}>
|
72
|
+
<react_native_1.Text style={contentStyles}>{content.tips}</react_native_1.Text>
|
73
|
+
{content.text}
|
74
|
+
</react_native_1.Text>
|
75
|
+
{enableNoDisturb === 'on' && (<FontAwesome5_1.default name={'bell-slash'} size={(0, rn_ui_1.dp)(12)} color={'#999'} style={styles.enableNoDisturb}/>)}
|
76
|
+
{enableTop === 'on' && (<MaterialIcons_1.default name={'push-pin'} size={(0, rn_ui_1.dp)(15)} color={'#999'} style={styles.enableNoDisturb}/>)}
|
77
|
+
</react_native_1.View>
|
78
|
+
</react_native_1.View>
|
79
|
+
</react_native_1.TouchableOpacity>);
|
80
|
+
});
|
81
|
+
const styles = react_native_1.StyleSheet.create({
|
82
|
+
card: {
|
83
|
+
height: (0, rn_ui_1.dp)(80),
|
84
|
+
padding: (0, rn_ui_1.dp)(16),
|
85
|
+
display: 'flex',
|
86
|
+
flexDirection: 'row',
|
87
|
+
},
|
88
|
+
selected: {
|
89
|
+
backgroundColor: '#f1f1f1',
|
90
|
+
},
|
91
|
+
enableTop: {
|
92
|
+
backgroundColor: '#f2f2f2',
|
93
|
+
borderColor: '#e9e9e9',
|
94
|
+
},
|
95
|
+
row: {
|
96
|
+
flexDirection: 'row',
|
97
|
+
alignItems: 'center',
|
98
|
+
},
|
99
|
+
name: {
|
100
|
+
fontSize: (0, rn_ui_1.dp)(15),
|
101
|
+
fontWeight: '500',
|
102
|
+
color: '#333333',
|
103
|
+
flex: 1,
|
104
|
+
},
|
105
|
+
time: {
|
106
|
+
fontSize: (0, rn_ui_1.dp)(12),
|
107
|
+
color: '#999999',
|
108
|
+
},
|
109
|
+
message: {
|
110
|
+
fontSize: (0, rn_ui_1.dp)(13),
|
111
|
+
color: '#999999',
|
112
|
+
flex: 1,
|
113
|
+
},
|
114
|
+
enableNoDisturb: {
|
115
|
+
color: '#999999',
|
116
|
+
},
|
117
|
+
contentRedStyles: {
|
118
|
+
color: '#ff4949',
|
119
|
+
},
|
120
|
+
swipe: {
|
121
|
+
flex: 1,
|
122
|
+
flexDirection: 'row',
|
123
|
+
justifyContent: 'space-between',
|
124
|
+
alignItems: 'center',
|
125
|
+
},
|
126
|
+
swipeDel: {
|
127
|
+
justifyContent: 'center',
|
128
|
+
width: (0, rn_ui_1.dp)(75),
|
129
|
+
backgroundColor: '#ff4949',
|
130
|
+
},
|
131
|
+
swipeDelText: {
|
132
|
+
color: '#FFF',
|
133
|
+
},
|
134
|
+
status: {
|
135
|
+
position: 'absolute',
|
136
|
+
right: 2,
|
137
|
+
bottom: 2,
|
138
|
+
backgroundColor: '#fff',
|
139
|
+
borderRadius: (0, rn_ui_1.dp)(10),
|
140
|
+
}
|
141
|
+
});
|
142
|
+
exports.default = ConversationCard;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { NativeTouchEvent } from 'react-native';
|
3
|
+
import { IConversation } from '@smart-link/im-base';
|
4
|
+
type ConversationOptionProps = {
|
5
|
+
conversation?: IConversation;
|
6
|
+
nativeEvent?: NativeTouchEvent;
|
7
|
+
visible: boolean;
|
8
|
+
onClose: () => void;
|
9
|
+
};
|
10
|
+
declare const _default: React.MemoExoticComponent<({ conversation, nativeEvent, onClose, visible, }: ConversationOptionProps) => React.JSX.Element>;
|
11
|
+
export default _default;
|
@@ -0,0 +1,99 @@
|
|
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
|
+
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 init_1 = require("../../../init");
|
34
|
+
const PopoverWrapper_1 = __importDefault(require("../../../components/PopoverWrapper"));
|
35
|
+
const renderMenuItem = (title, onPress) => <react_native_1.TouchableOpacity activeOpacity={0.5} onPress={onPress}>
|
36
|
+
<react_native_1.Text style={styles.text}>{title}</react_native_1.Text>
|
37
|
+
</react_native_1.TouchableOpacity>;
|
38
|
+
const ConversationOption = ({ conversation, nativeEvent, onClose, visible, }) => {
|
39
|
+
const { t } = (0, useTranslation_1.default)();
|
40
|
+
let read, disturb, top;
|
41
|
+
if (conversation === null || conversation === void 0 ? void 0 : conversation.unreadCount) {
|
42
|
+
read = renderMenuItem(t('markRead'), () => {
|
43
|
+
(0, init_1.getImManager)().markRead(conversation);
|
44
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
45
|
+
});
|
46
|
+
}
|
47
|
+
else {
|
48
|
+
read = renderMenuItem(t('markUnread'), () => {
|
49
|
+
(0, init_1.getImManager)().markUnread(conversation);
|
50
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
51
|
+
});
|
52
|
+
}
|
53
|
+
if ((conversation === null || conversation === void 0 ? void 0 : conversation.enableNoDisturb) === 'off') {
|
54
|
+
disturb = renderMenuItem(t('chatNoDisturbOn'), () => {
|
55
|
+
(0, init_1.getImManager)().noDisturbOn(conversation);
|
56
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
57
|
+
});
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
disturb = renderMenuItem(t('chatNoDisturbOff'), () => {
|
61
|
+
(0, init_1.getImManager)().noDisturbOff(conversation);
|
62
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
63
|
+
});
|
64
|
+
}
|
65
|
+
if ((conversation === null || conversation === void 0 ? void 0 : conversation.enableTop) === 'off') {
|
66
|
+
top = renderMenuItem(t('chatTopOn'), () => {
|
67
|
+
(0, init_1.getImManager)().topOn(conversation);
|
68
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
69
|
+
});
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
top = renderMenuItem(t('chatTopOff'), () => {
|
73
|
+
(0, init_1.getImManager)().topOff(conversation);
|
74
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
75
|
+
});
|
76
|
+
}
|
77
|
+
const del = renderMenuItem(t('deleteChat'), () => {
|
78
|
+
(0, init_1.getImManager)().deleteConversation(conversation);
|
79
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
80
|
+
});
|
81
|
+
return (<PopoverWrapper_1.default showArrow={false} measureTarget={false} visible={visible} onClose={onClose} nativeEvent={nativeEvent}>
|
82
|
+
{read}
|
83
|
+
<rn_ui_1.Line />
|
84
|
+
{disturb}
|
85
|
+
<rn_ui_1.Line />
|
86
|
+
{top}
|
87
|
+
<rn_ui_1.Line />
|
88
|
+
{del}
|
89
|
+
</PopoverWrapper_1.default>);
|
90
|
+
};
|
91
|
+
exports.default = (0, react_1.memo)(ConversationOption);
|
92
|
+
const styles = react_native_1.StyleSheet.create({
|
93
|
+
text: {
|
94
|
+
color: '#555',
|
95
|
+
fontSize: (0, rn_ui_1.dp)(15),
|
96
|
+
paddingHorizontal: (0, rn_ui_1.dp)(12),
|
97
|
+
paddingVertical: (0, rn_ui_1.dp)(12),
|
98
|
+
},
|
99
|
+
});
|