[Metro > Common] Add commands module

This commit is contained in:
Beef 2023-02-04 17:11:50 +00:00
parent 119060a43b
commit 1891a46eb9
4 changed files with 4 additions and 2 deletions

1
src/def.d.ts vendored
View file

@ -220,6 +220,7 @@ interface VendettaObject {
clipboard: PropIntellisense<"setString" | "getString" | "hasString">; clipboard: PropIntellisense<"setString" | "getString" | "hasString">;
assets: PropIntellisense<"registerAsset">; assets: PropIntellisense<"registerAsset">;
invites: PropIntellisense<"acceptInviteAndTransitionToInviteChannel">; invites: PropIntellisense<"acceptInviteAndTransitionToInviteChannel">;
commands: PropIntellisense<"getBuiltInCommands">;
navigation: PropIntellisense<"pushLazy">; navigation: PropIntellisense<"pushLazy">;
navigationStack: PropIntellisense<"createStackNavigator">; navigationStack: PropIntellisense<"createStackNavigator">;
NavigationNative: PropIntellisense<"NavigationContainer">; NavigationNative: PropIntellisense<"NavigationContainer">;

View file

@ -1,8 +1,7 @@
import { ApplicationCommand } from "@types"; import { ApplicationCommand } from "@types";
import { findByProps } from "@metro/filters"; import { commands as commandsModule } from "@metro/common";
import { after } from "@lib/patcher"; import { after } from "@lib/patcher";
const commandsModule = findByProps("getBuiltInCommands")
let commands: ApplicationCommand[] = []; let commands: ApplicationCommand[] = [];
export function patchCommands() { export function patchCommands() {

View file

@ -10,6 +10,7 @@ export const stylesheet = findByProps("createThemedStyleSheet");
export const clipboard = findByProps("setString", "getString", "hasString"); export const clipboard = findByProps("setString", "getString", "hasString");
export const assets = findByProps("registerAsset"); export const assets = findByProps("registerAsset");
export const invites = findByProps("acceptInviteAndTransitionToInviteChannel"); export const invites = findByProps("acceptInviteAndTransitionToInviteChannel");
export const commands = findByProps("getBuiltInCommands");
export const navigation = findByProps("pushLazy"); export const navigation = findByProps("pushLazy");
export const navigationStack = findByProps("createStackNavigator"); export const navigationStack = findByProps("createStackNavigator");
export const NavigationNative = findByProps("NavigationContainer"); export const NavigationNative = findByProps("NavigationContainer");

View file

@ -5,6 +5,7 @@ import { findByProps, findByStoreName } from "@metro/filters";
import { FluxDispatcher } from "@metro/common"; import { FluxDispatcher } from "@metro/common";
import logger from "@lib/logger"; import logger from "@lib/logger";
// TODO: Move these to common modules?
const ThemeManager = findByProps("updateTheme", "overrideTheme"); const ThemeManager = findByProps("updateTheme", "overrideTheme");
const AMOLEDThemeManager = findByProps("setAMOLEDThemeEnabled"); const AMOLEDThemeManager = findByProps("setAMOLEDThemeEnabled");
const ThemeStore = findByStoreName("ThemeStore"); const ThemeStore = findByStoreName("ThemeStore");