Skip to content

Commit

Permalink
feat(Reddit): Restrict support version to 2025.05.1
Browse files Browse the repository at this point in the history
  • Loading branch information
anddea committed Feb 11, 2025
1 parent 821e89e commit f0fe391
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<MethodReference>()?.name == "setTextAppearance"
}
val insertRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
if (!is_2025_06_or_greater) {
redditAlertDialogsFingerprint.methodOrThrow().apply {
val backgroundTintIndex = indexOfSetBackgroundTintListInstruction(this)
val insertIndex =
indexOfFirstInstructionOrThrow(backgroundTintIndex) {
opcode == Opcode.INVOKE_VIRTUAL &&
getReference<MethodReference>()?.name == "setTextAppearance"
}
val insertRegister = getInstruction<FiveRegisterInstruction>(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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ internal object Constants {

val COMPATIBLE_PACKAGE: Pair<PackageName, Set<VersionName>?> = 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.
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}

/**
Expand Down

0 comments on commit f0fe391

Please sign in to comment.