@smart-link/rn-im 1.1.5 → 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 +10 -4
  98. package/package.json +3 -4
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React, { memo, useState } from 'react';
12
+ import React, { memo, useRef, useState } from 'react';
13
13
  import { View, StyleSheet, TouchableOpacity } from 'react-native';
14
14
  import { dp } from "@smart-link/rn-ui";
15
15
  import Svg, { Path } from "react-native-svg";
@@ -30,8 +30,9 @@ const SvgFromUri = ({ direction, focus }) => {
30
30
  };
31
31
  const PayloadWrapper = memo((_a) => {
32
32
  var { children, direction, isRecord, showArrow, onLongPress, style } = _a, retProps = __rest(_a, ["children", "direction", "isRecord", "showArrow", "onLongPress", "style"]);
33
- const [layout, setLayout] = useState();
33
+ // const [layout, setLayout] = useState<NativeEventLayout>();
34
34
  const [focus, setFocus] = useState(false);
35
+ const ref = useRef(null);
35
36
  let backgroundColor = direction === 'right' ? '#cde6f9' : '#fff';
36
37
  if (focus) {
37
38
  backgroundColor = Color(backgroundColor).darken(0.08).hex();
@@ -39,15 +40,15 @@ const PayloadWrapper = memo((_a) => {
39
40
  if (isRecord) {
40
41
  backgroundColor = 'transparent';
41
42
  }
42
- return (<TouchableOpacity {...retProps} style={[
43
+ return (<TouchableOpacity ref={ref} {...retProps} style={[
43
44
  style,
44
45
  {
45
46
  backgroundColor,
46
47
  }
47
48
  ]} onLayout={e => {
48
- setLayout(e.nativeEvent.layout);
49
+ // setLayout(e.nativeEvent.layout);
49
50
  }} onLongPress={(e) => {
50
- onLongPress && onLongPress(e, layout);
51
+ onLongPress && onLongPress(e, ref.current);
51
52
  }} activeOpacity={1} onPressIn={() => {
52
53
  setFocus(true);
53
54
  }} onPressOut={() => {
@@ -1,6 +1,5 @@
1
1
  import { IMessage } from "@smart-link/im-base";
2
2
  import { GestureResponderEvent, StyleProp, ViewStyle } from "react-native";
3
- import { NativeEventLayout } from "../../../types";
4
3
  export interface PayloadProps extends IMessage {
5
4
  width?: number;
6
5
  style?: StyleProp<ViewStyle>;
@@ -8,6 +7,6 @@ export interface PayloadProps extends IMessage {
8
7
  showArrow?: boolean;
9
8
  isRecord?: boolean;
10
9
  onPress?: (e: GestureResponderEvent) => void;
11
- onLongPress?: (e: GestureResponderEvent, layout: NativeEventLayout) => void;
10
+ onLongPress?: (e: GestureResponderEvent, ref: any) => void;
12
11
  onLoad?: (localPath: string) => void;
13
12
  }
@@ -1,7 +1,7 @@
1
1
  import { MessageStatus } from '@smart-link/im-base';
2
- import { dp } from '@smart-link/rn-ui';
2
+ import { CaihText, dp } from '@smart-link/rn-ui';
3
3
  import * as React from 'react';
4
- import { View, Text, StyleSheet } from "react-native";
4
+ import { View, StyleSheet } from "react-native";
5
5
  import useTranslation from "../../../hooks/useTranslation";
6
6
  import dayjs from "dayjs";
7
7
  export const ReceiptBack = ({ message }) => {
@@ -9,10 +9,10 @@ export const ReceiptBack = ({ message }) => {
9
9
  // console.log('ReceiptBack: ', message.receiptBackList.length, message.receiptBackList);
10
10
  return (<View style={styles.content}>
11
11
  <View style={{ flexDirection: 'row' }}>
12
- <Text style={[styles.text, { width: dp(165) }]}>
12
+ <CaihText style={[styles.text, { width: dp(165) }]}>
13
13
  {dayjs(message.messageTime).format('YYYY-MM-DD HH:mm:ss')}
14
- </Text>
15
- <Text style={styles.text}>{message.messageStatus === MessageStatus.EMIT_ERROR ? t('sendFail') : t('sent')}</Text>
14
+ </CaihText>
15
+ <CaihText style={styles.text}>{message.messageStatus === MessageStatus.EMIT_ERROR ? t('sendFail') : t('sent')}</CaihText>
16
16
  </View>
17
17
 
18
18
  {message.receiptBackList && message.receiptBackList.map((item, index) => {
@@ -30,10 +30,10 @@ export const ReceiptBack = ({ message }) => {
30
30
  return null;
31
31
  }
32
32
  return (<View key={index} style={{ flexDirection: 'row' }}>
33
- <Text style={[styles.text, { width: dp(165) }]}>
33
+ <CaihText style={[styles.text, { width: dp(165) }]}>
34
34
  {dayjs(item.receiptBackMessageTime || item.messageTime).format('YYYY-MM-DD HH:mm:ss')}
35
- </Text>
36
- <Text style={styles.text}>{statusText}</Text>
35
+ </CaihText>
36
+ <CaihText style={styles.text}>{statusText}</CaihText>
37
37
  </View>);
38
38
  })}
39
39
  </View>);
@@ -1,32 +1,33 @@
1
1
  import { mix, mixAtList } from "@smart-link/im-base";
2
2
  import React, { memo } from 'react';
3
- import { Text, StyleSheet } from "react-native";
3
+ import { StyleSheet } from "react-native";
4
+ import { CaihText } from "@smart-link/rn-ui";
4
5
  const TextMixMessage = memo(props => {
5
6
  const { text, atList, onLongPressPhone, onLongPressURL, textStyle, } = props;
6
7
  const viewItems = mixAtList(atList, mix(text));
7
- return (<Text style={textStyle}>
8
+ return (<CaihText style={textStyle}>
8
9
  {viewItems.map((item, index) => {
9
10
  if (item.type === 'phone') {
10
- return (<Text key={index} style={styles.phone} onPress={(e) => {
11
+ return (<CaihText key={index} style={styles.phone} onPress={(e) => {
11
12
  e.stopPropagation();
12
13
  onLongPressPhone && onLongPressPhone(item.value);
13
14
  }}>
14
15
  {item.value}
15
- </Text>);
16
+ </CaihText>);
16
17
  }
17
18
  else if (item.type === 'url') {
18
- return (<Text key={index} style={styles.url} onPress={() => {
19
+ return (<CaihText key={index} style={styles.url} onPress={() => {
19
20
  onLongPressURL && onLongPressURL(item.value);
20
21
  }}>
21
22
  {item.value}
22
- </Text>);
23
+ </CaihText>);
23
24
  }
24
25
  else if (item.type === 'at') {
25
- return (<Text key={index} style={styles.at}>{item.value}</Text>);
26
+ return (<CaihText key={index} style={styles.at}>{item.value}</CaihText>);
26
27
  }
27
28
  return item.value;
28
29
  })}
29
- </Text>);
30
+ </CaihText>);
30
31
  });
31
32
  const styles = StyleSheet.create({
32
33
  phone: {
@@ -1,9 +1,9 @@
1
1
  import React, { memo } from 'react';
2
- import { ActivityIndicator, Image, StyleSheet, Text, TouchableOpacity, View, Dimensions } from 'react-native';
2
+ import { ActivityIndicator, Image, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native';
3
3
  import TextMixMessage from './TextMixMessage';
4
4
  import { shadowStyle } from '../../../components/styles';
5
5
  import AntDesign from 'react-native-vector-icons/AntDesign';
6
- import { dp, useTheme } from '@smart-link/rn-ui';
6
+ import { CaihText, dp, useTheme } from '@smart-link/rn-ui';
7
7
  import { ConversationType, numberToTime, buildSimpleText } from '@smart-link/im-base';
8
8
  import { calculate } from '../../../utils/golden-rectangle';
9
9
  import { dark } from '../../../utils/color';
@@ -16,10 +16,10 @@ const { width } = Dimensions.get('window');
16
16
  export const QuoteTextMix = memo(props => {
17
17
  const { quoteTitle, quoteText, color, textStyle, quoteStyle, onPressQuote, onLongPressPhone, onLongPressURL } = props;
18
18
  return (<TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[quoteStyle, styles.leftBorder, { backgroundColor: dark(color, 4) }]}>
19
- <Text style={[textStyle, styles.replyUserName]}>
19
+ <CaihText style={[textStyle, styles.replyUserName]}>
20
20
  {quoteTitle}
21
21
  {' : '}
22
- </Text>
22
+ </CaihText>
23
23
  <View style={styles.h5}/>
24
24
  <TextMixMessage text={quoteText} textStyle={textStyle} onLongPressPhone={onLongPressPhone} onLongPressURL={onLongPressURL}/>
25
25
  </TouchableOpacity>);
@@ -30,10 +30,10 @@ export const QuotePicture = memo(props => {
30
30
  const theme = useTheme();
31
31
  const sizeStyle = calculate(height || 100, width || 61.8, 100);
32
32
  return (<TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[quoteStyle, styles.leftBorder, { backgroundColor: dark(color, 6) }]}>
33
- <Text style={[textStyle, styles.replyUserName]}>
33
+ <CaihText style={[textStyle, styles.replyUserName]}>
34
34
  {quoteTitle}
35
35
  {' : '}
36
- </Text>
36
+ </CaihText>
37
37
  <View style={styles.h5}/>
38
38
  {(!localPath) && (<View style={[
39
39
  styles.pictureEmpty,
@@ -53,10 +53,10 @@ export const QuoteVideo = memo(props => {
53
53
  const theme = useTheme();
54
54
  const sizeStyle = calculate(height, width);
55
55
  return (<TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[quoteStyle, styles.leftBorder, { backgroundColor: dark(color, 6) }]}>
56
- <Text style={[textStyle, styles.replyUserName]}>
56
+ <CaihText style={[textStyle, styles.replyUserName]}>
57
57
  {quoteTitle}
58
58
  {' : '}
59
- </Text>
59
+ </CaihText>
60
60
  <View style={styles.h5}/>
61
61
  {(!imagePath) && (<View style={[
62
62
  styles.pictureEmpty,
@@ -73,7 +73,7 @@ export const QuoteVideo = memo(props => {
73
73
  <AntDesign size={30} name="playcircleo" color="#fff"/>
74
74
  </View>
75
75
  <View style={{ position: 'absolute', bottom: dp(5), right: dp(5) }}>
76
- <Text style={{ fontSize: dp(12), color: '#fff' }}>{numberToTime(duration)}</Text>
76
+ <CaihText style={{ fontSize: dp(12), color: '#fff' }}>{numberToTime(duration)}</CaihText>
77
77
  </View>
78
78
  </View>)}
79
79
  </TouchableOpacity>);
@@ -81,10 +81,10 @@ export const QuoteVideo = memo(props => {
81
81
  export const QuoteFile = memo(props => {
82
82
  const { quoteTitle, quoteMessage, color, textStyle, onPressQuote } = props;
83
83
  return (<TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[styles.leftBorder, { padding: dp(5), backgroundColor: dark(color, 6) }]}>
84
- <Text style={[textStyle, styles.replyUserName]}>
84
+ <CaihText style={[textStyle, styles.replyUserName]}>
85
85
  {quoteTitle}
86
86
  {' : '}
87
- </Text>
87
+ </CaihText>
88
88
  <View style={styles.h5}/>
89
89
  <View style={[styles.popoverFile, { backgroundColor: dark(color, 10), paddingHorizontal: dp(5), flexDirection: 'column' }]}>
90
90
  <PayloadFile {...quoteMessage} style={{ flex: 1, padding: dp(5) }} width={width - dp(155)} showArrow={false}/>
@@ -97,17 +97,17 @@ export const QuoteVoice = memo(props => {
97
97
  let voiceViewLength = 40 + (80 * duration) / 60;
98
98
  voiceViewLength = dp(voiceViewLength > 120 ? 120 : voiceViewLength);
99
99
  return (<TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[styles.leftBorder, { padding: dp(5), backgroundColor: dark(color, 6) }]}>
100
- <Text style={[textStyle, styles.replyUserName]}>
100
+ <CaihText style={[textStyle, styles.replyUserName]}>
101
101
  {quoteTitle}
102
102
  {' : '}
103
- </Text>
103
+ </CaihText>
104
104
  <View style={styles.h5}/>
105
105
 
106
106
  <View style={[styles.popoverVoice, { backgroundColor: dark(color, 10), width: voiceViewLength + dp(10) }]}>
107
107
  <View style={{ width: voiceViewLength, alignItems: 'flex-start' }}>
108
108
  <Image style={styles.voiceImage} source={voiceLeft}></Image>
109
109
  </View>
110
- <Text style={styles.duration}>{Math.round(duration || 0)}''</Text>
110
+ <CaihText style={styles.duration}>{Math.round(duration || 0)}''</CaihText>
111
111
  </View>
112
112
  </TouchableOpacity>);
113
113
  });
@@ -121,30 +121,30 @@ export const QuoteMultiple = memo(props => {
121
121
  : t('multipleChatRecordTitleGroup');
122
122
  const imManager = getImManager();
123
123
  return (<TouchableOpacity activeOpacity={0.5} onPress={onPressQuote} style={[quoteStyle, styles.leftBorder, { padding: dp(5), backgroundColor: dark(color, 4) }]}>
124
- <Text style={[textStyle, styles.replyUserName]}>
124
+ <CaihText style={[textStyle, styles.replyUserName]}>
125
125
  {quoteTitle}
126
126
  {' : '}
127
- </Text>
127
+ </CaihText>
128
128
  <View style={styles.h5}/>
129
- <Text style={styles.mulTitleText} numberOfLines={2}>
129
+ <CaihText style={styles.mulTitleText} numberOfLines={2}>
130
130
  {title}
131
- </Text>
131
+ </CaihText>
132
132
  <View style={styles.mulContent}>
133
133
  {messages.map((message, index) => {
134
134
  if (typeof message === 'string') {
135
- return (<Text key={index} style={styles.mulItemTextMore}>
135
+ return (<CaihText key={index} style={styles.mulItemTextMore}>
136
136
  ......
137
- </Text>);
137
+ </CaihText>);
138
138
  }
139
- return (<Text key={index} style={styles.mulItemText} numberOfLines={1}>
139
+ return (<CaihText key={index} style={styles.mulItemText} numberOfLines={1}>
140
140
  {message.messageFromName +
141
141
  ': ' +
142
142
  buildSimpleText(imManager, message.payloadType, message.payload)}
143
- </Text>);
143
+ </CaihText>);
144
144
  })}
145
145
  </View>
146
146
  <View style={styles.mulLine}/>
147
- <Text style={styles.mulFooterText}>{t('multipleChatRecord')}</Text>
147
+ <CaihText style={styles.mulFooterText}>{t('multipleChatRecord')}</CaihText>
148
148
  </TouchableOpacity>);
149
149
  });
150
150
  const styles = StyleSheet.create({
@@ -1,7 +1,7 @@
1
1
  import React, { memo } from 'react';
2
- import { dp } from '@smart-link/rn-ui';
2
+ import { CaihText, dp } from '@smart-link/rn-ui';
3
3
  import { Bar } from 'react-native-progress';
4
- import { View, StyleSheet, Text } from 'react-native';
4
+ import { View, StyleSheet } from 'react-native';
5
5
  import { numberToFileSize } from '../../../utils/file';
6
6
  const UploadProgress = ({ show, sendSize, totalSize, width }) => {
7
7
  if (!show) {
@@ -13,7 +13,7 @@ const UploadProgress = ({ show, sendSize, totalSize, width }) => {
13
13
  const progress = sendSize / totalSize;
14
14
  return (<View style={{ width }}>
15
15
  <Bar progress={progress} width={width} height={dp(3)} color={'#999'} borderRadius={dp(1)}/>
16
- <Text style={styles.rate}>{numberToFileSize(sendSize) + ' / ' + numberToFileSize(totalSize)}</Text>
16
+ <CaihText style={styles.rate}>{numberToFileSize(sendSize) + ' / ' + numberToFileSize(totalSize)}</CaihText>
17
17
  </View>);
18
18
  };
19
19
  const styles = StyleSheet.create({
@@ -1,8 +1,9 @@
1
1
  import React, { forwardRef, memo, useImperativeHandle, useRef, useState } from 'react';
2
- import { View, Text, FlatList, Animated, TouchableOpacity, Dimensions } from 'react-native';
2
+ import { View, FlatList, Animated, TouchableOpacity, Dimensions } from 'react-native';
3
3
  import { face } from '../../../../utils/emoji';
4
4
  import { DeleteSvg } from './Icons';
5
5
  import { useAnimatedValue } from "../../../../hooks/useAnimatedValue";
6
+ import { CaihText } from "@smart-link/rn-ui";
6
7
  const emojis = Array.from(new Set([...face]));
7
8
  const EMOJI_SIZE = (Dimensions.get('screen').width - 20) / 8;
8
9
  const keyExtractor = (item) => item;
@@ -19,7 +20,7 @@ const EmojiPanel = forwardRef(({ onCheck, onBackspace }, ref) => {
19
20
  }} onPress={() => {
20
21
  onCheck(item);
21
22
  }}>
22
- <Text style={{ fontSize: 22, color: '#333' }}>{item}</Text>
23
+ <CaihText style={{ fontSize: 22, color: '#333' }}>{item}</CaihText>
23
24
  </TouchableOpacity>);
24
25
  useImperativeHandle(ref, () => ({
25
26
  show: (height, animated) => {
@@ -189,6 +189,7 @@ const MessageBar = forwardRef(({ onKeyboardAt }, ref) => {
189
189
  var _a, _b, _c;
190
190
  tempText.current = text;
191
191
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.setText(tempText.current);
192
+ setShowSend(true);
192
193
  setTimeout(() => {
193
194
  var _a;
194
195
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -178,6 +178,7 @@ const styles = StyleSheet.create({
178
178
  borderRadius: dp(4),
179
179
  backgroundColor: '#fff',
180
180
  fontSize: dp(15),
181
+ fontFamily: ' ',
181
182
  minHeight: Platform.select({
182
183
  ios: dp(32),
183
184
  android: dp(28),
@@ -7,21 +7,22 @@ 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 { dp, useNavigation } from '@smart-link/rn-ui';
10
+ import { CaihText, dp, useNavigation } from '@smart-link/rn-ui';
11
11
  import React, { forwardRef, memo, useImperativeHandle, useState } from 'react';
12
- import { View, Text, FlatList, TouchableOpacity, Dimensions, StyleSheet, Animated } from 'react-native';
12
+ import { View, FlatList, TouchableOpacity, Dimensions, StyleSheet, Animated } from 'react-native';
13
13
  import { useConversation } from '../../../../hooks/useImSelector';
14
14
  import useTranslation from '../../../../hooks/useTranslation';
15
15
  import { getImManager } from '../../../../init';
16
16
  import { FileIcon, PhotosIcon, ShootingIcon, UserIcon } from './Icons';
17
17
  import ImagePicker from 'react-native-image-crop-picker';
18
18
  import { startSendContact } from '../../../../slice/contact/contact.slice';
19
- import { copyFile } from '../../../../utils/file';
19
+ import { moveFile } from '../../../../utils/file';
20
20
  import { scrollToBottom } from '../../../../utils/scroll';
21
21
  import { takeCamera } from '../../../../utils/take-camera';
22
22
  import FontAwesome from "react-native-vector-icons/FontAwesome";
23
23
  import { useAnimatedValue } from "../../../../hooks/useAnimatedValue";
24
- const OPTION_SIZE = (Dimensions.get('screen').width - 20) / 4;
24
+ import { buildVideoData } from "../../../../utils/camera";
25
+ const OPTION_SIZE = (Dimensions.get('window').width - 20) / 4;
25
26
  const keyExtractor = (item) => item.id;
26
27
  const OptionPanel = forwardRef((props, ref) => {
27
28
  const navigation = useNavigation();
@@ -62,36 +63,46 @@ const OptionPanel = forwardRef((props, ref) => {
62
63
  scrollToBottom();
63
64
  yield imManager.sendPictureMessage(Object.assign({}, currentConversation), data);
64
65
  });
65
- // const sendVideo = async (data: IPayload) => {
66
- // scrollToBottom();
67
- // await imManager.sendVideoMessage({...currentConversation!}, data);
68
- // };
69
- //
70
- // const sendFile = async (data: IPayload) => {
71
- // scrollToBottom();
72
- // const destPath = await copyFile(data.localPath as string, data.filename!, 'file');
73
- // await imManager.sendFileMessage({...currentConversation!}, {...data, localPath: destPath});
74
- // };
66
+ const sendVideo = (data) => __awaiter(void 0, void 0, void 0, function* () {
67
+ scrollToBottom();
68
+ yield imManager.sendVideoMessage(Object.assign({}, currentConversation), data);
69
+ });
75
70
  const openAlbum = () => __awaiter(void 0, void 0, void 0, function* () {
76
71
  try {
77
- const images = yield ImagePicker.openPicker({
78
- mediaType: 'photo',
72
+ const items = yield ImagePicker.openPicker({
73
+ mediaType: 'any',
79
74
  multiple: true,
80
75
  compressImageQuality: 0.7,
81
76
  compressImageMaxWidth: 1080,
77
+ cropping: false,
78
+ includeBase64: false,
82
79
  });
83
- console.log(images);
84
- for (const item of images) {
85
- const localPath = yield copyFile(item.path, item.filename, 'picture');
86
- yield sendPicture({
87
- filename: item.filename,
88
- size: item.size,
89
- localPath: localPath,
90
- type: item.mime,
91
- lastModified: Number(item.modificationDate),
92
- width: item.width,
93
- height: item.height,
94
- });
80
+ console.log(items);
81
+ for (const item of items) {
82
+ if (item.mime.includes('image')) {
83
+ const localPath = yield moveFile(item.path, item.filename, 'picture');
84
+ yield sendPicture({
85
+ filename: item.filename,
86
+ size: item.size,
87
+ localPath: localPath,
88
+ type: item.mime,
89
+ lastModified: Number(item.modificationDate),
90
+ width: item.width,
91
+ height: item.height,
92
+ });
93
+ }
94
+ else if (item.mime.includes('video')) {
95
+ console.log('video: ', item);
96
+ const videoData = yield buildVideoData({
97
+ path: item.path,
98
+ duration: (item.duration || 0) / 1000,
99
+ width: item.width,
100
+ height: item.height,
101
+ });
102
+ if (videoData) {
103
+ yield sendVideo(videoData);
104
+ }
105
+ }
95
106
  }
96
107
  }
97
108
  catch (e) {
@@ -167,7 +178,7 @@ const OptionPanel = forwardRef((props, ref) => {
167
178
  ];
168
179
  const renderItem = ({ item }) => (<TouchableOpacity style={style.item} onPress={item.onPress}>
169
180
  <View style={style.icon}>{item.icon}</View>
170
- <Text style={style.text}>{item.text}</Text>
181
+ <CaihText allowFontScaling={false} style={style.text}>{item.text}</CaihText>
171
182
  </TouchableOpacity>);
172
183
  return (<Animated.View style={{
173
184
  height: heightAnim,
@@ -7,9 +7,9 @@ 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 { dp, Toast } from '@smart-link/rn-ui';
10
+ import { CaihText, dp, Toast } from '@smart-link/rn-ui';
11
11
  import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
12
- import { View, Text, StyleSheet, Platform, AppState } from 'react-native';
12
+ import { View, StyleSheet, Platform, AppState } from 'react-native';
13
13
  import useTranslation from '../../../../hooks/useTranslation';
14
14
  import Icon from 'react-native-vector-icons/MaterialIcons';
15
15
  import { TopViewGetInstance } from '@smart-link/rn-ui';
@@ -223,7 +223,7 @@ const VoiceBar = () => {
223
223
  }, []);
224
224
  return (<View style={styles.container}>
225
225
  <View style={[styles.record, { backgroundColor: recordColor }]} onStartShouldSetResponder={() => true} onMoveShouldSetResponder={() => true} onResponderGrant={onResponderGrant} onResponderMove={onResponderMove} onResponderRelease={onResponderRelease} onResponderTerminationRequest={() => false}>
226
- <Text style={styles.recordText}>{recordText}</Text>
226
+ <CaihText style={styles.recordText}>{recordText}</CaihText>
227
227
  </View>
228
228
  </View>);
229
229
  };
@@ -263,10 +263,10 @@ class RecordToast {
263
263
  const { text, color, icon } = option;
264
264
  const ToastNode = (<Toast visible={true} onClose={() => {
265
265
  RecordToast.hide();
266
- }} content={<Text style={[styles.toastText, { color }]}>{text}</Text>} duration={10000} icon={<Text style={styles.toastIcon}>
266
+ }} content={<CaihText style={[styles.toastText, { color }]}>{text}</CaihText>} duration={10000} icon={<CaihText style={styles.toastIcon}>
267
267
  <Icon name={icon} size={70} color={'white'}/>
268
- <Text style={{ width: 80 }}>({Math.round(time)}'')</Text>
269
- </Text>}/>);
268
+ <CaihText style={{ width: 80 }}>({Math.round(time)}'')</CaihText>
269
+ </CaihText>}/>);
270
270
  if (RecordToast.key) {
271
271
  TopViewGetInstance().replace(ToastNode, RecordToast.key);
272
272
  }
@@ -7,9 +7,9 @@ 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 { NavigationPage, WrappedSearchPage, dp, useTheme, useNavigation, HeaderSearchBar } from '@smart-link/rn-ui';
10
+ import { NavigationPage, WrappedSearchPage, dp, useTheme, useNavigation, HeaderSearchBar, CaihText } from '@smart-link/rn-ui';
11
11
  import React, { memo, useEffect, useState } from 'react';
12
- import { Text, View, StyleSheet, TouchableOpacity, FlatList } from 'react-native';
12
+ import { View, StyleSheet, TouchableOpacity, FlatList } from 'react-native';
13
13
  import useTranslation from '../../hooks/useTranslation';
14
14
  import { getImManager } from '../../init';
15
15
  import { useRoute } from '@react-navigation/native';
@@ -40,7 +40,7 @@ const SearchChatRecords = memo(() => {
40
40
  }, [keyword]);
41
41
  const listHeaderComponent = (<>
42
42
  <View style={styles.currChat}>
43
- <Text style={styles.currChatText}>{'"' + name + '"' + t('searchMsgRec')}</Text>
43
+ <CaihText style={styles.currChatText}>{'"' + name + '"' + t('searchMsgRec')}</CaihText>
44
44
  </View>
45
45
  <View style={styles.listHeaderLine}/>
46
46
  </>);
@@ -55,8 +55,8 @@ const SearchChatRecords = memo(() => {
55
55
  <View style={styles.width10}/>
56
56
 
57
57
  <View style={styles.left}>
58
- <Text style={styles.name} numberOfLines={1}>{messageFromName}</Text>
59
- <Text style={styles.text} numberOfLines={1}>{getSummary(buildSearchText(item), keyword, 28, theme.primaryColor)}</Text>
58
+ <CaihText style={styles.name} numberOfLines={1}>{messageFromName}</CaihText>
59
+ <CaihText style={styles.text} numberOfLines={1}>{getSummary(buildSearchText(item), keyword, 28, theme.primaryColor)}</CaihText>
60
60
  </View>
61
61
  <FormatTimeText style={styles.time} time={messageTime}/>
62
62
  </TouchableOpacity>);
@@ -71,7 +71,7 @@ const SearchChatRecords = memo(() => {
71
71
  justifyContent: 'center',
72
72
  alignItems: 'center',
73
73
  }}>
74
- <Text>{t('noSearchResult')}</Text>
74
+ <CaihText>{t('noSearchResult')}</CaihText>
75
75
  </View>
76
76
  </View>)}
77
77
  {messages.length > 0 && (<FlatList contentContainerStyle={styles.list} data={messages} numColumns={1} initialNumToRender={1} keyExtractor={keyExtractor} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent} ListHeaderComponent={listHeaderComponent}/>)}
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import React, { memo, useEffect, useRef, useState } from 'react';
11
- import { View, StyleSheet, PixelRatio, TouchableOpacity, Text, SectionList } from 'react-native';
12
- import { dp, HeaderSearchBar, NavigationPage } from '@smart-link/rn-ui';
11
+ import { View, StyleSheet, PixelRatio, TouchableOpacity, SectionList } from 'react-native';
12
+ import { CaihText, dp, HeaderSearchBar, NavigationPage } from '@smart-link/rn-ui';
13
13
  import { borderStyle } from '../../components/styles';
14
14
  import { getImManager } from '../../init';
15
15
  import { MessageActions } from '@smart-link/im-base';
@@ -88,17 +88,17 @@ const SearchFile = memo(() => {
88
88
  })}>
89
89
  <View style={styles.itemTop}>
90
90
  <ChatAvatar disabled={true} name={messageFromName} id={messageFrom} size={dp(24)}/>
91
- <Text style={styles.name} numberOfLines={1}>
91
+ <CaihText style={styles.name} numberOfLines={1}>
92
92
  {messageFromName}
93
- </Text>
93
+ </CaihText>
94
94
  <FormatTimeText style={styles.time} time={item.messageTime}/>
95
95
  </View>
96
96
  <View style={styles.file}>
97
97
  <View style={styles.fileInfo}>
98
- <Text style={styles.fileName} numberOfLines={2} ellipsizeMode={'middle'}>
98
+ <CaihText style={styles.fileName} numberOfLines={2} ellipsizeMode={'middle'}>
99
99
  {payload.filename}
100
- </Text>
101
- <Text style={styles.fileSize}>{numberToFileSize(payload.size)}</Text>
100
+ </CaihText>
101
+ <CaihText style={styles.fileSize}>{numberToFileSize(payload.size)}</CaihText>
102
102
  </View>
103
103
  <Icon style={styles.imageIcon}/>
104
104
  </View>
@@ -108,9 +108,9 @@ const SearchFile = memo(() => {
108
108
  <HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
109
109
  <NavigationPage noPadding>
110
110
  {files.length > 0 ? (<SectionList sections={files} renderSectionHeader={({ section }) => {
111
- return <Text style={styles.dateTxt}>{section.date}</Text>;
111
+ return <CaihText style={styles.dateTxt}>{section.date}</CaihText>;
112
112
  }} renderItem={renderItem} keyExtractor={item => item.messageSeq} initialNumToRender={10} progressViewOffset={100} onEndReached={() => loadSearchFiles(keyword)} onEndReachedThreshold={0.2}/>) : (<View style={styles.empty}>
113
- <Text>{t('noSearchResult')}</Text>
113
+ <CaihText>{t('noSearchResult')}</CaihText>
114
114
  </View>)}
115
115
  </NavigationPage>
116
116
  </>);
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Text, TouchableOpacity } from 'react-native';
3
- import { dp, NavigationPage } from '@smart-link/rn-ui';
2
+ import { TouchableOpacity } from 'react-native';
3
+ import { CaihText, dp, NavigationPage } from '@smart-link/rn-ui';
4
4
  import useTranslation from '../../hooks/useTranslation';
5
5
  import SearchPictures from './components/SearchPictures';
6
6
  const SearchPicturePage = ({ navigation, route: { params } }) => {
@@ -16,7 +16,7 @@ const SearchPicturePage = ({ navigation, route: { params } }) => {
16
16
  return (<TouchableOpacity style={{ padding: dp(8) }} onPress={() => {
17
17
  setMultiple(p => !p);
18
18
  }}>
19
- <Text style={{ color: tintColor }}>{multiple ? t('cancel') : t('multiple')}</Text>
19
+ <CaihText style={{ color: tintColor }}>{multiple ? t('cancel') : t('multiple')}</CaihText>
20
20
  </TouchableOpacity>);
21
21
  },
22
22
  });
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
11
11
  import useTranslation from '../../../hooks/useTranslation';
12
12
  import { getImManager } from '../../../init';
13
- import { dp, useNavigation } from '@smart-link/rn-ui';
13
+ import { CaihText, dp, useNavigation } from '@smart-link/rn-ui';
14
14
  import React, { useEffect, useState } from 'react';
15
- import { View, Text, FlatList, StyleSheet, TouchableOpacity } from 'react-native';
15
+ import { View, FlatList, StyleSheet, TouchableOpacity } from 'react-native';
16
16
  const ChatRecords = ({ keyword }) => {
17
17
  const navigation = useNavigation();
18
18
  const { t } = useTranslation();
@@ -40,7 +40,7 @@ const ChatRecords = ({ keyword }) => {
40
40
  justifyContent: 'center',
41
41
  alignItems: 'center',
42
42
  }}>
43
- <Text>{t('noSearchResult')}</Text>
43
+ <CaihText>{t('noSearchResult')}</CaihText>
44
44
  </View>
45
45
  </View>);
46
46
  }
@@ -56,12 +56,12 @@ const ChatRecords = ({ keyword }) => {
56
56
  <ChatAvatar id={id} size={dp(42)} url={avatars} name={name}/>
57
57
  <View style={styles.width10}/>
58
58
  <View style={styles.left}>
59
- <Text style={styles.name} numberOfLines={1}>
59
+ <CaihText style={styles.name} numberOfLines={1}>
60
60
  {name}
61
- </Text>
62
- <Text style={styles.text} numberOfLines={1}>
61
+ </CaihText>
62
+ <CaihText style={styles.text} numberOfLines={1}>
63
63
  {count + ' ' + t('matchedMessage')}
64
- </Text>
64
+ </CaihText>
65
65
  </View>
66
66
  </TouchableOpacity>);
67
67
  };