fixes
This commit is contained in:
parent
3919cd1b76
commit
0f33f09690
|
@ -3,7 +3,7 @@
|
||||||
class FriendNotifications {
|
class FriendNotifications {
|
||||||
getName () {return "FriendNotifications";}
|
getName () {return "FriendNotifications";}
|
||||||
|
|
||||||
getVersion () {return "1.3.0";}
|
getVersion () {return "1.3.1";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@ class FriendNotifications {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
this.changelog = {
|
||||||
"added":[["Playing/Listening/Streaming","You can now listen for substatus like playing and listening, also added new placeholders like $game and $song to custom notifications"],["Default disable","Option to disable notification for newly added friends"]],
|
"fixed":[["Double notifications","It now should be impossible for the plugin to trigger double notifications, if this problem still occurs to you, then something is wrong on your end (double plugin file or two different versions at the same time)"]]
|
||||||
"fixed":[["Startup spam","Fixed the spam of toasts on plugin start"],["Missing sounds","Fixed the missing sounds for playing/listening"]]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchModules = {
|
this.patchModules = {
|
||||||
|
@ -22,6 +21,7 @@ class FriendNotifications {
|
||||||
|
|
||||||
initConstructor () {
|
initConstructor () {
|
||||||
this.userStatusStore = {};
|
this.userStatusStore = {};
|
||||||
|
this.shownNotifications = {};
|
||||||
|
|
||||||
this.checkInterval = null;
|
this.checkInterval = null;
|
||||||
|
|
||||||
|
@ -495,6 +495,7 @@ class FriendNotifications {
|
||||||
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
|
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
|
||||||
let users = Object.assign({}, BDFDB.loadAllData(this, "nonfriends"), BDFDB.loadAllData(this, "friends"));
|
let users = Object.assign({}, BDFDB.loadAllData(this, "nonfriends"), BDFDB.loadAllData(this, "friends"));
|
||||||
for (let id in users) this.userStatusStore[id] = this.getStatusWithMobileAndActivity(id, users[id]).statusname;
|
for (let id in users) this.userStatusStore[id] = this.getStatusWithMobileAndActivity(id, users[id]).statusname;
|
||||||
|
let intervaltime = BDFDB.getData("checkInterval", this, "amounts") * 1000;
|
||||||
this.checkInterval = setInterval(() => {
|
this.checkInterval = setInterval(() => {
|
||||||
for (let id in users) if (!users[id].disabled) {
|
for (let id in users) if (!users[id].disabled) {
|
||||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||||
|
@ -507,7 +508,8 @@ class FriendNotifications {
|
||||||
if (status.isactivity) toaststring = toaststring.replace(/\$song|\$game/g, `<strong>${status.name || status.details}</strong>`).replace(/\$artist/g, `<strong>${status.state}</strong>`);
|
if (status.isactivity) toaststring = toaststring.replace(/\$song|\$game/g, `<strong>${status.name || status.details}</strong>`).replace(/\$artist/g, `<strong>${status.state}</strong>`);
|
||||||
let avatar = EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.getUserAvatar(user.id));
|
let avatar = EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.getUserAvatar(user.id));
|
||||||
this.timeLog.push({string:toaststring, avatar, time: new Date()});
|
this.timeLog.push({string:toaststring, avatar, time: new Date()});
|
||||||
if (!(settings.muteOnDND && BDFDB.getUserStatus() == "dnd")) {
|
if (!(settings.muteOnDND && BDFDB.getUserStatus() == "dnd") && !this.shownNotifications[user.id]) {
|
||||||
|
this.shownNotifications[user.id] = true;
|
||||||
let openChannel = () => {
|
let openChannel = () => {
|
||||||
if (settings.openOnClick) {
|
if (settings.openOnClick) {
|
||||||
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
|
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
|
||||||
|
@ -532,11 +534,12 @@ class FriendNotifications {
|
||||||
let notificationsound = notificationsounds["desktop" + status.statusname] || {};
|
let notificationsound = notificationsounds["desktop" + status.statusname] || {};
|
||||||
BDFDB.showDesktopNotification(desktopstring, {icon:avatar, timeout:5000, click:openChannel, silent:notificationsound.mute, sound:notificationsound.song});
|
BDFDB.showDesktopNotification(desktopstring, {icon:avatar, timeout:5000, click:openChannel, silent:notificationsound.mute, sound:notificationsound.song});
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {delete this.shownNotifications[user.id]}, intervaltime/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.userStatusStore[id] = status.statusname;
|
this.userStatusStore[id] = status.statusname;
|
||||||
}
|
}
|
||||||
},BDFDB.getData("checkInterval", this, "amounts") * 1000);
|
}, intervaltime);
|
||||||
}
|
}
|
||||||
|
|
||||||
showTimeLog () {
|
showTimeLog () {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class MessageUtilities {
|
class MessageUtilities {
|
||||||
getName () {return "MessageUtilities";}
|
getName () {return "MessageUtilities";}
|
||||||
|
|
||||||
getVersion () {return "1.5.7";}
|
getVersion () {return "1.5.8";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ class MessageUtilities {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
this.changelog = {
|
||||||
"improved":[["Delays","A delay is need to cancel the single click event in case a double click follows, the plugin now checks if an action with a double click might overwrite a single click (happens if they share the same keys), if this is not the case the plugin will trigger the single click action without delay now"]],
|
"improved":[["Delays","A delay is need to cancel the single click event in case a double click follows, the plugin now checks if an action with a double click might overwrite a single click (happens if they share the same keys), if this is not the case the plugin will trigger the single click action without delay now"]],
|
||||||
"added":[["Context Hints", "Added hints to native contextmenu items, hints can now be disabled in the settings"],["Toasts","You can enable/disable toasts for native actions"]]
|
"added":[["Context Hints", "Added hints to native contextmenu items, hints can now be disabled in the settings"],["Toasts","You can enable/disable toasts for native actions"]],
|
||||||
|
"fixed":[["Double Hints", "Fixed the issue where the contextmenu hitn would be added twice in rare cases"]]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchModules = {
|
this.patchModules = {
|
||||||
|
@ -164,28 +165,31 @@ class MessageUtilities {
|
||||||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
|
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
|
||||||
let changed = false;
|
let changed = false;
|
||||||
for (let itemlabel of menu.querySelectorAll(BDFDB.dotCN.contextmenulabel)) {
|
for (let itemlabel of menu.querySelectorAll(BDFDB.dotCN.contextmenulabel)) {
|
||||||
let action = null;
|
let hint = itemlabel.parentElement.querySelector(BDFDB.dotCN.contextmenuhint);
|
||||||
switch (itemlabel.innerText) {
|
if (hint && !BDFDB.containsClass(hint, "BDFDB-contextMenuItemHint")) {
|
||||||
case BDFDB.LanguageStrings.COPY_MESSAGE_LINK:
|
let action = null;
|
||||||
action = "Copy_Link";
|
switch (itemlabel.innerText) {
|
||||||
break;
|
case BDFDB.LanguageStrings.COPY_MESSAGE_LINK:
|
||||||
case BDFDB.LanguageStrings.EDIT_MESSAGE:
|
action = "Copy_Link";
|
||||||
action = "Edit_Message";
|
break;
|
||||||
break;
|
case BDFDB.LanguageStrings.EDIT_MESSAGE:
|
||||||
case BDFDB.LanguageStrings.PIN_MESSAGE:
|
action = "Edit_Message";
|
||||||
case BDFDB.LanguageStrings.UNPIN_MESSAGE:
|
break;
|
||||||
action = "Pin/Unpin_Message";
|
case BDFDB.LanguageStrings.PIN_MESSAGE:
|
||||||
break;
|
case BDFDB.LanguageStrings.UNPIN_MESSAGE:
|
||||||
case BDFDB.LanguageStrings.DELETE_MESSAGE:
|
action = "Pin/Unpin_Message";
|
||||||
action = "Delete_Message";
|
break;
|
||||||
break;
|
case BDFDB.LanguageStrings.DELETE_MESSAGE:
|
||||||
}
|
action = "Delete_Message";
|
||||||
if (action) {
|
break;
|
||||||
let hintlabel = this.getActiveShortcutString(action);
|
}
|
||||||
if (hintlabel) {
|
if (action) {
|
||||||
changed = true;
|
let hintlabel = this.getActiveShortcutString(action);
|
||||||
BDFDB.addClass(itemlabel.nextElementSibling, "BDFDB-contextMenuItemHint");
|
if (hintlabel) {
|
||||||
BDFDB.setInnerText(itemlabel.nextElementSibling, hintlabel);
|
changed = true;
|
||||||
|
BDFDB.addClass(hint, "BDFDB-contextMenuItemHint");
|
||||||
|
BDFDB.setInnerText(hint, hintlabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue