generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Lightroom): Add
Unlock premium
patch (#2740)
Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...lin/app/revanced/patches/lightroom/misc/premium/annotations/UnlockPremiumCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package app.revanced.patches.lightroom.misc.premium.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility([Package("com.adobe.lrmobile")]) | ||
@Target(AnnotationTarget.CLASS) | ||
internal annotation class UnlockPremiumCompatibility |
18 changes: 18 additions & 0 deletions
18
...kotlin/app/revanced/patches/lightroom/misc/premium/fingerprint/HasPurchasedFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package app.revanced.patches.lightroom.misc.premium.fingerprint | ||
|
||
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 HasPurchasedFingerprint : MethodFingerprint( | ||
returnType = "Z", | ||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, | ||
strings = listOf("isPurchaseDoneRecently = true, access platform profile present? = "), | ||
opcodes = listOf( | ||
Opcode.SGET_OBJECT, | ||
Opcode.CONST_4, | ||
Opcode.CONST_4, | ||
Opcode.CONST_4, | ||
) | ||
) |
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/app/revanced/patches/lightroom/misc/premium/patch/UnlockPremiumPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package app.revanced.patches.lightroom.misc.premium.patch | ||
|
||
import app.revanced.extensions.toErrorResult | ||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction | ||
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.lightroom.misc.premium.annotations.UnlockPremiumCompatibility | ||
import app.revanced.patches.lightroom.misc.premium.fingerprint.HasPurchasedFingerprint | ||
|
||
@Patch | ||
@Name("Unlock premium") | ||
@Description("Unlocks premium features.") | ||
@UnlockPremiumCompatibility | ||
class UnlockPremiumPatch : BytecodePatch(listOf(HasPurchasedFingerprint)) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
// Set hasPremium = true. | ||
HasPurchasedFingerprint.result?.mutableMethod?.replaceInstruction(2, "const/4 v2, 0x1") | ||
?: throw HasPurchasedFingerprint.toErrorResult() | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |