@smart-link/rn-im 1.0.24 → 1.1.1

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 (125) hide show
  1. package/assets/file-dir.jpg +0 -0
  2. package/dist/api/addressList.d.ts +16 -15
  3. package/dist/api/addressList.js +15 -1
  4. package/dist/api/user.js +1 -1
  5. package/dist/components/Camera/Camera.js +3 -2
  6. package/dist/components/Camera/CameraCapture.js +61 -12
  7. package/dist/components/ChatAvatar/ChatAvatar.d.ts +3 -3
  8. package/dist/components/ChatAvatar/ChatAvatar.js +51 -49
  9. package/dist/components/ChatAvatar/ChatAvatarId.d.ts +2 -2
  10. package/dist/components/ChatAvatar/ChatAvatarId.js +19 -46
  11. package/dist/components/ChatAvatar/ChatAvatarLocal.js +22 -10
  12. package/dist/components/Favicon.js +1 -1
  13. package/dist/components/LocalImage.js +3 -1
  14. package/dist/components/styles.d.ts +7 -1
  15. package/dist/components/styles.js +16 -11
  16. package/dist/default-assets.d.ts +1 -0
  17. package/dist/default-assets.js +1 -0
  18. package/dist/hooks/useAnimatedValue.d.ts +2 -0
  19. package/dist/hooks/useAnimatedValue.js +9 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +1 -0
  22. package/dist/init.d.ts +2 -2
  23. package/dist/init.js +8 -5
  24. package/dist/interface.d.ts +15 -0
  25. package/dist/pages/address-list/AddressList.js +22 -40
  26. package/dist/pages/address-list/ChooseContact.js +209 -45
  27. package/dist/pages/address-list/MyGroups.d.ts +6 -0
  28. package/dist/pages/address-list/MyGroups.js +90 -0
  29. package/dist/pages/address-list/Organization.d.ts +0 -7
  30. package/dist/pages/address-list/Organization.js +24 -108
  31. package/dist/pages/address-list/UserDetail.js +5 -5
  32. package/dist/pages/address-list/UserSearch.js +6 -7
  33. package/dist/pages/address-list/addressList.routes.d.ts +9 -0
  34. package/dist/pages/address-list/addressList.routes.js +8 -0
  35. package/dist/pages/address-list/components/Icons.d.ts +8 -0
  36. package/dist/pages/address-list/components/Icons.js +15 -0
  37. package/dist/pages/address-list/components/OrgPath.d.ts +12 -0
  38. package/dist/pages/address-list/components/OrgPath.js +59 -0
  39. package/dist/pages/address-list/components/RenderUserItem.d.ts +9 -0
  40. package/dist/pages/address-list/components/RenderUserItem.js +14 -0
  41. package/dist/pages/address-list/{UserJobs.js → components/UserJobs.js} +2 -2
  42. package/dist/pages/address-list/useGroupCategory.d.ts +2 -0
  43. package/dist/pages/address-list/useGroupCategory.js +11 -0
  44. package/dist/pages/address-list/useRoleList.d.ts +2 -0
  45. package/dist/pages/address-list/useRoleList.js +11 -0
  46. package/dist/pages/collection/Collection.js +52 -8
  47. package/dist/pages/collection/ContentFactory.js +50 -3
  48. package/dist/pages/conversation/ForwardToConversation.js +4 -2
  49. package/dist/pages/conversation/List.js +15 -7
  50. package/dist/pages/conversation/components/ConversationCard.js +1 -7
  51. package/dist/pages/conversation/setting/OptionAvatars.d.ts +1 -1
  52. package/dist/pages/conversation/setting/OptionAvatars.js +0 -1
  53. package/dist/pages/conversation/setting/OptionGroup.d.ts +2 -2
  54. package/dist/pages/conversation/setting/OptionGroup.js +4 -4
  55. package/dist/pages/conversation/setting/OptionGroupManage.js +4 -8
  56. package/dist/pages/conversation/setting/OptionGroupMoreMember.js +37 -18
  57. package/dist/pages/conversation/setting/Setting.js +5 -5
  58. package/dist/pages/conversation/setting/SettingChatBg.js +32 -16
  59. package/dist/pages/message/ChooseMember.js +2 -2
  60. package/dist/pages/message/FileSelector.d.ts +6 -0
  61. package/dist/pages/message/FileSelector.js +272 -0
  62. package/dist/pages/message/MessageList.js +81 -43
  63. package/dist/pages/message/MessageRecord.js +34 -23
  64. package/dist/pages/message/components/MessageItem.d.ts +7 -7
  65. package/dist/pages/message/components/MessageItem.js +29 -20
  66. package/dist/pages/message/components/MessageOption.d.ts +7 -3
  67. package/dist/pages/message/components/MessageOption.js +14 -16
  68. package/dist/pages/message/components/MessagePayload.d.ts +2 -1
  69. package/dist/pages/message/components/MessagePictureAlbum.js +6 -4
  70. package/dist/pages/message/components/Payload/PayloadFile.d.ts +1 -1
  71. package/dist/pages/message/components/Payload/PayloadFile.js +34 -16
  72. package/dist/pages/message/components/Payload/PayloadMultiple.js +12 -8
  73. package/dist/pages/message/components/Payload/PayloadNotify.js +14 -5
  74. package/dist/pages/message/components/Payload/PayloadPicture.d.ts +1 -1
  75. package/dist/pages/message/components/Payload/PayloadPicture.js +9 -7
  76. package/dist/pages/message/components/Payload/PayloadText.js +7 -8
  77. package/dist/pages/message/components/Payload/PayloadVideo.js +2 -1
  78. package/dist/pages/message/components/Payload/PayloadVoice.js +7 -13
  79. package/dist/pages/message/components/Payload/PayloadWrapper.d.ts +2 -1
  80. package/dist/pages/message/components/Payload/PayloadWrapper.js +46 -20
  81. package/dist/pages/message/components/Payload/type.d.ts +3 -1
  82. package/dist/pages/message/components/ReceiptBack.js +2 -2
  83. package/dist/pages/message/components/TextMixMessage.d.ts +2 -0
  84. package/dist/pages/message/components/TextMixMessage.js +10 -3
  85. package/dist/pages/message/components/TextMixQuote.js +10 -15
  86. package/dist/pages/message/components/TextMixQuoteMessage.d.ts +2 -1
  87. package/dist/pages/message/components/TextMixQuoteMessage.js +5 -5
  88. package/dist/pages/message/components/UploadProgress.d.ts +1 -1
  89. package/dist/pages/message/components/UploadProgress.js +1 -1
  90. package/dist/pages/message/components/messageBar/EmojiPanel.js +8 -9
  91. package/dist/pages/message/components/messageBar/MessageBar.d.ts +1 -1
  92. package/dist/pages/message/components/messageBar/MessageBar.js +14 -12
  93. package/dist/pages/message/components/messageBar/MessageInput.d.ts +1 -0
  94. package/dist/pages/message/components/messageBar/MessageInput.js +19 -1
  95. package/dist/pages/message/components/messageBar/OptionPanel.js +22 -44
  96. package/dist/pages/message/message.routes.js +10 -0
  97. package/dist/pages/search/components/SearchUser.js +2 -2
  98. package/dist/pages/types.d.ts +6 -2
  99. package/dist/slice/contact/contact.slice.js +1 -0
  100. package/dist/slice/video/video.action.js +9 -1
  101. package/dist/utils/common-action-sheet.d.ts +1 -0
  102. package/dist/utils/common-action-sheet.js +18 -0
  103. package/dist/utils/file-icon.js +29 -2
  104. package/dist/utils/file.d.ts +21 -2
  105. package/dist/utils/file.js +209 -42
  106. package/dist/utils/phone.d.ts +1 -1
  107. package/dist/utils/phone.js +1 -9
  108. package/dist/utils/request.d.ts +2 -1
  109. package/dist/utils/request.js +17 -6
  110. package/dist/utils/upload.d.ts +2 -4
  111. package/dist/utils/upload.js +13 -49
  112. package/package.json +5 -5
  113. package/dist/pages/address-list/Icons.d.ts +0 -5
  114. package/dist/pages/address-list/Icons.js +0 -9
  115. package/dist/slice/contact/contact.action.d.ts +0 -1
  116. package/dist/slice/contact/contact.action.js +0 -1
  117. package/dist/utils/cookie.d.ts +0 -2
  118. package/dist/utils/cookie.js +0 -25
  119. package/dist/utils/file-operate.d.ts +0 -1
  120. package/dist/utils/file-operate.js +0 -3
  121. package/dist/utils/text-mix.d.ts +0 -9
  122. package/dist/utils/text-mix.js +0 -75
  123. /package/dist/pages/address-list/{CardInfo.d.ts → components/CardInfo.d.ts} +0 -0
  124. /package/dist/pages/address-list/{CardInfo.js → components/CardInfo.js} +0 -0
  125. /package/dist/pages/address-list/{UserJobs.d.ts → components/UserJobs.d.ts} +0 -0
