@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.
Files changed (155) hide show
  1. package/dist/api/addressList.js +6 -17
  2. package/dist/api/backup.js +8 -20
  3. package/dist/api/file.js +6 -35
  4. package/dist/api/user.js +6 -16
  5. package/dist/components/CachedImage.js +14 -42
  6. package/dist/components/Camera/Camera.js +26 -54
  7. package/dist/components/Camera/CameraCapture.js +99 -128
  8. package/dist/components/Camera/CameraResult.js +33 -61
  9. package/dist/components/ChatAvatar/ChatAvatar.d.ts +1 -1
  10. package/dist/components/ChatAvatar/ChatAvatar.js +34 -62
  11. package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
  12. package/dist/components/ChatAvatar/ChatAvatarId.js +26 -51
  13. package/dist/components/ChatAvatar/ChatAvatarLocal.d.ts +2 -2
  14. package/dist/components/ChatAvatar/ChatAvatarLocal.js +23 -25
  15. package/dist/components/ChatAvatar/index.js +2 -23
  16. package/dist/components/Favicon.js +6 -34
  17. package/dist/components/FormatTimeText.js +5 -10
  18. package/dist/components/Highlighter.js +9 -34
  19. package/dist/components/IndicatorText.js +14 -39
  20. package/dist/components/LocalImage.js +7 -32
  21. package/dist/components/NetworkUnconnected.js +14 -42
  22. package/dist/components/PopoverWrapper.js +22 -47
  23. package/dist/components/VideoPlayer.js +111 -138
  24. package/dist/components/styles.js +10 -13
  25. package/dist/default-assets.d.ts +1 -0
  26. package/dist/default-assets.js +8 -10
  27. package/dist/hooks/useDownloadSource.js +7 -12
  28. package/dist/hooks/useFormatMsgTime.js +5 -13
  29. package/dist/hooks/useImReady.js +7 -10
  30. package/dist/hooks/useImSelector.js +34 -48
  31. package/dist/hooks/useTranslation.js +5 -10
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.js +8 -28
  34. package/dist/init.js +30 -40
  35. package/dist/interface.js +1 -2
  36. package/dist/locales/en/addressList.js +1 -3
  37. package/dist/locales/index.js +4 -27
  38. package/dist/locales/lao/addressList.js +1 -3
  39. package/dist/locales/zh/addressList.js +1 -3
  40. package/dist/pages/address-list/AddressList.js +33 -61
  41. package/dist/pages/address-list/CardInfo.js +10 -18
  42. package/dist/pages/address-list/ChooseContact.js +50 -78
  43. package/dist/pages/address-list/Icons.js +7 -14
  44. package/dist/pages/address-list/Organization.js +59 -89
  45. package/dist/pages/address-list/UserDetail.js +55 -83
  46. package/dist/pages/address-list/UserJobs.js +31 -33
  47. package/dist/pages/address-list/UserSearch.js +29 -54
  48. package/dist/pages/address-list/addressList.routes.js +11 -16
  49. package/dist/pages/collection/Collection.js +53 -81
  50. package/dist/pages/collection/ContentFactory.js +53 -82
  51. package/dist/pages/collection/collection.routes.js +3 -9
  52. package/dist/pages/conversation/ForwardToConversation.js +63 -91
  53. package/dist/pages/conversation/List.js +74 -102
  54. package/dist/pages/conversation/components/ConversationCard.js +46 -74
  55. package/dist/pages/conversation/components/ConversationOption.js +27 -55
  56. package/dist/pages/conversation/conversation.routes.js +17 -23
  57. package/dist/pages/conversation/setting/GroupTransfer.js +32 -60
  58. package/dist/pages/conversation/setting/OptionAvatars.js +62 -90
  59. package/dist/pages/conversation/setting/OptionCancelGroup.js +14 -42
  60. package/dist/pages/conversation/setting/OptionConversation.js +20 -48
  61. package/dist/pages/conversation/setting/OptionGroup.js +20 -48
  62. package/dist/pages/conversation/setting/OptionGroupManage.js +21 -49
  63. package/dist/pages/conversation/setting/OptionGroupMoreMember.js +48 -53
  64. package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +49 -77
  65. package/dist/pages/conversation/setting/Setting.js +49 -54
  66. package/dist/pages/conversation/setting/SettingChatBg.js +26 -54
  67. package/dist/pages/index.js +7 -27
  68. package/dist/pages/message/ChooseMember.js +56 -84
  69. package/dist/pages/message/MessageBackup/Bar.js +18 -43
  70. package/dist/pages/message/MessageBackup/MessageBackup.js +42 -72
  71. package/dist/pages/message/MessageBackup/RestoreBackupPage.js +48 -76
  72. package/dist/pages/message/MessageBackup/StartBackupPage.js +48 -76
  73. package/dist/pages/message/MessageBackup/index.js +3 -12
  74. package/dist/pages/message/MessageBackup/utils.js +14 -22
  75. package/dist/pages/message/MessageList.js +141 -135
  76. package/dist/pages/message/MessageRecord.js +49 -73
  77. package/dist/pages/message/components/BusiNotifyCard.js +60 -85
  78. package/dist/pages/message/components/ChatBg.js +11 -36
  79. package/dist/pages/message/components/MessageItem.js +82 -110
  80. package/dist/pages/message/components/MessageItemQuote.js +30 -58
  81. package/dist/pages/message/components/MessageItemTips.js +27 -55
  82. package/dist/pages/message/components/MessageOption.js +96 -120
  83. package/dist/pages/message/components/MessagePayload.js +36 -64
  84. package/dist/pages/message/components/MessagePictureAlbum.js +32 -60
  85. package/dist/pages/message/components/MessageReceiptStatus.js +18 -43
  86. package/dist/pages/message/components/MessageUndo.js +18 -48
  87. package/dist/pages/message/components/MultipleBar/index.js +48 -76
  88. package/dist/pages/message/components/Payload/PayloadContact.js +30 -58
  89. package/dist/pages/message/components/Payload/PayloadFile.js +41 -65
  90. package/dist/pages/message/components/Payload/PayloadMultiple.js +38 -66
  91. package/dist/pages/message/components/Payload/PayloadNotify.js +28 -56
  92. package/dist/pages/message/components/Payload/PayloadPicture.js +21 -49
  93. package/dist/pages/message/components/Payload/PayloadShare.js +39 -67
  94. package/dist/pages/message/components/Payload/PayloadText.js +39 -67
  95. package/dist/pages/message/components/Payload/PayloadVideo.js +28 -56
  96. package/dist/pages/message/components/Payload/PayloadVoice.js +80 -93
  97. package/dist/pages/message/components/Payload/PayloadWrapper.js +18 -43
  98. package/dist/pages/message/components/Payload/type.js +1 -2
  99. package/dist/pages/message/components/ReceiptBack.js +31 -61
  100. package/dist/pages/message/components/TextMixMessage.js +13 -38
  101. package/dist/pages/message/components/TextMixQuote.js +129 -158
  102. package/dist/pages/message/components/TextMixQuoteMessage.js +16 -44
  103. package/dist/pages/message/components/UploadProgress.js +12 -37
  104. package/dist/pages/message/components/messageBar/EmojiPanel.js +25 -50
  105. package/dist/pages/message/components/messageBar/Icons.js +56 -74
  106. package/dist/pages/message/components/messageBar/MessageBar.js +84 -115
  107. package/dist/pages/message/components/messageBar/MessageInput.js +30 -55
  108. package/dist/pages/message/components/messageBar/OptionPanel.js +54 -82
  109. package/dist/pages/message/components/messageBar/VoiceBar.js +122 -100
  110. package/dist/pages/message/components/messageBar/index.js +2 -23
  111. package/dist/pages/message/message.routes.js +11 -40
  112. package/dist/pages/search/Search.js +38 -66
  113. package/dist/pages/search/SearchChatRecords.js +64 -92
  114. package/dist/pages/search/SearchFile.js +68 -96
  115. package/dist/pages/search/SearchManager.js +60 -65
  116. package/dist/pages/search/SearchPicturePage.js +16 -44
  117. package/dist/pages/search/components/ChatRecords.js +46 -74
  118. package/dist/pages/search/components/MyGroupChat.js +41 -69
  119. package/dist/pages/search/components/PictureMulipleBar.js +35 -63
  120. package/dist/pages/search/components/SearchFileList.js +59 -64
  121. package/dist/pages/search/components/SearchPictures.js +68 -98
  122. package/dist/pages/search/components/SearchShareLinkList.js +50 -55
  123. package/dist/pages/search/components/SearchUser.js +25 -53
  124. package/dist/pages/search/components/useSearchMessage.js +12 -16
  125. package/dist/pages/search/search.routes.js +11 -17
  126. package/dist/pages/search/utils.js +4 -12
  127. package/dist/pages/types.js +1 -2
  128. package/dist/slice/contact/contact.action.js +1 -2
  129. package/dist/slice/contact/contact.slice.js +4 -8
  130. package/dist/slice/index.js +7 -13
  131. package/dist/slice/panel/panel.slice.d.ts +2 -1
  132. package/dist/slice/panel/panel.slice.js +8 -7
  133. package/dist/slice/video/video.action.d.ts +1 -0
  134. package/dist/slice/video/video.action.js +56 -38
  135. package/dist/slice/video/video.slice.d.ts +1 -1
  136. package/dist/slice/video/video.slice.js +7 -8
  137. package/dist/utils/audio.d.ts +3 -0
  138. package/dist/utils/audio.js +10 -0
  139. package/dist/utils/color.js +2 -9
  140. package/dist/utils/common-action-sheet.js +9 -14
  141. package/dist/utils/cookie.js +6 -14
  142. package/dist/utils/emoji.js +9 -12
  143. package/dist/utils/file-icon.js +33 -60
  144. package/dist/utils/file-operate.js +1 -2
  145. package/dist/utils/file.d.ts +1 -1
  146. package/dist/utils/file.js +74 -87
  147. package/dist/utils/golden-rectangle.js +3 -7
  148. package/dist/utils/phone.js +13 -22
  149. package/dist/utils/request.js +7 -15
  150. package/dist/utils/scroll.js +5 -9
  151. package/dist/utils/summary.js +4 -11
  152. package/dist/utils/take-camera.js +12 -19
  153. package/dist/utils/text-mix.js +4 -11
  154. package/dist/utils/upload.js +20 -41
  155. 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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useDownloadImgSource = void 0;
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] = (0, react_1.useState)(localPath);
17
- (0, react_1.useEffect)(() => {
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 = (0, init_1.getImManager)();
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
- exports.useDownloadImgSource = useDownloadImgSource;
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
- "use strict";
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
- exports.formatTime = formatTime;
46
- function useFormatMsgTime(time, showDetail = true) {
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 (0, exports.formatTime)(time, t, i18n, showDetail);
44
+ return formatTime(time, t, i18n, showDetail);
52
45
  }
53
- exports.default = useFormatMsgTime;
@@ -1,15 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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] = (0, react_1.useState)(isReady);
8
- (0, react_1.useEffect)(() => {
9
- let imManager = (0, init_1.getImManager)();
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 = (0, init_1.getImManager)();
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePanel = exports.useContact = exports.useChatGroup = exports.useSetting = exports.useForward = exports.useCollection = exports.useVideo = exports.useAuth = exports.useMessage = exports.useAvatars = exports.useConversation = void 0;
4
- const react_redux_1 = require("react-redux");
5
- function useConversation() {
6
- return (0, react_redux_1.useSelector)(state => state['chat/conversation']);
7
- }
8
- exports.useConversation = useConversation;
9
- function useAvatars() {
10
- return (0, react_redux_1.useSelector)(state => state['chat/conversation']['avatarsMap']);
11
- }
12
- exports.useAvatars = useAvatars;
13
- function useMessage() {
14
- return (0, react_redux_1.useSelector)(state => state['chat/message']);
15
- }
16
- exports.useMessage = useMessage;
17
- function useAuth() {
18
- return (0, react_redux_1.useSelector)(state => state.auth);
19
- }
20
- exports.useAuth = useAuth;
21
- function useVideo() {
22
- return (0, react_redux_1.useSelector)(state => state['chat/video']);
23
- }
24
- exports.useVideo = useVideo;
25
- function useCollection() {
26
- return (0, react_redux_1.useSelector)(state => state['chat/collection']);
27
- }
28
- exports.useCollection = useCollection;
29
- function useForward() {
30
- return (0, react_redux_1.useSelector)(state => state['chat/forward']);
31
- }
32
- exports.useForward = useForward;
33
- function useSetting() {
34
- return (0, react_redux_1.useSelector)(state => state['chat/setting']);
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTranslationAddrList = void 0;
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
- exports.default = useTranslation;
9
- function useTranslationAddrList() {
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
@@ -5,3 +5,4 @@ export * from './slice';
5
5
  export * from './locales';
6
6
  export * from './hooks/useImSelector';
7
7
  export { default as ChatAvatar } from './components/ChatAvatar/ChatAvatar';
8
+ export { default as VideoPlayer } from './components/VideoPlayer';
package/dist/index.js CHANGED
@@ -1,28 +1,8 @@
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.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
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getLogo = exports.getImManager = exports.initRequest = exports.initImSdk = void 0;
16
- const im_base_1 = require("@smart-link/im-base");
17
- const react_native_1 = require("react-native");
18
- const react_native_sqlite_storage_1 = __importDefault(require("react-native-sqlite-storage"));
19
- const request_1 = require("./utils/request");
20
- const default_assets_1 = require("./default-assets");
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 (0, file_1.initDir)(user);
29
+ yield initDir(user);
36
30
  // 初始化数据库
37
- const db = new im_base_1.DBAdapter(new im_base_1.SqliteStorage(react_native_sqlite_storage_1.default));
31
+ const db = new DBAdapter(new SqliteStorage(Sqlite));
38
32
  yield db.createStores(user.userId);
39
- imManager = new im_base_1.ImManager({
33
+ imManager = new ImManager({
40
34
  db,
41
35
  store,
42
36
  storage,
43
37
  server,
44
38
  namespace: '/chat',
45
- user: (0, lodash_es_1.cloneDeep)(user),
46
- platform: react_native_1.Platform.OS === 'ios' ? im_base_1.Platform.IOS : im_base_1.Platform.ANDROID,
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: default_assets_1.defaultAvatars,
43
+ defaultAvatars: defaultAvatars,
50
44
  logout,
51
45
  uploadFile: (file, onProgress) => {
52
- return (0, upload_1.default)(file.localPath, file.type, onProgress);
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 === im_base_1.PayloadType.VIDEO) {
50
+ if (payloadType === PayloadType.VIDEO) {
57
51
  if (!file.imageFileId) {
58
- file.imageFileId = yield (0, upload_1.default)(file.imagePath, 'image/jpg');
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: file_1.download,
61
+ download: download,
68
62
  toast(message, type) {
69
63
  console.log('toast: ', message, type);
70
64
  if (type === 'success') {
71
- rn_ui_1.Toast.success(message);
65
+ Toast.success(message);
72
66
  }
73
67
  else if (type === 'fail') {
74
- rn_ui_1.Toast.error(message);
68
+ Toast.error(message);
75
69
  }
76
70
  else {
77
- rn_ui_1.Toast.info(message);
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
- (0, cookie_1.clearCookies)();
102
+ clearCookies();
109
103
  },
110
104
  });
111
105
  return imManager;
112
106
  });
113
- exports.initImSdk = initImSdk;
114
- const initRequest = (server) => {
115
- (0, request_1.createRequest)(server);
107
+ export const initRequest = (server) => {
108
+ createRequest(server);
116
109
  };
117
- exports.initRequest = initRequest;
118
- const getImManager = () => imManager;
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
- "use strict";
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
- exports.default = locale;
29
+ export default locale;
@@ -1,27 +1,4 @@
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.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
- exports.default = locale;
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
- exports.default = locale;
30
+ export default locale;
@@ -1,46 +1,18 @@
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 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] = (0, react_1.useState)([]);
38
- const { t } = (0, useTranslation_1.default)();
39
- const theme = (0, rn_ui_1.useTheme)();
40
- const { user } = (0, useImSelector_1.useAuth)();
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
- (0, react_1.useEffect)(() => {
43
- (0, addressList_1.listGroupCategory)({ appType: null }).then(({ data }) => {
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 (<rn_ui_1.NavigationPage noPadding noInsetBottom scroll>
55
- <react_native_1.View style={{ height: 10 }}/>
56
- <rn_ui_1.SearchBar style={{ marginHorizontal: 10 }} onSearch={onPressSearch}/>
57
- <react_native_1.View style={{ height: 8 }}/>
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
- <react_native_1.View style={{ height: 15 }}/>
45
+ <View style={{ height: 15 }}/>
74
46
 
75
- <rn_ui_1.ListRow title={<react_native_1.View style={styles.orgLine}>
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
- <react_native_1.Text style={styles.compName}>{compName}</react_native_1.Text>
79
- </react_native_1.View>}/>
50
+ <Text style={styles.compName}>{compName}</Text>
51
+ </View>}/>
80
52
 
81
53
  {groupCategoryList.map(item => {
82
- return (<rn_ui_1.ListRow key={item.groupCategoryId} title={<react_native_1.View style={styles.orgLine}>
83
- <react_native_1.Text style={styles.smallIcon}>
84
- <Icons_1.Unfold size={18} color={theme.primaryColor}/>
85
- </react_native_1.Text>
86
- <react_native_1.Text style={styles.title}>{item.groupCategoryName}</react_native_1.Text>
87
- </react_native_1.View>} onPress={() => handleGroupCategory(item)} topSeparator="full"/>);
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
- <react_native_1.View style={{ height: 15 }}/>
107
- </rn_ui_1.NavigationPage>);
78
+ <View style={{ height: 15 }}/>
79
+ </NavigationPage>);
108
80
  };
109
- const styles = react_native_1.StyleSheet.create({
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: (0, rn_ui_1.dp)(350),
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: (0, rn_ui_1.dp)(305),
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
- exports.default = AddressList;
126
+ export default AddressList;