[Cleanup] Small tidying
This commit is contained in:
parent
0fe5d30bbc
commit
715e6f9bc4
4 changed files with 11 additions and 10 deletions
|
@ -50,7 +50,7 @@ async function init() {
|
|||
patchLogHook();
|
||||
} catch (e: Error | any) {
|
||||
erroredOnLoad = true;
|
||||
alert(`Vendetta failed to initialize...\n${e.stack || e.toString()}`);
|
||||
alert(`Vendetta failed to initialize... ${e.stack || e.toString()}`);
|
||||
}
|
||||
|
||||
if (!erroredOnLoad) logger.log("Vendetta is ready!");
|
||||
|
|
|
@ -7,6 +7,11 @@ export const i18n = findByProps("Messages");
|
|||
export const url = findByProps("openURL");
|
||||
export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop);
|
||||
export const stylesheet = findByProps("createThemedStyleSheet");
|
||||
export const clipboard = findByProps("setString", "getString");
|
||||
export const assets = findByProps("registerAsset");
|
||||
export const navigation = findByProps("pushLazy");
|
||||
export const navigationStack = findByProps("createStackNavigator");
|
||||
export const NavigationNative = findByProps("NavigationContainer");
|
||||
|
||||
// React
|
||||
export const React = findByProps("createElement") as typeof import("react");
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { findByProps } from "@metro/filters";
|
||||
|
||||
const clipboard = findByProps("setString", "getString");
|
||||
import { clipboard } from "@metro/common";
|
||||
|
||||
export default function copyText(content: string) {
|
||||
try {
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
import { Asset, Assets } from "@types";
|
||||
import { after } from "@lib/patcher";
|
||||
import { findByProps } from "@metro/filters";
|
||||
|
||||
const assetsModule = findByProps("registerAsset");
|
||||
import { assets } from "@metro/common";
|
||||
|
||||
export const all: Assets = {};
|
||||
|
||||
export default function patchAssets() {
|
||||
try {
|
||||
after("registerAsset", assetsModule, (args: Asset[], id: number) => {
|
||||
after("registerAsset", assets, (args: Asset[], id: number) => {
|
||||
const asset = args[0];
|
||||
all[asset.name] = { ...asset, id: id };
|
||||
});
|
||||
|
||||
for (let id = 1; ; id++) {
|
||||
const asset = assetsModule.getAssetByID(id);
|
||||
const asset = assets.getAssetByID(id);
|
||||
if (!asset) break;
|
||||
if (all[asset.name]) continue;
|
||||
all[asset.name] = { ...asset, id: id };
|
||||
|
@ -24,5 +22,5 @@ export default function patchAssets() {
|
|||
|
||||
export const find = (filter: (a: any) => void): Asset | null | undefined => Object.values(all).find(filter);
|
||||
export const getAssetByName = (name: string): Asset => all[name];
|
||||
export const getAssetByID = (id: number): Asset => assetsModule.getAssetByID(id);
|
||||
export const getAssetByID = (id: number): Asset => assets.getAssetByID(id);
|
||||
export const getAssetIDByName = (name: string) => all[name]?.id;
|
Loading…
Reference in a new issue