Skip to content

Commit 38c7082

Browse files
committed
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.
1 parent c20cf01 commit 38c7082

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ object BlockCrashReportingModule : Module() {
1313
override fun onLoad(packageParam: XC_LoadPackage.LoadPackageParam) = with(packageParam) {
1414
val crashReportingClass = classLoader.safeLoadClass("com.discord.crash_reporting.CrashReporting")
1515
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-
}
2616

2717
// This only exists on 30720x and above
2818
runCatching {
@@ -32,6 +22,18 @@ object BlockCrashReportingModule : Module() {
3222
result = true
3323
}
3424
}
25+
}.onFailure {
26+
// In older versions, this hook works fine.
27+
// Hooking this on 30720x will result in a crash after a few seconds,
28+
// since Discord asserts initialization when setting a Sentry tag.
29+
hookMethod(
30+
"init", Context::class.java, String::class.java
31+
) {
32+
before {
33+
Log.i("Blocked CrashReporting initialization")
34+
result = null
35+
}
36+
}
3537
}
3638
}
3739

0 commit comments

Comments
 (0)