mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-07 01:57:02 +01:00
feat: add debug switch (#391)
This commit is contained in:
parent
fe0cdc6e82
commit
ee4b7761d8
@ -6,18 +6,34 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.enabledebugging.annotations.EnableDebuggingCompatibility
|
import app.revanced.patches.youtube.misc.enabledebugging.annotations.EnableDebuggingCompatibility
|
||||||
|
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.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch(false)
|
@Patch(false)
|
||||||
@Name("enable-debugging")
|
@Name("enable-debugging")
|
||||||
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||||
@Description("Enables app debugging by patching the manifest file.")
|
@Description("Enables app debugging by patching the manifest file.")
|
||||||
@EnableDebuggingCompatibility
|
@EnableDebuggingCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class EnableDebuggingPatch : ResourcePatch() {
|
class EnableDebuggingPatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_debug_enabled",
|
||||||
|
StringResource("revanced_debug_title", "Debug"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_debug_on", "Debug logs are enabled"),
|
||||||
|
StringResource("revanced_debug_off", "Debug logs are disabled")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
// create an xml editor instance
|
// create an xml editor instance
|
||||||
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||||
// get the application node
|
// get the application node
|
||||||
|
Loading…
Reference in New Issue
Block a user