From 38c708276041da7d9e56101e9795ad48b16370eb Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Sat, 22 Nov 2025 14:49:17 +0700 Subject: [PATCH] fix(modules/no_track/BlockCrashReportingModule): support 307204+ Discord pushed an update that changed some logic for the setTag method. Previously it only asserted initialization if isDisabled returns false, now it asserts initialization regardless. The init method sets the initialization latch and returns if crash reporting is disabled, so we don't need to hook that anymore. --- .../no_track/BlockCrashReportingModule.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/io/github/revenge/xposed/modules/no_track/BlockCrashReportingModule.kt b/app/src/main/kotlin/io/github/revenge/xposed/modules/no_track/BlockCrashReportingModule.kt index 986662b..c387a91 100644 --- a/app/src/main/kotlin/io/github/revenge/xposed/modules/no_track/BlockCrashReportingModule.kt +++ b/app/src/main/kotlin/io/github/revenge/xposed/modules/no_track/BlockCrashReportingModule.kt @@ -13,16 +13,6 @@ object BlockCrashReportingModule : Module() { override fun onLoad(packageParam: XC_LoadPackage.LoadPackageParam) = with(packageParam) { val crashReportingClass = classLoader.safeLoadClass("com.discord.crash_reporting.CrashReporting") crashReportingClass?.apply { - // Hooking this will result in a crash after a few seconds, since Discord expects initialization to complete when setting a Sentry tag. - // So we also hook isDisabled to make sure those calls are no-ops. - hookMethod( - "init", Context::class.java, String::class.java - ) { - before { - Log.i("Blocked CrashReporting initialization") - result = null - } - } // This only exists on 30720x and above runCatching { @@ -32,6 +22,18 @@ object BlockCrashReportingModule : Module() { result = true } } + }.onFailure { + // In older versions, this hook works fine. + // Hooking this on 30720x will result in a crash after a few seconds, + // since Discord asserts initialization when setting a Sentry tag. + hookMethod( + "init", Context::class.java, String::class.java + ) { + before { + Log.i("Blocked CrashReporting initialization") + result = null + } + } } }