@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,27 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -31,66 +7,75 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
8
  });
33
9
  };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const react_1 = __importStar(require("react"));
39
- const react_native_1 = require("react-native");
40
- const rn_ui_1 = require("@smart-link/rn-ui");
41
- const react_native_audio_recorder_player_1 = __importDefault(require("react-native-audio-recorder-player"));
42
- const PayloadWrapper_1 = __importDefault(require("./PayloadWrapper"));
43
- const variables_1 = __importDefault(require("@smart-link/rn-ui/dist/components/styles/variables"));
44
- const init_1 = require("../../../../init");
45
- const im_base_1 = require("@smart-link/im-base");
46
- const file_1 = require("../../../../utils/file");
47
- const react_native_fast_image_1 = __importDefault(require("react-native-fast-image"));
10
+ import React, { memo, useRef } from 'react';
11
+ import { Text, StyleSheet, View } from 'react-native';
12
+ import { dp } from '@smart-link/rn-ui';
13
+ import PayloadWrapper from './PayloadWrapper';
14
+ import variables from '@smart-link/rn-ui/dist/components/styles/variables';
15
+ import { getImManager } from '../../../../init';
16
+ import { MessageActions } from '@smart-link/im-base';
17
+ import { toAbsolutePath } from "../../../../utils/file";
18
+ import Image from 'react-native-fast-image';
19
+ import { AudioPlayer } from "../../../../utils/audio";
20
+ import RNFS from "react-native-fs";
21
+ import { usePanel } from "../../../../hooks/useImSelector";
22
+ import { setVoicePlayingSeq } from "../../../../slice/panel/panel.slice";
48
23
  const voiceLeft = require('../../../../../assets/voice-left.png');
49
24
  const voiceLeftPlaying = require('../../../../../assets/voice-left-playing.gif');
