@smart-link/rn-im 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/addressList.js +6 -17
- package/dist/api/backup.js +8 -20
- package/dist/api/file.js +6 -35
- package/dist/api/user.js +6 -16
- package/dist/components/CachedImage.js +14 -42
- package/dist/components/Camera/Camera.js +26 -54
- package/dist/components/Camera/CameraCapture.js +99 -128
- package/dist/components/Camera/CameraResult.js +33 -61
- package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
- package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
- package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
- package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
- package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
- package/dist/components/ChatAvatar/index.js +2 -23
- package/dist/components/Favicon.js +6 -34
- package/dist/components/FormatTimeText.js +5 -10
- package/dist/components/Highlighter.js +9 -34
- package/dist/components/IndicatorText.js +14 -39
- package/dist/components/LocalImage.js +7 -32
- package/dist/components/NetworkUnconnected.js +14 -42
- package/dist/components/PopoverWrapper.js +22 -47
- package/dist/components/VideoPlayer.js +111 -138
- package/dist/components/styles.js +10 -13
- package/dist/default-assets.d.ts +1 -0
- package/dist/default-assets.js +8 -10
- package/dist/hooks/useDownloadSource.js +7 -12
- package/dist/hooks/useFormatMsgTime.js +5 -13
- package/dist/hooks/useImReady.js +7 -10
- package/dist/hooks/useImSelector.js +34 -48
- package/dist/hooks/useTranslation.js +5 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -28
- package/dist/init.js +30 -40
- package/dist/interface.js +1 -2
- package/dist/locales/en/addressList.js +1 -3
- package/dist/locales/index.js +4 -27
- package/dist/locales/lao/addressList.js +1 -3
- package/dist/locales/zh/addressList.js +1 -3
- package/dist/pages/address-list/AddressList.js +33 -61
- package/dist/pages/address-list/CardInfo.js +10 -18
- package/dist/pages/address-list/ChooseContact.js +50 -78
- package/dist/pages/address-list/Icons.js +7 -14
- package/dist/pages/address-list/Organization.js +59 -89
- package/dist/pages/address-list/UserDetail.js +55 -83
- package/dist/pages/address-list/UserJobs.js +31 -33
- package/dist/pages/address-list/UserSearch.js +29 -54
- package/dist/pages/address-list/addressList.routes.js +11 -16
- package/dist/pages/collection/Collection.js +53 -81
- package/dist/pages/collection/ContentFactory.js +53 -82
- package/dist/pages/collection/collection.routes.js +3 -9
- package/dist/pages/conversation/ForwardToConversation.js +63 -91
- package/dist/pages/conversation/List.js +74 -102
- package/dist/pages/conversation/components/ConversationCard.js +46 -74
- package/dist/pages/conversation/components/ConversationOption.js +27 -55
- package/dist/pages/conversation/conversation.routes.js +17 -23
- package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
- package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
- package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
- package/dist/pages/conversation/setting/OptionConversation.js +20 -48
- package/dist/pages/conversation/setting/OptionGroup.js +20 -48
- package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
- package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
- package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
- package/dist/pages/conversation/setting/Setting.js +49 -54
- package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
- package/dist/pages/index.js +7 -27
- package/dist/pages/message/ChooseMember.js +56 -84
- package/dist/pages/message/MessageBackup/Bar.js +18 -43
- package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
- package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
- package/dist/pages/message/MessageBackup/index.js +3 -12
- package/dist/pages/message/MessageBackup/utils.js +14 -22
- package/dist/pages/message/MessageList.js +141 -135
- package/dist/pages/message/MessageRecord.js +49 -73
- package/dist/pages/message/components/BusiNotifyCard.js +60 -85
- package/dist/pages/message/components/ChatBg.js +11 -36
- package/dist/pages/message/components/MessageItem.js +82 -110
- package/dist/pages/message/components/MessageItemQuote.js +30 -58
- package/dist/pages/message/components/MessageItemTips.js +27 -55
- package/dist/pages/message/components/MessageOption.js +96 -120
- package/dist/pages/message/components/MessagePayload.js +36 -64
- package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
- package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
- package/dist/pages/message/components/MessageUndo.js +18 -48
- package/dist/pages/message/components/MultipleBar/index.js +48 -76
- package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
- package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
- package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
- package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
- package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
- package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
- package/dist/pages/message/components/Payload/PayloadText.js +39 -67
- package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
- package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
- package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
- package/dist/pages/message/components/Payload/type.js +1 -2
- package/dist/pages/message/components/ReceiptBack.js +31 -61
- package/dist/pages/message/components/TextMixMessage.js +13 -38
- package/dist/pages/message/components/TextMixQuote.js +129 -158
- package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
- package/dist/pages/message/components/UploadProgress.js +12 -37
- package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
- package/dist/pages/message/components/messageBar/Icons.js +56 -74
- package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
- package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
- package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
- package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
- package/dist/pages/message/components/messageBar/index.js +2 -23
- package/dist/pages/message/message.routes.js +11 -40
- package/dist/pages/search/Search.js +38 -66
- package/dist/pages/search/SearchChatRecords.js +64 -92
- package/dist/pages/search/SearchFile.js +68 -96
- package/dist/pages/search/SearchManager.js +60 -65
- package/dist/pages/search/SearchPicturePage.js +16 -44
- package/dist/pages/search/components/ChatRecords.js +46 -74
- package/dist/pages/search/components/MyGroupChat.js +41 -69
- package/dist/pages/search/components/PictureMulipleBar.js +35 -63
- package/dist/pages/search/components/SearchFileList.js +59 -64
- package/dist/pages/search/components/SearchPictures.js +68 -98
- package/dist/pages/search/components/SearchShareLinkList.js +50 -55
- package/dist/pages/search/components/SearchUser.js +25 -53
- package/dist/pages/search/components/useSearchMessage.js +12 -16
- package/dist/pages/search/search.routes.js +11 -17
- package/dist/pages/search/utils.js +4 -12
- package/dist/pages/types.js +1 -2
- package/dist/slice/contact/contact.action.js +1 -2
- package/dist/slice/contact/contact.slice.js +4 -8
- package/dist/slice/index.js +7 -13
- package/dist/slice/panel/panel.slice.d.ts +2 -1
- package/dist/slice/panel/panel.slice.js +8 -7
- package/dist/slice/video/video.action.d.ts +1 -0
- package/dist/slice/video/video.action.js +56 -38
- package/dist/slice/video/video.slice.d.ts +1 -1
- package/dist/slice/video/video.slice.js +7 -8
- package/dist/utils/audio.d.ts +3 -0
- package/dist/utils/audio.js +10 -0
- package/dist/utils/color.js +2 -9
- package/dist/utils/common-action-sheet.js +9 -14
- package/dist/utils/cookie.js +6 -14
- package/dist/utils/emoji.js +9 -12
- package/dist/utils/file-icon.js +33 -60
- package/dist/utils/file-operate.js +1 -2
- package/dist/utils/file.d.ts +1 -1
- package/dist/utils/file.js +74 -87
- package/dist/utils/golden-rectangle.js +3 -7
- package/dist/utils/phone.js +13 -22
- package/dist/utils/request.js +7 -15
- package/dist/utils/scroll.js +5 -9
- package/dist/utils/summary.js +4 -11
- package/dist/utils/take-camera.js +12 -19
- package/dist/utils/text-mix.js +4 -11
- package/dist/utils/upload.js +20 -41
- package/package.json +6 -7
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,16 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const react_1 = require("react");
|
14
|
-
const init_1 = require("../init");
|
10
|
+
import { useEffect, useState } from "react";
|
11
|
+
import { getImManager } from "../init";
|
15
12
|
function useDownload({ fileId, localPath, filename, resourceType }) {
|
16
|
-
const [local, setLocal] =
|
17
|
-
|
13
|
+
const [local, setLocal] = useState(localPath);
|
14
|
+
useEffect(() => {
|
18
15
|
let cancel = false;
|
19
16
|
const load = () => __awaiter(this, void 0, void 0, function* () {
|
20
|
-
const imManager =
|
17
|
+
const imManager = getImManager();
|
21
18
|
if (!localPath && fileId) {
|
22
19
|
const tmp = yield imManager.loadResourceFromCache(fileId);
|
23
20
|
if (tmp) {
|
@@ -46,7 +43,7 @@ function useDownload({ fileId, localPath, filename, resourceType }) {
|
|
46
43
|
}, [localPath, fileId, filename]);
|
47
44
|
return local;
|
48
45
|
}
|
49
|
-
function useDownloadImgSource(payload) {
|
46
|
+
export function useDownloadImgSource(payload) {
|
50
47
|
const { imageName, imagePath, imageFileId } = payload;
|
51
48
|
return useDownload({
|
52
49
|
localPath: imagePath,
|
@@ -55,8 +52,7 @@ function useDownloadImgSource(payload) {
|
|
55
52
|
resourceType: 'picture'
|
56
53
|
});
|
57
54
|
}
|
58
|
-
|
59
|
-
function useDownloadSource(payload) {
|
55
|
+
export default function useDownloadSource(payload) {
|
60
56
|
const { localPath, fileId, filename, } = payload;
|
61
57
|
return useDownload({
|
62
58
|
localPath,
|
@@ -65,4 +61,3 @@ function useDownloadSource(payload) {
|
|
65
61
|
resourceType: 'picture',
|
66
62
|
});
|
67
63
|
}
|
68
|
-
exports.default = useDownloadSource;
|
@@ -1,17 +1,11 @@
|
|
1
|
-
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.formatTime = void 0;
|
7
|
-
const useTranslation_1 = __importDefault(require("./useTranslation"));
|
1
|
+
import useTranslation from './useTranslation';
|
8
2
|
const isDate = (date) => {
|
9
3
|
if (date === null || date === undefined) {
|
10
4
|
return false;
|
11
5
|
}
|
12
6
|
return !isNaN(new Date(date).getTime());
|
13
7
|
};
|
14
|
-
const formatTime = (time, t, i18n, showDetail = true) => {
|
8
|
+
export const formatTime = (time, t, i18n, showDetail = true) => {
|
15
9
|
let date = new Date(time), nowDate = new Date();
|
16
10
|
let nowDay = nowDate.getDate(), nowMonth = nowDate.getMonth() + 1, nowYear = nowDate.getFullYear();
|
17
11
|
let year = date.getFullYear(), hours = date.getHours(), minutes = date.getMinutes(), month = date.getMonth() + 1, days = date.getDate();
|
@@ -42,12 +36,10 @@ const formatTime = (time, t, i18n, showDetail = true) => {
|
|
42
36
|
}
|
43
37
|
return `${year}/${month}/${days} ${showDetail ? `${hours}:${minutes}` : ''}`;
|
44
38
|
};
|
45
|
-
|
46
|
-
|
47
|
-
const { t, i18n } = (0, useTranslation_1.default)();
|
39
|
+
export default function useFormatMsgTime(time, showDetail = true) {
|
40
|
+
const { t, i18n } = useTranslation();
|
48
41
|
if (!isDate(time)) {
|
49
42
|
return '';
|
50
43
|
}
|
51
|
-
return
|
44
|
+
return formatTime(time, t, i18n, showDetail);
|
52
45
|
}
|
53
|
-
exports.default = useFormatMsgTime;
|
package/dist/hooks/useImReady.js
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const react_1 = require("react");
|
4
|
-
const init_1 = require("../init");
|
1
|
+
import { useEffect, useState } from "react";
|
2
|
+
import { getImManager } from "../init";
|
5
3
|
let isReady = false;
|
6
|
-
function useImReady() {
|
7
|
-
const [ready, setReady] =
|
8
|
-
|
9
|
-
let imManager =
|
4
|
+
export default function useImReady() {
|
5
|
+
const [ready, setReady] = useState(isReady);
|
6
|
+
useEffect(() => {
|
7
|
+
let imManager = getImManager();
|
10
8
|
if (!imManager) {
|
11
9
|
const cycle = setInterval(() => {
|
12
|
-
imManager =
|
10
|
+
imManager = getImManager();
|
13
11
|
if (imManager) {
|
14
12
|
clearInterval(cycle);
|
15
13
|
isReady = true;
|
@@ -24,4 +22,3 @@ function useImReady() {
|
|
24
22
|
}, []);
|
25
23
|
return isReady || ready;
|
26
24
|
}
|
27
|
-
exports.default = useImReady;
|
@@ -1,48 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
function
|
6
|
-
return
|
7
|
-
}
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
function
|
18
|
-
return
|
19
|
-
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
function
|
30
|
-
return
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
exports.useSetting = useSetting;
|
37
|
-
function useChatGroup() {
|
38
|
-
return (0, react_redux_1.useSelector)(state => state['chat/group']);
|
39
|
-
}
|
40
|
-
exports.useChatGroup = useChatGroup;
|
41
|
-
function useContact() {
|
42
|
-
return (0, react_redux_1.useSelector)(state => state['chat/contact']);
|
43
|
-
}
|
44
|
-
exports.useContact = useContact;
|
45
|
-
function usePanel() {
|
46
|
-
return (0, react_redux_1.useSelector)(state => state['chat/panel']);
|
47
|
-
}
|
48
|
-
exports.usePanel = usePanel;
|
1
|
+
import { useSelector } from 'react-redux';
|
2
|
+
export function useConversation() {
|
3
|
+
return useSelector(state => state['chat/conversation']);
|
4
|
+
}
|
5
|
+
export function useAvatars() {
|
6
|
+
return useSelector(state => state['chat/conversation']['avatarsMap']);
|
7
|
+
}
|
8
|
+
export function useMessage() {
|
9
|
+
return useSelector(state => state['chat/message']);
|
10
|
+
}
|
11
|
+
export function useAuth() {
|
12
|
+
return useSelector(state => state.auth);
|
13
|
+
}
|
14
|
+
export function useVideo() {
|
15
|
+
return useSelector(state => state['chat/video']);
|
16
|
+
}
|
17
|
+
export function useCollection() {
|
18
|
+
return useSelector(state => state['chat/collection']);
|
19
|
+
}
|
20
|
+
export function useForward() {
|
21
|
+
return useSelector(state => state['chat/forward']);
|
22
|
+
}
|
23
|
+
export function useSetting() {
|
24
|
+
return useSelector(state => state['chat/setting']);
|
25
|
+
}
|
26
|
+
export function useChatGroup() {
|
27
|
+
return useSelector(state => state['chat/group']);
|
28
|
+
}
|
29
|
+
export function useContact() {
|
30
|
+
return useSelector(state => state['chat/contact']);
|
31
|
+
}
|
32
|
+
export function usePanel() {
|
33
|
+
return useSelector(state => state['chat/panel']);
|
34
|
+
}
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const react_i18next_1 = require("react-i18next");
|
5
|
-
function useTranslation() {
|
6
|
-
return (0, react_i18next_1.useTranslation)('im');
|
1
|
+
import { useTranslation as useReactTranslation } from 'react-i18next';
|
2
|
+
export default function useTranslation() {
|
3
|
+
return useReactTranslation('im');
|
7
4
|
}
|
8
|
-
|
9
|
-
|
10
|
-
return (0, react_i18next_1.useTranslation)('addressList');
|
5
|
+
export function useTranslationAddrList() {
|
6
|
+
return useReactTranslation('addressList');
|
11
7
|
}
|
12
|
-
exports.useTranslationAddrList = useTranslationAddrList;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -1,28 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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.ChatAvatar = void 0;
|
21
|
-
__exportStar(require("@smart-link/im-base"), exports);
|
22
|
-
__exportStar(require("./init"), exports);
|
23
|
-
__exportStar(require("./pages"), exports);
|
24
|
-
__exportStar(require("./slice"), exports);
|
25
|
-
__exportStar(require("./locales"), exports);
|
26
|
-
__exportStar(require("./hooks/useImSelector"), exports);
|
27
|
-
var ChatAvatar_1 = require("./components/ChatAvatar/ChatAvatar");
|
28
|
-
Object.defineProperty(exports, "ChatAvatar", { enumerable: true, get: function () { return __importDefault(ChatAvatar_1).default; } });
|
1
|
+
export * from '@smart-link/im-base';
|
2
|
+
export * from './init';
|
3
|
+
export * from './pages';
|
4
|
+
export * from './slice';
|
5
|
+
export * from './locales';
|
6
|
+
export * from './hooks/useImSelector';
|
7
|
+
export { default as ChatAvatar } from './components/ChatAvatar/ChatAvatar';
|
8
|
+
export { default as VideoPlayer } from './components/VideoPlayer';
|
package/dist/init.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,54 +7,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const upload_1 = __importDefault(require("./utils/upload"));
|
22
|
-
const file_1 = require("./utils/file");
|
23
|
-
const rn_ui_1 = require("@smart-link/rn-ui");
|
24
|
-
const lodash_es_1 = require("lodash-es");
|
25
|
-
const cookie_1 = require("./utils/cookie");
|
10
|
+
import { DBAdapter, ImManager, PayloadType, Platform as OS, SqliteStorage, } from '@smart-link/im-base';
|
11
|
+
import { Platform } from 'react-native';
|
12
|
+
import Sqlite from 'react-native-sqlite-storage';
|
13
|
+
import { createRequest } from './utils/request';
|
14
|
+
import { defaultAvatars } from './default-assets';
|
15
|
+
import uploadFile from './utils/upload';
|
16
|
+
import { download, initDir } from './utils/file';
|
17
|
+
import { dp, Toast } from '@smart-link/rn-ui';
|
18
|
+
import { cloneDeep } from "lodash-es";
|
19
|
+
import { clearCookies } from "./utils/cookie";
|
26
20
|
let imManager;
|
27
21
|
let logo;
|
28
|
-
const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, undoLimitTime }) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
+
export const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, undoLimitTime }) => __awaiter(void 0, void 0, void 0, function* () {
|
29
23
|
console.log('initImSdk: ', server);
|
30
24
|
logo = outLogo;
|
31
25
|
if (imManager && !imManager.isDestroyed()) {
|
32
26
|
return imManager;
|
33
27
|
}
|
34
28
|
// 初始化目录
|
35
|
-
yield
|
29
|
+
yield initDir(user);
|
36
30
|
// 初始化数据库
|
37
|
-
const db = new
|
31
|
+
const db = new DBAdapter(new SqliteStorage(Sqlite));
|
38
32
|
yield db.createStores(user.userId);
|
39
|
-
imManager = new
|
33
|
+
imManager = new ImManager({
|
40
34
|
db,
|
41
35
|
store,
|
42
36
|
storage,
|
43
37
|
server,
|
44
38
|
namespace: '/chat',
|
45
|
-
user:
|
46
|
-
platform:
|
39
|
+
user: cloneDeep(user),
|
40
|
+
platform: Platform.OS === 'ios' ? OS.IOS : OS.ANDROID,
|
47
41
|
t,
|
48
42
|
undoLimitTime: undoLimitTime || 1000 * 60 * 5,
|
49
|
-
defaultAvatars:
|
43
|
+
defaultAvatars: defaultAvatars,
|
50
44
|
logout,
|
51
45
|
uploadFile: (file, onProgress) => {
|
52
|
-
return (
|
46
|
+
return uploadFile(file.localPath, file.type, onProgress);
|
53
47
|
},
|
54
48
|
beforeUpload: (payload, payloadType) => __awaiter(void 0, void 0, void 0, function* () {
|
55
49
|
const file = payload;
|
56
|
-
if (payloadType ===
|
50
|
+
if (payloadType === PayloadType.VIDEO) {
|
57
51
|
if (!file.imageFileId) {
|
58
|
-
file.imageFileId = yield (
|
52
|
+
file.imageFileId = yield uploadFile(file.imagePath, 'image/jpg');
|
59
53
|
}
|
60
54
|
return file;
|
61
55
|
}
|
@@ -64,22 +58,21 @@ const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, und
|
|
64
58
|
}
|
65
59
|
return payload;
|
66
60
|
}),
|
67
|
-
download:
|
61
|
+
download: download,
|
68
62
|
toast(message, type) {
|
69
63
|
console.log('toast: ', message, type);
|
70
64
|
if (type === 'success') {
|
71
|
-
|
65
|
+
Toast.success(message);
|
72
66
|
}
|
73
67
|
else if (type === 'fail') {
|
74
|
-
|
68
|
+
Toast.error(message);
|
75
69
|
}
|
76
70
|
else {
|
77
|
-
|
71
|
+
Toast.info(message);
|
78
72
|
}
|
79
73
|
},
|
80
74
|
scrollToLatest(animated) {
|
81
75
|
var _a;
|
82
|
-
console.log('scrollToLatest: ', animated);
|
83
76
|
const flatList = (_a = imManager.flatListRef) === null || _a === void 0 ? void 0 : _a.current;
|
84
77
|
if (flatList) {
|
85
78
|
flatList.scrollToOffset({ animated, offset: 0 });
|
@@ -99,23 +92,20 @@ const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, und
|
|
99
92
|
flatList.scrollToIndex({
|
100
93
|
animated,
|
101
94
|
index: index,
|
95
|
+
viewOffset: dp(15)
|
102
96
|
});
|
103
97
|
}
|
104
98
|
}
|
105
99
|
},
|
106
100
|
onDestroyed() {
|
107
101
|
console.log('IM onDestroyed');
|
108
|
-
|
102
|
+
clearCookies();
|
109
103
|
},
|
110
104
|
});
|
111
105
|
return imManager;
|
112
106
|
});
|
113
|
-
|
114
|
-
|
115
|
-
(0, request_1.createRequest)(server);
|
107
|
+
export const initRequest = (server) => {
|
108
|
+
createRequest(server);
|
116
109
|
};
|
117
|
-
|
118
|
-
const
|
119
|
-
exports.getImManager = getImManager;
|
120
|
-
const getLogo = () => logo;
|
121
|
-
exports.getLogo = getLogo;
|
110
|
+
export const getImManager = () => imManager;
|
111
|
+
export const getLogo = () => logo;
|
package/dist/interface.js
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
1
|
+
export {};
|
@@ -1,5 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
1
|
const locale = {
|
4
2
|
search: 'Search',
|
5
3
|
addressList: 'Address Book',
|
@@ -28,4 +26,4 @@ const locale = {
|
|
28
26
|
job: 'Job',
|
29
27
|
otherJob: 'Other Job',
|
30
28
|
};
|
31
|
-
|
29
|
+
export default locale;
|
package/dist/locales/index.js
CHANGED
@@ -1,27 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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.addressListLao = exports.addressListEn = exports.addressListZh = void 0;
|
21
|
-
var addressList_1 = require("./zh/addressList");
|
22
|
-
Object.defineProperty(exports, "addressListZh", { enumerable: true, get: function () { return __importDefault(addressList_1).default; } });
|
23
|
-
var addressList_2 = require("./en/addressList");
|
24
|
-
Object.defineProperty(exports, "addressListEn", { enumerable: true, get: function () { return __importDefault(addressList_2).default; } });
|
25
|
-
var addressList_3 = require("./lao/addressList");
|
26
|
-
Object.defineProperty(exports, "addressListLao", { enumerable: true, get: function () { return __importDefault(addressList_3).default; } });
|
27
|
-
__exportStar(require("./zh/addressList"), exports);
|
1
|
+
export { default as addressListZh } from './zh/addressList';
|
2
|
+
export { default as addressListEn } from './en/addressList';
|
3
|
+
export { default as addressListLao } from './lao/addressList';
|
4
|
+
export * from './zh/addressList';
|
@@ -1,5 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
1
|
const locale = {
|
4
2
|
search: 'ຄົ້ນຫາ',
|
5
3
|
addressList: 'ລາຍຊື່ການຕິດຕໍ່',
|
@@ -28,4 +26,4 @@ const locale = {
|
|
28
26
|
job: 'ວຽກ',
|
29
27
|
otherJob: 'ວຽກອື່ນໆ',
|
30
28
|
};
|
31
|
-
|
29
|
+
export default locale;
|
@@ -1,6 +1,4 @@
|
|
1
|
-
"use strict";
|
2
1
|
// ui 国际化语言
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
2
|
const locale = {
|
5
3
|
search: '搜索',
|
6
4
|
addressList: '通讯录',
|
@@ -29,4 +27,4 @@ const locale = {
|
|
29
27
|
job: '主岗',
|
30
28
|
otherJob: '兼岗',
|
31
29
|
};
|
32
|
-
|
30
|
+
export default locale;
|
@@ -1,46 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __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 Icons_1 = require("./Icons");
|
34
|
-
const addressList_1 = require("../../api/addressList");
|
35
|
-
const useImSelector_1 = require("../../hooks/useImSelector");
|
1
|
+
import { dp, ListRow, NavigationPage, SearchBar, useTheme } from '@smart-link/rn-ui';
|
2
|
+
import React, { useEffect, useState } from 'react';
|
3
|
+
import { View, Text, StyleSheet } from 'react-native';
|
4
|
+
import useTranslation from '../../hooks/useTranslation';
|
5
|
+
import { Unfold } from './Icons';
|
6
|
+
import { listGroupCategory } from '../../api/addressList';
|
7
|
+
import { useAuth } from '../../hooks/useImSelector';
|
36
8
|
const AddressList = ({ navigation }) => {
|
37
|
-
const [groupCategoryList, setGroupCategoryList] =
|
38
|
-
const { t } = (
|
39
|
-
const theme =
|
40
|
-
const { user } =
|
9
|
+
const [groupCategoryList, setGroupCategoryList] = useState([]);
|
10
|
+
const { t } = useTranslation();
|
11
|
+
const theme = useTheme();
|
12
|
+
const { user } = useAuth();
|
41
13
|
const compName = (user === null || user === void 0 ? void 0 : user.groupNamePath) || (user === null || user === void 0 ? void 0 : user.userName) || '';
|
42
|
-
|
43
|
-
|
14
|
+
useEffect(() => {
|
15
|
+
listGroupCategory({ appType: null }).then(({ data }) => {
|
44
16
|
setGroupCategoryList(data);
|
45
17
|
});
|
46
18
|
}, []);
|
@@ -51,10 +23,10 @@ const AddressList = ({ navigation }) => {
|
|
51
23
|
const handleGroupCategory = (item) => {
|
52
24
|
navigation.navigate('Organization', Object.assign({}, item));
|
53
25
|
};
|
54
|
-
return (<
|
55
|
-
<
|
56
|
-
<
|
57
|
-
<
|
26
|
+
return (<NavigationPage noPadding noInsetBottom scroll>
|
27
|
+
<View style={{ height: 10 }}/>
|
28
|
+
<SearchBar style={{ marginHorizontal: 10 }} onSearch={onPressSearch}/>
|
29
|
+
<View style={{ height: 8 }}/>
|
58
30
|
{/*<ListRow*/}
|
59
31
|
{/* title={*/}
|
60
32
|
{/* <View style={[styles.orgLine]}>*/}
|
@@ -70,21 +42,21 @@ const AddressList = ({ navigation }) => {
|
|
70
42
|
{/* topSeparator="full"*/}
|
71
43
|
{/*/>*/}
|
72
44
|
|
73
|
-
<
|
45
|
+
<View style={{ height: 15 }}/>
|
74
46
|
|
75
|
-
<
|
47
|
+
<ListRow title={<View style={styles.orgLine}>
|
76
48
|
{/*<Image style={{width: 30, height: 30, borderRadius: 3}}*/}
|
77
49
|
{/* source={Tenant.config.logoOrg || Tenant.config.logo}/>*/}
|
78
|
-
<
|
79
|
-
</
|
50
|
+
<Text style={styles.compName}>{compName}</Text>
|
51
|
+
</View>}/>
|
80
52
|
|
81
53
|
{groupCategoryList.map(item => {
|
82
|
-
return (<
|
83
|
-
<
|
84
|
-
<
|
85
|
-
</
|
86
|
-
<
|
87
|
-
</
|
54
|
+
return (<ListRow key={item.groupCategoryId} title={<View style={styles.orgLine}>
|
55
|
+
<Text style={styles.smallIcon}>
|
56
|
+
<Unfold size={18} color={theme.primaryColor}/>
|
57
|
+
</Text>
|
58
|
+
<Text style={styles.title}>{item.groupCategoryName}</Text>
|
59
|
+
</View>} onPress={() => handleGroupCategory(item)} topSeparator="full"/>);
|
88
60
|
})}
|
89
61
|
|
90
62
|
{/*<ListRow title=*/}
|
@@ -103,17 +75,17 @@ const AddressList = ({ navigation }) => {
|
|
103
75
|
{/* }*/}
|
104
76
|
{/* bottomSeparator='full'/>*/}
|
105
77
|
|
106
|
-
<
|
107
|
-
</
|
78
|
+
<View style={{ height: 15 }}/>
|
79
|
+
</NavigationPage>);
|
108
80
|
};
|
109
|
-
const styles =
|
81
|
+
const styles = StyleSheet.create({
|
110
82
|
orgInfo: {
|
111
83
|
paddingTop: 20,
|
112
84
|
backgroundColor: '#f1f1f1',
|
113
85
|
textAlignVertical: 'center',
|
114
86
|
},
|
115
87
|
orgLine: {
|
116
|
-
width:
|
88
|
+
width: dp(350),
|
117
89
|
flexDirection: 'row',
|
118
90
|
alignItems: 'center',
|
119
91
|
},
|
@@ -122,7 +94,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
122
94
|
borderTopWidth: 1,
|
123
95
|
},
|
124
96
|
compName: {
|
125
|
-
width:
|
97
|
+
width: dp(305),
|
126
98
|
fontSize: 16,
|
127
99
|
fontWeight: '500',
|
128
100
|
textAlignVertical: 'center',
|
@@ -151,4 +123,4 @@ const styles = react_native_1.StyleSheet.create({
|
|
151
123
|
fontSize: 16,
|
152
124
|
},
|
153
125
|
});
|
154
|
-
|
126
|
+
export default AddressList;
|