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") @Version("0.0.1")
class EnableAndroidDebuggingPatch : ResourcePatch { class EnableAndroidDebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
if (debuggable == true) { context.xmlEditor["AndroidManifest.xml"].use { dom ->
context.xmlEditor["AndroidManifest.xml"].use { dom -> val applicationNode = dom
val applicationNode = dom .file
.file .getElementsByTagName("application")
.getElementsByTagName("application") .item(0) as Element
.item(0) as Element
// set application as debuggable // set application as debuggable
applicationNode.setAttribute("android:debuggable", "true") applicationNode.setAttribute("android:debuggable", "true")
}
} }
return PatchResultSuccess() 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.ResourcePatch
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.all.misc.debugging.patch.EnableAndroidDebuggingPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference 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
@ -18,7 +17,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@Patch @Patch
@Name("enable-debugging") @Name("enable-debugging")
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, EnableAndroidDebuggingPatch::class]) @DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Description("Adds debugging options.") @Description("Adds debugging options.")
@DebuggingCompatibility @DebuggingCompatibility
@Version("0.0.2") @Version("0.0.2")