50
- const audioRecorderPlayer = new react_native_audio_recorder_player_1.default();
51
25
  const PayloadVoice = ({ payload, direction, style, messageSeq, showArrow = true, onLongPress }) => {
52
- console.log('PayloadVoice: messageSeq:', messageSeq);
53
- (0, react_1.useEffect)(() => {
54
- return () => {
55
- audioRecorderPlayer.removePlayBackListener();
56
- };
57
- }, []);
58
26
  const second = Math.round(payload.duration);
27
+ const { voicePlayingSeq } = usePanel();
59
28
  const voiceWidth = Math.min(120, 40 + (80 * (isNaN(second) ? 15 : second)) / 60);
60
- const [playing, setPlaying] = (0, react_1.useState)(false);
61
- const downloading = (0, react_1.useRef)(false);
29
+ const playing = voicePlayingSeq === messageSeq;
30
+ const downloading = useRef(false);
31
+ const imManager = getImManager();
32
+ const updateRead = (destPath) => {
33
+ imManager.db.updateMessage({
34
+ messageSeq: messageSeq,
35
+ payload: Object.assign(Object.assign({}, payload), { localPath: destPath, read: true }),
36
+ });
37
+ imManager.store.dispatch(MessageActions.updateMessage(messageSeq, {
38
+ payload: Object.assign(Object.assign({}, payload), { localPath: destPath, read: true }),
39
+ }));
40
+ };
41
+ const download = () => __awaiter(void 0, void 0, void 0, function* () {
42
+ const imManager = getImManager();
43
+ const destPath = yield imManager.download({
44
+ fileId: payload.fileId,
45
+ resourceType: 'voice',
46
+ filename: payload.filename,
47
+ });
48
+ updateRead(destPath);
49
+ return destPath;
50
+ });
62
51
  const startPlayer = (path) => __awaiter(void 0, void 0, void 0, function* () {
63
- audioRecorderPlayer.addPlayBackListener((e) => {
64
- setPlaying(!e.isFinished);
65
- if (e.isFinished) {
66
- audioRecorderPlayer.removePlayBackListener();
52
+ if (voicePlayingSeq === messageSeq) {
53
+ yield AudioPlayer.stopPlayer();
54
+ imManager.store.dispatch(setVoicePlayingSeq(''));
55
+ return;
56
+ }
57
+ else {
58
+ if (voicePlayingSeq) {
59
+ yield AudioPlayer.stopPlayer();
60
+ imManager.store.dispatch(setVoicePlayingSeq(''));
67
61
  }
68
- });
62
+ }
63
+ imManager.store.dispatch(setVoicePlayingSeq(messageSeq));
69
64
  try {
70
65
  console.log('startPlayer: ', path);
71
- yield audioRecorderPlayer.startPlayer((0, file_1.toAbsolutePath)(path));
66
+ yield AudioPlayer.startPlayer(toAbsolutePath(path));
72
67
  }
73
68
  catch (err) {
74
69
  console.log(err);
70
+ imManager.store.dispatch(setVoicePlayingSeq(''));
75
71
  }
76
72
  });
77
73
  const handlePlay = () => __awaiter(void 0, void 0, void 0, function* () {
78
- const imManager = (0, init_1.getImManager)();
74
+ console.log('handlePlay');
79
75
  if (!payload.localPath && payload.fileId && !downloading.current) {
80
76
  // 下载文件
81
77
  downloading.current = true;
82
- const destPath = yield imManager.download({
83
- fileId: payload.fileId,
84
- resourceType: 'voice',
85
- filename: payload.filename,
86
- });
87
- imManager.db.updateMessage({
88
- messageSeq: messageSeq,
89
- payload: Object.assign(Object.assign({}, payload), { localPath: destPath, read: true }),
90
- });
91
- imManager.store.dispatch(im_base_1.MessageActions.updateMessage(messageSeq, {
92
- payload: Object.assign(Object.assign({}, payload), { localPath: destPath, read: true }),
93
- }));
78
+ const destPath = yield download();
94
79
  yield startPlayer(destPath);
95
80
  return;
96
81
  }
@@ -98,21 +83,23 @@ const PayloadVoice = ({ payload, direction, style, messageSeq, showArrow = true,
98
83
  return;
99
84
  }
100
85
  else {
101
- // 更新已读状态
102
- imManager.db.updateMessage({
103
- messageSeq: messageSeq,
104
- payload: Object.assign(Object.assign({}, payload), { read: true }),
105
- });
106
- imManager.store.dispatch(im_base_1.MessageActions.updateMessage(messageSeq, {
107
- payload: Object.assign(Object.assign({}, payload), { read: true }),
108
- }));
109
- yield startPlayer(payload.localPath);
86
+ const isExist = yield RNFS.exists(payload.localPath);
87
+ if (!isExist) {
88
+ console.log('path not exists');
89
+ const destPath = yield download();
90
+ yield startPlayer(destPath);
91
+ return;
92
+ }
93
+ else {
94
+ updateRead(payload.localPath);
95
+ yield startPlayer(payload.localPath);
96
+ }
110
97
  }
111
98
  });
112
- return (<react_native_1.View style={[styles.root, { flexDirection: direction === 'left' ? 'row' : 'row-reverse' }]}>
113
- <PayloadWrapper_1.default showArrow={showArrow} direction={direction} onPress={handlePlay} onLongPress={onLongPress} style={[style, styles.popoverVoice, { width: voiceWidth + 15 }]}>
114
- <react_native_1.Text style={styles.duration}>{second}''</react_native_1.Text>
115
- <react_native_fast_image_1.default style={[
99
+ return (<View style={[styles.root, { flexDirection: direction === 'left' ? 'row' : 'row-reverse' }]}>
100
+ <PayloadWrapper showArrow={showArrow} direction={direction} onPress={handlePlay} onLongPress={onLongPress} style={[style, styles.popoverVoice, { width: voiceWidth + 15 }]}>
101
+ <Text style={styles.duration}>{second}''</Text>
102
+ <Image style={[
116
103
  styles.voiceImage,
117
104
  {
118
105
  transform: [
@@ -121,12 +108,12 @@ const PayloadVoice = ({ payload, direction, style, messageSeq, showArrow = true,
121
108
  },
122
109
  ],
123
110
  },
124
- ]} source={playing ? voiceLeftPlaying : voiceLeft}></react_native_fast_image_1.default>
125
- </PayloadWrapper_1.default>
126
- {!payload.read && direction === 'left' && <react_native_1.View style={styles.dot}/>}
127
- </react_native_1.View>);
111
+ ]} source={playing ? voiceLeftPlaying : voiceLeft}></Image>
112
+ </PayloadWrapper>
113
+ {!payload.read && direction === 'left' && <View style={styles.dot}/>}
114
+ </View>);
128
115
  };
129
- const styles = react_native_1.StyleSheet.create({
116
+ const styles = StyleSheet.create({
130
117
  root: {
131
118
  display: 'flex',
132
119
  flexDirection: 'row',
@@ -134,22 +121,22 @@ const styles = react_native_1.StyleSheet.create({
134
121
  },
135
122
  popoverVoice: {
136
123
  flexDirection: 'row',
137
- padding: (0, rn_ui_1.dp)(9),
124
+ padding: dp(9),
138
125
  },
139
126
  voiceImage: {
140
- width: (0, rn_ui_1.dp)(24),
141
- height: (0, rn_ui_1.dp)(18),
127
+ width: dp(24),
128
+ height: dp(18),
142
129
  },
143
130
  duration: {
144
- fontSize: (0, rn_ui_1.dp)(13),
131
+ fontSize: dp(13),
145
132
  color: '#666',
146
133
  alignSelf: 'center',
147
134
  },
148
135
  dot: {
149
- width: (0, rn_ui_1.dp)(6),
150
- height: (0, rn_ui_1.dp)(6),
151
- borderRadius: (0, rn_ui_1.dp)(3),
152
- backgroundColor: variables_1.default.red6,
136
+ width: dp(6),
137
+ height: dp(6),
138
+ borderRadius: dp(3),
139
+ backgroundColor: variables.red6,
153
140
  }
154
141
  });
155
- exports.default = (0, react_1.memo)(PayloadVoice);
142
+ export default memo(PayloadVoice);
@@ -1,27 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
1
  var __rest = (this && this.__rest) || function (s, e) {
26
2
  var t = {};
27
3
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -33,41 +9,40 @@ var __rest = (this && this.__rest) || function (s, e) {
33
9
  }
34
10
  return t;
35
11
  };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- const rn_ui_1 = require("@smart-link/rn-ui");
38
- const react_1 = __importStar(require("react"));
39
- const react_native_1 = require("react-native");
40
- const PayloadWrapper = (0, react_1.memo)((_a) => {
12
+ import { dp } from '@smart-link/rn-ui';
13
+ import React, { memo } from 'react';
14
+ import { View, StyleSheet, TouchableOpacity } from 'react-native';
15
+ const PayloadWrapper = memo((_a) => {
41
16
  var { children, direction, showArrow } = _a, retProps = __rest(_a, ["children", "direction", "showArrow"]);
42
- return (<react_native_1.TouchableOpacity {...retProps}>
43
- {showArrow && (<react_native_1.View style={[styles.arrow, direction === 'right' ? styles.rightArrow : styles.leftArrow]}/>)}
17
+ return (<TouchableOpacity {...retProps}>
18
+ {showArrow && (<View style={[styles.arrow, direction === 'right' ? styles.rightArrow : styles.leftArrow]}/>)}
44
19
  {children}
45
- </react_native_1.TouchableOpacity>);
20
+ </TouchableOpacity>);
46
21
  });
47
- const styles = react_native_1.StyleSheet.create({
22
+ const styles = StyleSheet.create({
48
23
  arrow: {
49
- width: (0, rn_ui_1.dp)(12),
50
- height: (0, rn_ui_1.dp)(12),
24
+ width: dp(12),
25
+ height: dp(12),
51
26
  position: 'absolute',
52
- top: (0, rn_ui_1.dp)(11),
27
+ top: dp(11),
53
28
  zIndex: 1,
54
29
  borderStyle: 'solid',
55
- borderTopWidth: (0, rn_ui_1.dp)(8),
30
+ borderTopWidth: dp(8),
56
31
  borderTopColor: 'transparent',
57
- borderBottomWidth: (0, rn_ui_1.dp)(8),
32
+ borderBottomWidth: dp(8),
58
33
  borderBottomColor: 'transparent',
59
34
  },
60
35
  leftArrow: {
61
- left: -(0, rn_ui_1.dp)(11),
36
+ left: -dp(11),
62
37
  borderRightColor: '#fff',
63
- borderRightWidth: (0, rn_ui_1.dp)(8),
38
+ borderRightWidth: dp(8),
64
39
  borderLeftWidth: 0,
65
40
  },
66
41
  rightArrow: {
67
- right: -(0, rn_ui_1.dp)(12),
42
+ right: -dp(12),
68
43
  borderLeftColor: '#e3e3e3',
69
- borderLeftWidth: (0, rn_ui_1.dp)(8),
44
+ borderLeftWidth: dp(8),
70
45
  borderRightWidth: 0,
71
46
  },
72
47
  });
73
- exports.default = PayloadWrapper;
48
+ export default PayloadWrapper;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,85 +1,55 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ReceiptBack = void 0;
30
- const im_base_1 = require("@smart-link/im-base");
31
- const rn_ui_1 = require("@smart-link/rn-ui");
32
- const React = __importStar(require("react"));
33
- const react_native_1 = require("react-native");
34
- const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
35
- const dayjs_1 = __importDefault(require("dayjs"));
36
- const ReceiptBack = ({ message }) => {
37
- const { t } = (0, useTranslation_1.default)();
38
- // console.log('ReceiptBack: ', message.receiptBackList.length, message.receiptBackList);
39
- return (<react_native_1.View style={styles.content}>
40
- <react_native_1.View style={{ flexDirection: 'row' }}>
41
- <react_native_1.Text style={[styles.text, { width: (0, rn_ui_1.dp)(165) }]}>
42
- {(0, dayjs_1.default)(message.messageTime).format('YYYY-MM-DD hh:mm:ss')}
43
- </react_native_1.Text>
44
- <react_native_1.Text style={styles.text}>{message.messageStatus === im_base_1.MessageStatus.EMIT_ERROR ? t('sendFail') : t('sent')}</react_native_1.Text>
45
- </react_native_1.View>
1
+ import { MessageStatus } from '@smart-link/im-base';
2
+ import { dp } from '@smart-link/rn-ui';
3
+ import * as React from 'react';
4
+ import { View, Text, StyleSheet } from "react-native";
5
+ import useTranslation from "../../../hooks/useTranslation";
6
+ import dayjs from "dayjs";
7
+ export const ReceiptBack = ({ message }) => {
8
+ const { t } = useTranslation();
9
+ // console.log('ReceiptBack: '', message.receiptBackList.length, message.receiptBackList);
10
+ return (<View style={styles.content}>
11
+ <View style={{ flexDirection: 'row' }}>
12
+ <Text style={[styles.text, { width: dp(165) }]}>
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>
16
+ </View>
46
17
 
47
18
  {message.receiptBackList && message.receiptBackList.map((item, index) => {
48
19
  let statusText = '';
49
20
  switch (item.receiptBackMessageStatus) {
50
- case im_base_1.MessageStatus.READ: {
21
+ case MessageStatus.READ: {
51
22
  statusText = t('statusRead');
52
23
  break;
53
24
  }
54
- case im_base_1.MessageStatus.ARRIVED: {
25
+ case MessageStatus.ARRIVED: {
55
26
  statusText = t('statusArrived');
56
27
  break;
57
28
  }
58
29
  default:
59
30
  return null;
60
31
  }
61
- return (<react_native_1.View key={index} style={{ flexDirection: 'row' }}>
62
- <react_native_1.Text style={[styles.text, { width: (0, rn_ui_1.dp)(165) }]}>
63
- {(0, dayjs_1.default)(item.receiptBackMessageTime || item.messageTime).format('YYYY-MM-DD hh:mm:ss')}
64
- </react_native_1.Text>
65
- <react_native_1.Text style={styles.text}>{statusText}</react_native_1.Text>
66
- </react_native_1.View>);
32
+ return (<View key={index} style={{ flexDirection: 'row' }}>
33
+ <Text style={[styles.text, { width: dp(165) }]}>
34
+ {dayjs(item.receiptBackMessageTime || item.messageTime).format('YYYY-MM-DD HH:mm:ss')}
35
+ </Text>
36
+ <Text style={styles.text}>{statusText}</Text>
37
+ </View>);
67
38
  })}
68
- </react_native_1.View>);
39
+ </View>);
69
40
  };
70
- exports.ReceiptBack = ReceiptBack;
71
- const styles = react_native_1.StyleSheet.create({
41
+ const styles = StyleSheet.create({
72
42
  content: {
73
43
  flex: 1,
74
44
  backgroundColor: '#fff',
75
- borderRadius: (0, rn_ui_1.dp)(5),
76
- height: (0, rn_ui_1.dp)(120),
77
- paddingLeft: (0, rn_ui_1.dp)(25),
45
+ borderRadius: dp(5),
46
+ height: dp(120),
47
+ paddingLeft: dp(25),
78
48
  justifyContent: 'center'
79
49
  },
80
50
  text: {
81
- fontSize: (0, rn_ui_1.dp)(15),
82
- lineHeight: (0, rn_ui_1.dp)(22),
51
+ fontSize: dp(15),
52
+ lineHeight: dp(22),
83
53
  color: '#333',
84
54
  }
85
55
  });
@@ -1,56 +1,31 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const react_1 = __importStar(require("react"));
27
- const react_native_1 = require("react-native");
28
- const text_mix_1 = require("../../../utils/text-mix");
29
- const TextMixMessage = (0, react_1.memo)(props => {
1
+ import React, { memo } from 'react';
2
+ import { Text, StyleSheet } from "react-native";
3
+ import { mix } from '../../../utils/text-mix';
4
+ const TextMixMessage = memo(props => {
30
5
  const { text, onLongPressPhone, onLongPressURL, textStyle, } = props;
31
- const viewItems = (0, text_mix_1.mix)(text);
32
- return (<react_native_1.Text style={textStyle}>
6
+ const viewItems = mix(text);
7
+ return (<Text style={textStyle}>
33
8
  {viewItems.map((item, index) => {
34
9
  if (item.type === 'phone') {
35
- return (<react_native_1.Text key={index} style={styles.phone} onPress={(e) => {
10
+ return (<Text key={index} style={styles.phone} onPress={(e) => {
36
11
  e.stopPropagation();
37
12
  onLongPressPhone && onLongPressPhone(item.value);
38
13
  }}>
39
14
  {item.value}
40
- </react_native_1.Text>);
15
+ </Text>);
41
16
  }
42
17
  else if (item.type === 'url') {
43
- return (<react_native_1.Text key={index} style={styles.url} onPress={() => {
18
+ return (<Text key={index} style={styles.url} onPress={() => {
44
19
  onLongPressURL && onLongPressURL(item.value);
45
20
  }}>
46
21
  {item.value}
47
- </react_native_1.Text>);
22
+ </Text>);
48
23
  }
49
24
  return item.value;
50
25
  })}
51
- </react_native_1.Text>);
26
+ </Text>);
52
27
  });
53
- const styles = react_native_1.StyleSheet.create({
28
+ const styles = StyleSheet.create({
54
29
  phone: {
55
30
  color: '#208aff'
56
31
  },
@@ -59,4 +34,4 @@ const styles = react_native_1.StyleSheet.create({
59
34
  textDecorationLine: 'underline'
60
35
  },
61
36
  });
62
- exports.default = TextMixMessage;
37
+ export default TextMixMessage;