mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
feat: add debug switch (#391)
This commit is contained in:
parent
fe0cdc6e82
commit
ee4b7761d8
1 changed files with 16 additions and 0 deletions
|
@ -6,18 +6,34 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.ResourceData
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
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.impl.ResourcePatch
|
||||
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
|
||||
|
||||
@Patch(false)
|
||||
@Name("enable-debugging")
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Description("Enables app debugging by patching the manifest file.")
|
||||
@EnableDebuggingCompatibility
|
||||
@Version("0.0.1")
|
||||
class EnableDebuggingPatch : ResourcePatch() {
|
||||
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
|
||||
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||
// get the application node
|
||||
|
|
Loading…
Reference in a new issue