feat(youtube/debugging): print stack traces

This commit is contained in:
oSumAtrIX 2022-12-05 06:34:01 +01:00
parent 424fe9d44f
commit 9cea382750
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -7,11 +7,11 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.debugging.annotations.DebuggingCompatibility import app.revanced.patches.youtube.misc.debugging.annotations.DebuggingCompatibility
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch @Patch
@ -23,12 +23,29 @@ import org.w3c.dom.Element
class DebuggingPatch : ResourcePatch { class DebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.MISC.addPreferences( SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference( app.revanced.patches.shared.settings.preference.impl.PreferenceScreen(
"revanced_debug_enabled", "revanced_debug",
StringResource("revanced_debug_title", "Debugging"), StringResource("revanced_debug_title", "Debugging"),
false, listOf(
StringResource("revanced_debug_on", "Debug logs are enabled"), SwitchPreference(
StringResource("revanced_debug_off", "Debug logs are disabled") "revanced_debug_enabled",
StringResource("revanced_debug_enabled_title", "Enable debug logs"),
false,
StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
StringResource("revanced_debug_summary_off", "Debug logs are disabled")
),
SwitchPreference(
"revanced_debug_stacktrace_enabled",
StringResource(
"revanced_debug_stacktrace_enabled_title",
"Print stack traces"
),
false,
StringResource("revanced_debug_stacktrace_summary_on", "Enabled printing stack traces"),
StringResource("revanced_debug_stacktrace_summary_off", "Disabled printing stack traces")
),
),
StringResource("revanced_debug_summary", "Enable or disable debugging options")
) )
) )