From 4808e099856e50a6f7e66834a92e2210cc84c8bc Mon Sep 17 00:00:00 2001 From: Caroline Joy Bell Date: Mon, 24 Oct 2022 23:39:28 -0700 Subject: [PATCH] feat: `fix-metanav-scaling` patch (#831) --- .../annotations/FixScalingCompatibility.kt | 10 +++++ .../metanav/scaling/patch/FixScalingPatch.kt | 37 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/main/kotlin/app/revanced/patches/metanav/scaling/annotations/FixScalingCompatibility.kt create mode 100644 src/main/kotlin/app/revanced/patches/metanav/scaling/patch/FixScalingPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/metanav/scaling/annotations/FixScalingCompatibility.kt b/src/main/kotlin/app/revanced/patches/metanav/scaling/annotations/FixScalingCompatibility.kt new file mode 100644 index 000000000..f35192165 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/metanav/scaling/annotations/FixScalingCompatibility.kt @@ -0,0 +1,10 @@ +package app.revanced.patches.metanav.scaling.annotations + +import app.revanced.patcher.annotation.Compatibility +import app.revanced.patcher.annotation.Package + +@Compatibility([Package("com.metanav", arrayOf("1.0"))]) +@Target(AnnotationTarget.CLASS) +@Retention(AnnotationRetention.RUNTIME) +annotation class FixScalingCompatibility { +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/metanav/scaling/patch/FixScalingPatch.kt b/src/main/kotlin/app/revanced/patches/metanav/scaling/patch/FixScalingPatch.kt new file mode 100644 index 000000000..905b9d650 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/metanav/scaling/patch/FixScalingPatch.kt @@ -0,0 +1,37 @@ +package app.revanced.patches.metanav.scaling.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 +import app.revanced.patches.metanav.scaling.annotations.FixScalingCompatibility +import org.w3c.dom.Element + +/** + * Fixes the scaling in the Metaverse Navigator app for Persona 5, aka "metaNav" + * + * @author halotroop2288 + */ +@Patch +@Name("fix-metanav-scaling") +@Description("Scales the content properly.") +@FixScalingCompatibility +@Version("0.0.1") +class FixScalingPatch : ResourcePatch { + override fun execute(context: ResourceContext): PatchResult { + context.xmlEditor["assets/startScreenCanvas.html"].use { editor -> + val svgNode = editor + .file + .getElementsByTagName("svg") + .item(0) as Element + + svgNode.setAttribute("height", "750") + } + + return PatchResultSuccess() + } +}