fixes
This commit is contained in:
parent
3919cd1b76
commit
0f33f09690
|
@ -3,7 +3,7 @@
|
|||
class FriendNotifications {
|
||||
getName () {return "FriendNotifications";}
|
||||
|
||||
getVersion () {return "1.3.0";}
|
||||
getVersion () {return "1.3.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,8 +11,7 @@ class FriendNotifications {
|
|||
|
||||
constructor () {
|
||||
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":[["Startup spam","Fixed the spam of toasts on plugin start"],["Missing sounds","Fixed the missing sounds for playing/listening"]]
|
||||
"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)"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -22,6 +21,7 @@ class FriendNotifications {
|
|||
|
||||
initConstructor () {
|
||||
this.userStatusStore = {};
|
||||
this.shownNotifications = {};
|
||||
|
||||
this.checkInterval = null;
|
||||
|
||||
|
@ -495,6 +495,7 @@ class FriendNotifications {
|
|||
let notificationsounds = BDFDB.getAllData(this, "notificationsounds");
|
||||
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;
|
||||
let intervaltime = BDFDB.getData("checkInterval", this, "amounts") * 1000;
|
||||
this.checkInterval = setInterval(() => {
|
||||
for (let id in users) if (!users[id].disabled) {
|
||||
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>`);
|
||||
let avatar = EUdata.removeIcon ? "" : (EUdata.url ? EUdata.url : BDFDB.getUserAvatar(user.id));
|
||||
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 = () => {
|
||||
if (settings.openOnClick) {
|
||||
let DMid = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(user.id)
|
||||
|
@ -532,11 +534,12 @@ class FriendNotifications {
|
|||
let notificationsound = notificationsounds["desktop" + status.statusname] || {};
|
||||
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;
|
||||
}
|
||||
},BDFDB.getData("checkInterval", this, "amounts") * 1000);
|
||||
}, intervaltime);
|
||||
}
|
||||
|
||||
showTimeLog () {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class MessageUtilities {
|
||||
getName () {return "MessageUtilities";}
|
||||
|
||||
getVersion () {return "1.5.7";}
|
||||
getVersion () {return "1.5.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -12,7 +12,8 @@ class MessageUtilities {
|
|||
constructor () {
|
||||
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"]],
|
||||
"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 = {
|
||||
|
@ -164,28 +165,31 @@ class MessageUtilities {
|
|||
if (instance.props && instance.props.message && instance.props.channel && instance.props.target) {
|
||||
let changed = false;
|
||||
for (let itemlabel of menu.querySelectorAll(BDFDB.dotCN.contextmenulabel)) {
|
||||
let action = null;
|
||||
switch (itemlabel.innerText) {
|
||||
case BDFDB.LanguageStrings.COPY_MESSAGE_LINK:
|
||||
action = "Copy_Link";
|
||||
break;
|
||||
case BDFDB.LanguageStrings.EDIT_MESSAGE:
|
||||
action = "Edit_Message";
|
||||
break;
|
||||
case BDFDB.LanguageStrings.PIN_MESSAGE:
|
||||
case BDFDB.LanguageStrings.UNPIN_MESSAGE:
|
||||
action = "Pin/Unpin_Message";
|
||||
break;
|
||||
case BDFDB.LanguageStrings.DELETE_MESSAGE:
|
||||
action = "Delete_Message";
|
||||
break;
|
||||
}
|
||||
if (action) {
|
||||
let hintlabel = this.getActiveShortcutString(action);
|
||||
if (hintlabel) {
|
||||
changed = true;
|
||||
BDFDB.addClass(itemlabel.nextElementSibling, "BDFDB-contextMenuItemHint");
|
||||
BDFDB.setInnerText(itemlabel.nextElementSibling, hintlabel);
|
||||
let hint = itemlabel.parentElement.querySelector(BDFDB.dotCN.contextmenuhint);
|
||||
if (hint && !BDFDB.containsClass(hint, "BDFDB-contextMenuItemHint")) {
|
||||
let action = null;
|
||||
switch (itemlabel.innerText) {
|
||||
case BDFDB.LanguageStrings.COPY_MESSAGE_LINK:
|
||||
action = "Copy_Link";
|
||||
break;
|
||||
case BDFDB.LanguageStrings.EDIT_MESSAGE:
|
||||
action = "Edit_Message";
|
||||
break;
|
||||
case BDFDB.LanguageStrings.PIN_MESSAGE:
|
||||
case BDFDB.LanguageStrings.UNPIN_MESSAGE:
|
||||
action = "Pin/Unpin_Message";
|
||||
break;
|
||||
case BDFDB.LanguageStrings.DELETE_MESSAGE:
|
||||
action = "Delete_Message";
|
||||
break;
|
||||
}
|
||||
if (action) {
|
||||
let hintlabel = this.getActiveShortcutString(action);
|
||||
if (hintlabel) {
|
||||
changed = true;
|
||||
BDFDB.addClass(hint, "BDFDB-contextMenuItemHint");
|
||||
BDFDB.setInnerText(hint, hintlabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue