@smart-link/rn-im 1.0.24 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/assets/file-dir.jpg +0 -0
  2. package/dist/api/addressList.d.ts +16 -15
  3. package/dist/api/addressList.js +15 -1
  4. package/dist/api/user.js +1 -1
  5. package/dist/components/Camera/Camera.js +3 -2
  6. package/dist/components/Camera/CameraCapture.js +61 -12
  7. package/dist/components/ChatAvatar/ChatAvatar.d.ts +3 -3
  8. package/dist/components/ChatAvatar/ChatAvatar.js +51 -49
  9. package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
  10. package/dist/components/ChatAvatar/ChatAvatarId.js +19 -46
  11. package/dist/components/ChatAvatar/ChatAvatarLocal.js +22 -10
  12. package/dist/components/Favicon.js +1 -1
  13. package/dist/components/LocalImage.js +3 -1
  14. package/dist/components/styles.d.ts +7 -1
  15. package/dist/components/styles.js +16 -11
  16. package/dist/default-assets.d.ts +1 -0
  17. package/dist/default-assets.js +1 -0
  18. package/dist/hooks/useAnimatedValue.d.ts +2 -0
  19. package/dist/hooks/useAnimatedValue.js +9 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +1 -0
  22. package/dist/init.d.ts +2 -2
  23. package/dist/init.js +8 -5
  24. package/dist/interface.d.ts +15 -0
  25. package/dist/pages/address-list/AddressList.js +22 -40
  26. package/dist/pages/address-list/ChooseContact.js +209 -45
  27. package/dist/pages/address-list/MyGroups.d.ts +6 -0
  28. package/dist/pages/address-list/MyGroups.js +90 -0
  29. package/dist/pages/address-list/Organization.d.ts +0 -7
  30. package/dist/pages/address-list/Organization.js +24 -108
  31. package/dist/pages/address-list/UserDetail.js +5 -5
  32. package/dist/pages/address-list/UserSearch.js +6 -7
  33. package/dist/pages/address-list/addressList.routes.d.ts +9 -0
  34. package/dist/pages/address-list/addressList.routes.js +8 -0
  35. package/dist/pages/address-list/components/Icons.d.ts +8 -0
  36. package/dist/pages/address-list/components/Icons.js +15 -0
  37. package/dist/pages/address-list/components/OrgPath.d.ts +12 -0
  38. package/dist/pages/address-list/components/OrgPath.js +59 -0
  39. package/dist/pages/address-list/components/RenderUserItem.d.ts +9 -0
  40. package/dist/pages/address-list/components/RenderUserItem.js +14 -0
  41. package/dist/pages/address-list/{UserJobs.js → components/UserJobs.js} +2 -2
  42. package/dist/pages/address-list/useGroupCategory.d.ts +2 -0
  43. package/dist/pages/address-list/useGroupCategory.js +11 -0
  44. package/dist/pages/address-list/useRoleList.d.ts +2 -0
  45. package/dist/pages/address-list/useRoleList.js +11 -0
  46. package/dist/pages/collection/Collection.js +52 -8
  47. package/dist/pages/collection/ContentFactory.js +50 -3
  48. package/dist/pages/conversation/ForwardToConversation.js +4 -2
  49. package/dist/pages/conversation/List.js +15 -7
  50. package/dist/pages/conversation/components/ConversationCard.js +1 -7
  51. package/dist/pages/conversation/setting/OptionAvatars.d.ts +1 -1
  52. package/dist/pages/conversation/setting/OptionAvatars.js +0 -1
  53. package/dist/pages/conversation/setting/OptionGroup.d.ts +2 -2
  54. package/dist/pages/conversation/setting/OptionGroup.js +4 -4
  55. package/dist/pages/conversation/setting/OptionGroupManage.js +4 -8
  56. package/dist/pages/conversation/setting/OptionGroupMoreMember.js +37 -18
  57. package/dist/pages/conversation/setting/Setting.js +5 -5
  58. package/dist/pages/conversation/setting/SettingChatBg.js +32 -16
  59. package/dist/pages/message/ChooseMember.js +2 -2
  60. package/dist/pages/message/FileSelector.d.ts +6 -0
  61. package/dist/pages/message/FileSelector.js +272 -0
  62. package/dist/pages/message/MessageList.js +81 -43
  63. package/dist/pages/message/MessageRecord.js +34 -23
  64. package/dist/pages/message/components/MessageItem.d.ts +7 -7
  65. package/dist/pages/message/components/MessageItem.js +29 -20
  66. package/dist/pages/message/components/MessageOption.d.ts +7 -3
  67. package/dist/pages/message/components/MessageOption.js +14 -16
  68. package/dist/pages/message/components/MessagePayload.d.ts +2 -1
  69. package/dist/pages/message/components/MessagePictureAlbum.js +6 -4
  70. package/dist/pages/message/components/Payload/PayloadFile.d.ts +1 -1
  71. package/dist/pages/message/components/Payload/PayloadFile.js +34 -16
  72. package/dist/pages/message/components/Payload/PayloadMultiple.js +12 -8
  73. package/dist/pages/message/components/Payload/PayloadNotify.js +14 -5
  74. package/dist/pages/message/components/Payload/PayloadPicture.d.ts +1 -1
  75. package/dist/pages/message/components/Payload/PayloadPicture.js +9 -7
  76. package/dist/pages/message/components/Payload/PayloadText.js +7 -8
  77. package/dist/pages/message/components/Payload/PayloadVideo.js +2 -1
  78. package/dist/pages/message/components/Payload/PayloadVoice.js +7 -13
  79. package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +2 -1
  80. package/dist/pages/message/components/Payload/PayloadWrapper.js +46 -20
  81. package/dist/pages/message/components/Payload/type.d.ts +3 -1
  82. package/dist/pages/message/components/ReceiptBack.js +2 -2
  83. package/dist/pages/message/components/TextMixMessage.d.ts +2 -0
  84. package/dist/pages/message/components/TextMixMessage.js +10 -3
  85. package/dist/pages/message/components/TextMixQuote.js +10 -15
  86. package/dist/pages/message/components/TextMixQuoteMessage.d.ts +2 -1
  87. package/dist/pages/message/components/TextMixQuoteMessage.js +5 -5
  88. package/dist/pages/message/components/UploadProgress.d.ts +1 -1
  89. package/dist/pages/message/components/UploadProgress.js +1 -1
  90. package/dist/pages/message/components/messageBar/EmojiPanel.js +8 -9
  91. package/dist/pages/message/components/messageBar/MessageBar.d.ts +1 -1
  92. package/dist/pages/message/components/messageBar/MessageBar.js +14 -12
  93. package/dist/pages/message/components/messageBar/MessageInput.d.ts +1 -0
  94. package/dist/pages/message/components/messageBar/MessageInput.js +19 -1
  95. package/dist/pages/message/components/messageBar/OptionPanel.js +22 -44
  96. package/dist/pages/message/message.routes.js +10 -0
  97. package/dist/pages/search/components/SearchUser.js +2 -2
  98. package/dist/pages/types.d.ts +6 -2
  99. package/dist/slice/contact/contact.slice.js +1 -0
  100. package/dist/slice/video/video.action.js +9 -1
  101. package/dist/utils/common-action-sheet.d.ts +1 -0
  102. package/dist/utils/common-action-sheet.js +18 -0
  103. package/dist/utils/file-icon.js +29 -2
  104. package/dist/utils/file.d.ts +21 -2
  105. package/dist/utils/file.js +209 -42
  106. package/dist/utils/phone.d.ts +1 -1
  107. package/dist/utils/phone.js +1 -9
  108. package/dist/utils/request.d.ts +2 -1
  109. package/dist/utils/request.js +17 -6
  110. package/dist/utils/upload.d.ts +2 -4
  111. package/dist/utils/upload.js +13 -49
  112. package/package.json +5 -5
  113. package/dist/pages/address-list/Icons.d.ts +0 -5
  114. package/dist/pages/address-list/Icons.js +0 -9
  115. package/dist/slice/contact/contact.action.d.ts +0 -1
  116. package/dist/slice/contact/contact.action.js +0 -1
  117. package/dist/utils/cookie.d.ts +0 -2
  118. package/dist/utils/cookie.js +0 -25
  119. package/dist/utils/file-operate.d.ts +0 -1
  120. package/dist/utils/file-operate.js +0 -3
  121. package/dist/utils/text-mix.d.ts +0 -9
  122. package/dist/utils/text-mix.js +0 -75
  123. /package/dist/pages/address-list/{CardInfo.d.ts → components/CardInfo.d.ts} +0 -0
  124. /package/dist/pages/address-list/{CardInfo.js → components/CardInfo.js} +0 -0
  125. /package/dist/pages/address-list/{UserJobs.d.ts → components/UserJobs.d.ts} +0 -0
