stuff
This commit is contained in:
parent
5cf8743c17
commit
8e5b0bfaa2
|
@ -2335,7 +2335,10 @@
|
|||
for (let guild of BDFDB.ArrayUtils.is(guilds) ? guilds : (typeof guilds == "string" || typeof guilds == "number" ? Array.of(guilds) : Array.from(guilds))) {
|
||||
let id = Node.prototype.isPrototypeOf(guild) ? BDFDB.GuildUtils.getId(guild) : (guild && typeof guild == "object" ? guild.id : guild);
|
||||
let channels = id && LibraryModules.GuildChannelStore.getChannels(id);
|
||||
if (channels) for (let type in channels) if (BDFDB.ArrayUtils.is(channels[type])) for (let channelobj of channels[type]) unreadChannels.push(channelobj.channel.id);
|
||||
if (channels) for (let type in channels) if (BDFDB.ArrayUtils.is(channels[type])) for (let channelobj of channels[type]) if (BDFDB.ChannelUtils.isTextChannel(channelobj.channel)) unreadChannels.push({
|
||||
channelId: channelobj.channel.id,
|
||||
messageId: LibraryModules.UnreadChannelUtils.getOldestUnreadMessageId(channelobj.channel.id)
|
||||
});
|
||||
}
|
||||
if (unreadChannels.length) LibraryModules.AckUtils.bulkAck(unreadChannels);
|
||||
};
|
||||
|
@ -2477,7 +2480,10 @@
|
|||
let unreadChannels = [];
|
||||
for (let channel of channels = BDFDB.ArrayUtils.is(channels) ? channels : (typeof channels == "string" || typeof channels == "number" ? Array.of(channels) : Array.from(channels))) {
|
||||
let id = Node.prototype.isPrototypeOf(channel) ? BDFDB.ChannelUtils.getId(channel) : (channel && typeof channel == "object" ? channel.id : channel);
|
||||
if (id) unreadChannels.push(id);
|
||||
if (id && BDFDB.ChannelUtils.isTextChannel(id)) unreadChannels.push({
|
||||
channelId: id,
|
||||
messageId: LibraryModules.UnreadChannelUtils.getOldestUnreadMessageId(id)
|
||||
});
|
||||
}
|
||||
if (unreadChannels.length) LibraryModules.AckUtils.bulkAck(unreadChannels);
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ var PinDMs = (_ => {
|
|||
return class PinDMs {
|
||||
getName () {return "PinDMs";}
|
||||
|
||||
getVersion () {return "1.6.7";}
|
||||
getVersion () {return "1.6.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -15,7 +15,7 @@ var PinDMs = (_ => {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["List flickering","Fixed the weird bugs where the list would jump around, flicker or leave huge gaps"]]
|
||||
"fixed":[["List flickering","Fixed the weird bugs where the list would jump around, flicker or leave huge gaps"],["Selected DM","Fixed issue where a selected DM outside of a category would not be marked as selected"]]
|
||||
};
|
||||
|
||||
this.patchedModules = {
|
||||
|
@ -288,9 +288,7 @@ var PinDMs = (_ => {
|
|||
e.instance.props.channels = Object.assign({}, e.instance.props.channels);
|
||||
e.instance.props.privateChannelIds = [].concat(e.instance.props.privateChannelIds || []);
|
||||
e.instance.props.pinnedChannelIds = Object.assign({}, e.instance.props.pinnedChannelIds);
|
||||
e.instance.props.shownPinnedChannelIds = Object.assign({}, e.instance.props.shownPinnedChannelIds);
|
||||
if (!e.returnvalue) {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (draggedChannel && releasedChannel) {
|
||||
let categoryId = releasedChannel.split("header_")[1];
|
||||
let category = categories.find(n => categoryId != undefined ? n.id == categoryId : n.dms.includes(releasedChannel));
|
||||
|
@ -316,20 +314,46 @@ var PinDMs = (_ => {
|
|||
releasedCategory = null;
|
||||
}
|
||||
e.instance.props.pinnedChannelIds = {};
|
||||
e.instance.props.shownPinnedChannelIds = {};
|
||||
for (let category of [].concat(categories).reverse()) {
|
||||
e.instance.props.pinnedChannelIds[category.id] = [];
|
||||
e.instance.props.shownPinnedChannelIds[category.id] = [];
|
||||
for (let id of this.sortDMsByTime(this.filterDMs(category.dms), "dmCategories").reverse()) {
|
||||
BDFDB.ArrayUtils.remove(e.instance.props.privateChannelIds, id, true);
|
||||
e.instance.props.pinnedChannelIds[category.id].push(id);
|
||||
if (!category.collapsed || e.instance.props.selectedChannelId == id) {
|
||||
e.instance.props.privateChannelIds.unshift(id);
|
||||
e.instance.props.shownPinnedChannelIds[category.id].push(id);
|
||||
}
|
||||
else e.instance.props.privateChannelIds.unshift(null);
|
||||
e.instance.props.pinnedChannelIds[category.id].push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
e.returnvalue.props.sections = [];
|
||||
e.returnvalue.props.sections.push(e.instance.state.preRenderedChildren);
|
||||
let shownPinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
|
||||
for (let ids of shownPinnedIds) e.returnvalue.props.sections.push(ids.length || 1);
|
||||
e.returnvalue.props.sections.push(e.instance.props.privateChannelIds.length - shownPinnedIds.flat().length);
|
||||
|
||||
let sectionHeight = e.returnvalue.props.sectionHeight;
|
||||
let sectionHeightFunc = typeof sectionHeight != "function" ? _ => sectionHeight : sectionHeight;
|
||||
e.returnvalue.props.sectionHeight = (...args) => {
|
||||
if (args[0] != 0 && args[0] != e.returnvalue.props.sections.length - 1) {
|
||||
let category = categories[args[0] - 1];
|
||||
if (category) return 40;
|
||||
}
|
||||
return sectionHeightFunc(...args);
|
||||
};
|
||||
|
||||
let rowHeight = e.returnvalue.props.rowHeight;
|
||||
let rowHeightFunc = typeof rowHeight != "function" ? _ => rowHeight : rowHeight;
|
||||
e.returnvalue.props.rowHeight = (...args) => {
|
||||
if (args[0] != 0 && args[0] != e.returnvalue.props.sections.length - 1) {
|
||||
let category = categories[args[0] - 1];
|
||||
if (category && (category.collapsed || category.id == draggedCategory)) return 0;
|
||||
}
|
||||
return rowHeightFunc(...args);
|
||||
};
|
||||
}
|
||||
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
BDFDB.ModuleUtils.unpatch(this, e.instance, "renderSection");
|
||||
BDFDB.ModuleUtils.patch(this, e.instance, "renderSection", {after: e2 => {
|
||||
if (e2.methodArguments[0].section != 0 && e2.methodArguments[0].section != e.instance.props.listRef.current.props.sections.length - 1) {
|
||||
|
@ -461,12 +485,8 @@ var PinDMs = (_ => {
|
|||
BDFDB.ModuleUtils.patch(this, e.instance, "renderDM", {before: e2 => {
|
||||
if (e2.methodArguments[0] != 0) e2.methodArguments[1] += pinnedIds.slice(0, e2.methodArguments[0] - 1).flat().length;
|
||||
}, after: e2 => {
|
||||
if (e2.methodArguments[0] != 0 && e2.methodArguments[0] != e.instance.props.listRef.current.props.sections.length - 1) {
|
||||
let category = categories[e2.methodArguments[0] - 1];
|
||||
if (e2.methodArguments[0] != 0) {
|
||||
let id = e.instance.props.privateChannelIds[e2.methodArguments[1]];
|
||||
if (category) {
|
||||
if (!id || category.collapsed && e.instance.props.selectedChannelId != id || !category.dms.includes(id) || draggedCategory == category.id || draggedChannel == id) e2.returnValue = null;
|
||||
else {
|
||||
e2.returnValue = e.instance.props.channels[id] ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PrivateChannelItems[e.instance.props.channels[id].isMultiUserDM() ? "GroupDM" : "DirectMessage"], Object.assign({
|
||||
key: id,
|
||||
channel: e.instance.props.channels[id],
|
||||
|
@ -474,7 +494,11 @@ var PinDMs = (_ => {
|
|||
}, e.instance.props.navigator.getItemProps({
|
||||
index: e2.methodArguments[2]
|
||||
}))) : null;
|
||||
if (hoveredCategory == category.id && [].concat(category.dms).reverse()[0] == id) e2.returnValue = [
|
||||
|
||||
let category = categories[e2.methodArguments[0] - 1];
|
||||
if (category) {
|
||||
if (!id || (category.collapsed && e.instance.props.selectedChannelId != id) || !category.dms.includes(id) || draggedCategory == category.id || draggedChannel == id) e2.returnValue = null;
|
||||
else if (hoveredCategory == category.id && [].concat(category.dms).reverse()[0] == id) e2.returnValue = [
|
||||
e2.returnValue,
|
||||
BDFDB.ReactUtils.createElement("h2", {
|
||||
className: BDFDB.disCNS.dmchannelheadercontainer + BDFDB.disCNS._pindmspinnedchannelsheadercontainer + BDFDB.disCNS._pindmsdmchannelplaceholder + BDFDB.disCN.namecontainernamecontainer
|
||||
|
@ -491,24 +515,7 @@ var PinDMs = (_ => {
|
|||
].filter(n => n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}}, {force: true, noCache: true});
|
||||
|
||||
BDFDB.ModuleUtils.unpatch(this, e.instance, "getSectionHeight");
|
||||
BDFDB.ModuleUtils.patch(this, e.instance, "getSectionHeight", {after: e2 => {
|
||||
if (e2.methodArguments[0] != 0 && e2.methodArguments[0] != e.instance.props.listRef.current.props.sections.length - 1) {
|
||||
let category = categories[e2.methodArguments[0] - 1];
|
||||
if (category && (category.collapsed && !category.dms.some(id => id == e.instance.props.selectedChannelId) || category.id == draggedCategory)) e2.returnValue = 0;
|
||||
}
|
||||
}}, {force: true, noCache: true});
|
||||
}
|
||||
else {
|
||||
e.returnvalue.props.sections = [];
|
||||
e.returnvalue.props.sections.push(e.instance.state.preRenderedChildren);
|
||||
let shownPinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.shownPinnedChannelIds).reverse();
|
||||
for (let ids of shownPinnedIds) e.returnvalue.props.sections.push(ids.length || 1);
|
||||
e.returnvalue.props.sections.push(e.instance.props.privateChannelIds.length - shownPinnedIds.flat().length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -575,6 +575,9 @@
|
|||
#app-mount .categoryFadeBlurple-1j72_A:hover {
|
||||
background-color: rgba(var(--vaccentcolor), 0.95);
|
||||
}
|
||||
.introductionAction-M1r6AX { /* gifpicker introductionaction tooltip */
|
||||
color: rgb(var(--vaccentcolor));
|
||||
}
|
||||
|
||||
/* ---- 4.3. MEMBERLIST ---- */
|
||||
|
||||
|
|
Loading…
Reference in New Issue