generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sleepasandroid):
unlock-premium
patch (#1172)
Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
1 parent
b77f2b5
commit 14a33ee
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...main/kotlin/app/revanced/patches/sleepasandroid/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,9 @@ | ||
package app.revanced.patches.sleepasandroid.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility([Package("com.urbandroid.sleep")]) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class UnlockPremiumCompatibility |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/app/revanced/patches/sleepasandroid/fingerprints/IsTrialFingerprint.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.sleepasandroid.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object IsTrialFingerprint : MethodFingerprint( | ||
"Z", | ||
customFingerprint = { it.name == "isTrial" } | ||
) |
36 changes: 36 additions & 0 deletions
36
src/main/kotlin/app/revanced/patches/sleepasandroid/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,36 @@ | ||
package app.revanced.patches.sleepasandroid.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
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.sleepasandroid.annotations.UnlockPremiumCompatibility | ||
import app.revanced.patches.sleepasandroid.fingerprints.IsTrialFingerprint | ||
|
||
@Patch | ||
@Name("unlock-premium") | ||
@Description("Unlocks all premium features.") | ||
@UnlockPremiumCompatibility | ||
class UnlockPremiumPatch : BytecodePatch( | ||
listOf( | ||
IsTrialFingerprint | ||
) | ||
) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
val method = IsTrialFingerprint.result!!.mutableMethod | ||
|
||
method.addInstructions( | ||
0, | ||
""" | ||
const/4 v0, 0x0 | ||
return v0 | ||
""" | ||
) | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |