diff --git a/src/entry.ts b/src/entry.ts index b96a63b..f57c48d 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -4,7 +4,7 @@ import { instead } from "spitroast"; // @ts-ignore - shut up fr globalThis.window = globalThis; -const init = (async () => { +const init = () => { try { // This logs in the native logging implementation, e.g. logcat console.log("Hello from Bunny! Pyon!"); @@ -12,7 +12,7 @@ const init = (async () => { // Make 'freeze' and 'seal' do nothing Object.freeze = Object.seal = Object; - await import(".").then(m => m.default()); + require(".").default(); } catch (e) { const { ClientInfoManager } = require("@lib/api/native/modules"); const stack = e instanceof Error ? e.stack : undefined; @@ -25,7 +25,7 @@ const init = (async () => { stack || e?.toString?.(), ].join("\n")); } -}); +}; // @ts-ignore if (typeof globalThis.__r !== "undefined") { diff --git a/src/lib/metro/filters.ts b/src/lib/metro/filters.ts index 986eb66..e6af7bb 100644 --- a/src/lib/metro/filters.ts +++ b/src/lib/metro/filters.ts @@ -46,8 +46,8 @@ for (const id in window.modules) { return importAll.default = exp, importAll; }; - orig(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - if (moduleObject.exports) onModuleRequire(moduleObject.exports, id); + orig(...args); + if (moduleObject.exports) onModuleRequire(moduleObject.exports); }); } } @@ -64,7 +64,13 @@ for (const id in window.modules) { let patchedInspectSource = false; -function onModuleRequire(exports: any, id: string) { +function onModuleRequire(exports: any) { + // Temporary + exports.initSentry &&= () => { }; + if (exports.default?.track && exports.default.trackMaker) { + exports.default.track = () => Promise.resolve(); + } + // There are modules registering the same native component if (exports?.default?.name === "requireNativeComponent") { instead("default", exports, (args, orig) => {