mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-30 18:32:55 +01:00
feat(anytracker): unlock-premium
patch (#1165)
Co-authored-by: FineFindus <63370021+FineFindus@users.noreply.github.com>
This commit is contained in:
parent
caeadbffaf
commit
e7ed324bb5
@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.anytracker.misc.premium.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.shervinkoushan.anyTracker")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class UnlockPremiumCompatibility
|
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.anytracker.misc.premium.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object IsPurchasedFlowFingerprint : MethodFingerprint(
|
||||||
|
"Landroidx/lifecycle/LiveData"
|
||||||
|
strings = listOf("premium_user", "sku"),
|
||||||
|
)
|
@ -0,0 +1,48 @@
|
|||||||
|
package app.revanced.patches.anytracker.misc.premium.patch
|
||||||
|
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.anytracker.misc.premium.annotations.UnlockPremiumCompatibility
|
||||||
|
import app.revanced.patches.anytracker.misc.premium.fingerprints.IsPurchasedFlowFingerprint
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("unlock-premium")
|
||||||
|
@Description("Unlocks all premium features.")
|
||||||
|
@UnlockPremiumCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class UnlockPremiumPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
IsPurchasedFlowFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
val method = IsPurchasedFlowFingerprint.result!!.mutableMethod
|
||||||
|
method.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
|
||||||
|
move-result-object v0
|
||||||
|
invoke-static {v0}, Lkotlinx/coroutines/flow/FlowKt;->flowOf(Ljava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
|
||||||
|
move-result-object v1
|
||||||
|
const/4 v2, 0x0
|
||||||
|
const-wide/16 v3, 0x0
|
||||||
|
const/4 v5, 0x3
|
||||||
|
const/4 v6, 0x0
|
||||||
|
invoke-static/range {v1 .. v6}, Landroidx/lifecycle/FlowLiveDataConversions;->asLiveData${'$'}default(Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/CoroutineContext;JILjava/lang/Object;)Landroidx/lifecycle/LiveData;
|
||||||
|
move-result-object v0
|
||||||
|
return-object v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user