@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,46 +7,42 @@ 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 im_base_1 = require("@smart-link/im-base");
42
- const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
43
- const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar/ChatAvatar"));
44
- const { OWNER, MGR, MEMBER, } = im_base_1.MemberLevel;
45
- const OptionGroup = (0, react_1.memo)(props => {
10
+ import React, { memo, useCallback } from 'react';
11
+ import { Text, View, StyleSheet } from 'react-native';
12
+ import { dp, ListRow } from '@smart-link/rn-ui';
13
+ import { ConversationType, MemberLevel } from "@smart-link/im-base";
14
+ import useTranslation from "../../../hooks/useTranslation";
15
+ import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
16
+ const { OWNER, MGR, MEMBER, } = MemberLevel;
17
+ const OptionGroup = memo(props => {
46
18
  const { id, name, avatars, notice, memberLevel = MEMBER, enableInviteValidate, toEditGroupAvatars, toEditGroupName, toEditGroupNotice, toGroupMgr, style } = props;
47
- const { t } = (0, useTranslation_1.default)();
19
+ const { t } = useTranslation();
48
20
  const onPressGroupMgr = !(memberLevel === OWNER) ? null : () => {
49
21
  toGroupMgr && toGroupMgr();
50
22
  };
51
23
  const inviteValidateInfo = enableInviteValidate === 'on' ? t('groupInviteValidateEnable') : t('groupInviteValidateDisable');
52
- const updateRemote = (0, react_1.useCallback)((url) => __awaiter(void 0, void 0, void 0, function* () {
24
+ const updateRemote = useCallback((url) => __awaiter(void 0, void 0, void 0, function* () {
53
25
  toEditGroupAvatars && toEditGroupAvatars(id, url);
54
26
  }), []);
55
- return (<react_native_1.View style={style}>
56
- <rn_ui_1.ListRow title={t('groupAvatars')} detail={<ChatAvatar_1.default size={(0, rn_ui_1.dp)(40)} id={id} url={avatars} name={name} type={im_base_1.ConversationType.C2G} editable={(memberLevel === OWNER || memberLevel === MGR)} disabled={!(memberLevel === OWNER || memberLevel === MGR)}/>}/>
57
- <rn_ui_1.ListRow title={t('groupChatName')} detail={name} onPress={toEditGroupName} topSeparator='full'/>
58
- <rn_ui_1.ListRow title={t('groupNotice')} titlePlace={notice ? 'top' : 'left'} detail={<react_native_1.Text numberOfLines={6} ellipsizeMode={'tail'} style={styles.noticeText}>
27
+ return (<View style={style}>
28
+ <ListRow title={t('groupAvatars')} detail={<ChatAvatar size={dp(40)} id={id} url={avatars} name={name} type={ConversationType.C2G} editable={(memberLevel === OWNER || memberLevel === MGR)} disabled={!(memberLevel === OWNER || memberLevel === MGR)}/>}/>
29
+ <ListRow title={t('groupChatName')} detail={name} onPress={toEditGroupName} topSeparator='full'/>
30
+ <ListRow title={t('groupNotice')} titlePlace={notice ? 'top' : 'left'} detail={<Text numberOfLines={6} ellipsizeMode={'tail'} style={styles.noticeText}>
59
31
  {notice || t('unSetting')}
60
- </react_native_1.Text>} topSeparator='full' onPress={toEditGroupNotice}/>
32
+ </Text>} topSeparator='full' onPress={toEditGroupNotice}/>
61
33
  {/*<ListRow*/}
62
34
  {/* title={t('groupMgr')}*/}
63
35
  {/* onPress={onPressGroupMgr}*/}
64
36
  {/* detail={inviteValidateInfo}*/}
65
37
  {/* topSeparator='full'*/}
66
38
  {/*/>*/}
67
- </react_native_1.View>);
39
+ </View>);
68
40
  });
69
- const styles = react_native_1.StyleSheet.create({
41
+ const styles = StyleSheet.create({
70
42
  noticeText: {
71
- marginVertical: (0, rn_ui_1.dp)(5),
72
- fontSize: (0, rn_ui_1.dp)(12),
43
+ marginVertical: dp(5),
44
+ fontSize: dp(12),
73
45
  color: '#888888'
74
46
  }
75
47
  });
76
- exports.default = OptionGroup;
48
+ export default OptionGroup;
@@ -1,59 +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
- 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 useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
32
- const rn_ui_1 = require("@smart-link/rn-ui");
33
- const useImSelector_1 = require("../../../hooks/useImSelector");
34
- const init_1 = require("../../../init");
35
- const im_base_1 = require("@smart-link/im-base");
36
- const OptionGroupManage = (0, react_1.memo)(props => {
1
+ import React, { memo, useCallback, useEffect } from 'react';
2
+ import { ScrollView, Switch } from 'react-native';
3
+ import useTranslation from "../../../hooks/useTranslation";
4
+ import { ListRow, NavigationPage, Space } from "@smart-link/rn-ui";
5
+ import { useConversation } from '../../../hooks/useImSelector';
6
+ import { getImManager } from '../../../init';
7
+ import { SettingActions } from '@smart-link/im-base';
8
+ const OptionGroupManage = memo(props => {
37
9
  const { navigation, } = props;
38
- const imManager = (0, init_1.getImManager)();
39
- const { t } = (0, useTranslation_1.default)();
40
- const { currentConversation } = (0, useImSelector_1.useConversation)();
10
+ const imManager = getImManager();
11
+ const { t } = useTranslation();
12
+ const { currentConversation } = useConversation();
41
13
  if (!currentConversation) {
42
14
  return null;
43
15
  }
44
16
  const { enableInviteValidate = 'off' } = currentConversation;
45
- (0, react_1.useEffect)(() => {
17
+ useEffect(() => {
46
18
  navigation.setOptions({
47
19
  title: t('groupMgr')
48
20
  });
49
21
  }, [navigation]);
50
- const onValueChange = (0, react_1.useCallback)((value) => {
51
- imManager.store.dispatch(im_base_1.SettingActions.settingEnableInviteValidate(value ? 'on' : 'off'));
22
+ const onValueChange = useCallback((value) => {
23
+ imManager.store.dispatch(SettingActions.settingEnableInviteValidate(value ? 'on' : 'off'));
52
24
  }, []);
53
- return (<rn_ui_1.NavigationPage scroll noPadding>
54
- <react_native_1.ScrollView>
55
- <rn_ui_1.Space size={'m'}/>
56
- <rn_ui_1.ListRow title={t('groupInviteValid')} detail={<react_native_1.Switch value={enableInviteValidate === 'on'} onValueChange={onValueChange}/>} topSeparator='full' bottomSeparator='full'/>
25
+ return (<NavigationPage scroll noPadding>
26
+ <ScrollView>
27
+ <Space size={'m'}/>
28
+ <ListRow title={t('groupInviteValid')} detail={<Switch value={enableInviteValidate === 'on'} onValueChange={onValueChange}/>} topSeparator='full' bottomSeparator='full'/>
57
29
  {/*<Space size={'m'} />*/}
58
30
  {/*<ListRow title={t('groupTransfer')}*/}
59
31
  {/* onPress={() => {*/}
@@ -62,7 +34,7 @@ const OptionGroupManage = (0, react_1.memo)(props => {
62
34
  {/* topSeparator='full'*/}
63
35
  {/* bottomSeparator='full'*/}
64
36
  {/*/>*/}
65
- </react_native_1.ScrollView>
66
- </rn_ui_1.NavigationPage>);
37
+ </ScrollView>
38
+ </NavigationPage>);
67
39
  });
68
- exports.default = OptionGroupManage;
40
+ export default OptionGroupManage;
@@ -1,37 +1,32 @@
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 rn_ui_1 = require("@smart-link/rn-ui");
7
- const useImSelector_1 = require("../../../hooks/useImSelector");
8
- const react_1 = require("react");
9
- const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
10
- const react_native_1 = require("react-native");
11
- const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar"));
12
- const default_assets_1 = require("../../../default-assets");
13
- const im_base_1 = require("@smart-link/im-base");
14
- const styles_1 = require("../../../components/styles");
15
- const { OWNER, MGR, } = im_base_1.MemberLevel;
1
+ import { NavigationPage, SearchInput, dp, useNavigation } from "@smart-link/rn-ui";
2
+ import { useChatGroup, useConversation } from "../../../hooks/useImSelector";
3
+ import { useEffect, useMemo, useState } from "react";
4
+ import useTranslation from "../../../hooks/useTranslation";
5
+ import { StyleSheet, View, Text, TouchableOpacity, Image, FlatList } from 'react-native';
6
+ import ChatAvatar from "../../../components/ChatAvatar";
7
+ import { defaultAvatars } from '../../../default-assets';
8
+ import { MemberLevel } from "@smart-link/im-base";
9
+ import { shadowStyle } from "../../../components/styles";
10
+ const { OWNER, MGR, } = MemberLevel;
16
11
  const OptionGroupMoreMember = (props) => {
17
- const { groupDetail } = (0, useImSelector_1.useChatGroup)();
12
+ const { groupDetail } = useChatGroup();
18
13
  const { memberTotalCount } = groupDetail;
19
- const { allMembers } = (0, useImSelector_1.useConversation)();
20
- const [keyword, setKeyword] = (0, react_1.useState)('');
21
- const { t } = (0, useTranslation_1.default)();
22
- const navigation = (0, rn_ui_1.useNavigation)();
23
- (0, react_1.useEffect)(() => {
14
+ const { allMembers } = useConversation();
15
+ const [keyword, setKeyword] = useState('');
16
+ const { t } = useTranslation();
17
+ const navigation = useNavigation();
18
+ useEffect(() => {
24
19
  navigation.setOptions({
25
20
  title: t('groupChatMember') + '(' + memberTotalCount + ')',
26
21
  });
27
22
  }, [t, navigation, memberTotalCount]);
28
- const listLineComponent = allMembers.length === 0 ? null : <react_native_1.View style={styles.listLine}/>;
29
- const itemSeparatorComponent = () => <react_native_1.View style={[styles.separator]}/>;
23
+ const listLineComponent = allMembers.length === 0 ? null : <View style={styles.listLine}/>;
24
+ const itemSeparatorComponent = () => <View style={[styles.separator]}/>;
30
25
  const keyExtractor = (member) => member.userId;
31
26
  const renderItem = ({ item }) => {
32
27
  const { userId, chatGroupId, memberName, memberLevel, } = item;
33
- const adminSource = memberLevel === OWNER ? default_assets_1.defaultAvatars.GROUP_OWNER : memberLevel === MGR ? default_assets_1.defaultAvatars.GROUP_MGR : null;
34
- return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={styles.row} onPress={() => {
28
+ const adminSource = memberLevel === OWNER ? defaultAvatars.GROUP_OWNER : memberLevel === MGR ? defaultAvatars.GROUP_MGR : null;
29
+ return (<TouchableOpacity activeOpacity={0.5} style={styles.row} onPress={() => {
35
30
  // onPressUserAvatars && onPressUserAvatars(userId)
36
31
  navigation.navigate('UserDetail', {
37
32
  userId: userId,
@@ -52,16 +47,16 @@ const OptionGroupMoreMember = (props) => {
52
47
  // memberLevel,
53
48
  // })
54
49
  }}>
55
- <ChatAvatar_1.default id={userId} disabled size={(0, rn_ui_1.dp)(40)} name={memberName}/>
56
- <react_native_1.View style={styles.w15}/>
57
- <react_native_1.View>
58
- <react_native_1.Text style={styles.userName} numberOfLines={1}>{memberName}</react_native_1.Text>
59
- </react_native_1.View>
50
+ <ChatAvatar id={userId} disabled size={dp(40)} name={memberName}/>
51
+ <View style={styles.w15}/>
52
+ <View>
53
+ <Text style={styles.userName} numberOfLines={1}>{memberName}</Text>
54
+ </View>
60
55
  {adminSource &&
61
- <react_native_1.Image source={adminSource} style={styles.admin} resizeMode={'contain'}/>}
62
- </react_native_1.TouchableOpacity>);
56
+ <Image source={adminSource} style={styles.admin} resizeMode={'contain'}/>}
57
+ </TouchableOpacity>);
63
58
  };
64
- const list = (0, react_1.useMemo)(() => {
59
+ const list = useMemo(() => {
65
60
  const allMembersData = allMembers.filter((item) => {
66
61
  if (keyword) {
67
62
  return item.memberName.indexOf(keyword) > -1;
@@ -80,14 +75,14 @@ const OptionGroupMoreMember = (props) => {
80
75
  }
81
76
  return dealData;
82
77
  }, [allMembers, keyword]);
83
- return (<rn_ui_1.NavigationPage noPadding>
84
- <rn_ui_1.SearchInput value={keyword} onChange={(txt) => {
78
+ return (<NavigationPage noPadding>
79
+ <SearchInput value={keyword} onChange={(txt) => {
85
80
  setKeyword(txt);
86
81
  }}/>
87
- <react_native_1.FlatList contentContainerStyle={styles.list} ItemSeparatorComponent={itemSeparatorComponent} ListHeaderComponent={listLineComponent} ListFooterComponent={listLineComponent} numColumns={1} initialNumToRender={15} data={list} keyboardShouldPersistTaps={'handled'} keyExtractor={keyExtractor} renderItem={renderItem}/>
88
- </rn_ui_1.NavigationPage>);
82
+ <FlatList contentContainerStyle={styles.list} ItemSeparatorComponent={itemSeparatorComponent} ListHeaderComponent={listLineComponent} ListFooterComponent={listLineComponent} numColumns={1} initialNumToRender={15} data={list} keyboardShouldPersistTaps={'handled'} keyExtractor={keyExtractor} renderItem={renderItem}/>
83
+ </NavigationPage>);
89
84
  };
90
- const styles = react_native_1.StyleSheet.create({
85
+ const styles = StyleSheet.create({
91
86
  moreMember: {
92
87
  backgroundColor: '#fff',
93
88
  flex: 1
@@ -96,41 +91,41 @@ const styles = react_native_1.StyleSheet.create({
96
91
  backgroundColor: '#fff',
97
92
  borderColor: '#eeeeee'
98
93
  },
99
- search: Object.assign({ backgroundColor: '#eee' }, styles_1.shadowStyle),
94
+ search: Object.assign({ backgroundColor: '#eee' }, shadowStyle),
100
95
  heightSpace: {
101
- height: (0, rn_ui_1.dp)(5)
96
+ height: dp(5)
102
97
  },
103
98
  row: {
104
- paddingHorizontal: (0, rn_ui_1.dp)(15),
99
+ paddingHorizontal: dp(15),
105
100
  flexDirection: 'row',
106
101
  alignItems: 'center',
107
- height: (0, rn_ui_1.dp)(50)
102
+ height: dp(50)
108
103
  },
109
104
  listLine: {
110
105
  marginVertical: 5,
111
- height: (0, rn_ui_1.dp)(1),
106
+ height: dp(1),
112
107
  backgroundColor: '#ececec'
113
108
  },
114
109
  separator: {
115
- marginLeft: (0, rn_ui_1.dp)(75),
116
- marginVertical: (0, rn_ui_1.dp)(5),
117
- height: (0, rn_ui_1.dp)(1),
110
+ marginLeft: dp(75),
111
+ marginVertical: dp(5),
112
+ height: dp(1),
118
113
  backgroundColor: '#ececec'
119
114
  },
120
115
  w15: {
121
- width: (0, rn_ui_1.dp)(15),
116
+ width: dp(15),
122
117
  },
123
118
  admin: {
124
- height: (0, rn_ui_1.dp)(18),
125
- width: (0, rn_ui_1.dp)(18),
119
+ height: dp(18),
120
+ width: dp(18),
126
121
  right: (15),
127
122
  position: 'absolute',
128
123
  },
129
124
  userName: {
130
- width: (0, rn_ui_1.dp)(230),
125
+ width: dp(230),
131
126
  color: '#333',
132
- lineHeight: (0, rn_ui_1.dp)(20),
133
- fontSize: (0, rn_ui_1.dp)(15),
127
+ lineHeight: dp(20),
128
+ fontSize: dp(15),
134
129
  },
135
130
  });
136
- exports.default = OptionGroupMoreMember;
131
+ export default OptionGroupMoreMember;
@@ -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,60 +7,56 @@ 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 useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
41
- const im_base_1 = require("@smart-link/im-base");
42
- const rn_ui_1 = require("@smart-link/rn-ui");
43
- const useImSelector_1 = require("../../../hooks/useImSelector");
44
- const init_1 = require("../../../init");
45
- const { OWNER, MGR, MEMBER, } = im_base_1.MemberLevel;
46
- const OptionGroupNameEdit = (0, react_1.memo)(props => {
10
+ import React, { memo, useEffect } from "react";
11
+ import { ScrollView, View, Text, TextInput, Keyboard, StyleSheet, TouchableOpacity } from "react-native";
12
+ import useTranslation from "../../../hooks/useTranslation";
13
+ import { MemberLevel, SettingActions } from "@smart-link/im-base";
14
+ import { dp, NavigationPage, Toast } from '@smart-link/rn-ui';
15
+ import { useConversation, useSetting } from "../../../hooks/useImSelector";
16
+ import { getImManager } from "../../../init";
17
+ const { OWNER, MGR, MEMBER, } = MemberLevel;
18
+ const OptionGroupNameEdit = memo(props => {
47
19
  const { type, memberLevel, groupNameEdit, groupNoticeEdit, setGroupNameEdit, setGroupNoticeEdit, } = props;
48
- const { t } = (0, useTranslation_1.default)();
20
+ const { t } = useTranslation();
49
21
  console.log('OptionGroupNameEdit: ', props);
50
22
  // @ts-ignore
51
23
  const isOwner = memberLevel === OWNER || memberLevel === MGR;
52
24
  if (type === 'groupNotice') {
53
- return <react_native_1.ScrollView contentContainerStyle={styles.noticeContentContainerStyle}>
54
- <react_native_1.View style={styles.noticeInput}>
55
- <react_native_1.TextInput style={styles.textInput} autoFocus={isOwner} value={groupNoticeEdit} maxLength={1000} multiline={true} editable={isOwner} underlineColorAndroid='transparent' onChangeText={setGroupNoticeEdit}/>
56
- </react_native_1.View>
57
- </react_native_1.ScrollView>;
25
+ return <ScrollView contentContainerStyle={styles.noticeContentContainerStyle}>
26
+ <View style={styles.noticeInput}>
27
+ <TextInput style={styles.textInput} autoFocus={isOwner} value={groupNoticeEdit} maxLength={1000} multiline={true} editable={isOwner} underlineColorAndroid='transparent' onChangeText={setGroupNoticeEdit}/>
28
+ </View>
29
+ </ScrollView>;
58
30
  }
59
31
  else {
60
- return <react_native_1.ScrollView contentContainerStyle={styles.contentContainerStyle}>
61
- <react_native_1.Text>{t('groupChatName')}:</react_native_1.Text>
62
- <react_native_1.View style={styles.input}>
63
- <react_native_1.TextInput autoFocus={isOwner} value={groupNameEdit} maxLength={120} editable={isOwner} returnKeyType={'done'} underlineColorAndroid='transparent' onChangeText={setGroupNameEdit} clearButtonMode={'while-editing'}/>
64
- </react_native_1.View>
65
- </react_native_1.ScrollView>;
32
+ return <ScrollView contentContainerStyle={styles.contentContainerStyle}>
33
+ <Text>{t('groupChatName')}:</Text>
34
+ <View style={styles.input}>
35
+ <TextInput autoFocus={isOwner} value={groupNameEdit} maxLength={120} editable={isOwner} returnKeyType={'done'} underlineColorAndroid='transparent' onChangeText={setGroupNameEdit} clearButtonMode={'while-editing'}/>
36
+ </View>
37
+ </ScrollView>;
66
38
  }
67
39
  });
68
- const OptionGroupNameOrNoticeEditPage = (0, react_1.memo)(props => {
40
+ const OptionGroupNameOrNoticeEditPage = memo(props => {
69
41
  const { navigation, route: { params: { type } } } = props;
70
- const { t } = (0, useTranslation_1.default)();
71
- const { currentConversation } = (0, useImSelector_1.useConversation)();
72
- const { groupNameEdit, groupNoticeEdit } = (0, useImSelector_1.useSetting)();
73
- const imManager = (0, init_1.getImManager)();
42
+ const { t } = useTranslation();
43
+ const { currentConversation } = useConversation();
44
+ const { groupNameEdit, groupNoticeEdit } = useSetting();
45
+ const imManager = getImManager();
74
46
  console.log('OptionGroupNameOrNoticeEditPage', groupNameEdit, groupNoticeEdit);
75
47
  if (!currentConversation) {
76
48
  return null;
77
49
  }
78
50
  const isEditGroupName = type === 'groupName';
79
51
  const setGroupNameEdit = (value) => {
80
- imManager.store.dispatch(im_base_1.SettingActions.setGroupNameEdit(value));
52
+ imManager.store.dispatch(SettingActions.setGroupNameEdit(value));
81
53
  };
82
54
  const setGroupNoticeEdit = (value) => {
83
- imManager.store.dispatch(im_base_1.SettingActions.setGroupNoticeEdit(value));
55
+ imManager.store.dispatch(SettingActions.setGroupNoticeEdit(value));
84
56
  };
85
57
  const { memberLevel } = currentConversation;
86
58
  // console.log('OptionGroupNameOrNoticeEditPage', currentConversation, memberLevel)
87
- (0, react_1.useEffect)(() => {
59
+ useEffect(() => {
88
60
  if (isEditGroupName) {
89
61
  setGroupNameEdit(currentConversation.name);
90
62
  }
@@ -93,44 +65,44 @@ const OptionGroupNameOrNoticeEditPage = (0, react_1.memo)(props => {
93
65
  }
94
66
  const confirm = () => __awaiter(void 0, void 0, void 0, function* () {
95
67
  if (isEditGroupName) {
96
- const toast = rn_ui_1.Toast.loading();
97
- yield imManager.store.dispatch(im_base_1.SettingActions.updateChatGroupName(imManager));
68
+ const toast = Toast.loading();
69
+ yield imManager.store.dispatch(SettingActions.updateChatGroupName(imManager));
98
70
  toast.close();
99
71
  }
100
72
  else {
101
- const toast = rn_ui_1.Toast.loading();
102
- yield imManager.store.dispatch(im_base_1.SettingActions.updateChatGroupNotice());
73
+ const toast = Toast.loading();
74
+ yield imManager.store.dispatch(SettingActions.updateChatGroupNotice());
103
75
  toast.close();
104
76
  }
105
- react_native_1.Keyboard.dismiss();
77
+ Keyboard.dismiss();
106
78
  navigation.pop();
107
79
  });
108
80
  navigation.setOptions({
109
81
  title: isEditGroupName ? t('groupChatName') : t('groupNotice'),
110
- headerRight: (memberLevel === MGR || memberLevel === OWNER) ? () => <react_native_1.TouchableOpacity style={{
82
+ headerRight: (memberLevel === MGR || memberLevel === OWNER) ? () => <TouchableOpacity style={{
111
83
  flexDirection: 'row',
112
84
  alignItems: 'center',
113
- padding: (0, rn_ui_1.dp)(8),
85
+ padding: dp(8),
114
86
  }} onPress={confirm}>
115
- <react_native_1.Text style={{ color: '#fff', fontSize: (0, rn_ui_1.dp)(14) }}>{t('confirm')}</react_native_1.Text>
116
- </react_native_1.TouchableOpacity> : undefined
87
+ <Text style={{ color: '#fff', fontSize: dp(14) }}>{t('confirm')}</Text>
88
+ </TouchableOpacity> : undefined
117
89
  });
118
90
  }, [navigation, currentConversation, type, memberLevel]);
119
- return (<rn_ui_1.NavigationPage noPadding>
91
+ return (<NavigationPage noPadding>
120
92
  <OptionGroupNameEdit type={type} setGroupNameEdit={setGroupNameEdit} setGroupNoticeEdit={setGroupNoticeEdit} groupNameEdit={groupNameEdit} groupNoticeEdit={groupNoticeEdit} memberLevel={memberLevel}/>
121
- </rn_ui_1.NavigationPage>);
93
+ </NavigationPage>);
122
94
  });
123
- const styles = react_native_1.StyleSheet.create({
95
+ const styles = StyleSheet.create({
124
96
  contentContainerStyle: {
125
- padding: (0, rn_ui_1.dp)(15)
97
+ padding: dp(15)
126
98
  },
127
99
  input: {
128
- marginTop: (0, rn_ui_1.dp)(10),
129
- padding: (0, rn_ui_1.dp)(8),
100
+ marginTop: dp(10),
101
+ padding: dp(8),
130
102
  backgroundColor: '#fff',
131
103
  },
132
104
  noticeContentContainerStyle: {
133
- margin: (0, rn_ui_1.dp)(15)
105
+ margin: dp(15)
134
106
  },
135
107
  noticeInput: {
136
108
  flex: 1,
@@ -139,11 +111,11 @@ const styles = react_native_1.StyleSheet.create({
139
111
  textInput: {
140
112
  flex: 1,
141
113
  padding: 10,
142
- fontSize: (0, rn_ui_1.dp)(16),
143
- minHeight: (0, rn_ui_1.dp)(400),
144
- lineHeight: (0, rn_ui_1.dp)(20),
114
+ fontSize: dp(16),
115
+ minHeight: dp(400),
116
+ lineHeight: dp(20),
145
117
  textAlignVertical: 'top',
146
118
  color: '#000',
147
119
  }
148
120
  });
149
- exports.default = OptionGroupNameOrNoticeEditPage;
121
+ export default OptionGroupNameOrNoticeEditPage;