Update FriendNotifications.plugin.js

This commit is contained in:
Mirco Wittrien 2024-09-05 14:25:29 +02:00
parent d21a386469
commit e98d43d087
1 changed files with 44 additions and 32 deletions

View File

@ -2,7 +2,7 @@
* @name FriendNotifications
* @author DevilBro
* @authorId 278543574059057154
* @version 2.0.0
* @version 2.0.1
* @description Shows a Notification when a Friend or a User, you choose to observe, changes their Status
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -747,10 +747,22 @@ module.exports = (_ => {
processGuildsBar (e) {
if (!this.settings.general.addOnlineCount) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "UnreadDMs"});
const process = returnValue => {
let [children, index] = BDFDB.ReactUtils.findParent(returnValue, {name: "UnreadDMs"});
if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(FriendOnlineCounterComponent, {
amount: this.getOnlineCount()
}));
};
let themeWrapper = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"});
if (themeWrapper) {
let childrenRender = themeWrapper.props.children;
themeWrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
process(children);
return children;
}, "Error in Children Render of Theme Wrapper!", this);
}
else process(e.returnvalue);
}
getObservedData () {