Skip to content

Commit

Permalink
[general] Disable Sentry and analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Apr 30, 2024
1 parent ca703ad commit 273f365
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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!");

// 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;
Expand All @@ -25,7 +25,7 @@ const init = (async () => {
stack || e?.toString?.(),
].join("\n"));
}
});
};

// @ts-ignore
if (typeof globalThis.__r !== "undefined") {
Expand Down
12 changes: 9 additions & 3 deletions src/lib/metro/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}
Expand All @@ -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) => {
Expand Down

0 comments on commit 273f365

Please sign in to comment.