fix(enable-android-debugging): remove json options (#2497)

This commit is contained in:
LisoUseInAIKyrios 2023-06-26 23:01:34 +04:00 committed by GitHub
parent 4392f108ed
commit 3e25f5f8df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 21 deletions

View file

@ -14,29 +14,17 @@ import org.w3c.dom.Element
@Version("0.0.1")
class EnableAndroidDebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
if (debuggable == true) {
context.xmlEditor["AndroidManifest.xml"].use { dom ->
val applicationNode = dom
.file
.getElementsByTagName("application")
.item(0) as Element
context.xmlEditor["AndroidManifest.xml"].use { dom ->
val applicationNode = dom
.file
.getElementsByTagName("application")
.item(0) as Element
// set application as debuggable
applicationNode.setAttribute("android:debuggable", "true")
}
// set application as debuggable
applicationNode.setAttribute("android:debuggable", "true")
}
return PatchResultSuccess()
}
companion object : OptionsContainer() {
var debuggable: Boolean? by option(
PatchOption.BooleanOption(
key = "debuggable",
default = false,
title = "App debugging",
description = "Whether to make the app debuggable on Android.",
)
)
}
}

View file

@ -9,7 +9,6 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.all.misc.debugging.patch.EnableAndroidDebuggingPatch
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
@ -18,7 +17,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@Patch
@Name("enable-debugging")
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, EnableAndroidDebuggingPatch::class])
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Description("Adds debugging options.")
@DebuggingCompatibility
@Version("0.0.2")