From 7667b70c678c8dccb3cef0ee30300dae5d96caa1 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:13:16 +0900 Subject: [PATCH] feat(Reddit): Restrict support version to `2025.05.1` (Close https://github.com/inotia00/ReVanced_Extended/issues/2772) --- .../subredditdialog/SubRedditDialogPatch.kt | 27 ++++++++++--------- .../reddit/utils/compatibility/Constants.kt | 5 +++- .../reddit/utils/settings/SettingsPatch.kt | 3 +++ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt index 1ebaef98f..7d51cb4a0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt @@ -10,6 +10,7 @@ import app.revanced.patches.reddit.utils.patch.PatchList.REMOVE_SUBREDDIT_DIALOG import app.revanced.patches.reddit.utils.settings.is_2024_41_or_greater import app.revanced.patches.reddit.utils.settings.is_2025_01_or_greater import app.revanced.patches.reddit.utils.settings.is_2025_05_or_greater +import app.revanced.patches.reddit.utils.settings.is_2025_06_or_greater import app.revanced.patches.reddit.utils.settings.settingsPatch import app.revanced.patches.reddit.utils.settings.updatePatchStatus import app.revanced.util.fingerprint.methodOrThrow @@ -83,19 +84,21 @@ val subRedditDialogPatch = bytecodePatch( } // Not used in latest Reddit client. - redditAlertDialogsFingerprint.methodOrThrow().apply { - val backgroundTintIndex = indexOfSetBackgroundTintListInstruction(this) - val insertIndex = - indexOfFirstInstructionOrThrow(backgroundTintIndex) { - opcode == Opcode.INVOKE_VIRTUAL && - getReference()?.name == "setTextAppearance" - } - val insertRegister = getInstruction(insertIndex).registerC + if (!is_2025_06_or_greater) { + redditAlertDialogsFingerprint.methodOrThrow().apply { + val backgroundTintIndex = indexOfSetBackgroundTintListInstruction(this) + val insertIndex = + indexOfFirstInstructionOrThrow(backgroundTintIndex) { + opcode == Opcode.INVOKE_VIRTUAL && + getReference()?.name == "setTextAppearance" + } + val insertRegister = getInstruction(insertIndex).registerC - addInstruction( - insertIndex, - "invoke-static {v$insertRegister}, $EXTENSION_CLASS_DESCRIPTOR->confirmDialog(Landroid/widget/TextView;)V" - ) + addInstruction( + insertIndex, + "invoke-static {v$insertRegister}, $EXTENSION_CLASS_DESCRIPTOR->confirmDialog(Landroid/widget/TextView;)V" + ) + } } updatePatchStatus( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/utils/compatibility/Constants.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/utils/compatibility/Constants.kt index 7ef039926..9589f9dd7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/utils/compatibility/Constants.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/utils/compatibility/Constants.kt @@ -8,6 +8,9 @@ internal object Constants { val COMPATIBLE_PACKAGE: Pair?> = Pair( REDDIT_PACKAGE_NAME, - null + setOf( + "2024.17.0", // This is the last version that can be patched without anti-split. + "2025.05.1", // This is the latest version supported by the RVX patch. + ) ) } \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt index d6f09660f..e126683fd 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt @@ -41,6 +41,8 @@ var is_2025_01_or_greater = false private set var is_2025_05_or_greater = false private set +var is_2025_06_or_greater = false + private set private val settingsBytecodePatch = bytecodePatch( description = "settingsBytecodePatch" @@ -65,6 +67,7 @@ private val settingsBytecodePatch = bytecodePatch( is_2024_41_or_greater = 2024410 <= versionNumber is_2025_01_or_greater = 2025010 <= versionNumber is_2025_05_or_greater = 2025050 <= versionNumber + is_2025_06_or_greater = 2025060 <= versionNumber } /**