@@ -7,59 +7,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { backgroundUpload, UploadType } from 'react-native-compressor';
11
- import { getCookieString } from './cookie';
12
10
  import request, { getBaseURL } from './request';
13
- import { Platform } from 'react-native';
14
11
  import { toAbsolutePath } from './file';
15
- import { throttle } from "lodash-es";
16
12
  const uploadFile = (filePath, type, onProgress) => __awaiter(void 0, void 0, void 0, function* () {
17
13
  const url = getBaseURL();
18
14
  const uploadUrl = `${url}/api-file/file/uploadFile`;
19
- const cookies = yield getCookieString();
20
- const throttledFn = throttle((o) => {
21
- onProgress === null || onProgress === void 0 ? void 0 : onProgress(o);
22
- }, 500);
23
- if (Platform.OS === 'android') {
24
- const resp = yield backgroundUpload(uploadUrl, filePath, {
25
- httpMethod: 'POST',
26
- uploadType: UploadType.MULTIPART,
27
- headers: {
28
- Cookie: cookies,
29
- accept: 'application/json',
30
- },
31
- }, (written, total) => {
32
- // console.log('uploadFile progress: ', written, total);
33
- throttledFn({ loaded: written, total });
34
- });
35
- console.log('uploadFile: ', resp);
36
- try {
37
- let body = JSON.parse(resp.body);
38
- if (body.data) {
39
- return body.data;
40
- }
41
- else {
42
- throw new Error(body.codeMsg);
43
- }
44
- }
45
- catch (e) {
46
- console.log('uploadFile error: ', e);
47
- throw e;
48
- }
49
- }
50
- else {
51
- const formData = new FormData();
52
- formData.append('file', {
53
- // @ts-ignore
54
- uri: toAbsolutePath(filePath),
55
- name: filePath.split('/').pop(),
56
- type: type,
57
- });
58
- const resp = yield request.postFile(uploadUrl, formData, {
59
- onUploadProgress: throttledFn,
60
- });
61
- console.log('uploadFile: ', resp);
62
- return resp.data;
63
- }
15
+ const formData = new FormData();
16
+ // @ts-ignore
17
+ formData.append('file', {
18
+ // @ts-ignore
19
+ uri: toAbsolutePath(filePath),
20
+ name: filePath.split('/').pop(),
21
+ type: type,
22
+ });
23
+ const resp = yield request.postFile(uploadUrl, formData, {
24
+ onUploadProgress: onProgress,
25
+ });
26
+ console.log('uploadFile: ', resp);
27
+ return resp.data;
64
28
  });
