[Cleanup] Several small cleanups
This commit is contained in:
parent
985115cd9b
commit
a8b5beff6e
6 changed files with 11 additions and 14 deletions
|
@ -45,10 +45,11 @@ export function patchLogHook() {
|
||||||
|
|
||||||
export const versionHash = "__vendettaVersion";
|
export const versionHash = "__vendettaVersion";
|
||||||
|
|
||||||
export function getDebugInfo(string: boolean = false) {
|
export function getDebugInfo() {
|
||||||
const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager;
|
const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager;
|
||||||
const hermesProps = window.HermesInternal.getRuntimeProperties();
|
const hermesProps = window.HermesInternal.getRuntimeProperties();
|
||||||
const PlatformConstants = RN.Platform.constants;
|
// TODO: Type 'any' removes errors, but is it sensible?
|
||||||
|
const PlatformConstants = RN.Platform.constants as any;
|
||||||
const rnVer = PlatformConstants.reactNativeVersion;
|
const rnVer = PlatformConstants.reactNativeVersion;
|
||||||
const DCDDeviceManager = RN.NativeModules.DCDDeviceManager;
|
const DCDDeviceManager = RN.NativeModules.DCDDeviceManager;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ for (const key in window.modules) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Early find logic
|
||||||
const basicFind = (prop: string) => Object.values(window.modules).find(m => m.publicModule.exports?.[prop]).publicModule.exports;
|
const basicFind = (prop: string) => Object.values(window.modules).find(m => m.publicModule.exports?.[prop]).publicModule.exports;
|
||||||
|
|
||||||
// Hoist React
|
// Hoist React
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Indexable, PluginManifest, Plugin } from "@types";
|
||||||
import { navigation } from "@metro/common";
|
import { navigation } from "@metro/common";
|
||||||
import logger from "@lib/logger";
|
import logger from "@lib/logger";
|
||||||
import createStorage from "@lib/storage";
|
import createStorage from "@lib/storage";
|
||||||
import PluginSettings from "@/ui/settings/components/PluginSettings";
|
import Subpage from "@/ui/settings/components/Subpage";
|
||||||
|
|
||||||
type EvaledPlugin = {
|
type EvaledPlugin = {
|
||||||
onLoad?(): void;
|
onLoad?(): void;
|
||||||
|
@ -126,8 +126,8 @@ export function showSettings(plugin: Plugin) {
|
||||||
const settings = getSettings(plugin.id);
|
const settings = getSettings(plugin.id);
|
||||||
if (!settings) return logger.error(`Plugin ${plugin.id} is not loaded or has no settings`);
|
if (!settings) return logger.error(`Plugin ${plugin.id} is not loaded or has no settings`);
|
||||||
|
|
||||||
navigation.push(PluginSettings, {
|
navigation.push(Subpage, {
|
||||||
plugin: plugin,
|
name: plugin.manifest.name,
|
||||||
children: settings,
|
children: settings,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import createStorage from "@lib/storage";
|
import createStorage from "@lib/storage";
|
||||||
import { Settings } from "@types";
|
import { Settings } from "@types";
|
||||||
|
|
||||||
// TODO: Switch to using 'any' as type?
|
|
||||||
export default createStorage<Settings>("VENDETTA_SETTINGS");
|
export default createStorage<Settings>("VENDETTA_SETTINGS");
|
|
@ -1,8 +1,6 @@
|
||||||
import { SearchFilter } from "@types";
|
import { SearchFilter } from "@types";
|
||||||
import findInTree from "@utils/findInTree";
|
import findInTree from "@utils/findInTree";
|
||||||
|
|
||||||
export default function findInReactTree(tree: { [key: string]: any }, filter: SearchFilter): any {
|
export default (tree: { [key: string]: any }, filter: SearchFilter): any => findInTree(tree, filter, {
|
||||||
return findInTree(tree, filter, {
|
|
||||||
walkable: ["props", "children", "child", "sibling"],
|
walkable: ["props", "children", "child", "sibling"],
|
||||||
});
|
});
|
||||||
}
|
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
// https://github.com/Cordwood/Cordwood/blob/91c0b971bbf05e112927df75415df99fa105e1e7/src/lib/utils/findInTree.ts
|
||||||
Disclaimer: https://github.com/Cordwood/Cordwood/blob/91c0b971bbf05e112927df75415df99fa105e1e7/src/lib/utils/findInTree.ts
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { FindInTreeOptions, SearchFilter } from "@types";
|
import { FindInTreeOptions, SearchFilter } from "@types";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue