Compare commits

..

1 commit

Author SHA1 Message Date
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
5 changed files with 88 additions and 20 deletions

View file

@ -0,0 +1,24 @@
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;
};
}

View file

@ -30,7 +30,8 @@ if (!storage.settings) {
enableCLI: true,
confirmBeforeDelete: true,
enableUnsafeFeatures: false,
addToSidebar: true
addToSidebar: true,
enableNativeSwitcher: true
};
} else {
@ -46,6 +47,9 @@ if (!storage.settings) {
if (storage.settings.addToSidebar === undefined) {
storage.settings.addToSidebar = true;
}
if (storage.settings.enableNativeSwitcher === undefined) {
storage.settings.enableNativeSwitcher = true;
}
if (storage.settings.showAccountNames !== undefined) {
delete storage.settings.showAccountNames;
@ -515,6 +519,44 @@ function SettingsPage({ onBack }) {
})
]),
React.createElement(ReactNative.View, {
key: "enable-native-switcher",
style: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingVertical: 12,
backgroundColor: '#36393f',
paddingHorizontal: 16,
borderRadius: 8,
marginBottom: 8
}
}, [
React.createElement(ReactNative.View, {
key: "text-container",
style: { flex: 1 }
}, [
React.createElement(ReactNative.Text, {
key: "label",
style: { color: 'white', fontSize: 16 }
}, "Enable Native Multi-Account Switcher"),
React.createElement(ReactNative.Text, {
key: "desc",
style: { color: '#72767d', fontSize: 12, marginTop: 2 }
}, "Unlocks Discord's own built-in account switcher (restart app to apply)")
]),
React.createElement(ReactNative.Switch, {
key: "toggle",
value: storage.settings.enableNativeSwitcher,
onValueChange: (v) => {
updateSetting("enableNativeSwitcher", v);
showToast("Restart app to apply", 0);
},
trackColor: { false: '#72767d', true: '#7289da' },
thumbColor: 'white'
})
]),
React.createElement(ReactNative.View, {
key: "confirm-delete",
style: {

View file

@ -4,24 +4,17 @@ import { getAssetIDByName } from "@vendetta/ui/assets";
import { after } from "@vendetta/patcher";
import { Forms } from "@vendetta/ui/components";
import { findInReactTree } from "@vendetta/utils";
import { findByProps } from "@vendetta/metro";
import { findByProps, findByName } from "@vendetta/metro";
import { logger } from "@vendetta";
import AccountSwitcherSettings from "./Settings";
const { FormSection, FormRow } = Forms;
const { TableRowIcon } = findByProps("TableRowIcon");
const bunny = window.bunny;
const tabsNavigationRef = bunny?.metro?.findByPropsLazy("getRootNavigationRef");
const settingConstants = bunny?.metro?.findByPropsLazy(
"SETTING_RENDERER_CONFIG",
);
const SettingsOverviewScreen = bunny?.metro?.findByNameLazy(
"SettingsOverviewScreen",
false,
);
const createListModule = bunny.metro.findByPropsLazy("createList");
const tabsNavigationRef = findByProps("getRootNavigationRef");
const settingConstants = findByProps("SETTING_RENDERER_CONFIG");
const SettingsOverviewScreen = findByName("SettingsOverviewScreen", false);
const createListModule = findByProps("createList");
function Section({ tabs }) {
const navigation = NavigationNative.useNavigation();
@ -48,10 +41,7 @@ function patchPanelUI(tabs, patches) {
patches.push(
after(
"default",
bunny?.metro?.findByNameLazy(
"UserSettingsOverviewWrapper",
false,
),
findByName("UserSettingsOverviewWrapper", false),
(_, ret) => {
const UserSettingsOverview = findInReactTree(
ret.props.children,

View file

@ -11,6 +11,7 @@ import { storage } from "@vendetta/plugin";
import { React } from "@vendetta/metro/common";
import AccountSwitcherSettings from "./Settings";
import patchSidebar from "./SidebarPatcher";
import patchNativeSwitcher from "./NativeSwitcher";
const {
meta: { resolveSemanticColor },
@ -37,7 +38,8 @@ if (!storage.settings) {
enableCLI: true,
confirmBeforeDelete: true,
enableUnsafeFeatures: false,
addToSidebar: true // Now using the correct patchSettingsPin method
addToSidebar: true, // Now using the correct patchSettingsPin method
enableNativeSwitcher: true
};
} else {
// Ensure all properties exist and migrate old settings
@ -53,6 +55,9 @@ if (!storage.settings) {
if (storage.settings.addToSidebar === undefined) {
storage.settings.addToSidebar = true; // Now using correct method
}
if (storage.settings.enableNativeSwitcher === undefined) {
storage.settings.enableNativeSwitcher = true;
}
// Remove old setting
if (storage.settings.showAccountNames !== undefined) {
delete storage.settings.showAccountNames;
@ -124,6 +129,9 @@ export default {
const sidebarUnpatch = patchSidebar();
this.patches.push(sidebarUnpatch);
const nativeSwitcherUnpatch = patchNativeSwitcher();
this.patches.push(nativeSwitcherUnpatch);
// Context menu patch for copying tokens
const optionLabel = "Copy Token";
const contextMenuUnpatch = patchBefore("render", findByProps("ScrollView").View, (args) => {

View file

@ -1,7 +1,11 @@
{
"name": "More Alts!",
"description": "Adds ability to safely add more alts to Discord!",
"authors": [{ "name": "Win8.1VMUser", "id": "793935599702507542" }],
"description": "Adds ability to safely add more alts to Discord, plus unlocks Discord's own native multi-account switcher.",
"authors": [
{ "name": "Win8.1VMUser", "id": "793935599702507542" },
{ "name": "John" },
{ "name": "cocobo1" }
],
"main": "./index.js",
"vendetta": { "icon": "ic_full_server_gating_24px" }
}