mirror of
https://github.com/revanced/revanced-patches
synced 2024-09-01 12:05:35 +02:00
feat: premium-icon-reddit
patch (#333)
This commit is contained in:
parent
9c2e7b7e29
commit
6739e7b94c
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.reddit.layout.premiumicon.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.reddit.frontpage", arrayOf()
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class PremiumIconCompatibility
|
@ -0,0 +1,24 @@
|
|||||||
|
package app.revanced.patches.reddit.layout.premiumicon.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
|
||||||
|
|
||||||
|
@Name("premium-icon-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lcom/reddit/domain/model/MyAccount;", "isPremiumSubscriber"
|
||||||
|
)
|
||||||
|
@PremiumIconCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object PremiumIconFingerprint : MethodFingerprint(
|
||||||
|
"Z",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("MyAccount;") && methodDef.name == "isPremiumSubscriber"
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patches.reddit.layout.premiumicon.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
|
||||||
|
import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("premium-icon-reddit")
|
||||||
|
@Description("Unlocking Premium Icons in reddit app.")
|
||||||
|
@PremiumIconCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class PremiumIconPatch : BytecodePatch() {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val method = PremiumIconFingerprint.result!!.mutableMethod
|
||||||
|
method.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user