Skip to content

Commit

Permalink
chore: Merge branch dev to main (ReVanced#2693)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX authored Feb 8, 2024
2 parents 501fc48 + 541a4cc commit efff31b
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 21 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [4.2.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.1.1-dev.1...v4.2.0-dev.1) (2024-02-08)


### Features

* **X:** Add `Hide view count` patch ([bf064ec](https://github.com/ReVanced/revanced-patches/commit/bf064ecc1d5de8b592d14d34acfa1a4314c374ba))
* **X:** Add `Unlock downloads` patch ([2c20844](https://github.com/ReVanced/revanced-patches/commit/2c20844eaae698f185a9d321e2c70bde4b485cee))

## [4.1.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.1.0...v4.1.1-dev.1) (2024-02-07)


### Bug Fixes

* **Infinity for Reddit - Unlock subscription:** Do not crash by patching billing client ([7d76e2e](https://github.com/ReVanced/revanced-patches/commit/7d76e2e43c69b2b75f40a15a9147d041c77cbcd9))

# [4.1.0](https://github.com/ReVanced/revanced-patches/compare/v4.0.2...v4.1.0) (2024-02-05)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ In order to build ReVanced Patches, you can follow the [ReVanced documentation](
## 📜 Licence

ReVanced Patches is licensed under the GPLv3 licence. Please see the [licence file](LICENSE) for more information.
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced patches as long as you track changes/dates in source files.
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced Patches as long as you track changes/dates in source files.
Any modifications to ReVanced Patches must also be made available under the GPL along with build & install instructions.
12 changes: 12 additions & 0 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,18 @@ public final class app/revanced/patches/twitch/misc/settings/SettingsResourcePat
public static final field INSTANCE Lapp/revanced/patches/twitch/misc/settings/SettingsResourcePatch;
}

public final class app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public final class app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/twitter/layout/viewcount/HideViewCountPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}

public final class app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch : app/revanced/patcher/patch/ResourcePatch {
public static final field INSTANCE Lapp/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch;
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 4.1.0
version = 4.2.0-dev.1
2 changes: 1 addition & 1 deletion patches.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.infinityforreddit.api.SpoofClientPatch
import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.BillingClientOnServiceConnected
import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.StartSubscriptionActivityFingerprint
import app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints.SubscriptionActivityOnCreateFingerprint
import app.revanced.util.returnEarly

@Patch(
name = "Unlock subscription",
description = "Unlocks the subscription feature but requires a custom client ID.",
compatiblePackages = [
CompatiblePackage("ml.docilealligator.infinityforreddit")
CompatiblePackage("ml.docilealligator.infinityforreddit"),
],
dependencies = [SpoofClientPatch::class]
dependencies = [SpoofClientPatch::class],
)
@Suppress("unused")
object UnlockSubscriptionPatch : BytecodePatch(
setOf(StartSubscriptionActivityFingerprint, SubscriptionActivityOnCreateFingerprint)
setOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected),
) {
override fun execute(context: BytecodeContext) =
listOf(StartSubscriptionActivityFingerprint, SubscriptionActivityOnCreateFingerprint).returnEarly()
listOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected).returnEarly()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package app.revanced.patches.reddit.customclients.infinityforreddit.subscription.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint

internal object BillingClientOnServiceConnected : MethodFingerprint(
strings = listOf("Billing service connected"),
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package app.revanced.patches.twitter.interaction.downloads

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.twitter.interaction.downloads.fingerprints.ConstructMediaOptionsSheetFingerprint
import app.revanced.patches.twitter.interaction.downloads.fingerprints.ShowDownloadVideoUpsellBottomSheetFingerprint
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction

@Patch(
name = "Unlock downloads",
description = "Unlocks the ability to download any video.",
compatiblePackages = [CompatiblePackage("com.twitter.android")]
)
@Suppress("unused")
object UnlockDownloadsPatch : BytecodePatch(
setOf(ConstructMediaOptionsSheetFingerprint, ShowDownloadVideoUpsellBottomSheetFingerprint)
) {
override fun execute(context: BytecodeContext) {
fun MethodFingerprint.patch(getRegisterAndIndex: MethodFingerprintResult.() -> Pair<Int, Int>) = result?.let {
getRegisterAndIndex(it).let { (index, register) ->
it.mutableMethod.addInstruction(index, "const/4 v$register, 0x1")
}
} ?: throw exception

// Allow downloads for non-premium users.
ShowDownloadVideoUpsellBottomSheetFingerprint.patch {
val checkIndex = scanResult.patternScanResult!!.startIndex
val register = mutableMethod.getInstruction<OneRegisterInstruction>(checkIndex).registerA

checkIndex to register
}

// Force show the download menu item.
ConstructMediaOptionsSheetFingerprint.patch {
val showDownloadButtonIndex = mutableMethod.getInstructions().lastIndex - 1
val register = mutableMethod.getInstruction<TwoRegisterInstruction>(showDownloadButtonIndex).registerA

showDownloadButtonIndex to register
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.twitter.interaction.downloads.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags


internal object ConstructMediaOptionsSheetFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
strings = listOf("captionsState")
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package app.revanced.patches.twitter.interaction.downloads.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode

internal object ShowDownloadVideoUpsellBottomSheetFingerprint : MethodFingerprint(
returnType = "Z",
strings = listOf("variantToDownload.url"),
opcodes = listOf(Opcode.IF_EQZ)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package app.revanced.patches.twitter.layout.viewcount


import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.twitter.layout.viewcount.fingerprints.ViewCountsEnabledFingerprint
import app.revanced.util.exception

@Patch(
name = "Hide view count",
description = "Hides the view count of Posts.",
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = false
)
@Suppress("unused")
object HideViewCountPatch : BytecodePatch(
setOf(ViewCountsEnabledFingerprint)
) {
override fun execute(context: BytecodeContext) =
ViewCountsEnabledFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
"""
) ?: throw ViewCountsEnabledFingerprint.exception
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.revanced.patches.twitter.layout.viewcount.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint

internal object ViewCountsEnabledFingerprint : MethodFingerprint(
returnType = "Z",
strings = listOf("view_counts_public_visibility_enabled")
)

0 comments on commit efff31b

Please sign in to comment.