@smart-link/rn-im 1.1.4 → 1.1.6

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 (98) hide show
  1. package/dist/api/addressList.d.ts +2 -0
  2. package/dist/api/addressList.js +1 -0
  3. package/dist/api/user.d.ts +2 -1
  4. package/dist/api/user.js +1 -0
  5. package/dist/components/Camera/Camera.d.ts +1 -1
  6. package/dist/components/Camera/Camera.js +2 -1
  7. package/dist/components/Camera/CameraCapture.d.ts +0 -24
  8. package/dist/components/Camera/CameraCapture.js +10 -76
  9. package/dist/components/Camera/CameraResult.js +6 -5
  10. package/dist/components/FormatTimeText.js +2 -2
  11. package/dist/components/Highlighter.js +5 -6
  12. package/dist/components/IndicatorText.js +4 -4
  13. package/dist/components/NetworkUnconnected.js +4 -4
  14. package/dist/components/VideoPlayer.js +5 -5
  15. package/dist/hooks/useImSelector.d.ts +3 -1
  16. package/dist/hooks/useImSelector.js +6 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/init.js +17 -2
  20. package/dist/pages/address-list/AddressList.js +8 -8
  21. package/dist/pages/address-list/ChooseContact.js +40 -22
  22. package/dist/pages/address-list/MyGroups.js +4 -4
  23. package/dist/pages/address-list/Organization.js +3 -3
  24. package/dist/pages/address-list/UserDetail.js +26 -21
  25. package/dist/pages/address-list/UserSearch.js +3 -3
  26. package/dist/pages/address-list/components/OrgPath.js +4 -4
  27. package/dist/pages/address-list/components/RenderUserItem.d.ts +4 -3
  28. package/dist/pages/address-list/components/RenderUserItem.js +5 -5
  29. package/dist/pages/address-list/components/UserJobs.d.ts +3 -3
  30. package/dist/pages/address-list/components/UserJobs.js +23 -8
  31. package/dist/pages/collection/Collection.js +5 -5
  32. package/dist/pages/collection/ContentFactory.js +11 -11
  33. package/dist/pages/conversation/ConversationList.js +5 -5
  34. package/dist/pages/conversation/ForwardToConversation.js +8 -8
  35. package/dist/pages/conversation/components/ConversationCard.js +8 -8
  36. package/dist/pages/conversation/components/ConversationOption.js +3 -3
  37. package/dist/pages/conversation/setting/GroupTransfer.js +4 -4
  38. package/dist/pages/conversation/setting/OptionAvatars.js +6 -6
  39. package/dist/pages/conversation/setting/OptionGroup.js +4 -4
  40. package/dist/pages/conversation/setting/OptionGroupMoreMember.js +3 -3
  41. package/dist/pages/conversation/setting/OptionGroupNameOrNoticeEdit.js +4 -4
  42. package/dist/pages/message/ChooseMember.js +7 -7
  43. package/dist/pages/message/FileSelector.js +19 -13
  44. package/dist/pages/message/MessageBackup/MessageBackup.js +3 -3
  45. package/dist/pages/message/MessageBackup/RestoreBackupPage.js +4 -4
  46. package/dist/pages/message/MessageBackup/StartBackupPage.js +4 -4
  47. package/dist/pages/message/MessageList.js +17 -22
  48. package/dist/pages/message/MessageRecord.js +3 -3
  49. package/dist/pages/message/components/BusiNotifyCard.js +9 -9
  50. package/dist/pages/message/components/MessageItem.d.ts +1 -2
  51. package/dist/pages/message/components/MessageItem.js +11 -11
  52. package/dist/pages/message/components/MessageItemQuote.js +4 -4
  53. package/dist/pages/message/components/MessageItemTips.js +5 -5
  54. package/dist/pages/message/components/MessageOption.d.ts +2 -3
  55. package/dist/pages/message/components/MessageOption.js +18 -18
  56. package/dist/pages/message/components/MessagePayload.d.ts +1 -2
  57. package/dist/pages/message/components/MessagePayload.js +2 -2
  58. package/dist/pages/message/components/MessageUndo.js +6 -9
  59. package/dist/pages/message/components/MultipleBar/index.js +5 -5
  60. package/dist/pages/message/components/Payload/PayloadContact.js +6 -6
  61. package/dist/pages/message/components/Payload/PayloadFile.js +4 -4
  62. package/dist/pages/message/components/Payload/PayloadMultiple.js +8 -8
  63. package/dist/pages/message/components/Payload/PayloadNotify.js +12 -11
  64. package/dist/pages/message/components/Payload/PayloadPicture.js +1 -1
  65. package/dist/pages/message/components/Payload/PayloadShare.js +5 -5
  66. package/dist/pages/message/components/Payload/PayloadVideo.js +3 -3
  67. package/dist/pages/message/components/Payload/PayloadVoice.js +3 -3
  68. package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +2 -3
  69. package/dist/pages/message/components/Payload/PayloadWrapper.js +6 -5
  70. package/dist/pages/message/components/Payload/type.d.ts +1 -2
  71. package/dist/pages/message/components/ReceiptBack.js +8 -8
  72. package/dist/pages/message/components/TextMixMessage.js +9 -8
  73. package/dist/pages/message/components/TextMixQuote.js +23 -23
  74. package/dist/pages/message/components/UploadProgress.js +3 -3
  75. package/dist/pages/message/components/messageBar/EmojiPanel.js +3 -2
  76. package/dist/pages/message/components/messageBar/MessageBar.js +1 -0
  77. package/dist/pages/message/components/messageBar/MessageInput.js +1 -0
  78. package/dist/pages/message/components/messageBar/OptionPanel.js +40 -29
  79. package/dist/pages/message/components/messageBar/VoiceBar.js +6 -6
  80. package/dist/pages/search/SearchChatRecords.js +6 -6
  81. package/dist/pages/search/SearchFile.js +9 -9
  82. package/dist/pages/search/SearchPicturePage.js +3 -3
  83. package/dist/pages/search/components/ChatRecords.js +7 -7
  84. package/dist/pages/search/components/MyGroupChat.js +5 -5
  85. package/dist/pages/search/components/PictureMulipleBar.js +5 -5
  86. package/dist/pages/search/components/SearchFileList.js +8 -8
  87. package/dist/pages/search/components/SearchPictures.js +4 -4
  88. package/dist/pages/search/components/SearchShareLinkList.js +8 -8
  89. package/dist/pages/search/components/SearchUser.js +5 -5
  90. package/dist/slice/video/video.action.js +6 -2
  91. package/dist/utils/camera.d.ts +25 -0
  92. package/dist/utils/camera.js +75 -0
  93. package/dist/utils/file.d.ts +2 -1
  94. package/dist/utils/file.js +26 -22
  95. package/dist/utils/request.js +0 -1
  96. package/dist/utils/summary.js +2 -2
  97. package/dist/utils/upload.js +11 -4
  98. package/package.json +3 -4
