Skip to content

Commit 06d6778

Browse files
committed
fix(modules/no_track/BlockCrashReportingModule): also hook isDisabled to true
Prevents Discord from crashing when trying to set a Sentry tag.
1 parent 9f1941e commit 06d6778

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

app/src/main/kotlin/io/github/revenge/xposed/modules/no_track/BlockCrashReportingModule.kt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,23 @@ import io.github.revenge.xposed.Utils.Log
1212
object BlockCrashReportingModule : Module() {
1313
override fun onLoad(packageParam: XC_LoadPackage.LoadPackageParam) = with(packageParam) {
1414
val crashReportingClass = classLoader.safeLoadClass("com.discord.crash_reporting.CrashReporting")
15-
crashReportingClass?.hookMethod(
16-
"init", Context::class.java, String::class.java
17-
) {
18-
before {
19-
Log.i("Blocked CrashReporting initialization")
20-
result = null
15+
crashReportingClass?.apply {
16+
// Hooking this will result in a crash after a few seconds, since Discord expects initialization to complete when setting a Sentry tag.
17+
// So we also hook isDisabled to make sure those calls are no-ops.
18+
hookMethod(
19+
"init", Context::class.java, String::class.java
20+
) {
21+
before {
22+
Log.i("Blocked CrashReporting initialization")
23+
result = null
24+
}
25+
}
26+
27+
hookMethod("isDisabled") {
28+
before {
29+
Log.i("Forced CrashReporting.isDisabled() to true")
30+
result = true
31+
}
2132
}
2233
}
2334

0 commit comments

Comments
 (0)