@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,101 +7,97 @@ 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 rn_ui_1 = require("@smart-link/rn-ui");
39
- const react_1 = __importStar(require("react"));
40
- const react_native_1 = require("react-native");
41
- const useTranslation_1 = require("../../hooks/useTranslation");
42
- const init_1 = require("../../init");
43
- const CardInfo_1 = require("./CardInfo");
44
- const UserJobs_1 = __importDefault(require("./UserJobs"));
45
- const ChatAvatar_1 = __importDefault(require("../../components/ChatAvatar/ChatAvatar"));
46
- const addressList_1 = require("../../api/addressList");
47
- const { width } = react_native_1.Dimensions.get('window');
10
+ import { Button, dp, NavigationPage } from '@smart-link/rn-ui';
11
+ import React, { useEffect, useState } from 'react';
12
+ import { StyleSheet, Text, View, Dimensions } from 'react-native';
13
+ import { useTranslationAddrList } from '../../hooks/useTranslation';
14
+ import { getImManager } from '../../init';
15
+ import { CardInfo, Line } from './CardInfo';
16
+ import UserJobs from './UserJobs';
17
+ import ChatAvatar from '../../components/ChatAvatar/ChatAvatar';
18
+ import { queryUser } from '../../api/addressList';
19
+ const { width } = Dimensions.get('window');
48
20
  const UserDetail = ({ navigation, route: { params } }) => {
49
- const [detail, setDetail] = (0, react_1.useState)({});
50
- const { t } = (0, useTranslation_1.useTranslationAddrList)();
51
- (0, react_1.useEffect)(() => {
21
+ const [detail, setDetail] = useState({});
22
+ const { t } = useTranslationAddrList();
23
+ useEffect(() => {
52
24
  navigation.setOptions({ title: t('userDetail') });
53
- (0, addressList_1.queryUser)(params.userId).then(({ data }) => {
25
+ queryUser(params.userId).then(({ data }) => {
54
26
  console.log('userDetail: ', data[0]);
55
27
  setDetail(data[0]);
56
28
  });
57
29
  }, [params.userId]);
58
30
  const openChatPanel = () => __awaiter(void 0, void 0, void 0, function* () {
59
- yield (0, init_1.getImManager)().initUserConversation(detail);
31
+ yield getImManager().initUserConversation(detail);
60
32
  navigation.navigate('MessageList');
61
33
  });
62
- return (<rn_ui_1.NavigationPage noPadding scroll>
63
- <CardInfo_1.CardInfo>
64
- <CardInfo_1.Line>
65
- <ChatAvatar_1.default id={detail.userId} size={(0, rn_ui_1.dp)(60)} name={detail.userName} url={detail.avatars} priority={'outside'}/>
66
- <react_native_1.View style={styles.accountInfo}>
67
- <react_native_1.Text style={styles.username} numberOfLines={2}>
34
+ return (<NavigationPage noPadding scroll>
35
+ <CardInfo>
36
+ <Line>
37
+ <ChatAvatar id={detail.userId} size={dp(60)} name={detail.userName} url={detail.avatars} priority={'outside'} disabled/>
38
+ <View style={styles.accountInfo}>
39
+ <Text style={styles.username} numberOfLines={2}>
68
40
  {detail.userName}
69
- </react_native_1.Text>
70
- <react_native_1.Text style={{
71
- lineHeight: (0, rn_ui_1.dp)(16),
72
- fontSize: (0, rn_ui_1.dp)(12),
41
+ </Text>
42
+ <Text style={{
43
+ lineHeight: dp(16),
44
+ fontSize: dp(12),
73
45
  color: '#6e6e6e',
74
46
  }}>
75
47
  {t('userCode')}:{detail.userCode || t('noAdd')}
76
- </react_native_1.Text>
77
- <react_native_1.Text style={{
78
- lineHeight: (0, rn_ui_1.dp)(16),
79
- fontSize: (0, rn_ui_1.dp)(12),
48
+ </Text>
49
+ <Text style={{
50
+ lineHeight: dp(16),
51
+ fontSize: dp(12),
80
52
  color: '#6e6e6e',
81
53
  }}>
82
54
  {t('mobile')}:{detail.mobile || t('noAdd')}
83
- </react_native_1.Text>
84
- <react_native_1.Text style={{
85
- lineHeight: (0, rn_ui_1.dp)(16),
86
- fontSize: (0, rn_ui_1.dp)(12),
55
+ </Text>
56
+ <Text style={{
57
+ lineHeight: dp(16),
58
+ fontSize: dp(12),
87
59
  color: '#6e6e6e',
88
60
  }}>
89
61
  {t('email')}:{detail.email || t('noAdd')}
90
- </react_native_1.Text>
91
- </react_native_1.View>
92
- </CardInfo_1.Line>
93
- </CardInfo_1.CardInfo>
62
+ </Text>
63
+ </View>
64
+ </Line>
65
+ </CardInfo>
94
66
 
95
- <UserJobs_1.default jobs={detail.groups}/>
67
+ <UserJobs jobs={detail.groups}/>
96
68
 
97
- <react_native_1.View style={{ height: (0, rn_ui_1.dp)(20) }}/>
69
+ <View style={{ height: dp(20) }}/>
98
70
 
99
- <react_native_1.View style={styles.button}>
100
- <rn_ui_1.Button type="primary" onPress={openChatPanel}>
71
+ <View style={styles.button}>
72
+ <Button type="primary" onPress={openChatPanel}>
101
73
  {t('sendNews')}
102
- </rn_ui_1.Button>
103
- </react_native_1.View>
74
+ </Button>
75
+ </View>
104
76
 
105
- <react_native_1.View style={{ height: (0, rn_ui_1.dp)(20) }}/>
106
- </rn_ui_1.NavigationPage>);
77
+ <View style={{ height: dp(20) }}/>
78
+ </NavigationPage>);
107
79
  };
108
- const styles = react_native_1.StyleSheet.create({
80
+ const styles = StyleSheet.create({
109
81
  lineIcon: {
110
- width: (0, rn_ui_1.dp)(40),
82
+ width: dp(40),
111
83
  textAlign: 'center',
112
84
  },
113
85
  accountInfo: {
114
- marginLeft: (0, rn_ui_1.dp)(20),
115
- width: width - (0, rn_ui_1.dp)(80 + 20 + 10),
86
+ marginLeft: dp(20),
87
+ width: width - dp(80 + 20 + 10),
116
88
  },
117
89
  username: {
118
- lineHeight: (0, rn_ui_1.dp)(25),
119
- fontSize: (0, rn_ui_1.dp)(18),
90
+ lineHeight: dp(25),
91
+ fontSize: dp(18),
120
92
  fontWeight: '500',
121
93
  textAlignVertical: 'center',
122
94
  },
123
95
  button: {
124
- marginHorizontal: (0, rn_ui_1.dp)(20),
96
+ marginHorizontal: dp(20),
125
97
  },
126
98
  btnText: {
127
- paddingVertical: (0, rn_ui_1.dp)(4),
128
- fontSize: (0, rn_ui_1.dp)(16),
99
+ paddingVertical: dp(4),
100
+ fontSize: dp(16),
129
101
  },
130
102
  });
131
- exports.default = UserDetail;
103
+ export default UserDetail;
@@ -1,50 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const rn_ui_1 = require("@smart-link/rn-ui");
4
- const react_native_1 = require("react-native");
5
- const useTranslation_1 = require("../../hooks/useTranslation");
6
- const CardInfo_1 = require("./CardInfo");
1
+ import { dp, useTheme } from '@smart-link/rn-ui';
2
+ import { View, Text, StyleSheet } from 'react-native';
3
+ import { useTranslationAddrList } from '../../hooks/useTranslation';
4
+ import { CardInfo, Line } from './CardInfo';
7
5
  const UserJobs = (props) => {
8
6
  const { jobs } = props;
9
- const { t } = (0, useTranslation_1.useTranslationAddrList)();
10
- const theme = (0, rn_ui_1.useTheme)();
7
+ const { t } = useTranslationAddrList();
8
+ const theme = useTheme();
11
9
  const styles = makeStyles(theme);
12
- return (<CardInfo_1.CardInfo>
10
+ return (<CardInfo>
13
11
  {(jobs === null || jobs === void 0 ? void 0 : jobs.length) > 0 &&
14
12
  jobs.map(job => {
15
13
  let isMainJob = job.majorFlag === 'y';
16
- return (<CardInfo_1.Line key={job.groupId}>
17
- <react_native_1.View style={isMainJob ? styles.mainJob : styles.partJob}>
18
- <react_native_1.Text style={{ color: isMainJob ? '#fff' : theme.primaryColor }}>
14
+ return (<Line key={job.groupId}>
15
+ <View style={isMainJob ? styles.mainJob : styles.partJob}>
16
+ <Text style={{ color: isMainJob ? '#fff' : theme.primaryColor }}>
19
17
  {isMainJob ? t('job') : t('otherJob')}
20
- </react_native_1.Text>
21
- </react_native_1.View>
22
- <react_native_1.View style={{ flexDirection: 'column', flex: 1 }}>
23
- <react_native_1.View style={{ marginLeft: 0 }}>
24
- <react_native_1.Text style={{ color: '#393939' }}>{job.groupNamePath}</react_native_1.Text>
25
- </react_native_1.View>
26
- <react_native_1.View style={{ marginBottom: 5 }}>
27
- <react_native_1.Text style={{ color: '#393939' }}>{job.postName}</react_native_1.Text>
28
- </react_native_1.View>
29
- </react_native_1.View>
30
- </CardInfo_1.Line>);
18
+ </Text>
19
+ </View>
20
+ <View style={{ flexDirection: 'column', flex: 1 }}>
21
+ <View style={{ marginLeft: 0 }}>
22
+ <Text style={{ color: '#393939' }}>{job.groupNamePath}</Text>
23
+ </View>
24
+ <View style={{ marginBottom: 5 }}>
25
+ <Text style={{ color: '#393939' }}>{job.postName}</Text>
26
+ </View>
27
+ </View>
28
+ </Line>);
31
29
  })}
32
- </CardInfo_1.CardInfo>);
30
+ </CardInfo>);
33
31
  };
34
- const makeStyles = (theme) => react_native_1.StyleSheet.create({
32
+ const makeStyles = (theme) => StyleSheet.create({
35
33
  mainJob: {
36
- padding: (0, rn_ui_1.dp)(4),
37
- borderRadius: (0, rn_ui_1.dp)(3),
38
- marginRight: (0, rn_ui_1.dp)(10),
34
+ padding: dp(4),
35
+ borderRadius: dp(3),
36
+ marginRight: dp(10),
39
37
  backgroundColor: theme.primaryColor,
40
38
  },
41
39
  partJob: {
42
- padding: (0, rn_ui_1.dp)(3),
43
- borderRadius: (0, rn_ui_1.dp)(3),
44
- marginRight: (0, rn_ui_1.dp)(10),
40
+ padding: dp(3),
41
+ borderRadius: dp(3),
42
+ marginRight: dp(10),
45
43
  borderColor: theme.primaryColor,
46
- borderWidth: (0, rn_ui_1.dp)(1),
44
+ borderWidth: dp(1),
47
45
  backgroundColor: '#fff',
48
46
  },
49
47
  });
50
- exports.default = UserJobs;
48
+ export default UserJobs;
@@ -1,52 +1,27 @@
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 rn_ui_1 = require("@smart-link/rn-ui");
27
- const react_1 = __importStar(require("react"));
28
- const react_native_1 = require("react-native");
29
- const useTranslation_1 = require("../../hooks/useTranslation");
30
- const Organization_1 = require("./Organization");
31
- const addressList_1 = require("../../api/addressList");
32
- const init_1 = require("../../init");
33
- const react_redux_1 = require("react-redux");
34
- const contact_slice_1 = require("../../slice/contact/contact.slice");
35
- const useImSelector_1 = require("../../hooks/useImSelector");
36
- const UserSearch = (0, react_1.memo)(({ navigation, route: { params } }) => {
37
- const [keyword, setKeyword] = (0, react_1.useState)('');
38
- const { selectUsers } = (0, useImSelector_1.useContact)();
1
+ import { NavigationPage, ListRow, HeaderSearchBar } from '@smart-link/rn-ui';
2
+ import React, { memo, useEffect, useState } from 'react';
3
+ import { Text, View, StyleSheet } from 'react-native';
4
+ import { useTranslationAddrList } from '../../hooks/useTranslation';
5
+ import { RenderUserItem } from './Organization';
6
+ import { searchUser } from '../../api/addressList';
7
+ import { getImManager } from '../../init';
8
+ import { useDispatch } from 'react-redux';
9
+ import { onSelectUser } from '../../slice/contact/contact.slice';
10
+ import { useContact } from '../../hooks/useImSelector';
11
+ const UserSearch = memo(({ navigation, route: { params } }) => {
12
+ const [keyword, setKeyword] = useState('');
13
+ const { selectUsers } = useContact();
39
14
  const { checkable } = params || {};
40
- const [userList, setUserList] = (0, react_1.useState)([]);
41
- const { t } = (0, useTranslation_1.useTranslationAddrList)();
42
- const imManager = (0, init_1.getImManager)();
43
- const dispatch = (0, react_redux_1.useDispatch)();
15
+ const [userList, setUserList] = useState([]);
16
+ const { t } = useTranslationAddrList();
17
+ const imManager = getImManager();
18
+ const dispatch = useDispatch();
44
19
  const selectCount = Object.keys(selectUsers).length;
45
- (0, react_1.useEffect)(() => {
20
+ useEffect(() => {
46
21
  if (!keyword || keyword === '') {
47
22
  return;
48
23
  }
49
- (0, addressList_1.searchUser)({
24
+ searchUser({
50
25
  userNameLike: keyword,
51
26
  tenantId: imManager.user.tenantId,
52
27
  }).then(({ data }) => {
@@ -57,26 +32,26 @@ const UserSearch = (0, react_1.memo)(({ navigation, route: { params } }) => {
57
32
  navigation.navigate('UserDetail', { userId: item.userId, userAccount: item.userAccount });
58
33
  };
59
34
  return (<>
60
- <rn_ui_1.HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
61
- <rn_ui_1.NavigationPage noPadding scroll={userList.length > 0}>
62
- {userList.length > 0 ? (userList.map((item) => (<rn_ui_1.ListRow key={item.userId} onPress={() => {
35
+ <HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
36
+ <NavigationPage noPadding scroll={userList.length > 0}>
37
+ {userList.length > 0 ? (userList.map((item) => (<ListRow key={item.userId} onPress={() => {
63
38
  if (checkable) {
64
- dispatch((0, contact_slice_1.onSelectUser)(item));
39
+ dispatch(onSelectUser(item));
65
40
  }
66
41
  else {
67
42
  handleUser(item);
68
43
  }
69
- }} title={<Organization_1.RenderUserItem checkable={checkable} checked={!!selectUsers[item.userId]} data={item}/>} topSeparator="full"/>))) : (<react_native_1.View style={[styles.noData]}>
70
- <react_native_1.Text>{t('noData')}</react_native_1.Text>
71
- </react_native_1.View>)}
72
- </rn_ui_1.NavigationPage>
44
+ }} title={<RenderUserItem checkable={checkable} checked={!!selectUsers[item.userId]} data={item}/>} topSeparator="full"/>))) : (<View style={[styles.noData]}>
45
+ <Text>{t('noData')}</Text>
46
+ </View>)}
47
+ </NavigationPage>
73
48
  </>);
74
49
  });
75
- const styles = react_native_1.StyleSheet.create({
50
+ const styles = StyleSheet.create({
76
51
  noData: {
77
52
  flex: 1,
78
53
  justifyContent: 'center',
79
54
  alignItems: 'center',
80
55
  },
81
56
  });
82
- exports.default = UserSearch;
57
+ export default UserSearch;
@@ -1,31 +1,26 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const UserDetail_1 = __importDefault(require("./UserDetail"));
7
- const UserSearch_1 = __importDefault(require("./UserSearch"));
8
- const ChooseContact_1 = __importDefault(require("./ChooseContact"));
9
- const Organization_1 = __importDefault(require("./Organization"));
10
- const AddressList_1 = __importDefault(require("./AddressList"));
1
+ import UserDetail from './UserDetail';
2
+ import UserSearch from './UserSearch';
3
+ import ChooseContact from './ChooseContact';
4
+ import Organization from './Organization';
5
+ import AddressList from './AddressList';
11
6
  const addressListRoutes = [
12
7
  {
13
8
  name: 'AddressList',
14
- component: AddressList_1.default,
9
+ component: AddressList,
15
10
  options: {
16
11
  title: ''
17
12
  },
18
13
  },
19
14
  {
20
15
  name: 'Organization',
21
- component: Organization_1.default,
16
+ component: Organization,
22
17
  options: {
23
18
  title: ''
24
19
  },
25
20
  },
26
21
  {
27
22
  name: 'ChooseContact',
28
- component: ChooseContact_1.default,
23
+ component: ChooseContact,
29
24
  options: {
30
25
  animation: 'fade',
31
26
  title: ''
@@ -33,18 +28,18 @@ const addressListRoutes = [
33
28
  },
34
29
  {
35
30
  name: 'UserDetail',
36
- component: UserDetail_1.default,
31
+ component: UserDetail,
37
32
  options: {
38
33
  title: ''
39
34
  },
40
35
  },
41
36
  {
42
37
  name: 'UserSearch',
43
- component: UserSearch_1.default,
38
+ component: UserSearch,
44
39
  options: {
45
40
  animation: 'fade',
46
41
  headerShown: false,
47
42
  },
48
43
  },
49
44
  ];
50
- exports.default = addressListRoutes;
45
+ export default addressListRoutes;
@@ -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,80 +7,76 @@ 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 rn_ui_1 = require("@smart-link/rn-ui");
39
- const react_1 = __importStar(require("react"));
40
- const react_native_1 = require("react-native");
41
- const useTranslation_1 = __importDefault(require("../../hooks/useTranslation"));
42
- const init_1 = require("../../init");
43
- const useImSelector_1 = require("../../hooks/useImSelector");
44
- const ContentFactory_1 = __importDefault(require("./ContentFactory"));
45
- const styles_1 = require("../../components/styles");
46
- const FormatTimeText_1 = __importDefault(require("../../components/FormatTimeText"));
47
- const common_action_sheet_1 = require("../../utils/common-action-sheet");
10
+ import { NavigationPage, dp, useNavigation, HeaderSearchBar } from '@smart-link/rn-ui';
11
+ import React, { useEffect, useState } from 'react';
12
+ import { Text, TouchableOpacity, View, StyleSheet, FlatList } from 'react-native';
13
+ import useTranslation from '../../hooks/useTranslation';
14
+ import { getImManager } from '../../init';
15
+ import { useCollection, useConversation } from '../../hooks/useImSelector';
16
+ import ContentFactory from './ContentFactory';
17
+ import { borderStyle, shadowStyle } from '../../components/styles';
18
+ import FormatTimeText from '../../components/FormatTimeText';
19
+ import { ConfirmActionSheet } from '../../utils/common-action-sheet';
48
20
  const Collection = () => {
49
- const { t } = (0, useTranslation_1.default)();
50
- const [keyword, setKeyword] = (0, react_1.useState)('');
51
- const { currentConversation } = (0, useImSelector_1.useConversation)();
52
- const { collections } = (0, useImSelector_1.useCollection)();
53
- const navigation = (0, rn_ui_1.useNavigation)();
54
- (0, react_1.useEffect)(() => {
55
- (0, init_1.getImManager)().selectCollections(keyword);
21
+ const { t } = useTranslation();
22
+ const [keyword, setKeyword] = useState('');
23
+ const { currentConversation } = useConversation();
24
+ const { collections } = useCollection();
25
+ const navigation = useNavigation();
26
+ useEffect(() => {
27
+ getImManager().selectCollections(keyword);
56
28
  }, [keyword]);
57
29
  const onPressCollection = (collection) => {
58
- (0, common_action_sheet_1.ConfirmActionSheet)(t('sendTo') + (currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.name), () => __awaiter(void 0, void 0, void 0, function* () {
30
+ ConfirmActionSheet(t('sendTo') + (currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.name), () => __awaiter(void 0, void 0, void 0, function* () {
59
31
  // TODO: 发送收藏消息
60
- yield (0, init_1.getImManager)().sendCollectionMessage(collection);
32
+ yield getImManager().sendCollectionMessage(collection);
61
33
  navigation.goBack();
62
34
  }), t);
63
35
  };
64
36
  const keyExtractor = (item) => item.messageSeq;
65
- const itemSeparatorComponent = () => <react_native_1.View style={styles.h10}/>;
37
+ const itemSeparatorComponent = () => <View style={styles.h10}/>;
66
38
  const renderItem = ({ item }) => {
67
39
  const { conversationName, messageTime } = item;
68
- return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={styles.item} onPress={() => {
40
+ return (<TouchableOpacity activeOpacity={0.5} style={styles.item} onPress={() => {
69
41
  onPressCollection(item);
70
42
  }}>
71
- <ContentFactory_1.default collection={item} keyword={keyword}/>
72
- <react_native_1.View style={styles.h10}/>
73
- <react_native_1.View style={styles.row}>
74
- <react_native_1.Text style={styles.title} numberOfLines={1}>
43
+ <ContentFactory collection={item} keyword={keyword}/>
44
+ <View style={styles.h10}/>
45
+ <View style={styles.row}>
46
+ <Text style={styles.title} numberOfLines={1}>
75
47
  {conversationName + ' '}
76
- </react_native_1.Text>
77
- <FormatTimeText_1.default style={styles.time} time={messageTime}/>
78
- </react_native_1.View>
79
- </react_native_1.TouchableOpacity>);
48
+ </Text>
49
+ <FormatTimeText style={styles.time} time={messageTime}/>
50
+ </View>
51
+ </TouchableOpacity>);
80
52
  };
81
53
  return (<>
82
- <rn_ui_1.HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
83
- <rn_ui_1.NavigationPage scroll={false} noPadding>
84
- {collections.length > 0 && (<react_native_1.FlatList contentContainerStyle={styles.list} numColumns={1} data={collections} keyExtractor={keyExtractor} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent}/>)}
85
- {collections.length === 0 && (<react_native_1.View style={{ flex: 1 }}>
86
- <react_native_1.View style={{
54
+ <HeaderSearchBar value={keyword} onSubmitEditing={setKeyword}/>
55
+ <NavigationPage scroll={false} noPadding>
56
+ {collections.length > 0 && (<FlatList contentContainerStyle={styles.list} numColumns={1} data={collections} keyExtractor={keyExtractor} renderItem={renderItem} keyboardShouldPersistTaps={'handled'} ItemSeparatorComponent={itemSeparatorComponent}/>)}
57
+ {collections.length === 0 && (<View style={{ flex: 1 }}>
58
+ <View style={{
87
59
  flex: 1,
88
60
  justifyContent: 'center',
89
61
  alignItems: 'center',
90
- height: (0, rn_ui_1.dp)(80),
62
+ height: dp(80),
91
63
  }}>
92
- <react_native_1.Text>{t('emptyCollect')}</react_native_1.Text>
93
- </react_native_1.View>
94
- </react_native_1.View>)}
95
- </rn_ui_1.NavigationPage>
64
+ <Text>{t('emptyCollect')}</Text>
65
+ </View>
66
+ </View>)}
67
+ </NavigationPage>
96
68
  </>);
97
69
  };
98
- const styles = react_native_1.StyleSheet.create({
70
+ const styles = StyleSheet.create({
99
71
  collection: {
100
72
  flex: 1,
101
73
  },
102
74
  list: {
103
- paddingVertical: (0, rn_ui_1.dp)(10),
104
- paddingHorizontal: (0, rn_ui_1.dp)(12),
75
+ paddingVertical: dp(10),
76
+ paddingHorizontal: dp(12),
105
77
  },
106
- item: Object.assign(Object.assign({ minHeight: (0, rn_ui_1.dp)(80), padding: (0, rn_ui_1.dp)(15), backgroundColor: '#fff', borderColor: '#eee' }, styles_1.shadowStyle), styles_1.borderStyle),
107
- search: Object.assign({ backgroundColor: '#fff', padding: (0, rn_ui_1.dp)(10), borderBottomWidth: (0, rn_ui_1.dp)(1), borderColor: '#e9e9e9' }, styles_1.shadowStyle),
78
+ item: Object.assign(Object.assign({ minHeight: dp(80), padding: dp(15), backgroundColor: '#fff', borderColor: '#eee' }, shadowStyle), borderStyle),
79
+ search: Object.assign({ backgroundColor: '#fff', padding: dp(10), borderBottomWidth: dp(1), borderColor: '#e9e9e9' }, shadowStyle),
108
80
  empty: {
109
81
  flex: 1,
110
82
  backgroundColor: '#fff',
@@ -112,25 +84,25 @@ const styles = react_native_1.StyleSheet.create({
112
84
  justifyContent: 'center',
113
85
  },
114
86
  h10: {
115
- height: (0, rn_ui_1.dp)(10),
87
+ height: dp(10),
116
88
  },
117
89
  h15: {
118
- height: (0, rn_ui_1.dp)(15),
90
+ height: dp(15),
119
91
  },
120
92
  row: {
121
93
  flexDirection: 'row',
122
94
  },
123
95
  title: {
124
- maxWidth: (0, rn_ui_1.dp)(230),
96
+ maxWidth: dp(230),
125
97
  color: '#666',
126
- fontSize: (0, rn_ui_1.dp)(13),
127
- lineHeight: (0, rn_ui_1.dp)(20),
98
+ fontSize: dp(13),
99
+ lineHeight: dp(20),
128
100
  },
129
101
  time: {
130
- marginLeft: (0, rn_ui_1.dp)(10),
102
+ marginLeft: dp(10),
131
103
  color: '#666',
132
- fontSize: (0, rn_ui_1.dp)(13),
133
- lineHeight: (0, rn_ui_1.dp)(20),
104
+ fontSize: dp(13),
105
+ lineHeight: dp(20),
134
106
  },
135
107
  });
136
- exports.default = Collection;
108
+ export default Collection;