diff --git a/Plugins/BetterFriendList/BetterFriendList.plugin.js b/Plugins/BetterFriendList/BetterFriendList.plugin.js index 4319cb3d92..77eccded7d 100644 --- a/Plugins/BetterFriendList/BetterFriendList.plugin.js +++ b/Plugins/BetterFriendList/BetterFriendList.plugin.js @@ -2,7 +2,7 @@ * @name BetterFriendList * @author DevilBro * @authorId 278543574059057154 - * @version 1.4.7 + * @version 1.4.8 * @description Adds extra Controls to the Friends Page, for example sort by Name/Status, Search and All/Request/Blocked Amount * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -96,9 +96,6 @@ module.exports = (_ => { after: [ "PeopleList", "PeopleListItem", - "PeopleListItemBlocked", - "PeopleListItemFriend", - "PeopleListItemPending", "PeopleListSectionedLazy", "PeopleListSectionedNonLazy", "TabBar" @@ -373,18 +370,6 @@ module.exports = (_ => { }); } - processPeopleListItemFriend (e) { - e.returnvalue.props.mutualGuilds = e.instance.props.mutualGuilds; - } - - processPeopleListItemPending (e) { - this.processPeopleListItemFriend(e); - } - - processPeopleListItemBlocked (e) { - this.processPeopleListItemFriend(e); - } - processPeopleListItem (e) { if (e.node) { BDFDB.TimeUtils.clear(rerenderTimeout); @@ -392,30 +377,27 @@ module.exports = (_ => { } else { if (e.instance.props.user.id == placeHolderId) return null; - else if (this.settings.general.addMutualGuild && e.instance.props.mutualGuilds && e.instance.props.mutualGuilds.length) { - if (typeof e.returnvalue.props.children == "function") { + else if (this.settings.general.addMutualGuild) { + let mutualGuilds = BDFDB.ArrayUtils.removeCopies([].concat(BDFDB.LibraryStores.GuildMemberStore.memberOf(e.instance.props.user.id), (BDFDB.LibraryStores.UserProfileStore.getMutualGuilds(e.instance.props.user.id) || []).map(n => n && n.guild && n.guild.id)).flat()).filter(n => n); + if (mutualGuilds && mutualGuilds.length) { + let guildsIds = BDFDB.LibraryModules.SortedGuildUtils.getFlattenedGuildIds(); let childrenRender = e.returnvalue.props.children; e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.injectMutualGuilds(children, e.instance.props.mutualGuilds); - return children; + let returnValue = childrenRender(...args); + 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, { + className: BDFDB.disCN._betterfriendlistmutualguilds, + guilds: mutualGuilds.sort((x, y) => guildsIds.indexOf(x) < guildsIds.indexOf(y) ? -1 : 1).map(BDFDB.LibraryStores.GuildStore.getGuild), + showTooltip: true, + max: 10 + }, true)); + return returnValue; }, "", this); } - else this.injectMutualGuilds(e.returnvalue, e.instance.props.mutualGuilds); } } } - injectMutualGuilds (returnvalue, mutualGuilds) { - 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, { - className: BDFDB.disCN._betterfriendlistmutualguilds, - guilds: mutualGuilds, - showTooltip: true, - max: 10 - }, true)); - } - createBadge (amount, text, red) { let badge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.NumberBadge, { className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.peoplesbadge), diff --git a/Plugins/GameActivityToggle/GameActivityToggle.plugin.js b/Plugins/GameActivityToggle/GameActivityToggle.plugin.js index a8236ab6ca..8e3e39aee7 100644 --- a/Plugins/GameActivityToggle/GameActivityToggle.plugin.js +++ b/Plugins/GameActivityToggle/GameActivityToggle.plugin.js @@ -2,7 +2,7 @@ * @name GameActivityToggle * @author DevilBro * @authorId 278543574059057154 - * @version 1.1.7 + * @version 1.1.8 * @description Adds a Quick-Toggle Game Activity Button * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -86,8 +86,6 @@ module.exports = (_ => { onLoad () { _this = this; - sounds = [(BDFDB.ModuleUtils.findByString("undeafen", "deafen", "robot_man", "mute", {defaultExport: false}) || {exports: {keys: (_ => [])}}).exports.keys()].flat(10).filter(n => n).map(s => s.replace("./", "").split(".")[0]).sort(); - this.defaults = { general: { showButton: {value: true, description: "Show Quick Toggle Button"}, @@ -119,6 +117,8 @@ module.exports = (_ => { } onStart () { + sounds = [BDFDB.LibraryModules.SoundParser && BDFDB.LibraryModules.SoundParser.keys()].flat(10).filter(n => n).map(s => s.replace("./", "").split(".")[0]).sort(); + let cachedState = BDFDB.DataUtils.load(this, "cachedState"); let state = BDFDB.DiscordUtils.getSetting("status", "showCurrentGame"); if (!cachedState.date || (new Date() - cachedState.date) > 1000*60*60*24*3) { @@ -238,6 +238,7 @@ module.exports = (_ => { } activateKeybind () { + console.log(keybind); if (keybind && keybind.length) BDFDB.ListenerUtils.addGlobal(this, "GAMEACTIVITY_TOGGLE", keybind, _ => this.toggle()); else BDFDB.ListenerUtils.removeGlobal(this, "GAMEACTIVITY_TOGGLE"); }