@smart-link/rn-im 1.0.16 → 1.0.18
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.
@@ -35,6 +35,7 @@ const MaterialIcons_1 = __importDefault(require("react-native-vector-icons/Mater
|
|
35
35
|
const ChatAvatar_1 = __importDefault(require("../../../components/ChatAvatar/ChatAvatar"));
|
36
36
|
const useFormatMsgTime_1 = __importDefault(require("../../../hooks/useFormatMsgTime"));
|
37
37
|
const useTranslation_1 = __importDefault(require("../../../hooks/useTranslation"));
|
38
|
+
const init_1 = require("../../../init");
|
38
39
|
const ConversationCard = (0, react_1.memo)(props => {
|
39
40
|
const { status, selected, conversation, onPressCard, onLongPressCard } = props;
|
40
41
|
const { t } = (0, useTranslation_1.default)();
|
@@ -45,6 +46,12 @@ const ConversationCard = (0, react_1.memo)(props => {
|
|
45
46
|
const content = (0, im_base_1.getConversationContent)(text, errorText, draftText, tipsList, countText, t);
|
46
47
|
const contentStyles = content.tips ? styles.contentRedStyles : null;
|
47
48
|
const formatTime = (0, useFormatMsgTime_1.default)(time, true);
|
49
|
+
const imManager = (0, init_1.getImManager)();
|
50
|
+
// 还没找到为啥会让空的头像的人变成登录人的头像,先解决表面问题
|
51
|
+
let newAvatars = avatars;
|
52
|
+
if (avatars === imManager.user.avatars && name !== imManager.user.userName) {
|
53
|
+
newAvatars = "";
|
54
|
+
}
|
48
55
|
return (<react_native_1.TouchableOpacity activeOpacity={0.5} style={[styles.card, enableTopStyles, selected && styles.selected]} onPress={() => {
|
49
56
|
onPressCard && onPressCard(conversation);
|
50
57
|
}} onLongPress={({ nativeEvent }) => {
|
@@ -52,7 +59,7 @@ const ConversationCard = (0, react_1.memo)(props => {
|
|
52
59
|
}}>
|
53
60
|
<react_native_1.View style={{ height: (0, rn_ui_1.dp)(50), width: (0, rn_ui_1.dp)(50), marginRight: (0, rn_ui_1.dp)(16) }}>
|
54
61
|
<rn_ui_1.Badge text={unreadCount} dot={showPoint}>
|
55
|
-
<ChatAvatar_1.default disabled type={type} id={id} size={(0, rn_ui_1.dp)(48)} name={name} url={
|
62
|
+
<ChatAvatar_1.default disabled type={type} id={id} size={(0, rn_ui_1.dp)(48)} name={name} url={newAvatars}/>
|
56
63
|
</rn_ui_1.Badge>
|
57
64
|
{status === 'online' && <react_native_1.View style={styles.status}>
|
58
65
|
<MaterialIcons_1.default size={(0, rn_ui_1.dp)(14)} color={status === 'online' ? '#4caf50' : '#616161'} name={status === 'online' ? 'check-circle' : 'not-interested'}/>
|
@@ -62,12 +62,23 @@ const OptionGroupMoreMember = (props) => {
|
|
62
62
|
</react_native_1.TouchableOpacity>);
|
63
63
|
};
|
64
64
|
const list = (0, react_1.useMemo)(() => {
|
65
|
-
|
65
|
+
const allMembersData = allMembers.slice().reverse().filter((item) => {
|
66
66
|
if (keyword) {
|
67
67
|
return item.memberName.indexOf(keyword) > -1;
|
68
68
|
}
|
69
69
|
return true;
|
70
70
|
});
|
71
|
+
// 让群主在第一个
|
72
|
+
let dealData = allMembersData;
|
73
|
+
const ownerIndex = dealData.findIndex(m => m.memberLevel === "owner");
|
74
|
+
if (ownerIndex > 0) {
|
75
|
+
dealData = [
|
76
|
+
allMembersData[ownerIndex],
|
77
|
+
...allMembersData.slice(0, ownerIndex),
|
78
|
+
...allMembersData.slice(ownerIndex + 1) // 群主之后的成员
|
79
|
+
];
|
80
|
+
}
|
81
|
+
return dealData;
|
71
82
|
}, [allMembers, keyword]);
|
72
83
|
return (<rn_ui_1.NavigationPage noPadding>
|
73
84
|
<rn_ui_1.SearchInput value={keyword} onChange={(txt) => {
|
@@ -22,7 +22,7 @@ const { LIAISON } = im_base_1.GroupType;
|
|
22
22
|
// 最大显示人数
|
23
23
|
const MAX_SHOW_MEMBER_COUNT = 23;
|
24
24
|
const ConversationSetting = ({ navigation }) => {
|
25
|
-
var _a;
|
25
|
+
var _a, _b;
|
26
26
|
const { t } = (0, useTranslation_1.default)();
|
27
27
|
const { currentConversation } = (0, useImSelector_1.useConversation)();
|
28
28
|
const { groupDetail } = (0, useImSelector_1.useChatGroup)();
|
@@ -136,7 +136,7 @@ const ConversationSetting = ({ navigation }) => {
|
|
136
136
|
</>);
|
137
137
|
break;
|
138
138
|
case im_base_1.ConversationType.C2G:
|
139
|
-
|
139
|
+
let avatarList = groupMemberList
|
140
140
|
.map(item => {
|
141
141
|
var _a;
|
142
142
|
return {
|
@@ -147,6 +147,23 @@ const ConversationSetting = ({ navigation }) => {
|
|
147
147
|
};
|
148
148
|
})
|
149
149
|
.splice(0, MAX_SHOW_MEMBER_COUNT);
|
150
|
+
let fMaster = groupMemberList.find(item => item.memberLevel === OWNER);
|
151
|
+
// 假设 fMaster 是要插入的对象,且它有一个唯一标识,比如 userId
|
152
|
+
if (fMaster) {
|
153
|
+
const fMasterWithRequiredFields = {
|
154
|
+
userId: fMaster.userId,
|
155
|
+
userName: (_b = fMaster.memberName) !== null && _b !== void 0 ? _b : '',
|
156
|
+
avatars: fMaster.memberAvatars,
|
157
|
+
memberLevel: fMaster.memberLevel,
|
158
|
+
};
|
159
|
+
// 先移除已存在的群主
|
160
|
+
const existingIndex = avatarList.findIndex(item => item.userId === (fMaster === null || fMaster === void 0 ? void 0 : fMaster.userId));
|
161
|
+
if (existingIndex > -1) {
|
162
|
+
avatarList.splice(existingIndex, 1);
|
163
|
+
}
|
164
|
+
// 插入群主
|
165
|
+
avatarList.unshift(fMasterWithRequiredFields);
|
166
|
+
}
|
150
167
|
content = (<>
|
151
168
|
<OptionAvatars_1.default list={avatarList} showTitle memberTotalCount={memberTotalCount} showAdd showMore={isMgr ? avatarList.length > 8 : avatarList.length > 9} isMgr={isMgr} addUser={() => {
|
152
169
|
// 添加成员
|