File tree Expand file tree Collapse file tree
app/src/main/kotlin/io/github/revenge/xposed/modules/no_track Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,12 +12,23 @@ import io.github.revenge.xposed.Utils.Log
1212object 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
You can’t perform that action at this time.
0 commit comments