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.
This commit is contained in:
PalmDevs 2025-11-22 14:49:17 +07:00 • committed by cocobo1
parent 9a323a663e
commit 8a413f279a

View file

@ -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
}
}
}
}