ServerDrawer: fold in BetterFolders' auto-collapse and hide-icons features
This commit is contained in:
parent
634bf8db5a
commit
ffc4e301f8
7 changed files with 80 additions and 10 deletions
|
|
@ -26,7 +26,7 @@ To install: open Discord with Revenge installed, go to **Settings → Plugins**,
|
|||
| FakeProfileThemesAndEffects | Revived | Profile theming and profile effects without Nitro. Fork of [shipwr3ckd's FPTE](https://github.com/shipwr3ckd/FPTE) - fixed a crash on every profile-editor open, confirmed via on-device diagnostics. | `https://rp.jarviscli.dev/fake-profile-themes-and-effects/install/` |
|
||||
| BetterTimestamps | Revived | Calendar-relative, fully relative, ISO 8601, or a custom moment.js timestamp format, for both messages and day dividers. | `https://rp.jarviscli.dev/better-timestamps/install/` |
|
||||
| CopyRoleColor | Revived | Long-press a role pill to copy its color as hex. | `https://rp.jarviscli.dev/copy-role-color/install/` |
|
||||
| ServerDrawer | Revived | Replaces the Quest Dock with an expandable server grid, hides the left server rail down to a single DMs icon, long-press a server for its context menu, one-tap create/join. Fork of [kmmiio99o's ServerDrawer](https://github.com/kmmiio99o/vd-plugins/tree/main/plugins/ServerDrawer) - fixed an unguarded lookup that could silently skip every patch after it. | `https://rp.jarviscli.dev/server-drawer/install/` |
|
||||
| ServerDrawer | Revived | Replaces the Quest Dock with an expandable server grid, hides the left server rail down to a single DMs icon, long-press a server for its context menu, one-tap create/join, auto-collapse folders. Fork of [kmmiio99o's ServerDrawer](https://github.com/kmmiio99o/vd-plugins/tree/main/plugins/ServerDrawer) - fixed an unguarded lookup that could silently skip every patch after it. Folder options adapted from [fres621's BetterFolders](https://github.com/fres621/vendetta-plugins/tree/master/plugins/BetterFolders), rebuilt against the drawer's own folders since BetterFolders' target component no longer exists. | `https://rp.jarviscli.dev/server-drawer/install/` |
|
||||
| YouBar+ | Revived | Up to 2 configurable buttons (None/Direct Messages/Settings) on the YouBar, in your chosen order. Fork of [Purple-EyeZ's YouBar+](https://github.com/Purple-EyeZ/RevengePlugins/tree/main/plugins/YouBarPlus) - fixed a startup race condition where the button patch could silently never apply for an entire session. | `https://rp.jarviscli.dev/you-bar-plus/install/` |
|
||||
|
||||
### Productivity
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
"description": "Replaces the Quest Dock with a server grid drawer above the YouBar - tap to expand, long-press a server for its context menu, plus a one-tap create/join button.",
|
||||
"authors": [
|
||||
{ "name": "everestmcarthur" },
|
||||
{ "name": "kmmiio99o" }
|
||||
{ "name": "kmmiio99o" },
|
||||
{ "name": "fres" }
|
||||
],
|
||||
"main": "src/index.ts",
|
||||
"vendetta": {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import React from "react";
|
|||
import { View, Text, Animated, Pressable, Image, ViewStyle, StyleSheet } from "react-native";
|
||||
import { findByProps, findByStoreName } from "@vendetta/metro";
|
||||
import { getAssetIDByName } from "@vendetta/ui/assets";
|
||||
import { storage } from "@vendetta/plugin";
|
||||
import { useProxy } from "@vendetta/storage";
|
||||
import { useFolderExpanded, GuildNode } from "../utils/theme";
|
||||
import GuildIcon from "./GuildIcon";
|
||||
import GuildItem from "./GuildItem";
|
||||
|
|
@ -53,15 +55,23 @@ function FolderBadge({ node }: { node: GuildNode }) {
|
|||
}
|
||||
|
||||
function FolderCover({ node }: { node: GuildNode }) {
|
||||
useProxy(storage);
|
||||
const col = folderColor(node.color);
|
||||
|
||||
return (
|
||||
<View style={fc.outer}>
|
||||
<View style={[fc.icon, { backgroundColor: col }]}>
|
||||
{node.children.slice(0, 4).map((ch, i) => (
|
||||
<View key={ch.id} style={[fc.cell, POS[i]]}>
|
||||
<GuildIcon id={ch.id as string} size={MINI} />
|
||||
{storage.hideFolderIcons ? (
|
||||
<View style={fc.plainIcon}>
|
||||
<Image source={FOLDER_ASSET} style={fo.folderImg} tintColor="#fff" />
|
||||
</View>
|
||||
))}
|
||||
) : (
|
||||
node.children.slice(0, 4).map((ch, i) => (
|
||||
<View key={ch.id} style={[fc.cell, POS[i]]}>
|
||||
<GuildIcon id={ch.id as string} size={MINI} />
|
||||
</View>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
<FolderBadge node={node} />
|
||||
</View>
|
||||
|
|
@ -72,6 +82,7 @@ const fc = StyleSheet.create({
|
|||
outer: { width: ICON, height: ICON },
|
||||
icon: { width: ICON, height: ICON, borderRadius: 16, overflow: "hidden" },
|
||||
cell: { position: "absolute", width: MINI, height: MINI, borderRadius: 8, overflow: "hidden" },
|
||||
plainIcon: { width: ICON, height: ICON, alignItems: "center", justifyContent: "center" },
|
||||
});
|
||||
|
||||
function FadeIn({ children }: { children: React.ReactNode }) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { patchGetQuestAsset } from "./patches/getQuestAsset";
|
|||
import { patchExpanded, patchEmpty } from "./patches/contentPatch";
|
||||
import { patchHideGuildsBar } from "./patches/hideGuildsBar";
|
||||
import { patchCreateElement } from "./patches/createElementIntercept";
|
||||
import { patchAutoCollapseFolders } from "./patches/autoCollapseFolders";
|
||||
import Settings from "./ui/Settings";
|
||||
|
||||
let cleanups: (() => void)[] = [];
|
||||
|
|
@ -44,7 +45,9 @@ function applyAll() {
|
|||
if (tryPatch("hideGuildsBar", () => patchHideGuildsBar(cleanups))) applied.push("hideGuildsBar");
|
||||
}
|
||||
|
||||
logger.log(`[ServerDrawer] onLoad done - ${applied.length}/11 patches applied (${applied.join(", ") || "none"})`);
|
||||
if (tryPatch("autoCollapseFolders", () => patchAutoCollapseFolders(cleanups))) applied.push("autoCollapseFolders");
|
||||
|
||||
logger.log(`[ServerDrawer] onLoad done - ${applied.length}/12 patches applied (${applied.join(", ") || "none"})`);
|
||||
}
|
||||
|
||||
function unpatchAll() {
|
||||
|
|
@ -67,6 +70,8 @@ export default {
|
|||
onLoad: () => {
|
||||
storage.hideGuildsBar ??= true;
|
||||
storage.showUnreadBadges ??= true;
|
||||
storage.autoCollapseFolders ??= false;
|
||||
storage.hideFolderIcons ??= false;
|
||||
|
||||
applyAll();
|
||||
},
|
||||
|
|
|
|||
31
plugins/server-drawer/src/patches/autoCollapseFolders.ts
Normal file
31
plugins/server-drawer/src/patches/autoCollapseFolders.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { findByStoreName } from "@vendetta/metro";
|
||||
import { FluxDispatcher } from "@vendetta/metro/common";
|
||||
import { storage } from "@vendetta/plugin";
|
||||
|
||||
// Adapted from fres621's BetterFolders (autoCollapse.ts) - ported as a ServerDrawer feature
|
||||
// instead of a standalone plugin because BetterFolders' other half (hideIcons) patches a
|
||||
// "GuildContainer" component that no longer exists in current Discord builds at all, and its
|
||||
// icon-collapsing behavior only made sense for the native server rail, which ServerDrawer already
|
||||
// replaces. This half doesn't touch that component - it only reacts to the same folder-expand
|
||||
// store/event ServerDrawer's own FolderItem already uses, so it works standalone here.
|
||||
export function patchAutoCollapseFolders(cleanups: (() => void)[]): boolean {
|
||||
const ExpandedGuildFolderStore = findByStoreName("ExpandedGuildFolderStore");
|
||||
if (!ExpandedGuildFolderStore?.getExpandedFolders) return false;
|
||||
|
||||
const listener = ({ folderId }: { folderId?: string | number }) => {
|
||||
if (!storage.autoCollapseFolders || folderId == null) return;
|
||||
|
||||
const expanded = ExpandedGuildFolderStore.getExpandedFolders();
|
||||
if (!(expanded instanceof Set) || !expanded.has(folderId)) return;
|
||||
|
||||
for (const id of expanded) {
|
||||
if (id !== folderId) {
|
||||
FluxDispatcher.dispatch({ type: "TOGGLE_GUILD_FOLDER_EXPAND", folderId: id });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND", listener);
|
||||
cleanups.push(() => FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND", listener));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -35,6 +35,26 @@ export default function Settings() {
|
|||
onValueChange={(v: boolean) => { storage.showUnreadBadges = v; }}
|
||||
/>
|
||||
</FormSection>
|
||||
<FormSection title="Folders">
|
||||
<FormSwitchRow
|
||||
label="Auto-collapse other folders"
|
||||
subLabel="Opening a folder collapses any other folder that was already open"
|
||||
value={!!storage.autoCollapseFolders}
|
||||
onValueChange={(v: boolean) => { storage.autoCollapseFolders = v; }}
|
||||
/>
|
||||
<FormSwitchRow
|
||||
label="Hide icons in collapsed folders"
|
||||
subLabel="Show a plain folder icon instead of a 4-server preview"
|
||||
value={!!storage.hideFolderIcons}
|
||||
onValueChange={(v: boolean) => { storage.hideFolderIcons = v; }}
|
||||
/>
|
||||
</FormSection>
|
||||
<NoteBox>
|
||||
The folder options above are ported from fres621's BetterFolders - its other half
|
||||
(hiding icons in the native left server rail) patched a component that no longer
|
||||
exists in current Discord builds, so it's been rebuilt here instead, where it
|
||||
actually applies to what you see.
|
||||
</NoteBox>
|
||||
</SettingsScaffold>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,15 +241,17 @@
|
|||
"category": "Moderation & Appearance",
|
||||
"status": "revived",
|
||||
"accent": "#F97316",
|
||||
"tagline": "Turns the Quest Dock into an expandable server grid, above the YouBar.",
|
||||
"note": "Fork of kmmiio99o's ServerDrawer. One lookup (useMobileQuestDock) was missing an optional-chaining guard - if that lookup came back empty, the whole onLoad threw and every patch after it in the sequence never got applied, not just that one surface. Fixed, plus every patch call is now wrapped so a single bad lookup only skips its own surface.",
|
||||
"tagline": "Turns the Quest Dock into an expandable server grid, with smarter folders.",
|
||||
"note": "Fork of kmmiio99o's ServerDrawer. One lookup (useMobileQuestDock) was missing an optional-chaining guard - if that lookup came back empty, the whole onLoad threw and every patch after it in the sequence never got applied, not just that one surface. Fixed, plus every patch call is now wrapped so a single bad lookup only skips its own surface. Folder options (auto-collapse, hide preview icons) are adapted from fres621's BetterFolders - its icon-hiding half patched a \"GuildContainer\" component that no longer exists anywhere in current Discord builds (confirmed against decompiled source), and only applied to the native server rail anyway, which this plugin already replaces - so it's been rebuilt as a feature of the drawer's own folders instead.",
|
||||
"howItWorks": "Hijacks the Quest Dock - the strip Discord normally uses for daily quests, right above the tab bar - and puts a grid of your servers there instead. Tap it to expand, tap a server to jump to it, long-press for the usual context menu (mark as read, notification settings, leave, etc). A + button opens Discord's own create/join-server modal. Optionally hides the left server rail down to a single DMs icon, since your servers now live in the drawer instead.",
|
||||
"features": [
|
||||
"Tap-to-expand server grid with folders, unread badges, and mention counts",
|
||||
"Long-press a server for its real context menu, not a rebuilt one",
|
||||
"One-tap create/join through Discord's native modal",
|
||||
"Optional: collapse the left server rail to a single DMs icon",
|
||||
"Toggle unread badges independently"
|
||||
"Toggle unread badges independently",
|
||||
"Auto-collapse other open folders when you open a new one",
|
||||
"Optional plain folder icon instead of the 4-server preview when collapsed"
|
||||
],
|
||||
"commands": [],
|
||||
"limitations": "Depends on several internal Quest Dock lookups (11 in total) - each is individually guarded, so a future Discord rename degrades one surface at a time instead of breaking the whole plugin. Drawer position (left/right/top) is planned but not in this build yet - it currently only replaces the Quest Dock's native bottom position."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue