@smart-link/rn-im 1.0.23 → 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 +46 -74
  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 -135
  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 +4 -8
  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,59 +7,55 @@ 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 im_base_1 = require("@smart-link/im-base");
39
- const rn_ui_1 = require("@smart-link/rn-ui");
40
- const react_1 = __importStar(require("react"));
41
- const react_native_1 = require("react-native");
42
- const IndicatorText_1 = __importDefault(require("../../components/IndicatorText"));
43
- const NetworkUnconnected_1 = __importDefault(require("../../components/NetworkUnconnected"));
44
- const useImSelector_1 = require("../../hooks/useImSelector");
45
- const useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
46
- const init_1 = require("../../init");
47
- const ConversationCard_1 = __importDefault(require("./components/ConversationCard"));
48
- const ConversationOption_1 = __importDefault(require("./components/ConversationOption"));
49
- const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/MaterialIcons"));
50
- const contact_slice_1 = require("../../slice/contact/contact.slice");
10
+ import { ConnectStatus, ConversationActions } from '@smart-link/im-base';
11
+ import { CaihIcon, dp, Popover, SearchBar } from '@smart-link/rn-ui';
12
+ import React, { useEffect, useRef, useState } from 'react';
13
+ import { StyleSheet, View, FlatList, TouchableOpacity, Vibration, DevSettings, } from 'react-native';
14
+ import IndicatorText from '../../components/IndicatorText';
15
+ import NetworkUnconnected from '../../components/NetworkUnconnected';
16
+ import { useConversation } from '../../hooks/useImSelector';
17
+ import useTranslation from '../../hooks/useTranslation';
18
+ import { getImManager } from '../../init';
19
+ import ConversationCard from './components/ConversationCard';
20
+ import ConversationOption from './components/ConversationOption';
21
+ import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
22
+ import { startCreateGroup } from '../../slice/contact/contact.slice';
51
23
  const List = ({ navigation }) => {
52
- const { t } = (0, useTranslation_1.default)();
53
- const { connectStatus, conversations, onlineMap } = (0, useImSelector_1.useConversation)();
54
- const [nativeEvent, setNativeEvent] = (0, react_1.useState)();
55
- const [popoverVisible, setPopoverVisible] = (0, react_1.useState)(false);
56
- const [conversation, setConversation] = (0, react_1.useState)();
57
- const lastPressTime = (0, react_1.useRef)(0);
58
- const flatListRef = (0, react_1.useRef)(null);
59
- (0, react_1.useEffect)(() => {
24
+ const { t } = useTranslation();
25
+ const { connectStatus, conversations, onlineMap } = useConversation();
26
+ const [nativeEvent, setNativeEvent] = useState();
27
+ const [popoverVisible, setPopoverVisible] = useState(false);
28
+ const [conversation, setConversation] = useState();
29
+ const lastPressTime = useRef(0);
30
+ const flatListRef = useRef(null);
31
+ useEffect(() => {
60
32
  let headerTitle = t('message');
61
33
  switch (connectStatus) {
62
- case im_base_1.ConnectStatus.CONNECTING:
63
- headerTitle = () => <IndicatorText_1.default text={t('connecting') + '...'}/>;
34
+ case ConnectStatus.CONNECTING:
35
+ headerTitle = () => <IndicatorText text={t('connecting') + '...'}/>;
64
36
  break;
65
- case im_base_1.ConnectStatus.CONNECT_PARAM_ERROR:
37
+ case ConnectStatus.CONNECT_PARAM_ERROR:
66
38
  headerTitle = t('connectFail');
67
39
  break;
68
- case im_base_1.ConnectStatus.CONNECT_ERROR:
40
+ case ConnectStatus.CONNECT_ERROR:
69
41
  headerTitle = t('serverConnectionFailed');
70
42
  break;
71
- case im_base_1.ConnectStatus.CONNECT_TIMEOUT:
43
+ case ConnectStatus.CONNECT_TIMEOUT:
72
44
  headerTitle = t('serverConnectionTimeout');
73
45
  break;
74
- case im_base_1.ConnectStatus.SYNC_SUBSCRIBE_LIST:
75
- headerTitle = () => <IndicatorText_1.default text={t('receipting') + '...'}/>;
46
+ case ConnectStatus.SYNC_SUBSCRIBE_LIST:
47
+ headerTitle = () => <IndicatorText text={t('receipting') + '...'}/>;
76
48
  break;
77
- case im_base_1.ConnectStatus.UN_CONNECT:
49
+ case ConnectStatus.UN_CONNECT:
78
50
  headerTitle = t('message') + '(' + t('unConnect') + ')';
79
51
  break;
80
52
  }
81
53
  const options = [
82
54
  {
83
- icon: <MaterialIcons_1.default name="person-add"/>,
55
+ icon: <MaterialIcon name="person-add"/>,
84
56
  content: t('createGroupChat'),
85
57
  onPress: () => {
86
- (0, init_1.getImManager)().store.dispatch((0, contact_slice_1.startCreateGroup)());
58
+ getImManager().store.dispatch(startCreateGroup());
87
59
  navigation.navigate('ChooseContact', {
88
60
  chooseOrg: true,
89
61
  checkMode: 'multi',
@@ -91,7 +63,7 @@ const List = ({ navigation }) => {
91
63
  },
92
64
  },
93
65
  {
94
- icon: <MaterialIcons_1.default name="qr-code-scanner"/>,
66
+ icon: <MaterialIcon name="qr-code-scanner"/>,
95
67
  content: t('scan'),
96
68
  onPress: () => {
97
69
  navigation.navigate('ScanCode');
@@ -100,24 +72,24 @@ const List = ({ navigation }) => {
100
72
  ];
101
73
  if (__DEV__) {
102
74
  options.push({
103
- icon: <MaterialIcons_1.default name="settings"/>,
75
+ icon: <MaterialIcon name="settings"/>,
104
76
  content: '清空数据并重启',
105
77
  onPress: () => {
106
- (0, init_1.getImManager)().db.clean();
107
- react_native_1.DevSettings.reload();
78
+ getImManager().db.clean();
79
+ DevSettings.reload();
108
80
  },
109
81
  });
110
82
  }
111
83
  navigation.setOptions({
112
84
  headerTitle,
113
- headerRight: () => (<rn_ui_1.Popover type="dark" placement="bottom" layout="vertical" duration={100} options={options} contentStyle={{ borderRadius: (0, rn_ui_1.dp)(6) }}>
114
- <react_native_1.TouchableOpacity style={{ marginHorizontal: (0, rn_ui_1.dp)(10), padding: (0, rn_ui_1.dp)(9) }}>
115
- <rn_ui_1.CaihIcon name="picker-add" size={(0, rn_ui_1.dp)(19)} color={'#f6f6f6'}/>
116
- </react_native_1.TouchableOpacity>
117
- </rn_ui_1.Popover>),
85
+ headerRight: () => (<Popover type="dark" placement="bottom" layout="vertical" duration={100} options={options} contentStyle={{ borderRadius: dp(6) }}>
86
+ <TouchableOpacity style={{ marginHorizontal: dp(10), padding: dp(9) }}>
87
+ <CaihIcon name="picker-add" size={dp(19)} color={'#f6f6f6'}/>
88
+ </TouchableOpacity>
89
+ </Popover>),
118
90
  });
119
91
  }, [t, navigation, connectStatus]);
120
- (0, react_1.useEffect)(() => {
92
+ useEffect(() => {
121
93
  return navigation.addListener('tabPress', (e) => {
122
94
  const now = Date.now();
123
95
  if (now - lastPressTime.current < 300) {
@@ -143,8 +115,8 @@ const List = ({ navigation }) => {
143
115
  setPopoverVisible(false);
144
116
  try {
145
117
  // 设置更新已读数量
146
- const imManager = (0, init_1.getImManager)();
147
- yield imManager.store.dispatch(im_base_1.ConversationActions.initConversation(imManager, conversation));
118
+ const imManager = getImManager();
119
+ yield imManager.store.dispatch(ConversationActions.initConversation(imManager, conversation));
148
120
  navigation.navigate('MessageList');
149
121
  }
150
122
  catch (e) {
@@ -152,27 +124,27 @@ const List = ({ navigation }) => {
152
124
  }
153
125
  });
154
126
  const onLongPressCard = (conversation, nativeEvent) => {
155
- react_native_1.Vibration.vibrate(10);
127
+ Vibration.vibrate(10);
156
128
  setPopoverVisible(true);
157
129
  setNativeEvent(nativeEvent);
158
130
  setConversation(conversation);
159
131
  };
160
132
  const listHeaderComponent = () => (<>
161
- <rn_ui_1.SearchBar onSearch={handleSearch} style={styles.searchBar}/>
162
- <react_native_1.View style={styles.line}/>
163
- {connectStatus === im_base_1.ConnectStatus.CONNECT_ERROR && (<>
164
- <NetworkUnconnected_1.default />
165
- <react_native_1.View style={styles.line}/>
133
+ <SearchBar onSearch={handleSearch} style={styles.searchBar}/>
134
+ <View style={styles.line}/>
135
+ {connectStatus === ConnectStatus.CONNECT_ERROR && (<>
136
+ <NetworkUnconnected />
137
+ <View style={styles.line}/>
166
138
  </>)}
167
139
  {/*{TenantConfig.config.showOrgChat && <OrgGroupBar onPressOrgGroupBar={onPressOrgGroupBar} />}*/}
168
- <react_native_1.View style={styles.line}/>
140
+ <View style={styles.line}/>
169
141
  </>);
170
- const listFooterComponent = () => <react_native_1.View style={styles.line}/>;
142
+ const listFooterComponent = () => <View style={styles.line}/>;
171
143
  const keyExtractor = (item) => item.id;
172
144
  const renderItem = ({ item }) => {
173
145
  return (
174
146
  // @ts-ignore
175
- <ConversationCard_1.default selected={item.id === (conversation === null || conversation === void 0 ? void 0 : conversation.id)} conversation={item} onPressCard={onPressCard} onLongPressCard={onLongPressCard} status={onlineMap[item.id]}/>);
147
+ <ConversationCard selected={item.id === (conversation === null || conversation === void 0 ? void 0 : conversation.id)} conversation={item} onPressCard={onPressCard} onLongPressCard={onLongPressCard} status={onlineMap[item.id]}/>);
176
148
  };
177
149
  const itemSeparatorComponent = ({ leadingItem }) => {
178
150
  for (let i = 0; i < conversations.length; i++) {
@@ -180,41 +152,41 @@ const List = ({ navigation }) => {
180
152
  break;
181
153
  }
182
154
  if (leadingItem.id === conversations[i].id && conversations[i].enableTop === 'on') {
183
- return (<react_native_1.View style={styles.separatorBg}>
184
- <react_native_1.View style={styles.separator}/>
185
- </react_native_1.View>);
155
+ return (<View style={styles.separatorBg}>
156
+ <View style={styles.separator}/>
157
+ </View>);
186
158
  }
187
159
  }
188
- return <react_native_1.View style={styles.separator}/>;
160
+ return <View style={styles.separator}/>;
189
161
  };
190
162
  const getItemLayout = (_, index) => ({
191
- length: (0, rn_ui_1.dp)(81),
192
- offset: (0, rn_ui_1.dp)(81) * index + (0, rn_ui_1.dp)(57),
163
+ length: dp(81),
164
+ offset: dp(81) * index + dp(57),
193
165
  index,
194
166
  });
195
- return (<react_native_1.View style={{ flex: 1 }}>
196
- <react_native_1.FlatList ref={flatListRef} contentContainerStyle={styles.contentContainerStyle} keyboardShouldPersistTaps={'handled'} data={conversations} ListHeaderComponent={listHeaderComponent} ListFooterComponent={listFooterComponent} ItemSeparatorComponent={itemSeparatorComponent} getItemLayout={getItemLayout} renderItem={renderItem} numColumns={1} keyExtractor={keyExtractor}/>
197
- <ConversationOption_1.default conversation={conversation} nativeEvent={nativeEvent} visible={popoverVisible} onClose={() => {
167
+ return (<View style={{ flex: 1 }}>
168
+ <FlatList ref={flatListRef} contentContainerStyle={styles.contentContainerStyle} keyboardShouldPersistTaps={'handled'} data={conversations} ListHeaderComponent={listHeaderComponent} ListFooterComponent={listFooterComponent} ItemSeparatorComponent={itemSeparatorComponent} getItemLayout={getItemLayout} renderItem={renderItem} numColumns={1} keyExtractor={keyExtractor}/>
169
+ <ConversationOption conversation={conversation} nativeEvent={nativeEvent} visible={popoverVisible} onClose={() => {
198
170
  setPopoverVisible(false);
199
171
  setConversation(undefined);
200
172
  }}/>
201
- </react_native_1.View>);
173
+ </View>);
202
174
  };
203
- const styles = react_native_1.StyleSheet.create({
175
+ const styles = StyleSheet.create({
204
176
  contentContainerStyle: {
205
177
  backgroundColor: '#fff',
206
178
  },
207
179
  searchBar: {
208
- marginHorizontal: (0, rn_ui_1.dp)(10),
209
- marginVertical: (0, rn_ui_1.dp)(10),
180
+ marginHorizontal: dp(10),
181
+ marginVertical: dp(10),
210
182
  },
211
183
  line: {
212
- height: (0, rn_ui_1.dp)(1),
184
+ height: dp(1),
213
185
  backgroundColor: '#ececec',
214
186
  },
215
187
  separator: {
216
- marginLeft: (0, rn_ui_1.dp)(80),
217
- height: (0, rn_ui_1.dp)(1),
188
+ marginLeft: dp(80),
189
+ height: dp(1),
218
190
  backgroundColor: '#ececec',
219
191
  },
220
192
  separatorBg: {
@@ -222,15 +194,15 @@ const styles = react_native_1.StyleSheet.create({
222
194
  },
223
195
  backButton: {
224
196
  backgroundColor: '#ddd',
225
- height: (0, rn_ui_1.dp)(50),
226
- width: (0, rn_ui_1.dp)(50),
227
- borderRadius: (0, rn_ui_1.dp)(25),
197
+ height: dp(50),
198
+ width: dp(50),
199
+ borderRadius: dp(25),
228
200
  opacity: 0.5,
229
201
  justifyContent: 'center',
230
202
  alignItems: 'center',
231
203
  position: 'absolute',
232
- bottom: (0, rn_ui_1.dp)(15),
233
- right: (0, rn_ui_1.dp)(15),
204
+ bottom: dp(15),
205
+ right: dp(15),
234
206
  },
235
207
  });
236
- exports.default = List;
208
+ export default List;
@@ -1,93 +1,65 @@
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
- const im_base_1 = require("@smart-link/im-base");
30
- const rn_ui_1 = require("@smart-link/rn-ui");
31
- const react_1 = __importStar(require("react"));
32
- const react_native_1 = require("react-native");
33
- const FontAwesome5_1 = __importDefault(require("react-native-vector-icons/FontAwesome5"));
34
- const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/MaterialIcons"));
35
- const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar/ChatAvatar"));
36
- const useFormatMsgTime_1 = __importDefault(require("../../../hooks/useFormatMsgTime"));
37
- const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
38
- const ConversationCard = (0, react_1.memo)(props => {
1
+ import { getConversationContent } from '@smart-link/im-base';
2
+ import { Badge, dp } from '@smart-link/rn-ui';
3
+ import React, { memo } from 'react';
4
+ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
5
+ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
6
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
7
+ import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
8
+ import useFormatMsgTime from '../../../hooks/useFormatMsgTime';
9
+ import useTranslation from '../../../hooks/useTranslation';
10
+ const ConversationCard = memo(props => {
39
11
  const { status, selected, conversation, onPressCard, onLongPressCard } = props;
40
- const { t } = (0, useTranslation_1.default)();
12
+ const { t } = useTranslation();
41
13
  const { id, type, avatars, name, text, draftText, errorText, enableNoDisturb, enableTop, tipsList, time, unreadCount } = conversation;
42
14
  const enableTopStyles = enableTop === 'on' ? styles.enableTop : null;
43
15
  const showPoint = enableNoDisturb === 'on' && unreadCount > 0;
44
16
  const countText = showPoint && unreadCount > 0 ? t('unreadCount', { unreadCount }) : '';
45
- const content = (0, im_base_1.getConversationContent)(text, errorText, draftText, tipsList, countText, t);
17
+ const content = getConversationContent(text, errorText, draftText, tipsList, countText, t);
46
18
  const contentStyles = content.tips ? styles.contentRedStyles : null;
47
- const formatTime = (0, useFormatMsgTime_1.default)(time, true);
19
+ const formatTime = useFormatMsgTime(time, true);
48
20
  // const imManager = getImManager();
49
21
  // // 还没找到为啥会让空的头像的人变成登录人的头像,先解决表面问题
50
22
  // let newAvatars = avatars;
51
23
  // if (avatars === imManager.user.avatars && name !== imManager.user.userName) {
52
24
  // newAvatars = "";
53
25
  // }
54
- return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={[styles.card, enableTopStyles, selected && styles.selected]} onPress={() => {
26
+ return (<TouchableOpacity activeOpacity={0.5} style={[styles.card, enableTopStyles, selected && styles.selected]} onPress={() => {
55
27
  onPressCard && onPressCard(conversation);
56
28
  }} onLongPress={({ nativeEvent }) => {
57
29
  onLongPressCard && onLongPressCard(conversation, nativeEvent);
58
30
  }}>
59
- <react_native_1.View style={{ height: (0, rn_ui_1.dp)(50), width: (0, rn_ui_1.dp)(50), marginRight: (0, rn_ui_1.dp)(16) }}>
60
- <rn_ui_1.Badge text={unreadCount} dot={showPoint}>
61
- <ChatAvatar_1.default disabled type={type} id={id} size={(0, rn_ui_1.dp)(48)} name={name} url={avatars}/>
62
- </rn_ui_1.Badge>
63
- {status === 'online' && <react_native_1.View style={styles.status}>
64
- <MaterialIcons_1.default size={(0, rn_ui_1.dp)(14)} color={status === 'online' ? '#4caf50' : '#616161'} name={status === 'online' ? 'check-circle' : 'not-interested'}/>
65
- </react_native_1.View>}
66
- </react_native_1.View>
31
+ <View style={{ height: dp(50), width: dp(50), marginRight: dp(16) }}>
32
+ <Badge text={unreadCount} dot={showPoint}>
33
+ <ChatAvatar disabled type={type} id={id} size={dp(48)} name={name}/>
34
+ </Badge>
35
+ {status === 'online' && <View style={styles.status}>
36
+ <MaterialIcons size={dp(14)} color={status === 'online' ? '#4caf50' : '#616161'} name={status === 'online' ? 'check-circle' : 'not-interested'}/>
37
+ </View>}
38
+ </View>
67
39
 
68
- <react_native_1.View style={{ flexDirection: 'column', flex: 1 }}>
69
- <react_native_1.View style={styles.swipe}>
70
- <react_native_1.Text style={styles.name} numberOfLines={1}>
40
+ <View style={{ flexDirection: 'column', flex: 1 }}>
41
+ <View style={styles.swipe}>
42
+ <Text style={styles.name} numberOfLines={1}>
71
43
  {name}
72
- </react_native_1.Text>
73
- <react_native_1.Text style={styles.time}>{formatTime}</react_native_1.Text>
74
- </react_native_1.View>
44
+ </Text>
45
+ <Text style={styles.time}>{formatTime}</Text>
46
+ </View>
75
47
 
76
- <react_native_1.View style={styles.row}>
77
- <react_native_1.Text style={styles.message} numberOfLines={1}>
78
- <react_native_1.Text style={contentStyles}>{content.tips}</react_native_1.Text>
48
+ <View style={styles.row}>
49
+ <Text style={styles.message} numberOfLines={1}>
50
+ <Text style={contentStyles}>{content.tips}</Text>
79
51
  {content.text}
80
- </react_native_1.Text>
81
- {enableNoDisturb === 'on' && (<FontAwesome5_1.default name={'bell-slash'} size={(0, rn_ui_1.dp)(12)} color={'#999'} style={styles.enableNoDisturb}/>)}
82
- {enableTop === 'on' && (<MaterialIcons_1.default name={'push-pin'} size={(0, rn_ui_1.dp)(15)} color={'#999'} style={styles.enableNoDisturb}/>)}
83
- </react_native_1.View>
84
- </react_native_1.View>
85
- </react_native_1.TouchableOpacity>);
52
+ </Text>
53
+ {enableNoDisturb === 'on' && (<FontAwesome5 name={'bell-slash'} size={dp(12)} color={'#999'} style={styles.enableNoDisturb}/>)}
54
+ {enableTop === 'on' && (<MaterialIcons name={'push-pin'} size={dp(15)} color={'#999'} style={styles.enableNoDisturb}/>)}
55
+ </View>
56
+ </View>
57
+ </TouchableOpacity>);
86
58
  });
87
- const styles = react_native_1.StyleSheet.create({
59
+ const styles = StyleSheet.create({
88
60
  card: {
89
- height: (0, rn_ui_1.dp)(80),
90
- padding: (0, rn_ui_1.dp)(16),
61
+ height: dp(80),
62
+ padding: dp(16),
91
63
  display: 'flex',
92
64
  flexDirection: 'row',
93
65
  },
@@ -103,17 +75,17 @@ const styles = react_native_1.StyleSheet.create({
103
75
  alignItems: 'center',
104
76
  },
105
77
  name: {
106
- fontSize: (0, rn_ui_1.dp)(15),
78
+ fontSize: dp(15),
107
79
  fontWeight: '500',
108
80
  color: '#333333',
109
81
  flex: 1,
110
82
  },
111
83
  time: {
112
- fontSize: (0, rn_ui_1.dp)(12),
84
+ fontSize: dp(12),
113
85
  color: '#999999',
114
86
  },
115
87
  message: {
116
- fontSize: (0, rn_ui_1.dp)(13),
88
+ fontSize: dp(13),
117
89
  color: '#999999',
118
90
  flex: 1,
119
91
  },
@@ -131,7 +103,7 @@ const styles = react_native_1.StyleSheet.create({
131
103
  },
132
104
  swipeDel: {
133
105
  justifyContent: 'center',
134
- width: (0, rn_ui_1.dp)(75),
106
+ width: dp(75),
135
107
  backgroundColor: '#ff4949',
136
108
  },
137
109
  swipeDelText: {
@@ -142,7 +114,7 @@ const styles = react_native_1.StyleSheet.create({
142
114
  right: 2,
143
115
  bottom: 2,
144
116
  backgroundColor: '#fff',
145
- borderRadius: (0, rn_ui_1.dp)(10),
117
+ borderRadius: dp(10),
146
118
  }
147
119
  });
148
- exports.default = ConversationCard;
120
+ export default ConversationCard;
@@ -1,99 +1,71 @@
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
- const react_1 = __importStar(require("react"));
30
- const react_native_1 = require("react-native");
31
- const rn_ui_1 = require("@smart-link/rn-ui");
32
- const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
33
- const init_1 = require("../../../init");
34
- const PopoverWrapper_1 = __importDefault(require("../../../components/PopoverWrapper"));
35
- const renderMenuItem = (title, onPress) => <react_native_1.TouchableOpacity activeOpacity={0.5} onPress={onPress}>
36
- <react_native_1.Text style={styles.text}>{title}</react_native_1.Text>
37
- </react_native_1.TouchableOpacity>;
1
+ import React, { memo } from 'react';
2
+ import { Text, StyleSheet, TouchableOpacity, } from 'react-native';
3
+ import { dp, Line } from '@smart-link/rn-ui';
4
+ import useTranslation from '../../../hooks/useTranslation';
5
+ import { getImManager } from '../../../init';
6
+ import PopoverWrapper from '../../../components/PopoverWrapper';
7
+ const renderMenuItem = (title, onPress) => <TouchableOpacity activeOpacity={0.5} onPress={onPress}>
8
+ <Text style={styles.text}>{title}</Text>
9
+ </TouchableOpacity>;
38
10
  const ConversationOption = ({ conversation, nativeEvent, onClose, visible, }) => {
39
- const { t } = (0, useTranslation_1.default)();
11
+ const { t } = useTranslation();
40
12
  let read, disturb, top;
41
13
  if (conversation === null || conversation === void 0 ? void 0 : conversation.unreadCount) {
42
14
  read = renderMenuItem(t('markRead'), () => {
43
- (0, init_1.getImManager)().markRead(conversation);
15
+ getImManager().markRead(conversation);
44
16
  onClose === null || onClose === void 0 ? void 0 : onClose();
45
17
  });
46
18
  }
47
19
  else {
48
20
  read = renderMenuItem(t('markUnread'), () => {
49
- (0, init_1.getImManager)().markUnread(conversation);
21
+ getImManager().markUnread(conversation);
50
22
  onClose === null || onClose === void 0 ? void 0 : onClose();
51
23
  });
52
24
  }
53
25
  if ((conversation === null || conversation === void 0 ? void 0 : conversation.enableNoDisturb) === 'off') {
54
26
  disturb = renderMenuItem(t('chatNoDisturbOn'), () => {
55
- (0, init_1.getImManager)().noDisturbOn(conversation);
27
+ getImManager().noDisturbOn(conversation);
56
28
  onClose === null || onClose === void 0 ? void 0 : onClose();
57
29
  });
58
30
  }
59
31
  else {
60
32
  disturb = renderMenuItem(t('chatNoDisturbOff'), () => {
61
- (0, init_1.getImManager)().noDisturbOff(conversation);
33
+ getImManager().noDisturbOff(conversation);
62
34
  onClose === null || onClose === void 0 ? void 0 : onClose();
63
35
  });
64
36
  }
65
37
  if ((conversation === null || conversation === void 0 ? void 0 : conversation.enableTop) === 'off') {
66
38
  top = renderMenuItem(t('chatTopOn'), () => {
67
- (0, init_1.getImManager)().topOn(conversation);
39
+ getImManager().topOn(conversation);
68
40
  onClose === null || onClose === void 0 ? void 0 : onClose();
69
41
  });
70
42
  }
71
43
  else {
72
44
  top = renderMenuItem(t('chatTopOff'), () => {
73
- (0, init_1.getImManager)().topOff(conversation);
45
+ getImManager().topOff(conversation);
74
46
  onClose === null || onClose === void 0 ? void 0 : onClose();
75
47
  });
76
48
  }
77
49
  const del = renderMenuItem(t('deleteChat'), () => {
78
- (0, init_1.getImManager)().deleteConversation(conversation);
50
+ getImManager().deleteConversation(conversation);
79
51
  onClose === null || onClose === void 0 ? void 0 : onClose();
80
52
  });
81
- return (<PopoverWrapper_1.default showArrow={false} measureTarget={false} visible={visible} onClose={onClose} nativeEvent={nativeEvent}>
53
+ return (<PopoverWrapper showArrow={false} measureTarget={false} visible={visible} onClose={onClose} nativeEvent={nativeEvent}>
82
54
  {read}
83
- <rn_ui_1.Line />
55
+ <Line />
84
56
  {disturb}
85
- <rn_ui_1.Line />
57
+ <Line />
86
58
  {top}
87
- <rn_ui_1.Line />
59
+ <Line />
88
60
  {del}
89
- </PopoverWrapper_1.default>);
61
+ </PopoverWrapper>);
90
62
  };
91
- exports.default = (0, react_1.memo)(ConversationOption);
92
- const styles = react_native_1.StyleSheet.create({
63
+ export default memo(ConversationOption);
64
+ const styles = StyleSheet.create({
93
65
  text: {
94
66
  color: '#555',
95
- fontSize: (0, rn_ui_1.dp)(15),
96
- paddingHorizontal: (0, rn_ui_1.dp)(12),
97
- paddingVertical: (0, rn_ui_1.dp)(12),
67
+ fontSize: dp(15),
68
+ paddingHorizontal: dp(12),
69
+ paddingVertical: dp(12),
98
70
  },
99
71
  });