@@ -20,8 +20,10 @@ export declare const listTree: (data: IListTreeParams) => Promise<import("../uti
20
20
  export declare const listUser: (data: IListUserParams) => Promise<import("../utils/request").IResponse<IUser[]>>;
21
21
  export declare const queryUser: (userId: string) => Promise<import("../utils/request").IResponse<any>>;
22
22
  export declare const queryUsersByCond: (userIds: string[]) => Promise<import("../utils/request").IResponse<IUser[]>>;
23
+ export declare const queryUserJobs: (userIds: string[]) => Promise<import("../utils/request").IResponse<IGroup[]>>;
23
24
  export declare const searchUser: (params: {
24
25
  userNameLike: string;
26
+ tenantId?: string;
25
27
  }) => Promise<import("../utils/request").IResponse<IUser[]>>;
26
28
  export declare const listRole: () => Promise<import("../utils/request").IResponse<IRole[]>>;
27
29
  export declare const listRoleUser: (roleId: string) => Promise<import("../utils/request").IResponse<IUser[]>>;
@@ -7,6 +7,7 @@ export const queryUser = (userId) => request.post(`${api}/open/userQuery/queryUs
7
7
  export const queryUsersByCond = (userIds) => request.post(`${api}/open/userQuery/queryUsersByCond`, {
8
8
  userIds,
9
9
  });
10
+ export const queryUserJobs = (userIds) => request.post(`${api}/open/userQuery/getUserJobs`, [{ userIds }]);
10
11
  export const searchUser = (params) => request.post(`${api}/open/userQuery/listUser`, Object.assign(Object.assign({}, params), { queryAll: true, userStatus: 'valid', pageSize: 100, pageNum: 1 }));
11
12
  export const listRole = () => request.post(`${api}/open/roleQuery/listRole`, {
12
13
  pageNum: 1,
@@ -1,8 +1,9 @@
1
1
  import { IQueryPage, IUser } from '@smart-link/im-base';
2
2
  export declare const userApi = "/api-user-center";
3
3
  export declare const searchUser: (params: {
4
- searchKey: string;
4
+ userNameLike: string;
5
5
  } & IQueryPage) => Promise<import("../utils/request").IResponse<IUser[]>>;
6
6
  export declare const updateUserInfo: (params: any) => Promise<import("../utils/request").IResponse<unknown>>;
7
7
  export declare const reloadUserInfo: () => Promise<import("../utils/request").IResponse<unknown>>;
8
8
  export declare const queryUserByIds: (userIds: string[]) => Promise<import("../utils/request").IResponse<IUser[]>>;
9
+ export declare const loadUserInfoByUserId: (userId: string) => Promise<import("../utils/request").IResponse<IUser>>;
package/dist/api/user.js CHANGED
@@ -4,3 +4,4 @@ export const searchUser = (params) => request.post(`${userApi}/open/userQuery/li
4
4
  export const updateUserInfo = (params) => request.post(`${userApi}/mgr/user/editUserInfo`, params);
5
5
  export const reloadUserInfo = () => request.post('/auth/reloadUserInfo', {});
6
6
  export const queryUserByIds = (userIds) => request.post(`${userApi}/open/userQuery/queryUsersByIds`, userIds);
7
+ export const loadUserInfoByUserId = (userId) => request.post(`${userApi}/auth/loadUserInfoByUserId?userId=${userId}`);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { VideoData, PictureData } from './CameraCapture';
2
+ import { PictureData, VideoData } from "../../utils/camera";
3
3
  export interface ICameraProps {
4
4
  horizontal: boolean;
5
5
  finishTakePicture: (data: PictureData) => void;
@@ -9,10 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import React, { memo } from 'react';
11
11
  import CameraResult from './CameraResult';
12
- import CameraCapture, { buildPictureData } from './CameraCapture';
12
+ import CameraCapture from './CameraCapture';
13
13
  import { Modal, Platform, StatusBar, NativeModules } from "react-native";
14
14
  import { toAbsolutePath, toFullPath } from "../../utils/file";
15
15
  import PhotoEditor from "@baronha/react-native-photo-editor";
16
+ import { buildPictureData } from "../../utils/camera";
16
17
  const Camera = memo(props => {
17
18
  const { horizontal = true, cancelCamera, finishTakePicture, finishTakeRecord, } = props;
18
19
  const [showCamera, setShowCamera] = React.useState(true);
@@ -1,32 +1,8 @@
1
1
  import React from 'react';
2
- import { PhotoFile } from 'react-native-vision-camera';
3
2
  export interface IProps {
4
3
  finishTakePicture?: (data: any) => void;
5
4
  finishTakeRecord?: (data: any) => void;
6
5
  cancelCamera?: () => void;
7
6
  }
8
7
  declare const CameraCapture: React.NamedExoticComponent<IProps>;
9
- export interface PictureData {
10
- filename: string;
11
- localPath: string;
12
- height: number;
13
- width: number;
14
- ext: string;
15
- type: string;
16
- size: number;
17
- }
18
- export declare function buildPictureData(data: PhotoFile): Promise<{
19
- filename: string;
20
- localPath: string;
21
- height: number;
22
- width: number;
23
- ext: string | undefined;
24
- type: string;
25
- size: string;
26
- }>;
27
- export interface VideoData extends PictureData {
28
- imageName: string;
29
- imagePath: string;
30
- duration: number;
31
- }
32
8
  export default CameraCapture;
@@ -8,15 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import React, { memo, useEffect, useState, useCallback, useRef } from 'react';
11
- import { StyleSheet, Text, TouchableOpacity, View, Animated, Dimensions, Platform } from 'react-native';
12
- import { Camera, useCameraDevice, useCameraFormat, useMicrophonePermission } from 'react-native-vision-camera';
11
+ import { StyleSheet, TouchableOpacity, View, Animated, Dimensions, Platform } from 'react-native';
12
+ import { Camera, useCameraDevice, useCameraFormat, useMicrophonePermission, } from 'react-native-vision-camera';
13
13
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
14
- import { numberToTime, ResourceType } from '@smart-link/im-base';
15
- import { moveFile, requestSaveFilePermissionIfAndroid, toFullPath } from '../../utils/file';
14
+ import { numberToTime } from '@smart-link/im-base';
15
+ import { requestSaveFilePermissionIfAndroid } from '../../utils/file';
16
16
  import { getImManager } from '../../init';
17
- import { dp, CaihIcon, Toast } from '@smart-link/rn-ui';
18
- import { createVideoThumbnail, Image, Video, getFileSize, uuidv4 } from 'react-native-compressor';
19
- const { PICTURE, VIDEO } = ResourceType;
17
+ import { dp, CaihIcon, Toast, CaihText } from '@smart-link/rn-ui';
18
+ import { buildPictureData, buildVideoData } from "../../utils/camera";
20
19
  const FlashModeValue = ['on', 'off', 'auto'];
21
20
  const FlashModeIcon = ['flash', 'flash-off', 'flash-auto'];
22
21
  const CameraTypeValue = ['back', 'front'];
@@ -87,7 +86,7 @@ const CameraCapture = memo(props => {
87
86
  camera.current.startRecording({
88
87
  videoBitRate: 'low',
89
88
  videoCodec: 'h264',
90
- fileType: 'mp4',
89
+ fileType: 'mov',
91
90
  onRecordingFinished: (data) => __awaiter(void 0, void 0, void 0, function* () {
92
91
  var _c, _d;
93
92
  console.log('onRecordingFinished: ', data);
@@ -153,12 +152,12 @@ const CameraCapture = memo(props => {
153
152
  };
154
153
  }, []);
155
154
  return (<View style={styles.camera}>
156
- {device ? (<Camera ref={camera} device={device} format={format} isActive={true} style={styles.preview} photo={true} video={true} pixelFormat={'yuv'} audio={microphone.hasPermission} outputOrientation="portrait" onInitialized={() => {
155
+ {device ? (<Camera ref={camera} device={device} format={format} isActive={true} style={styles.preview} photo={true} video={true} pixelFormat={'yuv'} audio={microphone.hasPermission} onInitialized={() => {
157
156
  console.log('Camera initialized!');
158
157
  }} onError={error => {
159
158
  console.log(error);
160
159
  }}/>) : (<View style={styles.emptyContainer}>
161
- <Text style={styles.text}>Your phone does not have a Camera.</Text>
160
+ <CaihText style={styles.text}>Your phone does not have a Camera.</CaihText>
162
161
  </View>)}
163
162
 
164
163
  {isRecording && (<>
@@ -197,7 +196,7 @@ const Timer = memo(props => {
197
196
  }, []);
198
197
  return (<View style={style}>
199
198
  {showPoint && <View style={styles.point}/>}
200
- <Text style={styles.timeText}>{numberToTime(duration / 2)}</Text>
199
+ <CaihText style={styles.timeText}>{numberToTime(duration / 2)}</CaihText>
201
200
  </View>);
202
201
  });
203
202
  const Bounds = memo(props => {
@@ -317,69 +316,4 @@ const styles = StyleSheet.create({
317
316
  textAlign: 'center',
318
317
  },
319
318
  });
320
- export function buildPictureData(data) {
321
- return __awaiter(this, void 0, void 0, function* () {
322
- const uid = uuidv4();
323
- const path = data.path;
324
- const ext = path.split('.').pop();
325
- const filename = PICTURE + '_' + uid + '.' + ext;
326
- const tmp = yield Image.compress(path, {
327
- compressionMethod: 'auto'
328
- });
329
- const localPath = yield moveFile(tmp, filename, PICTURE);
330
- const size = yield getFileSize(toFullPath(localPath));
331
- let width = data.width;
332
- let height = data.height;
333
- if (data.orientation === 'portrait') {
334
- if (width > height) {
335
- [width, height] = [height, width];
336
- }
337
- }
338
- return {
339
- filename: filename,
340
- localPath: localPath,
341
- height: height,
342
- width: width,
343
- ext: ext,
344
- type: 'image/' + ext,
345
- size,
346
- };
347
- });
348
- }
349
- function buildVideoData(data) {
350
- return __awaiter(this, void 0, void 0, function* () {
351
- const uid = uuidv4();
352
- const path = data.path;
353
- try {
354
- const compressPath = yield Video.compress(path, {
355
- compressionMethod: 'auto',
356
- maxSize: 1080,
357
- });
358
- const ext = compressPath.split('.').pop();
359
- const filename = VIDEO + '_' + uid + '.' + ext;
360
- const size = yield getFileSize(compressPath);
361
- let thumb = yield createVideoThumbnail(compressPath);
362
- console.log('RNThumbnail', thumb);
363
- const imageName = 'thumb_' + uid + '.jpg';
364
- const imagePath = yield moveFile(thumb.path, imageName, VIDEO);
365
- const localPath = yield moveFile(compressPath, filename, VIDEO);
366
- return {
367
- filename,
368
- localPath: localPath,
369
- imageName,
370
- imagePath,
371
- duration: data.duration,
372
- ext: ext,
373
- type: 'video/' + ext,
374
- width: thumb.width,
375
- height: thumb.height,
376
- size,
377
- };
378
- }
379
- catch (e) {
380
- console.log('RNThumbnail', e);
381
- return null;
382
- }
383
- });
384
- }
385
319
  export default CameraCapture;
@@ -1,17 +1,16 @@
1
1
  import { dp } from '@smart-link/rn-ui';
2
2
  import React, { useEffect } from 'react';
3
- import { View, StyleSheet, TouchableOpacity, Image } from 'react-native';
3
+ import { View, StyleSheet, TouchableOpacity, Image, Dimensions } from 'react-native';
4
4
  import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
5
5
  const CameraResult = (props) => {
6
- const { horizontal = false, isVideo = false, source, cancelResult, confirmResult, editResult, } = props;
7
- const resizeMode = horizontal ? 'contain' : 'cover';
6
+ const { isVideo = false, source, cancelResult, confirmResult, editResult, } = props;
8
7
  useEffect(() => {
9
8
  return () => {
10
9
  console.log('CameraResult unmounted');
11
10
  };
12
11
  }, []);
13
12
  return (<View style={styles.confirm}>
14
- <Image style={styles.pic} resizeMode={resizeMode} source={Object.assign({}, source)}/>
13
+ <Image style={styles.pic} resizeMode="contain" source={Object.assign({}, source)}/>
15
14
 
16
15
  <View style={styles.bar}>
17
16
  <TouchableOpacity style={styles.cancel} onPress={cancelResult}>
@@ -35,7 +34,9 @@ const styles = StyleSheet.create({
35
34
  justifyContent: "center",
36
35
  },
37
36
  pic: {
38
- flex: 1,
37
+ width: Dimensions.get('window').width,
38
+ height: Dimensions.get('window').height,
39
+ alignSelf: 'center',
39
40
  },
40
41
  bar: {
41
42
  position: 'absolute',
@@ -10,10 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React from "react";
13
- import { Text } from "react-native";
14
13
  import useFormatMsgTime from "../hooks/useFormatMsgTime";
14
+ import { CaihText } from "@smart-link/rn-ui";
15
15
  const FormatTimeText = (_a) => {
16
16
  var { time, showDetail = true } = _a, retProps = __rest(_a, ["time", "showDetail"]);
17
- return <Text {...retProps}>{useFormatMsgTime(time, showDetail)}</Text>;
17
+ return <CaihText {...retProps}>{useFormatMsgTime(time, showDetail)}</CaihText>;
18
18
  };
19
19
  export default FormatTimeText;
@@ -1,17 +1,16 @@
1
- import { useTheme } from '@smart-link/rn-ui';
1
+ import { CaihText, useTheme } from '@smart-link/rn-ui';
2
2
  import React, { memo } from 'react';
3
- import { Text } from 'react-native';
4
3
  const Highlighter = ({ style, searchWord, textToHighlight, numberOfLines }) => {
5
4
  const theme = useTheme();
6
5
  // 高亮显示搜索关键字
7
- return (<Text style={style} numberOfLines={numberOfLines}>
6
+ return (<CaihText style={style} numberOfLines={numberOfLines}>
8
7
  {textToHighlight.split(new RegExp(`(${searchWord})`, 'gi')).map((part, index) => {
9
- return part.toLowerCase() === searchWord.toLowerCase() ? (<Text key={index} style={{
8
+ return part.toLowerCase() === searchWord.toLowerCase() ? (<CaihText key={index} style={{
10
9
  color: theme.primaryColor,
11
10
  }}>
12
11
  {part}
13
- </Text>) : (part);
12
+ </CaihText>) : (part);
14
13
  })}
15
- </Text>);
14
+ </CaihText>);
16
15
  };
17
16
  export default memo(Highlighter);
@@ -1,13 +1,13 @@
1
- import { dp } from '@smart-link/rn-ui';
1
+ import { CaihText, dp } from '@smart-link/rn-ui';
2
2
  import React, { memo } from 'react';
3
- import { View, StyleSheet, ActivityIndicator, Text } from 'react-native';
3
+ import { View, StyleSheet, ActivityIndicator } from 'react-native';
4
4
  const IndicatorText = memo(props => {
5
5
  const { text, loadingColor = '#fff', fontSize = dp(18), color = '#fff', style } = props;
6
6
  return (<View style={[styles.indicatorText, style]}>
7
7
  <ActivityIndicator size="small" color={loadingColor} animating={true}/>
8
- <Text numberOfLines={1} style={[styles.text, { fontSize, color }]}>
8
+ <CaihText numberOfLines={1} style={[styles.text, { fontSize, color }]}>
9
9
  {text}
10
- </Text>
10
+ </CaihText>
11
11
  </View>);
12
12
  });
13
13
  const styles = StyleSheet.create({
@@ -1,13 +1,13 @@
1
- import { dp } from '@smart-link/rn-ui';
1
+ import { CaihText, dp } from '@smart-link/rn-ui';
2
2
  import React, { memo } from 'react';
3
- import { StyleSheet, Text, View } from 'react-native';
3
+ import { StyleSheet, View } from 'react-native';
4
4
  import useTranslation from '../hooks/useTranslation';
5
5
  const NetworkUnconnected = memo(() => {
6
6
  const { t } = useTranslation();
7
7
  return (<View style={styles.network}>
8
- <Text style={styles.text} numberOfLines={1}>
8
+ <CaihText style={styles.text} numberOfLines={1}>
9
9
  {t('checkNetwork')}
10
- </Text>
10
+ </CaihText>
11
11
  </View>);
12
12
  });
13
13
  const styles = StyleSheet.create({
@@ -1,12 +1,12 @@
1
1
  import React, { memo, useEffect, useState } from 'react';
2
- import { Modal, StyleSheet, Text, TouchableOpacity, View, ImageBackground, StatusBar, Platform, Dimensions, } from 'react-native';
2
+ import { Modal, StyleSheet, TouchableOpacity, View, ImageBackground, StatusBar, Platform, Dimensions, } from 'react-native';
3
3
  import Video from 'react-native-video';
4
4
  import MaterialIcons from "react-native-vector-icons/MaterialIcons";
5
5
  import AntDesign from "react-native-vector-icons/AntDesign";
6
6
  import FontAwesome from "react-native-vector-icons/FontAwesome";
7
7
  import * as Progress from "react-native-progress";
8
8
  import Slider from '@react-native-community/slider';
9
- import { dp } from '@smart-link/rn-ui';
9
+ import { CaihText, dp } from '@smart-link/rn-ui';
10
10
  import { toAbsolutePath } from '../utils/file';
11
11
  import { numberToTime } from '@smart-link/im-base';
12
12
  import useTranslation from '../hooks/useTranslation';
@@ -116,7 +116,7 @@ const VideoPlayer = memo(() => {
116
116
  {(isError || videoDownloadError) &&
117
117
  <View style={styles.error}>
118
118
  <MaterialIcons name={'error'} size={dp(50)} color={'#fff'}/>
119
- <Text style={styles.errorText}>{t('videoLoadingError')}</Text>
119
+ <CaihText style={styles.errorText}>{t('videoLoadingError')}</CaihText>
120
120
  </View>}
121
121
  {!isError && videoLocalPath &&
122
122
  <Video ref={player} source={{ uri: toAbsolutePath(videoLocalPath) }} paused={paused} resizeMode={'contain'} progressUpdateInterval={100} onLoad={onLoad} onProgress={onProgress} onEnd={onEnd} onError={videoError} style={styles.player}/>}
@@ -143,7 +143,7 @@ const PlayBar = memo(props => {
143
143
  <FontAwesome name='pause' size={dp(13)} color={'#fff'}/>
144
144
  </TouchableOpacity>}
145
145
  <View style={{ width: dp(5) }}/>
146
- <Text style={styles.time}>{numberToTime(currentTime)}</Text>
146
+ <CaihText style={styles.time}>{numberToTime(currentTime)}</CaihText>
147
147
  <View style={{ width: dp(10) }}/>
148
148
  {Platform.OS === 'ios' ? <View style={styles.progress}>
149
149
  <View style={[styles.percent, { width: percentWidth }]}>
@@ -152,7 +152,7 @@ const PlayBar = memo(props => {
152
152
  </View> :
153
153
  <Slider style={{ width: dp(200), height: dp(30) }} disabled={duration === 0} value={currentTime} minimumValue={0} maximumValue={duration} minimumTrackTintColor="#fff" thumbTintColor="#fff" onSlidingStart={onPressSeek} onValueChange={onMoveSeek} onSlidingComplete={onReleaseSeek}/>}
154
154
  <View style={{ width: dp(10) }}/>
155
- <Text style={styles.time}>{numberToTime(duration)}</Text>
155
+ <CaihText style={styles.time}>{numberToTime(duration)}</CaihText>
156
156
  </View>);
157
157
  });
158
158
  const SeekBottom = memo(props => {
@@ -1,7 +1,9 @@
1
- import { ChatGroupState, CollectionState, ConversationState, ForwardState, IUser, MessageState, SettingState } from '@smart-link/im-base';
1
+ import { ChatGroupState, CollectionState, ConversationState, ForwardState, IUser, MessageState, SettingState, IConversation } from '@smart-link/im-base';
2
2
  import { ContactState, PanelState, VideoState } from '../slice';
3
3
  export declare function useConversation(): ConversationState;
4
+ export declare function useCurrentConversation(): IConversation | null;
4
5
  export declare function useUnreadTotal(): number;
6
+ export declare function useConversations(): Record<string, any>;
5
7
  export declare function useAvatars(): Record<string, string>;
6
8
  export declare function useMessage(): MessageState;
7
9
  export declare function useAuth(): {
@@ -2,9 +2,15 @@ import { useSelector } from 'react-redux';
2
2
  export function useConversation() {
3
3
  return useSelector(state => state['chat/conversation']);
4
4
  }
5
+ export function useCurrentConversation() {
6
+ return useSelector(state => state['chat/conversation']['currentConversation']);
7
+ }
5
8
  export function useUnreadTotal() {
6
9
  return useSelector(state => state['chat/conversation']['unreadTotal']);
7
10
  }
11
+ export function useConversations() {
12
+ return useSelector(state => state['chat/conversation']['c']);
13
+ }
8
14
  export function useAvatars() {
9
15
  return useSelector(state => state['chat/conversation']['avatarsMap']);
10
16
  }
package/dist/index.d.ts CHANGED
@@ -7,3 +7,4 @@ export * from './hooks/useImSelector';
7
7
  export * from './utils/file';
8
8
  export { default as ChatAvatar } from './components/ChatAvatar/ChatAvatar';
9
9
  export { default as VideoPlayer } from './components/VideoPlayer';
10
+ export { default as UserJobs } from './pages/address-list/components/UserJobs';
package/dist/index.js CHANGED
@@ -7,3 +7,4 @@ export * from './hooks/useImSelector';
7
7
  export * from './utils/file';
8
8
  export { default as ChatAvatar } from './components/ChatAvatar/ChatAvatar';
9
9
  export { default as VideoPlayer } from './components/VideoPlayer';
10
+ export { default as UserJobs } from './pages/address-list/components/UserJobs';
package/dist/init.js CHANGED
@@ -13,9 +13,10 @@ import Sqlite from 'react-native-sqlite-storage';
13
13
  import { createRequest } from './utils/request';
14
14
  import { defaultAvatars } from './default-assets';
15
15
  import uploadFile from './utils/upload';
16
- import { download, initDir } from './utils/file';
16
+ import { download, getFileSize, initDir, moveFile, toAbsolutePath } from './utils/file';
17
17
  import { dp, Toast } from '@smart-link/rn-ui';
18
18
  import { cloneDeep } from "lodash-es";
19
+ import { Video } from "react-native-compressor";
19
20
  let imManager;
20
21
  let logo;
21
22
  export const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logout, undoLimitTime }) => __awaiter(void 0, void 0, void 0, function* () {
@@ -49,9 +50,23 @@ export const initImSdk = ({ user, storage, store, server, logo: outLogo, t, logo
49
50
  beforeUpload: (payload, payloadType) => __awaiter(void 0, void 0, void 0, function* () {
50
51
  const file = payload;
51
52
  if (payloadType === PayloadType.VIDEO) {
52
- if (!file.imageFileId) {
53
+ if (!file.imageFileId && file.imagePath) {
54
+ // 上传缩率图
53
55
  file.imageFileId = yield uploadFile(file.imagePath, 'image/jpg');
54
56
  }
57
+ if (!file.fileId && payload.localPath && file.localPath.endsWith('.mov')) {
58
+ // 压缩视频后上传
59
+ const compressPath = yield Video.compress(toAbsolutePath(file.localPath), {
60
+ compressionMethod: 'auto',
61
+ maxSize: 1080,
62
+ });
63
+ const filename = file.filename.replace('.mov', '.mp4');
64
+ file.size = yield getFileSize(file.localPath);
65
+ file.sourcePath = file.localPath;
66
+ file.localPath = yield moveFile(compressPath, filename, 'video');
67
+ file.filename = filename;
68
+ file.type = 'video/mp4';
69
+ }
55
70
  return file;
56
71
  }
57
72
  if (payload.fileId) {
@@ -1,6 +1,6 @@
1
- import { dp, ListRow, NavigationPage, SearchBar, useTheme } from '@smart-link/rn-ui';
1
+ import { CaihText, dp, ListRow, NavigationPage, SearchBar, useTheme } from '@smart-link/rn-ui';
2
2
  import React from 'react';
3
- import { View, Text, StyleSheet, Image } from 'react-native';
3
+ import { View, StyleSheet, Image } from 'react-native';
4
4
  import useTranslation from '../../hooks/useTranslation';
5
5
  import { Group, Unfold } from './components/Icons';
6
6
  import { useAuth } from '../../hooks/useImSelector';
@@ -30,7 +30,7 @@ const AddressList = ({ navigation }) => {
30
30
  }]}>
31
31
  <Group size={22} color="#fff"/>
32
32
  </View>
33
- <Text style={styles.title}>{t('groupChat')}</Text>
33
+ <CaihText style={styles.title}>{t('groupChat')}</CaihText>
34
34
  </View>} topSeparator="full" onPress={() => {
35
35
  navigation.navigate('MyGroups');
36
36
  }}/>
@@ -39,23 +39,23 @@ const AddressList = ({ navigation }) => {
39
39
 
40
40
  <ListRow title={<View style={styles.orgLine}>
41
41
  <Image style={{ width: 30, height: 30, borderRadius: 3 }} source={getLogo()}/>
42
- <Text style={styles.compName}>{compName}</Text>
42
+ <CaihText style={styles.compName}>{compName}</CaihText>
43
43
  </View>}/>
44
44
 
45
45
  {groupCategoryList.map(item => {
46
46
  return (<ListRow key={item.groupCategoryId} title={<View style={styles.orgLine}>
47
47
  <Unfold size={18} color={theme.primaryColor}/>
48
- <Text style={styles.title}>{item.groupCategoryName}</Text>
48
+ <CaihText style={styles.title}>{item.groupCategoryName}</CaihText>
49
49
  </View>} onPress={() => handleGroupCategory(item)} topSeparator="full"/>);
50
50
  })}
51
51
 
52
52
  {/*<ListRow title=*/}
53
53
  {/* {*/}
54
54
  {/* <View style={styles.orgLine}>*/}
55
- {/* <Text style={[styles.smallIcon]}>*/}
55
+ {/* <CaihText style={[styles.smallIcon]}>*/}
56
56
  {/* <Icon name="ban-outlined" size={18} color='red' />*/}
57
- {/* </Text>*/}
58
- {/* <Text style={styles.title}>{t('myOrg')}</Text>*/}
57
+ {/* </CaihText>*/}
58
+ {/* <CaihText style={styles.title}>{t('myOrg')}</CaihText>*/}
59
59
  {/* </View>*/}
60
60
  {/* }*/}
61
61
  {/* onPress={*/}