forked from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iconpackstudio):
unlock-pro
patch (ReVanced#1047)
- Loading branch information
1 parent
9cec440
commit fcbca9c
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...kotlin/app/revanced/patches/iconpackstudio/misc/pro/annotations/UnlockProCompatibility.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,9 @@ | ||
package app.revanced.patches.iconpackstudio.misc.pro.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility([Package("ginlemon.iconpackstudio")]) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class UnlockProCompatibility |
14 changes: 14 additions & 0 deletions
14
...n/kotlin/app/revanced/patches/iconpackstudio/misc/pro/fingerprints/CheckProFingerprint.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,14 @@ | ||
package app.revanced.patches.iconpackstudio.misc.pro.fingerprints | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.iconpackstudio.misc.pro.annotations.UnlockProCompatibility | ||
|
||
@Name("check-pro-fingerprint") | ||
@UnlockProCompatibility | ||
@Version("0.0.1") | ||
object CheckProFingerprint : MethodFingerprint( | ||
"Z", | ||
customFingerprint = { it.definingClass.endsWith("IPSPurchaseRepository;")} | ||
) |
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/patch/UnlockProPatch.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,38 @@ | ||
package app.revanced.patches.iconpackstudio.misc.pro.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.extensions.removeInstruction | ||
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.iconpackstudio.misc.pro.annotations.UnlockProCompatibility | ||
import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerprint | ||
|
||
@Patch | ||
@Name("unlock-pro") | ||
@Description("Unlocks all pro features.") | ||
@UnlockProCompatibility | ||
@Version("0.0.1") | ||
class UnlockProPatch : BytecodePatch( | ||
listOf( | ||
CheckProFingerprint | ||
) | ||
) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
val method = CheckProFingerprint.result!!.mutableMethod | ||
method.addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x1 | ||
return v0 | ||
""" | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |