Compare commits

..

No commits in common. "more-alts-native-switcher" and "master" have entirely different histories.

5 changed files with 20 additions and 88 deletions

View file

@ -1,24 +0,0 @@
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,8 +30,7 @@ if (!storage.settings) {
enableCLI: true,
confirmBeforeDelete: true,
enableUnsafeFeatures: false,
addToSidebar: true,
enableNativeSwitcher: true
addToSidebar: true
};
} else {
@ -47,9 +46,6 @@ 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;
@ -519,44 +515,6 @@ 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,17 +4,24 @@ import { getAssetIDByName } from "@vendetta/ui/assets";
import { after } from "@vendetta/patcher";
import { Forms } from "@vendetta/ui/components";
import { findInReactTree } from "@vendetta/utils";
import { findByProps, findByName } from "@vendetta/metro";
import { findByProps } from "@vendetta/metro";
import { logger } from "@vendetta";
import AccountSwitcherSettings from "./Settings";
const { FormSection, FormRow } = Forms;
const { TableRowIcon } = findByProps("TableRowIcon");
const tabsNavigationRef = findByProps("getRootNavigationRef");
const settingConstants = findByProps("SETTING_RENDERER_CONFIG");
const SettingsOverviewScreen = findByName("SettingsOverviewScreen", false);
const createListModule = findByProps("createList");
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");
function Section({ tabs }) {
const navigation = NavigationNative.useNavigation();
@ -41,7 +48,10 @@ function patchPanelUI(tabs, patches) {
patches.push(
after(
"default",
findByName("UserSettingsOverviewWrapper", false),
bunny?.metro?.findByNameLazy(
"UserSettingsOverviewWrapper",
false,
),
(_, ret) => {
const UserSettingsOverview = findInReactTree(
ret.props.children,

View file

@ -11,7 +11,6 @@ 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 },
@ -38,8 +37,7 @@ if (!storage.settings) {
enableCLI: true,
confirmBeforeDelete: true,
enableUnsafeFeatures: false,
addToSidebar: true, // Now using the correct patchSettingsPin method
enableNativeSwitcher: true
addToSidebar: true // Now using the correct patchSettingsPin method
};
} else {
// Ensure all properties exist and migrate old settings
@ -55,9 +53,6 @@ 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;
@ -129,9 +124,6 @@ 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,11 +1,7 @@
{
"name": "More Alts!",
"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" }
],
"description": "Adds ability to safely add more alts to Discord!",
"authors": [{ "name": "Win8.1VMUser", "id": "793935599702507542" }],
"main": "./index.js",
"vendetta": { "icon": "ic_full_server_gating_24px" }
}