This commit is contained in:
Mirco Wittrien 2022-10-28 13:04:56 +02:00
parent f3366594bb
commit dcff64e2e6
2 changed files with 111 additions and 98 deletions

View File

@ -400,6 +400,13 @@
"NowPlayingItem": {"strings": [".wrapper", "padded:"]}, "NowPlayingItem": {"strings": [".wrapper", "padded:"]},
"PanelButton": {"strings": ["Masks.PANEL_BUTTON"]}, "PanelButton": {"strings": ["Masks.PANEL_BUTTON"]},
"ParticipantsForSelectedParticipant": {"strings": ["ACTIVITY", "maxVisibleUsers", "participantType"]}, "ParticipantsForSelectedParticipant": {"strings": ["ACTIVITY", "maxVisibleUsers", "participantType"]},
"PeopleList": {"strings": [".SECTION_NO_RESULTS", ".section", "SUGGESTIONS"]},
"PeopleListItem": {"strings": ["height:new", "isFocused", "onOtherHover"]},
"PeopleListItemBlocked": {"strings": [".listItemContents", "UNKNOWN", ".BLOCKED"]},
"PeopleListItemFriend": {"strings": [".getMutablePrivateChannels", ".handleOpenPrivateChannel", "isActiveRow"]},
"PeopleListItemPending": {"strings": ["PENDING_INCOMING", ".DENY", "addRelationship"]},
"PeopleListSectionedLazy": {"strings": [".statusSections", ".peopleList", "id:\"people-list\""]},
"PeopleListSectionedNonLazy": {"strings": [".statusSections", ".peopleList", "id:\"people\""]},
"PrivateChannel": {"strings": ["LEAVE_GROUP_DM_MANAGED_BODY", "handleCloseButtonMouseDown", "handleLeaveGroup"]}, "PrivateChannel": {"strings": ["LEAVE_GROUP_DM_MANAGED_BODY", "handleCloseButtonMouseDown", "handleLeaveGroup"]},
"PrivateChannelRecipients": {"strings": [".membersWrap", "recipients"]}, "PrivateChannelRecipients": {"strings": [".membersWrap", "recipients"]},
"PrivateChannelsList": {"strings": ["privateChannelIds", "privateChannelRecipientsInviteButtonIcon"]}, "PrivateChannelsList": {"strings": ["privateChannelIds", "privateChannelRecipientsInviteButtonIcon"]},
@ -419,6 +426,7 @@
"Spoiler": {"strings": ["revealSpoiler", ".onReveal"]}, "Spoiler": {"strings": ["revealSpoiler", ".onReveal"]},
"SpoilerWarning": {"strings": [".spoilerWarning", ".SPOILER"]}, "SpoilerWarning": {"strings": [".spoilerWarning", ".SPOILER"]},
"StandardSidebarView": {"strings": ["standardSidebarView", ".sidebarTheme", "mobileSidebarHeader"]}, "StandardSidebarView": {"strings": ["standardSidebarView", ".sidebarTheme", "mobileSidebarHeader"]},
"TabBar": {"props": ["Types", "Looks", "Item", "Panel"]},
"TransitionGroup": {"protos": ["performAppear", "performEnter", "performLeave"]}, "TransitionGroup": {"protos": ["performAppear", "performEnter", "performLeave"]},
"UnreadDMs": {"strings": ["getMutablePrivateChannels", "selectedVoiceGuildId", ".selectedVoiceChannelId"]}, "UnreadDMs": {"strings": ["getMutablePrivateChannels", "selectedVoiceGuildId", ".selectedVoiceChannelId"]},
"UseCopyIdItem": {"strings": ["\"devmode-copy-id\""]}, "UseCopyIdItem": {"strings": ["\"devmode-copy-id\""]},

View File

