mirror of
https://github.com/revanced/revanced-patches
synced 2024-09-01 12:05:35 +02:00
feat: predictive-back-gesture
patch (#1236)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
bb56037cda
commit
11b59f767c
@ -0,0 +1,36 @@
|
||||
package app.revanced.patches.all.interaction.gestures.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
|
||||
@Patch
|
||||
@Name("predictive-back-gesture")
|
||||
@Description("Enables the predictive back gesture introduced on Android 13.")
|
||||
@Version("0.0.1")
|
||||
class PredictiveBackGesturePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||
val document = editor.file
|
||||
|
||||
with(document.getElementsByTagName("application").item(0)) {
|
||||
attributes.getNamedItem(FLAG)?.let {
|
||||
document.createAttribute(FLAG)
|
||||
.apply { value = "true" }
|
||||
.let(attributes::setNamedItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FLAG = "android:enableOnBackInvokedCallback"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user