@@ -10,13 +10,15 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import LocalImage from '../../components/LocalImage';
13
- import { PayloadType, numberToTime } from '@smart-link/im-base';
13
+ import { PayloadType, numberToTime, buildSimpleText } from '@smart-link/im-base';
14
14
  import { dp } from '@smart-link/rn-ui';
15
15
  import React, { memo } from 'react';
16
16
  import { Image, StyleSheet, Text, View } from 'react-native';
17
17
  import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
18
18
  import PayloadFile from '../message/components/Payload/PayloadFile';
19
- const { TEXT, VOICE, VIDEO, PICTURE, FILE, } = PayloadType;
19
+ import useTranslation from "../../hooks/useTranslation";
20
+ import { getImManager } from "../../init";
21
+ const { TEXT, VOICE, VIDEO, PICTURE, FILE, MULTIPLE, } = PayloadType;
20
22
  export default function ContentFactory({ keyword, collection }) {
21
23
  const { payloadType, payload } = collection, retProps = __rest(collection, ["payloadType", "payload"]);
22
24
  switch (payloadType) {
@@ -36,6 +38,9 @@ export default function ContentFactory({ keyword, collection }) {
36
38
  case VIDEO: {
37
39
  return <ContentVideo {...payload}/>;
38
40
  }
41
+ case MULTIPLE: {
42
+ return <ContentMultiple {...payload}/>;
43
+ }
39
44
  default: {
40
45
  return null;
41
46
  }
@@ -47,6 +52,29 @@ const ContentText = memo(props => {
47
52
  {text}
48
53
  </Text>);
49
54
  });
55
+ const ContentMultiple = memo((props) => {
56
+ const { selectedMessages, fromName, toName } = props;
57
+ const { t } = useTranslation();
58
+ console.log(fromName, toName);
59
+ let title = t('multipleChatRecord');
60
+ if (fromName && toName) {
61
+ title = t('multipleChatRecordTitle', { fromName, toName });
62
+ }
63
+ const imManager = getImManager();
64
+ const messages = selectedMessages.length > 2 ? [...selectedMessages.slice(0, 2), 'more'] : selectedMessages;
65
+ return <View>
66
+ <Text style={styles.text} numberOfLines={1}>{title}</Text>
67
+ <View style={styles.multiContent}>
68
+ {messages.map((message, index) => {
69
+ return message === 'more' ? (<Text key={index} style={styles.itemTextMore}>
70
+ ......
71
+ </Text>) : (<Text key={index} style={styles.itemText} numberOfLines={1} ellipsizeMode="middle">
72
+ {message.messageFromName + ': ' + buildSimpleText(imManager, message.payloadType, message.payload)}
73
+ </Text>);
74
+ })}
75
+ </View>
76
+ </View>;
77
+ });
50
78
  const voiceLeft = require('../../../assets/voice-left.png');
51
79
  const ContentVoice = memo(props => {
52
80
  const { duration } = props;
@@ -134,5 +162,24 @@ const styles = StyleSheet.create({
134
162
  },
135
163
  w15: {
136
164
  width: dp(15),
137
- }
165
+ },
166
+ titleText: {
167
+ color: '#333',
168
+ fontSize: dp(14),
169
+ lineHeight: dp(18),
170
+ },
171
+ multiContent: {
172
+ flexDirection: 'column'
173
+ },
174
+ item: {
175
+ justifyContent: 'center',
176
+ },
177
+ itemText: {
178
+ color: '#999',
179
+ fontSize: dp(13),
180
+ },
181
+ itemTextMore: {
182
+ color: '#999',
183
+ fontSize: dp(13),
184
+ },
138
185
  });
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useEffect } from 'react';
2
2
  import { StyleSheet, TouchableOpacity, View, Text, FlatList } from 'react-native';
3
- import { Checkbox, dp, NavigationPage, SearchInput, Space } from '@smart-link/rn-ui';
3
+ import { Checkbox, dp, NavigationPage, SearchInput, Space, Toast } from '@smart-link/rn-ui';
4
4
  import { useForward, useMessage } from '../../hooks/useImSelector';
5
5
  import useTranslation from '../../hooks/useTranslation';
6
6
  import { shadowStyle } from '../../components/styles';
@@ -35,10 +35,12 @@ const ForwardToConversation = ({ navigation }) => {
35
35
  const disabled = selectList.length === 0;
36
36
  const selectCountText = disabled ? '' : '(' + selectList.length + ')';
37
37
  return (<TouchableOpacity activeOpacity={0.5} style={{ padding: dp(10) }} disabled={disabled} onPress={() => {
38
+ const toast = Toast.loading();
38
39
  imManager.store.dispatch(ForwardActions.forwardMessage(imManager, forwardMessage, selectList, () => {
39
40
  imManager.store.dispatch(ForwardActions.resetState());
40
41
  imManager.store.dispatch(MessageActions.setForwardMessage(null));
41
42
  navigation.goBack();
43
+ toast.close();
42
44
  }));
43
45
  }}>
44
46
  <Text style={{ color: tintColor }}>
@@ -61,7 +63,7 @@ const ForwardToConversation = ({ navigation }) => {
61
63
  <Checkbox style={{ pointerEvents: 'none' }} checked={checked}/>
62
64
  </View>
63
65
 
64
- <ChatAvatar disabled id={item.id} priority="outside" url={item.avatars} name={item.name} size={dp(40)} type={item.type}/>
66
+ <ChatAvatar disabled id={item.id} needUpdate url={item.avatars} name={item.name} size={dp(40)} type={item.type}/>
65
67
  <View style={styles.width10}/>
66
68
  <Text numberOfLines={1} style={styles.nameText}>
67
69
  {item.name}
@@ -22,11 +22,12 @@ import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
22
22
  import { startCreateGroup } from '../../slice/contact/contact.slice';
23
23
  const List = ({ navigation }) => {
24
24
  const { t } = useTranslation();
25
- const { connectStatus, conversations, onlineMap } = useConversation();
25
+ const { connectStatus, conversations } = useConversation();
26
26
  const [nativeEvent, setNativeEvent] = useState();
27
27
  const [popoverVisible, setPopoverVisible] = useState(false);
28
28
  const [conversation, setConversation] = useState();
29
29
  const lastPressTime = useRef(0);
30
+ const lastIndex = useRef(0);
30
31
  const flatListRef = useRef(null);
31
32
  useEffect(() => {
32
33
  let headerTitle = t('message');
@@ -62,6 +63,13 @@ const List = ({ navigation }) => {
62
63
  });
63
64
  },
64
65
  },
66
+ {
67
+ icon: <MaterialIcon name="star"/>,
68
+ content: t('collected'),
69
+ onPress: () => {
70
+ navigation.navigate('Collection');
71
+ },
72
+ },
65
73
  {
66
74
  icon: <MaterialIcon name="qr-code-scanner"/>,
67
75
  content: t('scan'),
@@ -93,12 +101,13 @@ const List = ({ navigation }) => {
93
101
  return navigation.addListener('tabPress', (e) => {
94
102
  const now = Date.now();
95
103
  if (now - lastPressTime.current < 300) {
96
- // 双击, 定位到第一个未读消息
97
- conversations.find((item) => {
104
+ // 双击, 定位到未读会话,循环定位
105
+ conversations.find((item, index) => {
98
106
  var _a;
99
- if (item.unreadCount > 0 && item.enableNoDisturb === 'off') {
107
+ if (item.unreadCount > 0 && item.enableNoDisturb === 'off' && lastIndex.current !== index) {
108
+ lastIndex.current = index;
100
109
  (_a = flatListRef.current) === null || _a === void 0 ? void 0 : _a.scrollToIndex({
101
- index: conversations.indexOf(item),
110
+ index: index,
102
111
  animated: true,
103
112
  });
104
113
  return true;
@@ -114,7 +123,6 @@ const List = ({ navigation }) => {
114
123
  const onPressCard = (conversation) => __awaiter(void 0, void 0, void 0, function* () {
115
124
  setPopoverVisible(false);
116
125
  try {
117
- // 设置更新已读数量
118
126
  const imManager = getImManager();
119
127
  yield imManager.store.dispatch(ConversationActions.initConversation(imManager, conversation));
120
128
  navigation.navigate('MessageList');
@@ -144,7 +152,7 @@ const List = ({ navigation }) => {
144
152
  const renderItem = ({ item }) => {
145
153
  return (
146
154
  // @ts-ignore
147
- <ConversationCard selected={item.id === (conversation === null || conversation === void 0 ? void 0 : conversation.id)} conversation={item} onPressCard={onPressCard} onLongPressCard={onLongPressCard} status={onlineMap[item.id]}/>);
155
+ <ConversationCard selected={item.id === (conversation === null || conversation === void 0 ? void 0 : conversation.id)} conversation={item} onPressCard={onPressCard} onLongPressCard={onLongPressCard}/>);
148
156
  };
149
157
  const itemSeparatorComponent = ({ leadingItem }) => {
150
158
  for (let i = 0; i < conversations.length; i++) {
@@ -17,12 +17,6 @@ const ConversationCard = memo(props => {
17
17
  const content = getConversationContent(text, errorText, draftText, tipsList, countText, t);
18
18
  const contentStyles = content.tips ? styles.contentRedStyles : null;
19
19
  const formatTime = useFormatMsgTime(time, true);
20
- // const imManager = getImManager();
21
- // // 还没找到为啥会让空的头像的人变成登录人的头像,先解决表面问题
22
- // let newAvatars = avatars;
23
- // if (avatars === imManager.user.avatars && name !== imManager.user.userName) {
24
- // newAvatars = "";
25
- // }
26
20
  return (<TouchableOpacity activeOpacity={0.5} style={[styles.card, enableTopStyles, selected && styles.selected]} onPress={() => {
27
21
  onPressCard && onPressCard(conversation);
28
22
  }} onLongPress={({ nativeEvent }) => {
@@ -30,7 +24,7 @@ const ConversationCard = memo(props => {
30
24
  }}>
31
25
  <View style={{ height: dp(50), width: dp(50), marginRight: dp(16) }}>
32
26
  <Badge text={unreadCount} dot={showPoint}>
33
- <ChatAvatar disabled type={type} id={id} size={dp(48)} name={name}/>
27
+ <ChatAvatar disabled type={type} id={id} url={avatars} size={dp(48)} name={name}/>
34
28
  </Badge>
35
29
  {status === 'online' && <View style={styles.status}>
36
30
  <MaterialIcons size={dp(14)} color={status === 'online' ? '#4caf50' : '#616161'} name={status === 'online' ? 'check-circle' : 'not-interested'}/>
@@ -4,7 +4,7 @@ export interface OptionAvatarsProps {
4
4
  list: {
5
5
  userId: string;
6
6
  userName: string;
7
- avatars: string;
7
+ avatars?: string;
8
8
  memberLevel?: MemberLevel;
9
9
  }[];
10
10
  showTitle?: boolean;
@@ -77,7 +77,6 @@ const styles = StyleSheet.create({
77
77
  borderBottomWidth: px(1),
78
78
  },
79
79
  avatarsItem: {
80
- height: dp(60),
81
80
  width: dp(42),
82
81
  marginTop: dp(10),
83
82
  marginHorizontal: (width - dp(42) * 5) / 12 - 0.01,
@@ -4,7 +4,7 @@ import { ViewProps } from "react-native/Libraries/Components/View/ViewPropTypes"
4
4
  interface IOptionGroupProps extends ViewProps {
5
5
  id: string;
6
6
  name: string;
7
- avatars: string;
7
+ avatars?: string;
8
8
  notice: string;
9
9
  memberLevel: MemberLevel;
10
10
  enableInviteValidate: string;
@@ -13,5 +13,5 @@ interface IOptionGroupProps extends ViewProps {
13
13
  toEditGroupNotice?: () => void;
14
14
  toGroupMgr?: () => void;
15
15
  }
16
- declare const OptionGroup: React.NamedExoticComponent<IOptionGroupProps>;
16
+ declare const OptionGroup: (props: IOptionGroupProps) => React.JSX.Element;
17
17
  export default OptionGroup;
@@ -7,14 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import React, { memo, useCallback } from 'react';
10
+ import React, { useCallback } from 'react';
11
11
  import { Text, View, StyleSheet } from 'react-native';
12
12
  import { dp, ListRow } from '@smart-link/rn-ui';
13
13
  import { ConversationType, MemberLevel } from "@smart-link/im-base";
14
14
  import useTranslation from "../../../hooks/useTranslation";
15
15
  import ChatAvatar from '../../../components/ChatAvatar/ChatAvatar';
16
16
  const { OWNER, MGR, MEMBER, } = MemberLevel;
17
- const OptionGroup = memo(props => {
17
+ const OptionGroup = (props) => {
18
18
  const { id, name, avatars, notice, memberLevel = MEMBER, enableInviteValidate, toEditGroupAvatars, toEditGroupName, toEditGroupNotice, toGroupMgr, style } = props;
19
19
  const { t } = useTranslation();
20
20
  const onPressGroupMgr = !(memberLevel === OWNER) ? null : () => {
@@ -25,7 +25,7 @@ const OptionGroup = memo(props => {
25
25
  toEditGroupAvatars && toEditGroupAvatars(id, url);
26
26
  }), []);
27
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)}/>}/>
28
+ <ListRow title={t('groupAvatars')} detail={<ChatAvatar size={dp(40)} id={id} name={name} url={avatars} type={ConversationType.C2G} editable={(memberLevel === OWNER || memberLevel === MGR)} disabled={!(memberLevel === OWNER || memberLevel === MGR)}/>}/>
29
29
  <ListRow title={t('groupChatName')} detail={name} onPress={toEditGroupName} topSeparator='full'/>
30
30
  <ListRow title={t('groupNotice')} titlePlace={notice ? 'top' : 'left'} detail={<Text numberOfLines={6} ellipsizeMode={'tail'} style={styles.noticeText}>
31
31
  {notice || t('unSetting')}
@@ -37,7 +37,7 @@ const OptionGroup = memo(props => {
37
37
  {/* topSeparator='full'*/}
38
38
  {/*/>*/}
39
39
  </View>);
40
- });
40
+ };
41
41
  const styles = StyleSheet.create({
42
42
  noticeText: {
43
43
  marginVertical: dp(5),
@@ -26,14 +26,10 @@ const OptionGroupManage = memo(props => {
26
26
  <ScrollView>
27
27
  <Space size={'m'}/>
28
28
  <ListRow title={t('groupInviteValid')} detail={<Switch value={enableInviteValidate === 'on'} onValueChange={onValueChange}/>} topSeparator='full' bottomSeparator='full'/>
29
- {/*<Space size={'m'} />*/}
30
- {/*<ListRow title={t('groupTransfer')}*/}
31
- {/* onPress={() => {*/}
32
- {/* navigation.navigate('GroupTransfer')*/}
33
- {/* }}*/}
34
- {/* topSeparator='full'*/}
35
- {/* bottomSeparator='full'*/}
36
- {/*/>*/}
29
+ <Space size={'m'}/>
30
+ <ListRow title={t('groupTransfer')} onPress={() => {
31
+ navigation.navigate('GroupTransfer');
32
+ }} topSeparator='full' bottomSeparator='full'/>
37
33
  </ScrollView>
38
34
  </NavigationPage>);
39
35
  });
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { NavigationPage, SearchInput, dp, useNavigation } from "@smart-link/rn-ui";
2
11
  import { useChatGroup, useConversation } from "../../../hooks/useImSelector";
3
12
  import { useEffect, useMemo, useState } from "react";
@@ -5,13 +14,16 @@ import useTranslation from "../../../hooks/useTranslation";
5
14
  import { StyleSheet, View, Text, TouchableOpacity, Image, FlatList } from 'react-native';
6
15
  import ChatAvatar from "../../../components/ChatAvatar";
7
16
  import { defaultAvatars } from '../../../default-assets';
8
- import { MemberLevel } from "@smart-link/im-base";
17
+ import { ConversationActions, GroupActions, MemberLevel, updateGroupManager, viewGroupDetail } from "@smart-link/im-base";
9
18
  import { shadowStyle } from "../../../components/styles";
19
+ import { getImManager } from "../../../init";
20
+ import { ConfirmActionSheetNoTitle } from "../../../utils/common-action-sheet";
10
21
  const { OWNER, MGR, } = MemberLevel;
11
22
  const OptionGroupMoreMember = (props) => {
12
23
  const { groupDetail } = useChatGroup();
13
- const { memberTotalCount } = groupDetail;
14
- const { allMembers } = useConversation();
24
+ const { memberTotalCount, memberLevel } = groupDetail;
25
+ const { allMembers, currentConversation } = useConversation();
26
+ const dispatch = getImManager().store.dispatch;
15
27
  const [keyword, setKeyword] = useState('');
16
28
  const { t } = useTranslation();
17
29
  const navigation = useNavigation();
@@ -20,6 +32,7 @@ const OptionGroupMoreMember = (props) => {
20
32
  title: t('groupChatMember') + '(' + memberTotalCount + ')',
21
33
  });
22
34
  }, [t, navigation, memberTotalCount]);
35
+ const isMgr = memberLevel === OWNER || memberLevel === MGR;
23
36
  const listLineComponent = allMembers.length === 0 ? null : <View style={styles.listLine}/>;
24
37
  const itemSeparatorComponent = () => <View style={[styles.separator]}/>;
25
38
  const keyExtractor = (member) => member.userId;
@@ -27,25 +40,31 @@ const OptionGroupMoreMember = (props) => {
27
40
  const { userId, chatGroupId, memberName, memberLevel, } = item;
28
41
  const adminSource = memberLevel === OWNER ? defaultAvatars.GROUP_OWNER : memberLevel === MGR ? defaultAvatars.GROUP_MGR : null;
29
42
  return (<TouchableOpacity activeOpacity={0.5} style={styles.row} onPress={() => {
30
- // onPressUserAvatars && onPressUserAvatars(userId)
31
43
  navigation.navigate('UserDetail', {
32
44
  userId: userId,
33
45
  });
34
46
  }} onLongPress={() => {
35
- // if (!isMgr) {
36
- // return;
37
- // }
38
- //
39
- // if (!imGroupId || !memberLevel || memberLevel === OWNER) {
40
- // return;
41
- // }
42
- //
43
- // onLongPressUserAvatars && onLongPressUserAvatars({
44
- // imGroupId,
45
- // userId,
46
- // userName:memberName,
47
- // memberLevel,
48
- // })
47
+ if (!isMgr) {
48
+ return;
49
+ }
50
+ if (!chatGroupId || !memberLevel || memberLevel === OWNER) {
51
+ return;
52
+ }
53
+ const title = memberLevel === MGR ? t('cancelMgr', { userName: memberName }) : t('setToMgr', { userName: memberName });
54
+ ConfirmActionSheetNoTitle(title, () => __awaiter(void 0, void 0, void 0, function* () {
55
+ yield updateGroupManager({
56
+ chatGroupId,
57
+ userId: userId,
58
+ userName: memberName,
59
+ memberLevel: memberLevel === MGR ? MemberLevel.MEMBER : MemberLevel.MGR,
60
+ });
61
+ const detail = yield viewGroupDetail(chatGroupId);
62
+ dispatch(ConversationActions.setCurrentConversation(Object.assign(Object.assign({}, currentConversation), {
63
+ groupMemberList: detail.groupMemberList
64
+ })));
65
+ dispatch(GroupActions.setGroupDetail(detail));
66
+ dispatch(ConversationActions.loadAllMembers(chatGroupId));
67
+ }), t);
49
68
  }}>
50
69
  <ChatAvatar id={userId} disabled size={dp(40)} name={memberName}/>
51
70
  <View style={styles.w15}/>
@@ -17,8 +17,7 @@ const { LIAISON } = GroupType;
17
17
  const MAX_SHOW_MEMBER_COUNT = 23;
18
18
  const ConversationSetting = ({ navigation }) => {
19
19
  const { t } = useTranslation();
20
- // const {allMembers} = useMessage();
21
- const { currentConversation } = useConversation();
20
+ const { currentConversation, allMembers } = useConversation();
22
21
  const { groupDetail } = useChatGroup();
23
22
  const title = t('chatSetting');
24
23
  const memberTotalCount = (groupDetail === null || groupDetail === void 0 ? void 0 : groupDetail.memberTotalCount) || 0;
@@ -110,18 +109,18 @@ const ConversationSetting = ({ navigation }) => {
110
109
  switch (type) {
111
110
  case ConversationType.C2C:
112
111
  content = (<>
113
- <OptionAvatars list={id ? [
112
+ <OptionAvatars list={[
114
113
  {
115
114
  userId: id,
116
115
  userName: name,
117
- avatars,
118
116
  },
119
- ] : []} showAdd={true} showDelete={false} showMore={false} addUser={() => {
117
+ ]} showAdd={true} showDelete={false} showMore={false} addUser={() => {
120
118
  getImManager().store.dispatch(startCreateGroup());
121
119
  navigation.navigate('ChooseContact', {
122
120
  chooseOrg: true,
123
121
  checkMode: 'multi',
124
122
  checkedIds: [id],
123
+ disableIds: [id],
125
124
  });
126
125
  }}/>
127
126
  <Space size={'m'}/>
@@ -148,6 +147,7 @@ const ConversationSetting = ({ navigation }) => {
148
147
  navigation.navigate('ChooseContact', {
149
148
  chooseOrg: true,
150
149
  checkMode: 'multi',
150
+ disableIds: allMembers.map((item) => item.userId),
151
151
  });
152
152
  }} removeUser={removeUser} toMoreMember={() => {
153
153
  navigation.navigate('OptionGroupMoreMember');
@@ -16,12 +16,31 @@ import { ConversationActions, updateOptionSetting } from '@smart-link/im-base';
16
16
  import { ListRow, NavigationPage, Space, Toast } from '@smart-link/rn-ui';
17
17
  import React, { useEffect } from 'react';
18
18
  import ImagePicker from 'react-native-image-crop-picker';
19
+ import to from "await-to-js";
19
20
  const SettingChatBg = ({ navigation }) => {
20
21
  const { t } = useTranslation();
21
22
  const { currentConversation } = useConversation();
23
+ const imManager = getImManager();
22
24
  useEffect(() => {
23
25
  navigation.setOptions({ title: t('selectChatBackground') });
24
26
  }, [navigation, t]);
27
+ const updateChatBg = (fileId) => __awaiter(void 0, void 0, void 0, function* () {
28
+ yield updateOptionSetting({
29
+ type: currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.type,
30
+ conversationId: currentConversation.id,
31
+ optionKey: 'imageBackground',
32
+ optionValue: fileId,
33
+ });
34
+ imManager.store.dispatch(ConversationActions.setCurrentConversation(Object.assign(Object.assign({}, currentConversation), { imageBackground: fileId })));
35
+ imManager.store.dispatch(ConversationActions.updateConversation({
36
+ id: currentConversation.id,
37
+ imageBackground: fileId,
38
+ }));
39
+ yield imManager.db.updateConversationById({
40
+ id: currentConversation.id,
41
+ imageBackground: fileId,
42
+ });
43
+ });
25
44
  const openAlbum = () => __awaiter(void 0, void 0, void 0, function* () {
26
45
  let toast;
27
46
  let image;
@@ -40,22 +59,7 @@ const SettingChatBg = ({ navigation }) => {
40
59
  try {
41
60
  toast = Toast.loading();
42
61
  const fileId = yield uploadFile(image.path, image.mime);
43
- yield updateOptionSetting({
44
- type: currentConversation === null || currentConversation === void 0 ? void 0 : currentConversation.type,
45
- conversationId: currentConversation.id,
46
- optionKey: 'imageBackground',
47
- optionValue: fileId,
48
- });
49
- const imManager = getImManager();
50
- imManager.store.dispatch(ConversationActions.setCurrentConversation(Object.assign(Object.assign({}, currentConversation), { imageBackground: fileId })));
51
- imManager.store.dispatch(ConversationActions.updateConversation({
52
- id: currentConversation.id,
53
- imageBackground: fileId,
54
- }));
55
- yield imManager.db.updateConversationById({
56
- id: currentConversation.id,
57
- imageBackground: fileId,
58
- });
62
+ yield updateChatBg(fileId);
59
63
  // 更新本地资源存储
60
64
  yield imManager.updateResource({
61
65
  url: fileId,
@@ -70,9 +74,21 @@ const SettingChatBg = ({ navigation }) => {
70
74
  Toast.error(t('settingFail'));
71
75
  }
72
76
  });
77
+ const clearBg = () => __awaiter(void 0, void 0, void 0, function* () {
78
+ const toast = Toast.loading();
79
+ const [err,] = yield to(updateChatBg('bg0'));
80
+ if (err) {
81
+ toast === null || toast === void 0 ? void 0 : toast.close();
82
+ Toast.error(t('settingFail'));
83
+ return;
84
+ }
85
+ navigation.dispatch(StackActions.pop(2));
86
+ toast === null || toast === void 0 ? void 0 : toast.close();
87
+ });
73
88
  return (<NavigationPage noPadding>
74
89
  <Space size="m"/>
75
90
  <ListRow title={t('chooseFromAlbum')} onPress={openAlbum} accessory="none"/>
91
+ <ListRow title={t('clearChatBackground')} onPress={clearBg} accessory="none"/>
76
92
  </NavigationPage>);
77
93
  };
78
94
  export default SettingChatBg;
@@ -50,7 +50,7 @@ const ChooseMember = ({ navigation, route: { params } }) => {
50
50
  const members = list.filter(item => checked.includes(item.userId));
51
51
  if (params.atOther) {
52
52
  if ((_a = imManager.inputRef) === null || _a === void 0 ? void 0 : _a.current) {
53
- (_c = (_b = imManager.inputRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.appendInputText(`${members[0].memberName} `);
53
+ (_c = (_b = imManager.inputRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.inertText(`${members[0].memberName} `);
54
54
  }
55
55
  imManager.store.dispatch(MessageActions.addAtUser(members[0]));
56
56
  }
@@ -132,7 +132,7 @@ const styles = StyleSheet.create({
132
132
  width10: {
133
133
  width: dp(10),
134
134
  },
135
- search: Object.assign({ backgroundColor: '#fff', padding: dp(10), borderBottomWidth: dp(1), borderColor: '#e9e9e9' }, shadowStyle),
135
+ search: Object.assign({ backgroundColor: '#fff', paddingHorizontal: dp(10), borderBottomWidth: dp(1), height: dp(40), borderColor: '#e9e9e9' }, shadowStyle),
136
136
  heightSpace: {
137
137
  height: dp(5),
138
138
  },
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { NativeStackScreenProps } from "@react-navigation/native-stack/lib/typescript/src/types";
3
+ import { IMPageParamList } from "../types";
4
+ type FileSelectorProps = NativeStackScreenProps<IMPageParamList, 'FileSelector'>;
5
+ declare const FileSelector: ({ navigation }: FileSelectorProps) => React.JSX.Element;
6
+ export default FileSelector;