@ -2,7 +2,7 @@
* @name BetterFriendList * @name BetterFriendList
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.4.6 * @version 1.4.7
* @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount * @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -87,22 +87,28 @@ module.exports = (_ => {
} }
}; };
this.patchedModules = { this.modulePatches = {
before: { before: [
TabBar: "render", "PeopleListSectionedLazy",
PeopleListSectionedLazy: "default", "PeopleListSectionedNonLazy",
PeopleListSectionedNonLazy: "default" "TabBar"
}, ],
after: { after: [
TabBar: "render", "PeopleList",
PeopleListSectionedLazy: "default", "PeopleListItem",
PeopleListSectionedNonLazy: "default", "PeopleListItemBlocked",
PeopleList: "default", "PeopleListItemFriend",
FriendRow: "render", "PeopleListItemPending",
PendingRow: "default", "PeopleListSectionedLazy",
BlockedRow: "render", "PeopleListSectionedNonLazy",
PeopleListItem: ["render", "componentDidMount","componentWillUnmount"] "TabBar"
} ],
componentDidMount: [
"PeopleListItem"
],
componentWillUnmount: [
"PeopleListItem"
]
}; };
this.css = ` this.css = `
@ -180,10 +186,11 @@ module.exports = (_ => {
} }
onUserContextMenu (e) { onUserContextMenu (e) {
if (e.instance.props.user && e.subType == "useUserRelationshipItems" && BDFDB.LibraryStores.RelationshipStore.isFriend(e.instance.props.user.id)) { if (!e.instance.props.user || !BDFDB.LibraryStores.RelationshipStore.isFriend(e.instance.props.user.id)) return;
let favorized = favorizedFriends.indexOf(e.instance.props.user.id) > -1; let favorized = favorizedFriends.indexOf(e.instance.props.user.id) > -1;
let hidden = hiddenFriends.indexOf(e.instance.props.user.id) > -1; let hidden = hiddenFriends.indexOf(e.instance.props.user.id) > -1;
e.returnvalue.push(this.settings.general.addFavorizedCategory && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "remove-friend"});
if (index > -1) children.splice(index + 1, 0, this.settings.general.addFavorizedCategory && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: favorized ? this.labels.context_unfavorizefriend : this.labels.context_favorizefriend, label: favorized ? this.labels.context_unfavorizefriend : this.labels.context_favorizefriend,
id: BDFDB.ContextMenuUtils.createItemId(this.name, favorized ? "unfavorize-friend" : "favorize-friend"), id: BDFDB.ContextMenuUtils.createItemId(this.name, favorized ? "unfavorize-friend" : "favorize-friend"),
action: _ => { action: _ => {
@ -211,7 +218,6 @@ module.exports = (_ => {
} }
})); }));
} }
}
processTabBar (e) { processTabBar (e) {
if (e.instance.props.children && e.instance.props.children.some(c => c && c.props.id == BDFDB.DiscordConstants.FriendsSections.ADD_FRIEND)) { if (e.instance.props.children && e.instance.props.children.some(c => c && c.props.id == BDFDB.DiscordConstants.FriendsSections.ADD_FRIEND)) {
@ -315,8 +321,8 @@ module.exports = (_ => {
} }
processPeopleList (e) { processPeopleList (e) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SectionTitle"}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {filter: n => n && n.props && n.props.title && n.props.id});
if (index > -1) { if (index == -1) return;
let users = (BDFDB.ReactUtils.findChild(e.returnvalue, {props: ["statusSections"]}) || {props: {statusSections: []}}).props.statusSections.flat(10); let users = (BDFDB.ReactUtils.findChild(e.returnvalue, {props: ["statusSections"]}) || {props: {statusSections: []}}).props.statusSections.flat(10);
let filteredUsers = users; let filteredUsers = users;
if (this.settings.general.addFavorizedCategory) { if (this.settings.general.addFavorizedCategory) {
@ -366,18 +372,17 @@ module.exports = (_ => {
].flat(10).filter(n => n) ].flat(10).filter(n => n)
}); });
} }
}
processFriendRow (e) { processPeopleListItemFriend (e) {
e.returnvalue.props.mutualGuilds = e.instance.props.mutualGuilds; e.returnvalue.props.mutualGuilds = e.instance.props.mutualGuilds;
} }
processPendingRow (e) { processPeopleListItemPending (e) {
this.processFriendRow(e); this.processPeopleListItemFriend(e);
} }
processBlockedRow (e) { processPeopleListItemBlocked (e) {
this.processFriendRow(e); this.processPeopleListItemFriend(e);
} }
processPeopleListItem (e) { processPeopleListItem (e) {
@ -402,7 +407,7 @@ module.exports = (_ => {
} }
injectMutualGuilds (returnvalue, mutualGuilds) { injectMutualGuilds (returnvalue, mutualGuilds) {
let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "UserInfo"}); let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {filter: n => n && n.props && n.props.subText && n.props.user});
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildSummaryItem, { if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildSummaryItem, {
className: BDFDB.disCN._betterfriendlistmutualguilds, className: BDFDB.disCN._betterfriendlistmutualguilds,
guilds: mutualGuilds, guilds: mutualGuilds,