@smart-link/rn-im 1.0.22 → 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 +52 -81
  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 -134
  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 +7 -11
  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,18 +1,12 @@
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.searchRoutes = void 0;
7
- const Search_1 = __importDefault(require("./Search"));
8
- const SearchChatRecords_1 = __importDefault(require("./SearchChatRecords"));
9
- const SearchFile_1 = __importDefault(require("./SearchFile"));
10
- const SearchPicturePage_1 = __importDefault(require("./SearchPicturePage"));
11
- const SearchManager_1 = __importDefault(require("./SearchManager"));
12
- exports.searchRoutes = [
1
+ import Search from './Search';
2
+ import SearchChatRecords from './SearchChatRecords';
3
+ import SearchFile from './SearchFile';
4
+ import SearchPicturePage from './SearchPicturePage';
5
+ import SearchManager from "./SearchManager";
6
+ export const searchRoutes = [
13
7
  {
14
8
  name: 'Search',
15
- component: Search_1.default,
9
+ component: Search,
16
10
  options: {
17
11
  animation: 'fade',
18
12
  headerShown: false,
@@ -20,7 +14,7 @@ exports.searchRoutes = [
20
14
  },
21
15
  {
22
16
  name: 'SearchChatRecords',
23
- component: SearchChatRecords_1.default,
17
+ component: SearchChatRecords,
24
18
  options: {
25
19
  animation: 'fade',
26
20
  headerShown: false,
@@ -28,18 +22,18 @@ exports.searchRoutes = [
28
22
  },
29
23
  {
30
24
  name: 'SearchFile',
31
- component: SearchFile_1.default,
25
+ component: SearchFile,
32
26
  options: {
33
27
  headerShown: false,
34
28
  },
35
29
  },
36
30
  {
37
31
  name: 'SearchPicture',
38
- component: SearchPicturePage_1.default,
32
+ component: SearchPicturePage,
39
33
  },
40
34
  {
41
35
  name: 'SearchManager',
42
- component: SearchManager_1.default,
36
+ component: SearchManager,
43
37
  options: {
44
38
  title: '',
45
39
  headerShown: false,
@@ -1,11 +1,5 @@
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.filesDataToList = exports.normalFilesData = void 0;
7
- const dayjs_1 = __importDefault(require("dayjs"));
8
- function normalFilesData(files, data) {
1
+ import dayjs from "dayjs";
2
+ export function normalFilesData(files, data) {
9
3
  let mapData = {};
10
4
  if (!data)
11
5
  return [];
@@ -18,7 +12,7 @@ function normalFilesData(files, data) {
18
12
  }
19
13
  });
20
14
  data.map(item => {
21
- const date = (0, dayjs_1.default)(item.messageTime).format("YYYY/MM");
15
+ const date = dayjs(item.messageTime).format("YYYY/MM");
22
16
  if (mapData[date]) {
23
17
  mapData[date].push(item);
24
18
  }
@@ -28,8 +22,7 @@ function normalFilesData(files, data) {
28
22
  });
29
23
  return filesDataToList(mapData);
30
24
  }
31
- exports.normalFilesData = normalFilesData;
32
- function filesDataToList(map) {
25
+ export function filesDataToList(map) {
33
26
  const list = [];
34
27
  for (let key in map) {
35
28
  list.push({
@@ -39,4 +32,3 @@ function filesDataToList(map) {
39
32
  }
40
33
  return list;
41
34
  }
42
- exports.filesDataToList = filesDataToList;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,21 +1,17 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.onDefaultCheckedUser = exports.startSendContact = exports.resetState = exports.startAddMember = exports.startCreateGroup = exports.onSelectUser = exports.setCurrentRoot = exports.setSelectGroups = exports.setSelectUsers = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const initialState = {
1
+ import { createSlice } from "@reduxjs/toolkit";
2
+ const initialState = () => ({
7
3
  selectUsers: {},
8
4
  selectGroups: {},
9
5
  currentRoot: 'none',
10
6
  choosePurpose: 'none',
11
7
  checkMode: 'multiple',
12
- };
13
- const contactSlice = (0, toolkit_1.createSlice)({
8
+ });
9
+ const contactSlice = createSlice({
14
10
  name: 'chat/contact',
15
11
  initialState,
16
12
  reducers: {
17
13
  resetState(state) {
18
- Object.assign(state, initialState);
14
+ Object.assign(state, initialState());
19
15
  },
20
16
  setSelectUsers(state, action) {
21
17
  state.selectUsers = action.payload;
@@ -56,5 +52,5 @@ const contactSlice = (0, toolkit_1.createSlice)({
56
52
  },
57
53
  },
58
54
  });
59
- _a = contactSlice.actions, exports.setSelectUsers = _a.setSelectUsers, exports.setSelectGroups = _a.setSelectGroups, exports.setCurrentRoot = _a.setCurrentRoot, exports.onSelectUser = _a.onSelectUser, exports.startCreateGroup = _a.startCreateGroup, exports.startAddMember = _a.startAddMember, exports.resetState = _a.resetState, exports.startSendContact = _a.startSendContact, exports.onDefaultCheckedUser = _a.onDefaultCheckedUser;
60
- exports.default = contactSlice.reducer;
55
+ export const { setSelectUsers, setSelectGroups, setCurrentRoot, onSelectUser, startCreateGroup, startAddMember, resetState, startSendContact, onDefaultCheckedUser, } = contactSlice.actions;
56
+ export default contactSlice.reducer;
@@ -1,14 +1,8 @@
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.chatReducers = void 0;
7
- const video_slice_1 = __importDefault(require("./video/video.slice"));
8
- const contact_slice_1 = __importDefault(require("./contact/contact.slice"));
9
- const panel_slice_1 = __importDefault(require("./panel/panel.slice"));
10
- exports.chatReducers = {
11
- 'chat/video': video_slice_1.default,
12
- 'chat/contact': contact_slice_1.default,
13
- 'chat/panel': panel_slice_1.default,
1
+ import videoSlice from './video/video.slice';
2
+ import contactSlice from './contact/contact.slice';
3
+ import panelSlice from './panel/panel.slice';
4
+ export const chatReducers = {
5
+ 'chat/video': videoSlice,
6
+ 'chat/contact': contactSlice,
7
+ 'chat/panel': panelSlice,
14
8
  };
@@ -2,7 +2,8 @@ export interface PanelState {
2
2
  show: boolean;
3
3
  type: 'emoji' | 'option' | 'voice';
4
4
  messageBarHeight: number;
5
+ voicePlayingSeq: string;
5
6
  }
6
- export declare const setMessageBarHeight: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/panel/setMessageBarHeight">;
7
+ export declare const setMessageBarHeight: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/panel/setMessageBarHeight">, setVoicePlayingSeq: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/panel/setVoicePlayingSeq">;
7
8
  declare const _default: import("@reduxjs/toolkit").Reducer<PanelState>;
8
9
  export default _default;
@@ -1,19 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setMessageBarHeight = void 0;
4
- const toolkit_1 = require("@reduxjs/toolkit");
5
- const panelSlice = (0, toolkit_1.createSlice)({
1
+ import { createSlice } from "@reduxjs/toolkit";
2
+ const panelSlice = createSlice({
6
3
  name: 'chat/panel',
7
4
  initialState: {
8
5
  show: false,
9
6
  type: 'emoji',
10
7
  messageBarHeight: 0,
8
+ voicePlayingSeq: '',
11
9
  },
12
10
  reducers: {
13
11
  setMessageBarHeight(state, action) {
14
12
  state.messageBarHeight = action.payload;
15
13
  },
14
+ setVoicePlayingSeq(state, action) {
15
+ state.voicePlayingSeq = action.payload;
16
+ }
16
17
  }
17
18
  });
18
- exports.setMessageBarHeight = panelSlice.actions.setMessageBarHeight;
19
- exports.default = panelSlice.reducer;
19
+ export const { setMessageBarHeight, setVoicePlayingSeq, } = panelSlice.actions;
20
+ export default panelSlice.reducer;
@@ -4,3 +4,4 @@ export declare const loadVideoPlayer: (message: {
4
4
  payload: IPayload;
5
5
  isRecord?: boolean;
6
6
  }) => AsyncAction;
7
+ export declare const stopVideoPlayer: () => AsyncAction;
@@ -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,56 +7,71 @@ 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.loadVideoPlayer = void 0;
13
- const im_base_1 = require("@smart-link/im-base");
14
- const video_slice_1 = require("./video.slice");
15
- const rn_ui_1 = require("@smart-link/rn-ui");
16
- const file_1 = require("../../api/file");
17
- const init_1 = require("../../init");
18
- const loadVideoPlayer = message => (dispatch) => __awaiter(void 0, void 0, void 0, function* () {
10
+ import { MessageActions } from '@smart-link/im-base';
11
+ import { setVideoDownloadProgress, showVideoPlayer, setVideoDownloadError, cancelVideoPlayer } from './video.slice';
12
+ import { dp } from '@smart-link/rn-ui';
13
+ import { getDownloadUrl } from '../../api/file';
14
+ import { getImManager } from '../../init';
15
+ let stopFn = () => { };
16
+ export const loadVideoPlayer = message => (dispatch) => __awaiter(void 0, void 0, void 0, function* () {
19
17
  console.log('loadVideoPlayer: ', message);
20
18
  const { payload, messageSeq, isRecord } = message;
21
- const { width = (0, rn_ui_1.dp)(100), height = (0, rn_ui_1.dp)(163), localPath } = payload;
19
+ const { width = dp(100), height = dp(163), localPath } = payload;
22
20
  const thumbnail = payload.imagePath
23
21
  ? { uri: 'file://' + payload.imagePath }
24
- : { uri: (0, file_1.getDownloadUrl)(payload.imageFileId) };
25
- const imManager = (0, init_1.getImManager)();
22
+ : { uri: getDownloadUrl(payload.imageFileId) };
23
+ const imManager = getImManager();
26
24
  const download = () => __awaiter(void 0, void 0, void 0, function* () {
27
- return yield imManager.download({
28
- fileId: payload.fileId,
29
- resourceType: 'video',
30
- filename: payload.filename || (payload.fileId + '.mp4'),
31
- onProgress(o) {
32
- dispatch((0, video_slice_1.setVideoDownloadProgress)(o.loaded / Number(o.total || payload.size)));
33
- },
34
- });
25
+ try {
26
+ return yield imManager.download({
27
+ fileId: payload.fileId,
28
+ resourceType: 'video',
29
+ filename: payload.filename || (payload.fileId + '.mp4'),
30
+ onProgress(o) {
31
+ dispatch(setVideoDownloadProgress(o.loaded / Number(o.total || payload.size)));
32
+ },
33
+ onStart: (stop) => {
34
+ stopFn = stop;
35
+ }
36
+ });
37
+ }
38
+ catch (e) {
39
+ dispatch(setVideoDownloadError());
40
+ console.log('download error: ', e);
41
+ throw new Error('download error');
42
+ }
35
43
  });
36
44
  if (!localPath && !isRecord) {
37
- dispatch((0, video_slice_1.showVideoPlayer)({
45
+ dispatch(showVideoPlayer({
38
46
  videoLocalPath: '',
39
47
  videoImageHeight: height,
40
48
  videoImageWidth: width,
41
49
  videoImagePath: thumbnail.uri,
42
50
  }));
43
- const destPath = yield download();
44
- dispatch((0, video_slice_1.showVideoPlayer)({
45
- videoLocalPath: destPath,
46
- videoImageHeight: height,
47
- videoImageWidth: width,
48
- videoImagePath: thumbnail.uri,
49
- }));
50
- dispatch(im_base_1.MessageActions.updateMessage(messageSeq, {
51
- payload: Object.assign(Object.assign({}, payload), { localPath: destPath })
52
- }));
53
- imManager.db.updateMessage({
54
- messageSeq,
55
- payload: Object.assign(Object.assign({}, payload), { localPath: destPath })
56
- });
51
+ try {
52
+ const destPath = yield download();
53
+ dispatch(showVideoPlayer({
54
+ videoLocalPath: destPath,
55
+ videoImageHeight: height,
56
+ videoImageWidth: width,
57
+ videoImagePath: thumbnail.uri,
58
+ }));
59
+ dispatch(MessageActions.updateMessage(messageSeq, {
60
+ payload: Object.assign(Object.assign({}, payload), { localPath: destPath })
61
+ }));
62
+ imManager.db.updateMessage({
63
+ messageSeq,
64
+ payload: Object.assign(Object.assign({}, payload), { localPath: destPath })
65
+ });
66
+ }
67
+ catch (e) {
68
+ console.log('loadVideoPlayer error: ', e);
69
+ }
57
70
  }
58
71
  else if (!localPath && isRecord) {
59
72
  // 下载文件,缓存资源
60
73
  let destPath = yield imManager.loadResourceFromCache(payload.fileId);
74
+ console.log('video cache: ', destPath);
61
75
  if (!destPath) {
62
76
  destPath = yield download();
63
77
  imManager.updateResource({
@@ -65,7 +79,7 @@ const loadVideoPlayer = message => (dispatch) => __awaiter(void 0, void 0, void
65
79
  localPath: destPath,
66
80
  });
67
81
  }
68
- dispatch((0, video_slice_1.showVideoPlayer)({
82
+ dispatch(showVideoPlayer({
69
83
  videoLocalPath: destPath,
70
84
  videoImageHeight: height,
71
85
  videoImageWidth: width,
@@ -73,7 +87,7 @@ const loadVideoPlayer = message => (dispatch) => __awaiter(void 0, void 0, void
73
87
  }));
74
88
  }
75
89
  else {
76
- dispatch((0, video_slice_1.showVideoPlayer)({
90
+ dispatch(showVideoPlayer({
77
91
  videoLocalPath: localPath,
78
92
  videoImageHeight: height,
79
93
  videoImageWidth: width,
@@ -81,4 +95,8 @@ const loadVideoPlayer = message => (dispatch) => __awaiter(void 0, void 0, void
81
95
  }));
82
96
  }
83
97
  });
84
- exports.loadVideoPlayer = loadVideoPlayer;
98
+ export const stopVideoPlayer = () => (dispatch) => {
99
+ stopFn();
100
+ dispatch(cancelVideoPlayer());
101
+ stopFn = () => { };
102
+ };
@@ -12,6 +12,6 @@ export declare const showVideoPlayer: import("@reduxjs/toolkit").ActionCreatorWi
12
12
  videoImagePath: string;
13
13
  videoImageHeight: number;
14
14
  videoImageWidth: number;
15
- }, "chat/video/showVideoPlayer">, cancelVideoPlayer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/video/cancelVideoPlayer">, setVideoDownloadProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/video/setVideoDownloadProgress">, setShowVideoPlay: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/video/setShowVideoPlay">;
15
+ }, "chat/video/showVideoPlayer">, cancelVideoPlayer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/video/cancelVideoPlayer">, setVideoDownloadProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/video/setVideoDownloadProgress">, setShowVideoPlay: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "chat/video/setShowVideoPlay">, setVideoDownloadError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chat/video/setVideoDownloadError">;
16
16
  declare const _default: import("@reduxjs/toolkit").Reducer<VideoState>;
17
17
  export default _default;
@@ -1,9 +1,5 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.setShowVideoPlay = exports.setVideoDownloadProgress = exports.cancelVideoPlayer = exports.showVideoPlayer = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const videoSlice = (0, toolkit_1.createSlice)({
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ const videoSlice = createSlice({
7
3
  name: 'chat/video',
8
4
  initialState: {
9
5
  showVideoPlay: false,
@@ -32,8 +28,11 @@ const videoSlice = (0, toolkit_1.createSlice)({
32
28
  },
33
29
  setVideoDownloadProgress(state, action) {
34
30
  state.videoDownloadProgress = action.payload;
31
+ },
32
+ setVideoDownloadError(state) {
33
+ state.videoDownloadError = true;
35
34
  }
36
35
  }
37
36
  });
38
- _a = videoSlice.actions, exports.showVideoPlayer = _a.showVideoPlayer, exports.cancelVideoPlayer = _a.cancelVideoPlayer, exports.setVideoDownloadProgress = _a.setVideoDownloadProgress, exports.setShowVideoPlay = _a.setShowVideoPlay;
39
- exports.default = videoSlice.reducer;
37
+ export const { showVideoPlayer, cancelVideoPlayer, setVideoDownloadProgress, setShowVideoPlay, setVideoDownloadError, } = videoSlice.actions;
38
+ export default videoSlice.reducer;
@@ -0,0 +1,3 @@
1
+ import AudioRecorderPlayer from "react-native-audio-recorder-player";
2
+ export declare const AudioRecorder: AudioRecorderPlayer;
3
+ export declare const AudioPlayer: AudioRecorderPlayer;
@@ -0,0 +1,10 @@
1
+ import AudioRecorderPlayer from "react-native-audio-recorder-player";
2
+ import { setVoicePlayingSeq } from "../slice/panel/panel.slice";
3
+ import { getImManager } from "../init";
4
+ export const AudioRecorder = new AudioRecorderPlayer();
5
+ export const AudioPlayer = new AudioRecorderPlayer();
6
+ AudioPlayer.addPlayBackListener((e) => {
7
+ if (e.isFinished) {
8
+ getImManager().store.dispatch(setVoicePlayingSeq(''));
9
+ }
10
+ });
@@ -1,9 +1,2 @@
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.dark = void 0;
7
- const color_1 = __importDefault(require("color"));
8
- const dark = (color, ratio) => (0, color_1.default)(color).darken(ratio / 100).toString();
9
- exports.dark = dark;
1
+ import Color from 'color';
2
+ export const dark = (color, ratio) => Color(color).darken(ratio / 100).toString();
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfirmActionSheets = exports.ConfirmActionSheet = void 0;
4
- const rn_ui_1 = require("@smart-link/rn-ui");
5
- const ConfirmActionSheet = (title, confirm, t) => {
6
- rn_ui_1.ActionSheet.open({
1
+ import { ActionSheet } from '@smart-link/rn-ui';
2
+ export const ConfirmActionSheet = (title, confirm, t) => {
3
+ ActionSheet.open({
7
4
  title,
8
5
  onClose: () => {
9
- rn_ui_1.ActionSheet.destroy();
6
+ ActionSheet.destroy();
10
7
  },
11
8
  options: [
12
9
  {
13
10
  text: t('confirm'), textColor: 'primary', onPress: () => {
14
- rn_ui_1.ActionSheet.destroy();
11
+ ActionSheet.destroy();
15
12
  confirm();
16
13
  },
17
14
  },
@@ -21,18 +18,17 @@ const ConfirmActionSheet = (title, confirm, t) => {
21
18
  },
22
19
  });
23
20
  };
24
- exports.ConfirmActionSheet = ConfirmActionSheet;
25
- const ConfirmActionSheets = ({ title, t, confirm, options = [] }) => {
26
- rn_ui_1.ActionSheet.open({
21
+ export const ConfirmActionSheets = ({ title, t, confirm, options = [] }) => {
22
+ ActionSheet.open({
27
23
  title,
28
24
  onClose: () => {
29
- rn_ui_1.ActionSheet.destroy();
25
+ ActionSheet.destroy();
30
26
  },
31
27
  options: [
32
28
  ...options,
33
29
  {
34
30
  text: t('confirm'), textColor: 'primary', onPress: () => {
35
- rn_ui_1.ActionSheet.destroy();
31
+ ActionSheet.destroy();
36
32
  confirm();
37
33
  },
38
34
  },
@@ -42,4 +38,3 @@ const ConfirmActionSheets = ({ title, t, confirm, options = [] }) => {
42
38
  },
43
39
  });
44
40
  };
45
- exports.ConfirmActionSheets = ConfirmActionSheets;
@@ -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,26 +7,19 @@ 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.clearCookies = exports.getCookieString = void 0;
16
- const request_1 = require("../utils/request");
17
- const cookies_1 = __importDefault(require("@react-native-cookies/cookies"));
10
+ import { getBaseURL } from '../utils/request';
11
+ import CookieManager from '@react-native-cookies/cookies';
18
12
  let cookiesStr = '';
19
- const getCookieString = () => __awaiter(void 0, void 0, void 0, function* () {
13
+ export const getCookieString = () => __awaiter(void 0, void 0, void 0, function* () {
20
14
  if (cookiesStr)
21
15
  return cookiesStr;
22
- const url = (0, request_1.getBaseURL)();
23
- const cookies = yield cookies_1.default.get(url);
16
+ const url = getBaseURL();
17
+ const cookies = yield CookieManager.get(url);
24
18
  cookiesStr = Object.keys(cookies).map((key) => {
25
19
  return `${key}=${cookies[key].value}`;
26
20
  }).join(';');
27
21
  return cookiesStr;
28
22
  });
29
- exports.getCookieString = getCookieString;
30
- const clearCookies = () => __awaiter(void 0, void 0, void 0, function* () {
23
+ export const clearCookies = () => __awaiter(void 0, void 0, void 0, function* () {
31
24
  cookiesStr = '';
32
25
  });
33
- exports.clearCookies = clearCookies;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nature = exports.diet = exports.flower = exports.common = exports.animal = exports.gesture = exports.person = exports.face = exports.other = void 0;
4
- exports.other = [
1
+ export const other = [
5
2
  '🏢',
6
3
  '🏣',
7
4
  '🏤',
@@ -189,7 +186,7 @@ exports.other = [
189
186
  '💦',
190
187
  '💨',
191
188
  ];
192
- exports.face = [
189
+ export const face = [
193
190
  '😀',
194
191
  '😁',
195
192
  '😂',
@@ -253,7 +250,7 @@ exports.face = [
253
250
  '👾',
254
251
  '💣',
255
252
  ];
256
- exports.person = [
253
+ export const person = [
257
254
  '👦',
258
255
  '👧',
259
256
  '👨',
@@ -293,8 +290,8 @@ exports.person = [
293
290
  '💑',
294
291
  '👪',
295
292
  ];
296
- exports.gesture = ['💪', '👈', '👉', '👆', '👇', '✋', '👌', '👍', '👎', '✊', '👊', '👋', '👏', '👐', '✍'];
297
- exports.animal = [
293
+ export const gesture = ['💪', '👈', '👉', '👆', '👇', '✋', '👌', '👍', '👎', '✊', '👊', '👋', '👏', '👐', '✍'];
294
+ export const animal = [
298
295
  '🙈',
299
296
  '🙉',
300
297
  '🙊',
@@ -372,7 +369,7 @@ exports.animal = [
372
369
  '🐞',
373
370
  '🦋',
374
371
  ];
375
- exports.common = [
372
+ export const common = [
376
373
  '👄',
377
374
  '💋',
378
375
  '👓',
@@ -516,7 +513,7 @@ exports.common = [
516
513
  '💦',
517
514
  '💨',
518
515
  ];
519
- exports.flower = [
516
+ export const flower = [
520
517
  '💐',
521
518
  '🌸',
522
519
  '💮',
@@ -537,7 +534,7 @@ exports.flower = [
537
534
  '🍂',
538
535
  '🍃',
539
536
  ];
540
- exports.diet = [
537
+ export const diet = [
541
538
  '🍇',
542
539
  '🍈',
543
540
  '🍉',
@@ -598,7 +595,7 @@ exports.diet = [
598
595
  '🍻',
599
596
  '🍴',
600
597
  ];
601
- exports.nature = [
598
+ export const nature = [
602
599
  '🌍',
603
600
  '🌎',
604
601
  '🌏',