@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,92 @@
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
35
|
+
var t = {};
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
37
|
+
t[p] = s[p];
|
38
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
39
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
40
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
41
|
+
t[p[i]] = s[p[i]];
|
42
|
+
}
|
43
|
+
return t;
|
44
|
+
};
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
47
|
+
};
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
49
|
+
const React = __importStar(require("react"));
|
50
|
+
const useImSelector_1 = require("../../hooks/useImSelector");
|
51
|
+
const react_1 = require("react");
|
52
|
+
const init_1 = require("../../init");
|
53
|
+
const ChatAvatarLocal_1 = __importDefault(require("./ChatAvatarLocal"));
|
54
|
+
const user_1 = require("../../api/user");
|
55
|
+
const ChatAvatarId = (_a) => {
|
56
|
+
var { id, fileId: fileIdProp, priority } = _a, ret = __rest(_a, ["id", "fileId", "priority"]);
|
57
|
+
const avatars = (0, useImSelector_1.useAvatars)();
|
58
|
+
const [fileId, setFileId] = (0, react_1.useState)(fileIdProp);
|
59
|
+
const newFileId = avatars[id];
|
60
|
+
// console.log('ChatAvatarId: ', ret.name, newFileId,)
|
61
|
+
(0, react_1.useEffect)(() => {
|
62
|
+
if (priority === 'outside' && fileIdProp) {
|
63
|
+
setFileId(fileIdProp);
|
64
|
+
(0, init_1.getImManager)().updateAvatar({ avatarsId: id, url: fileIdProp });
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
(0, init_1.getImManager)().loadAvatarFromCache(id).then((cacheFileId) => __awaiter(void 0, void 0, void 0, function* () {
|
68
|
+
// console.log('ChatAvatarId cacheFileId: ', ret.name, cacheFileId,)
|
69
|
+
if (!cacheFileId) {
|
70
|
+
try {
|
71
|
+
// 通过接口请求头像
|
72
|
+
const { data: [user] } = yield (0, user_1.queryUserByIds)([id]);
|
73
|
+
if (user === null || user === void 0 ? void 0 : user.avatars) {
|
74
|
+
setFileId(user.avatars);
|
75
|
+
(0, init_1.getImManager)().updateAvatar({ avatarsId: id, url: user.avatars });
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
setFileId('');
|
79
|
+
}
|
80
|
+
}
|
81
|
+
catch (e) {
|
82
|
+
console.log('queryUserByIds error: ', e);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
setFileId(cacheFileId);
|
87
|
+
}
|
88
|
+
}));
|
89
|
+
}, [id, priority, newFileId, fileIdProp]);
|
90
|
+
return (<ChatAvatarLocal_1.default fileId={fileId} {...ret}/>);
|
91
|
+
};
|
92
|
+
exports.default = ChatAvatarId;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface ChatAvatarProps {
|
3
|
+
fileId?: string;
|
4
|
+
size: number;
|
5
|
+
name?: string;
|
6
|
+
defaultAvatar?: any;
|
7
|
+
}
|
8
|
+
declare const ChatAvatarLocal: ({ fileId, size, name, defaultAvatar }: ChatAvatarProps) => React.JSX.Element;
|
9
|
+
export default ChatAvatarLocal;
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const react_1 = __importDefault(require("react"));
|
16
|
+
const react_native_1 = require("react-native");
|
17
|
+
const rn_ui_1 = require("@smart-link/rn-ui");
|
18
|
+
const react_2 = require("react");
|
19
|
+
const init_1 = require("../../init");
|
20
|
+
const file_1 = require("../../utils/file");
|
21
|
+
const react_native_fs_1 = __importDefault(require("react-native-fs"));
|
22
|
+
;
|
23
|
+
// 防止重复下载
|
24
|
+
const downloadMap = Object.create(null);
|
25
|
+
const ChatAvatarLocal = ({ fileId, size, name, defaultAvatar }) => {
|
26
|
+
const [avatar, setAvatar] = (0, react_2.useState)('');
|
27
|
+
const loadAvatar = () => __awaiter(void 0, void 0, void 0, function* () {
|
28
|
+
console.log('loadResourceFromCache: ', fileId);
|
29
|
+
if (fileId) {
|
30
|
+
const imManager = (0, init_1.getImManager)();
|
31
|
+
const localPath = yield imManager.loadResourceFromCache(fileId);
|
32
|
+
console.log('loadResourceFromCache: ', localPath);
|
33
|
+
if (localPath) {
|
34
|
+
const exists = yield react_native_fs_1.default.exists(localPath);
|
35
|
+
if (exists) {
|
36
|
+
setAvatar((0, file_1.toAbsolutePath)(localPath));
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
if (downloadMap[fileId]) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
downloadMap[fileId] = true;
|
44
|
+
try {
|
45
|
+
console.log('imManager.download: ', fileId, Number.isNaN(Number(fileId)));
|
46
|
+
if (Number.isNaN(Number(fileId))) {
|
47
|
+
// 下载头像文件
|
48
|
+
const localPath = yield imManager.download({
|
49
|
+
fileId,
|
50
|
+
filename: `${fileId}.jpg`,
|
51
|
+
resourceType: 'avatars',
|
52
|
+
});
|
53
|
+
setAvatar((0, file_1.toAbsolutePath)(localPath));
|
54
|
+
// 更新资源
|
55
|
+
imManager.updateResource({
|
56
|
+
url: fileId,
|
57
|
+
localPath,
|
58
|
+
});
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
setAvatar(fileId);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
catch (e) {
|
65
|
+
downloadMap[fileId] = false;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
});
|
69
|
+
(0, react_2.useEffect)(() => {
|
70
|
+
loadAvatar();
|
71
|
+
}, [fileId]);
|
72
|
+
return (<rn_ui_1.Avatar src={avatar} icon={<react_native_1.Image style={{ width: size, height: size }} source={defaultAvatar}/>} style={size ? { width: size, height: size } : {}}>
|
73
|
+
{name === null || name === void 0 ? void 0 : name[0]}
|
74
|
+
</rn_ui_1.Avatar>);
|
75
|
+
};
|
76
|
+
exports.default = ChatAvatarLocal;
|
@@ -0,0 +1,23 @@
|
|
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 __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.default = void 0;
|
21
|
+
var ChatAvatar_1 = require("./ChatAvatar");
|
22
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ChatAvatar_1).default; } });
|
23
|
+
__exportStar(require("./ChatAvatar"), exports);
|
@@ -0,0 +1,74 @@
|
|
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 react_1 = __importStar(require("react"));
|
39
|
+
const react_native_fast_image_1 = __importDefault(require("react-native-fast-image"));
|
40
|
+
const Favicon = ({ url, size = 40 }) => {
|
41
|
+
const [favicon, setFavicon] = react_1.default.useState();
|
42
|
+
(0, react_1.useEffect)(() => {
|
43
|
+
if (!url)
|
44
|
+
return;
|
45
|
+
getFavicon(url).then((favicon) => {
|
46
|
+
console.log('favicon: ', favicon);
|
47
|
+
setFavicon(favicon);
|
48
|
+
});
|
49
|
+
}, [url]);
|
50
|
+
return (<react_native_fast_image_1.default style={{ width: size, height: size }} source={favicon ? { uri: favicon } : {}}/>);
|
51
|
+
};
|
52
|
+
const faviconCache = new Map();
|
53
|
+
const getFavicon = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
54
|
+
var _a;
|
55
|
+
// 手动解析 URL 的 origin
|
56
|
+
const urlParts = url.match(/^(https?:\/\/[^\/?#]+)/);
|
57
|
+
const origin = urlParts ? urlParts[0] : '';
|
58
|
+
if (faviconCache.has(origin)) {
|
59
|
+
return faviconCache.get(origin);
|
60
|
+
}
|
61
|
+
const response = yield fetch(url);
|
62
|
+
if (!response.ok) {
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
const html = yield response.text();
|
66
|
+
const favicon = (_a = html.match(/<link.*?rel=".*icon".*?href="(.*?)"/)) === null || _a === void 0 ? void 0 : _a[1];
|
67
|
+
if (favicon) {
|
68
|
+
let icon = favicon.startsWith('http') ? favicon : origin + favicon;
|
69
|
+
faviconCache.set(origin, icon);
|
70
|
+
return icon;
|
71
|
+
}
|
72
|
+
return null;
|
73
|
+
});
|
74
|
+
exports.default = (0, react_1.memo)(Favicon);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { TextProps } from "react-native";
|
3
|
+
export interface FormatTimeTextProps extends TextProps {
|
4
|
+
time: number;
|
5
|
+
showDetail?: boolean;
|
6
|
+
}
|
7
|
+
declare const FormatTimeText: React.FC<FormatTimeTextProps>;
|
8
|
+
export default FormatTimeText;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
3
|
+
var t = {};
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
+
t[p] = s[p];
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
+
t[p[i]] = s[p[i]];
|
10
|
+
}
|
11
|
+
return t;
|
12
|
+
};
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
const react_1 = __importDefault(require("react"));
|
18
|
+
const react_native_1 = require("react-native");
|
19
|
+
const useFormatMsgTime_1 = __importDefault(require("../hooks/useFormatMsgTime"));
|
20
|
+
const FormatTimeText = (_a) => {
|
21
|
+
var { time, showDetail = true } = _a, retProps = __rest(_a, ["time", "showDetail"]);
|
22
|
+
return <react_native_1.Text {...retProps}>{(0, useFormatMsgTime_1.default)(time, showDetail)}</react_native_1.Text>;
|
23
|
+
};
|
24
|
+
exports.default = FormatTimeText;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TextStyle } from 'react-native';
|
3
|
+
type HighlighterProps = {
|
4
|
+
style?: TextStyle;
|
5
|
+
searchWord: string;
|
6
|
+
textToHighlight: string;
|
7
|
+
};
|
8
|
+
declare const _default: React.MemoExoticComponent<({ style, searchWord, textToHighlight }: HighlighterProps) => React.JSX.Element>;
|
9
|
+
export default _default;
|
@@ -0,0 +1,42 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
const rn_ui_1 = require("@smart-link/rn-ui");
|
27
|
+
const react_1 = __importStar(require("react"));
|
28
|
+
const react_native_1 = require("react-native");
|
29
|
+
const Highlighter = ({ style, searchWord, textToHighlight }) => {
|
30
|
+
const theme = (0, rn_ui_1.useTheme)();
|
31
|
+
// 高亮显示搜索关键字
|
32
|
+
return (<react_native_1.Text style={style}>
|
33
|
+
{textToHighlight.split(new RegExp(`(${searchWord})`, 'gi')).map((part, index) => {
|
34
|
+
return part.toLowerCase() === searchWord.toLowerCase() ? (<react_native_1.Text key={index} style={{
|
35
|
+
color: theme.primaryColor,
|
36
|
+
}}>
|
37
|
+
{part}
|
38
|
+
</react_native_1.Text>) : (part);
|
39
|
+
})}
|
40
|
+
</react_native_1.Text>);
|
41
|
+
};
|
42
|
+
exports.default = (0, react_1.memo)(Highlighter);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface IndicatorTextProps {
|
3
|
+
text: string;
|
4
|
+
loadingColor?: string;
|
5
|
+
fontSize?: number;
|
6
|
+
color?: string;
|
7
|
+
style?: object;
|
8
|
+
}
|
9
|
+
declare const IndicatorText: React.NamedExoticComponent<IndicatorTextProps>;
|
10
|
+
export default IndicatorText;
|
@@ -0,0 +1,47 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
const rn_ui_1 = require("@smart-link/rn-ui");
|
27
|
+
const react_1 = __importStar(require("react"));
|
28
|
+
const react_native_1 = require("react-native");
|
29
|
+
const IndicatorText = (0, react_1.memo)(props => {
|
30
|
+
const { text, loadingColor = '#fff', fontSize = (0, rn_ui_1.dp)(18), color = '#fff', style } = props;
|
31
|
+
return (<react_native_1.View style={[styles.indicatorText, style]}>
|
32
|
+
<react_native_1.ActivityIndicator size="small" color={loadingColor} animating={true}/>
|
33
|
+
<react_native_1.Text numberOfLines={1} style={[styles.text, { fontSize, color }]}>
|
34
|
+
{text}
|
35
|
+
</react_native_1.Text>
|
36
|
+
</react_native_1.View>);
|
37
|
+
});
|
38
|
+
const styles = react_native_1.StyleSheet.create({
|
39
|
+
indicatorText: {
|
40
|
+
flexDirection: 'row',
|
41
|
+
},
|
42
|
+
text: {
|
43
|
+
maxWidth: (0, rn_ui_1.dp)(280),
|
44
|
+
marginLeft: (0, rn_ui_1.dp)(5),
|
45
|
+
},
|
46
|
+
});
|
47
|
+
exports.default = IndicatorText;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ImageStyle, StyleProp } from 'react-native';
|
3
|
+
import { ImageResizeMode } from 'react-native/Libraries/Image/ImageResizeMode';
|
4
|
+
declare const LocalImage: React.NamedExoticComponent<LocalImageProps>;
|
5
|
+
export interface LocalImageProps {
|
6
|
+
style?: StyleProp<ImageStyle>;
|
7
|
+
resizeMode?: ImageResizeMode;
|
8
|
+
localPath: string;
|
9
|
+
}
|
10
|
+
export default LocalImage;
|
@@ -0,0 +1,37 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
const react_1 = __importStar(require("react"));
|
27
|
+
const react_native_1 = require("react-native");
|
28
|
+
const file_1 = require("../utils/file");
|
29
|
+
const LocalImage = (0, react_1.memo)(props => {
|
30
|
+
const { style, resizeMode, localPath } = props;
|
31
|
+
let source = localPath;
|
32
|
+
if (Object.prototype.toString.call(localPath) === '[object String]') {
|
33
|
+
source = { uri: (0, file_1.toAbsolutePath)(localPath) };
|
34
|
+
}
|
35
|
+
return <react_native_1.Image style={style} resizeMode={resizeMode} source={source}/>;
|
36
|
+
});
|
37
|
+
exports.default = LocalImage;
|
@@ -0,0 +1,55 @@
|
|
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 rn_ui_1 = require("@smart-link/rn-ui");
|
30
|
+
const react_1 = __importStar(require("react"));
|
31
|
+
const react_native_1 = require("react-native");
|
32
|
+
const useTranslation_1 = __importDefault(require("../hooks/useTranslation"));
|
33
|
+
const NetworkUnconnected = (0, react_1.memo)(() => {
|
34
|
+
const { t } = (0, useTranslation_1.default)();
|
35
|
+
return (<react_native_1.View style={styles.network}>
|
36
|
+
<react_native_1.Text style={styles.text} numberOfLines={1}>
|
37
|
+
{t('checkNetwork')}
|
38
|
+
</react_native_1.Text>
|
39
|
+
</react_native_1.View>);
|
40
|
+
});
|
41
|
+
const styles = react_native_1.StyleSheet.create({
|
42
|
+
network: {
|
43
|
+
flexDirection: 'row',
|
44
|
+
paddingVertical: (0, rn_ui_1.dp)(10),
|
45
|
+
backgroundColor: '#feebeb',
|
46
|
+
justifyContent: 'center',
|
47
|
+
},
|
48
|
+
text: {
|
49
|
+
color: '#666',
|
50
|
+
lineHeight: (0, rn_ui_1.dp)(21),
|
51
|
+
alignItems: 'center',
|
52
|
+
justifyContent: 'center',
|
53
|
+
},
|
54
|
+
});
|
55
|
+
exports.default = NetworkUnconnected;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { NativeTouchEvent } from 'react-native';
|
3
|
+
type PopoverWrapperProps = {
|
4
|
+
visible: boolean;
|
5
|
+
showArrow: boolean;
|
6
|
+
fullscreen?: boolean;
|
7
|
+
measureTarget?: boolean;
|
8
|
+
nativeEvent?: NativeTouchEvent;
|
9
|
+
children: React.ReactNode;
|
10
|
+
onClose: () => void;
|
11
|
+
};
|
12
|
+
declare const _default: React.MemoExoticComponent<({ showArrow, measureTarget, visible, fullscreen, nativeEvent, children, onClose }: PopoverWrapperProps) => React.JSX.Element>;
|
13
|
+
export default _default;
|
@@ -0,0 +1,78 @@
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
const react_1 = __importStar(require("react"));
|
27
|
+
const react_native_1 = require("react-native");
|
28
|
+
const popover_1 = require("@smart-link/rn-ui/dist/components/popover");
|
29
|
+
const rn_ui_1 = require("@smart-link/rn-ui");
|
30
|
+
const elements_1 = require("@react-navigation/elements");
|
31
|
+
const PopoverWrapper = ({ showArrow = true, measureTarget = true, visible, fullscreen, nativeEvent, children, onClose }) => {
|
32
|
+
var _a, _b;
|
33
|
+
const { height, width } = react_native_1.Dimensions.get('window');
|
34
|
+
const headerHeight = (0, elements_1.useHeaderHeight)();
|
35
|
+
const [contentHeight, setContentHeight] = (0, react_1.useState)(0);
|
36
|
+
const [fromRect, setFromRect] = (0, react_1.useState)({ x: (_a = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX) !== null && _a !== void 0 ? _a : 0,
|
37
|
+
y: (_b = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageY) !== null && _b !== void 0 ? _b : 0,
|
38
|
+
width: 0,
|
39
|
+
height: 0, });
|
40
|
+
const onLayout = (0, react_1.useCallback)((event) => {
|
41
|
+
setContentHeight(event.nativeEvent.layout.height);
|
42
|
+
}, []);
|
43
|
+
(0, react_1.useEffect)(() => {
|
44
|
+
if (!measureTarget && (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX)) {
|
45
|
+
setFromRect(prev => { var _a, _b; return (Object.assign(Object.assign({}, prev), { x: (_a = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageX) !== null && _a !== void 0 ? _a : 0, y: ((_b = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.pageY) !== null && _b !== void 0 ? _b : 0) - react_native_1.StatusBar.currentHeight })); });
|
46
|
+
}
|
47
|
+
if (!measureTarget || !(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target))
|
48
|
+
return;
|
49
|
+
const callback = (_x, _y, width, height, x, y) => {
|
50
|
+
setFromRect({
|
51
|
+
x,
|
52
|
+
y,
|
53
|
+
width,
|
54
|
+
height,
|
55
|
+
});
|
56
|
+
};
|
57
|
+
react_native_1.NativeModules.UIManager.measure(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target, callback);
|
58
|
+
}, [visible, measureTarget, nativeEvent]);
|
59
|
+
const padding = (0, rn_ui_1.dp)(12);
|
60
|
+
const viewHeight = height - react_native_1.StatusBar.currentHeight - 46 - 48 - padding * 2;
|
61
|
+
return (<popover_1.PopoverBase calculateStatusBar useNativeDriver showArrow={showArrow} duration={100} contentStyle={styles.content} backgroundStyle={styles.bg} visible={visible} fromRect={fromRect} placement={fromRect.y + contentHeight > viewHeight ? 'top' : 'bottom'} displayArea={measureTarget ? {
|
62
|
+
x: padding,
|
63
|
+
y: headerHeight,
|
64
|
+
width: width - padding * 2,
|
65
|
+
height: height - react_native_1.StatusBar.currentHeight - 46 - headerHeight - padding * 2,
|
66
|
+
} : undefined} onClose={onClose}>
|
67
|
+
<react_native_1.View onLayout={onLayout}>{children}</react_native_1.View>
|
68
|
+
</popover_1.PopoverBase>);
|
69
|
+
};
|
70
|
+
const styles = react_native_1.StyleSheet.create({
|
71
|
+
bg: {
|
72
|
+
backgroundColor: 'transparent',
|
73
|
+
},
|
74
|
+
content: {
|
75
|
+
borderRadius: (0, rn_ui_1.dp)(6),
|
76
|
+
},
|
77
|
+
});
|
78
|
+
exports.default = (0, react_1.memo)(PopoverWrapper);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const VideoPlayer: React.MemoExoticComponent<() => React.JSX.Element | null>;
|
3
|
+
export interface PlayBarProps {
|
4
|
+
paused: boolean;
|
5
|
+
currentTime: number;
|
6
|
+
duration: number;
|
7
|
+
onPause: () => void;
|
8
|
+
onResume: () => void;
|
9
|
+
onPressSeek: (value: number) => void;
|
10
|
+
onMoveSeek: (value: number) => void;
|
11
|
+
onReleaseSeek: (value: number) => void;
|
12
|
+
}
|
13
|
+
export default VideoPlayer;
|