mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-08 16:46:59 +01:00
feat(androidtwelvewidgets): unlock-paid-widgets
patch (#1641)
This commit is contained in:
parent
fe64881c83
commit
44b74ae268
@ -0,0 +1,5 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object AgendaDaysWidgetUnlockFingerprint : MethodUnlockFingerprint("AgendaDaysWidgetConfigureActivity")
|
@ -0,0 +1,5 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object CalendarBigWidgetUnlockFingerprint : MethodUnlockFingerprint("CalendarBigWidgetConfigureActivity")
|
@ -0,0 +1,4 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object CalendarWideDayEventsWidgetUnlockFingerprint :
|
||||
MethodUnlockFingerprint("CalendarWideDayEventsWidgetConfigureActivity")
|
@ -0,0 +1,6 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object CalendarWideTimelineWidgetUnlockFingerprint :
|
||||
MethodUnlockFingerprint("CalendarWideTimelineWidgetConfigureActivity")
|
@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
abstract class MethodUnlockFingerprint(private val className: String) : MethodFingerprint(
|
||||
"L",
|
||||
strings = listOf("binding.addButton"),
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.definingClass.endsWith("/$className;")
|
||||
}
|
||||
)
|
||||
|
@ -0,0 +1,5 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object ScreentimeSmallWidgetUnlockFingerprint : MethodUnlockFingerprint("ScreentimeSmallWidgetConfigureActivity")
|
@ -0,0 +1,3 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object WeatherWidgetUnlockFingerprint : MethodUnlockFingerprint("WeatherWidgetConfigureActivity")
|
@ -0,0 +1,54 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.*
|
||||
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.twelvewidgets.unlock.fingerprints.*
|
||||
|
||||
@Patch
|
||||
@Name("unlock-paid-widgets")
|
||||
@Description("Unlocks paid widgets of the app")
|
||||
@Compatibility([Package("com.dci.dev.androidtwelvewidgets")])
|
||||
@Version("0.0.1")
|
||||
class UnlockPaidWidgetsPatch : BytecodePatch(
|
||||
listOf(
|
||||
AgendaDaysWidgetUnlockFingerprint,
|
||||
CalendarBigWidgetUnlockFingerprint,
|
||||
CalendarWideDayEventsWidgetUnlockFingerprint,
|
||||
CalendarWideTimelineWidgetUnlockFingerprint,
|
||||
ScreentimeSmallWidgetUnlockFingerprint,
|
||||
WeatherWidgetUnlockFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
listOf(
|
||||
AgendaDaysWidgetUnlockFingerprint,
|
||||
CalendarBigWidgetUnlockFingerprint,
|
||||
CalendarWideDayEventsWidgetUnlockFingerprint,
|
||||
CalendarWideTimelineWidgetUnlockFingerprint,
|
||||
ScreentimeSmallWidgetUnlockFingerprint,
|
||||
WeatherWidgetUnlockFingerprint
|
||||
).map { fingerprint ->
|
||||
fingerprint.result?.mutableMethod ?: return fingerprint.toErrorResult()
|
||||
}.forEach { method ->
|
||||
method.apply {
|
||||
removeInstructions(4, 2)
|
||||
addInstructions(
|
||||
implementation?.instructions?.size!!, """
|
||||
const/4 v1, 0x0
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V
|
||||
return-object v0
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user