Apex-Plugins/plugins/MoreAlts/NativeSwitcher.js
Ally Founder b077927fab MoreAlts: add option to unlock Discord's native multi-account switcher
Merges in rain's accountswitcher trick (flip getCanUseMultiAccountMobile
and canUseMultiAccountNotifications) as an opt-in toggle alongside the
existing custom account manager, default on.

Also fixes SidebarPatcher.js, which referenced window.bunny - that
global doesn't exist on Vendetta/Revenge (only Bunny), so the sidebar
pin threw on load there. Swapped to @vendetta/metro's findByProps/
findByName, matching every other lookup already in this plugin.
2026-08-19 00:53:55 -04:00

24 lines
774 B
JavaScript

import { findByProps, findByStoreName } from "@vendetta/metro";
import { after } from "@vendetta/patcher";
import { storage } from "@vendetta/plugin";
const AccountDispatcher = findByProps("getCanUseMultiAccountMobile");
const MultiAccountStore = findByStoreName("MultiAccountStore");
export default function patchNativeSwitcher() {
if (!storage.settings?.enableNativeSwitcher || !AccountDispatcher || !MultiAccountStore) {
return () => {};
}
const unpatch = after("getCanUseMultiAccountMobile", AccountDispatcher, () => true);
Object.defineProperty(MultiAccountStore, "canUseMultiAccountNotifications", {
get: () => true,
configurable: true
});
return () => {
unpatch();
delete MultiAccountStore.canUseMultiAccountNotifications;
};
}