65
29
  export default uploadFile;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@smart-link/rn-im",
3
- "version": "1.0.24",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "dependencies": {
7
7
  "color": "^5.0.0",
8
8
  "lodash-es": "^4.17.21",
9
- "emoji-regex": "^10.4.0"
9
+ "emoji-regex": "^10.4.0",
10
+ "await-to-js": "^3.0.0"
10
11
  },
11
12
  "devDependencies": {
12
13
  "@react-native/eslint-config": "0.73.2",
@@ -23,7 +24,6 @@
23
24
  },
24
25
  "peerDependencies": {
25
26
  "@baronha/react-native-photo-editor": "1.1.6",
26
- "@react-native-async-storage/async-storage": "1.24.0",
27
27
  "@react-native-camera-roll/camera-roll": "7.10.0",
28
28
  "@react-native-clipboard/clipboard": "1.16.2",
29
29
  "@react-native-community/netinfo": "11.4.1",
@@ -62,8 +62,8 @@
62
62
  "react-redux": "^8.1.3",
63
63
  "redux": "^4.2.1",
64
64
  "redux-thunk": "^2.4.2",
65
- "@smart-link/rn-ui": "^1.0.6",
66
- "@smart-link/im-base": "^1.0.24"
65
+ "@smart-link/rn-ui": "^1.1.0",
66
+ "@smart-link/im-base": "^1.1.1"
67
67
  },
68
68
  "files": [
69
69
  "dist/**",
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const Unfold: (props: {
3
- size: number;
4
- color: string;
5
- }) => React.JSX.Element;
@@ -1,9 +0,0 @@
1
- import { dp } from '@smart-link/rn-ui';
2
- import React from 'react';
3
- import { Svg, Path } from 'react-native-svg';
4
- export const Unfold = (props) => {
5
- const { size = 32, color } = props || {};
6
- return (<Svg viewBox="0 0 1024 1024" width={dp(size)} height={dp(size)}>
7
- <Path d="M832 800H256a32 32 0 0 1-32-32V192a32 32 0 0 1 64 0v544h544a32 32 0 1 1 0 64z" fill={color}/>
8
- </Svg>);
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export declare const getCookieString: () => Promise<string>;
2
- export declare const clearCookies: () => Promise<void>;
@@ -1,25 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { getBaseURL } from '../utils/request';
11
- import CookieManager from '@react-native-cookies/cookies';
12
- let cookiesStr = '';
13
- export const getCookieString = () => __awaiter(void 0, void 0, void 0, function* () {
14
- if (cookiesStr)
15
- return cookiesStr;
16
- const url = getBaseURL();
17
- const cookies = yield CookieManager.get(url);
18
- cookiesStr = Object.keys(cookies).map((key) => {
19
- return `${key}=${cookies[key].value}`;
20
- }).join(';');
21
- return cookiesStr;
22
- });
23
- export const clearCookies = () => __awaiter(void 0, void 0, void 0, function* () {
24
- cookiesStr = '';
25
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- // import {NativeModules, PermissionsAndroid, Platform} from "react-native";
2
- // import CameraRoll from '@react-native-community/cameraroll';
3
- export {};
@@ -1,9 +0,0 @@
1
- export type TextType = 'text' | 'phone' | 'url';
2
- export type TextItem = {
3
- type: TextType;
4
- value: string;
5
- };
6
- export declare function mixPhone(text: string): TextItem[];
7
- export declare function mixUrl(text: string): TextItem[];
8
- export declare function mixWithReg(text: string, type: TextType, reg: RegExp): TextItem[];
9
- export declare function mix(text: string): TextItem[];
@@ -1,75 +0,0 @@
1
- // export function mixEmoji(text: string, textEmojiItems: TextItem[]) {
2
- // if (!text || text.length === 0) {
3
- // return;
4
- // }
5
- //
6
- // let leftIndex = text.indexOf('[');
7
- // let rightIndex = text.indexOf(']');
8
- //
9
- // if (leftIndex < 0 || rightIndex < 0) {
10
- // textEmojiItems.push({type: 'text', value: text});
11
- // return;
12
- // }
13
- //
14
- //
15
- // let leftText = text.substring(0, leftIndex);
16
- // if(textEmojiItems.length > 0 && (leftText.length === 0 || leftText.lastIndexOf(' ') !== leftText.length -1)){
17
- // leftText = leftText +' ';
18
- // }
19
- // textEmojiItems.push({type: 'text', value: leftText });
20
- //
21
- // const emoji = text.substring(leftIndex + 1, rightIndex);
22
- // textEmojiItems.push({type: 'emoji', value: emoji});
23
- //
24
- // text = ' ' + text.substring(rightIndex + 1);
25
- // mixEmoji(text, textEmojiItems);
26
- // }
27
- export function mixPhone(text) {
28
- const phoneReg = /(1[\d]{10}|0\d{2,3}-\d{7,8}|400-?\d{3}-?\d{4})/g;
29
- return mixWithReg(text, 'phone', phoneReg);
30
- }
31
- export function mixUrl(text) {
32
- let urlReg = /(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g;
33
- return mixWithReg(text, 'url', urlReg);
34
- }
35
- export function mixWithReg(text, type, reg) {
36
- const items = [];
37
- const tags = text.match(reg);
38
- tags && tags.forEach(tag => {
39
- let leftIndex = text.indexOf(tag);
40
- let rightIndex = leftIndex + tag.length;
41
- const leftText = text.substring(0, leftIndex);
42
- items.push({ type: 'text', value: leftText + '' });
43
- const tagText = text.substring(leftIndex, rightIndex);
44
- items.push({ type: type, value: tagText });
45
- text = '' + text.substring(rightIndex);
46
- });
47
- items.push({ type: 'text', value: text });
48
- return items;
49
- }
50
- export function mix(text) {
51
- const viewItems = [];
52
- if (!text || text === '') {
53
- return viewItems;
54
- }
55
- mixUrl(text).forEach(textUrlItem => {
56
- if (textUrlItem.type === 'text') {
57
- mixPhone(textUrlItem.value).forEach(textPhoneItem => {
58
- // if (textPhoneItem.type === 'text') {
59
- // const textEmojiItems: TextItem[] = [];
60
- // // mixEmoji(textPhoneItem.value, textEmojiItems);
61
- // textEmojiItems.forEach(textEmojiItem => {
62
- // viewItems.push(textEmojiItem);
63
- // })
64
- // } else {
65
- // viewItems.push(textPhoneItem);
66
- // }
67
- viewItems.push(textPhoneItem);
68
- });
69
- }
70
- else {
71
- viewItems.push(textUrlItem);
72
- }
73
- });
74
- return viewItems;
75
- }