mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-07 12:57:06 +01:00
feat(ticktick): unlock-themes
patch (#1028)
This commit is contained in:
parent
7e6b453401
commit
7f1fedcddd
@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.ticktick.misc.themeunlock.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.ticktick.task")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class UnlockThemesCompatibility
|
@ -0,0 +1,15 @@
|
||||
package app.revanced.patches.ticktick.misc.themeunlock.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.ticktick.misc.themeunlock.annotations.UnlockThemesCompatibility
|
||||
|
||||
@Name("check-locked-theme-fingerprint")
|
||||
@UnlockThemesCompatibility
|
||||
@Version("0.0.1")
|
||||
object CheckLockedThemesFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.definingClass.endsWith("Theme;") && methodDef.name == "isLockedTheme"
|
||||
}
|
||||
)
|
@ -0,0 +1,15 @@
|
||||
package app.revanced.patches.ticktick.misc.themeunlock.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.ticktick.misc.themeunlock.annotations.UnlockThemesCompatibility
|
||||
|
||||
@Name("set-theme-fingerprint")
|
||||
@UnlockThemesCompatibility
|
||||
@Version("0.0.1")
|
||||
object SetThemeFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.definingClass.endsWith("ThemePreviewActivity;") && methodDef.name == "lambda\$updateUserBtn\$1"
|
||||
}
|
||||
)
|
@ -0,0 +1,43 @@
|
||||
package app.revanced.patches.ticktick.misc.themeunlock.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.removeInstructions
|
||||
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.ticktick.misc.themeunlock.annotations.UnlockThemesCompatibility
|
||||
import app.revanced.patches.ticktick.misc.themeunlock.fingerprints.CheckLockedThemesFingerprint
|
||||
import app.revanced.patches.ticktick.misc.themeunlock.fingerprints.SetThemeFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("unlock-themes")
|
||||
@Description("Unlocks all themes.")
|
||||
@UnlockThemesCompatibility
|
||||
@Version("0.0.1")
|
||||
class UnlockProPatch : BytecodePatch(
|
||||
listOf(
|
||||
CheckLockedThemesFingerprint,
|
||||
SetThemeFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val lockedThemesMethod = CheckLockedThemesFingerprint.result!!.mutableMethod
|
||||
lockedThemesMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
|
||||
val setThemeMethod = SetThemeFingerprint.result!!.mutableMethod
|
||||
setThemeMethod.removeInstructions(0, 9)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user