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.
24 lines
774 B
JavaScript
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;
|
|
};
|
|
}
|