mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-29 15:35:49 +01:00
feat(Android Widgets (Material U)): Remove Unlock paid widgets
patch (#3286)
This commit is contained in:
parent
1f6951c0e0
commit
b44da1c701
@ -1,52 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.twelvewidgets.unlock.fingerprints.*
|
||||
|
||||
@Patch(
|
||||
name = "Unlock paid widgets",
|
||||
description = "Unlocks paid widgets of the app",
|
||||
compatiblePackages = [CompatiblePackage("com.dci.dev.androidtwelvewidgets")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object UnlockPaidWidgetsPatch : BytecodePatch(
|
||||
setOf(
|
||||
AgendaDaysWidgetUnlockFingerprint,
|
||||
CalendarBigWidgetUnlockFingerprint,
|
||||
CalendarWideDayEventsWidgetUnlockFingerprint,
|
||||
CalendarWideTimelineWidgetUnlockFingerprint,
|
||||
ScreentimeSmallWidgetUnlockFingerprint,
|
||||
WeatherWidgetUnlockFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
listOf(
|
||||
AgendaDaysWidgetUnlockFingerprint,
|
||||
CalendarBigWidgetUnlockFingerprint,
|
||||
CalendarWideDayEventsWidgetUnlockFingerprint,
|
||||
CalendarWideTimelineWidgetUnlockFingerprint,
|
||||
ScreentimeSmallWidgetUnlockFingerprint,
|
||||
WeatherWidgetUnlockFingerprint
|
||||
).map { fingerprint ->
|
||||
fingerprint.result?.mutableMethod ?: throw fingerprint.exception
|
||||
}.forEach { method ->
|
||||
method.apply {
|
||||
removeInstructions(4, 3)
|
||||
addInstructions(
|
||||
implementation?.instructions?.size!!,
|
||||
"""
|
||||
const/4 v1, 0x0
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V
|
||||
return-object v0
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object AgendaDaysWidgetUnlockFingerprint : MethodUnlockFingerprint("AgendaDaysWidgetConfigureActivity")
|
@ -1,3 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object CalendarBigWidgetUnlockFingerprint : MethodUnlockFingerprint("CalendarBigWidgetConfigureActivity")
|
@ -1,4 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object CalendarWideDayEventsWidgetUnlockFingerprint :
|
||||
MethodUnlockFingerprint("CalendarWideDayEventsWidgetConfigureActivity")
|
@ -1,4 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object CalendarWideTimelineWidgetUnlockFingerprint :
|
||||
MethodUnlockFingerprint("CalendarWideTimelineWidgetConfigureActivity")
|
@ -1,12 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
abstract class MethodUnlockFingerprint(private val className: String) : MethodFingerprint(
|
||||
"L",
|
||||
strings = listOf("binding.addButton"),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/$className;")
|
||||
}
|
||||
)
|
||||
|
@ -1,3 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object ScreentimeSmallWidgetUnlockFingerprint : MethodUnlockFingerprint("ScreentimeSmallWidgetConfigureActivity")
|
@ -1,3 +0,0 @@
|
||||
package app.revanced.patches.twelvewidgets.unlock.fingerprints
|
||||
|
||||
object WeatherWidgetUnlockFingerprint : MethodUnlockFingerprint("WeatherWidgetConfigureActivity")
|
Loading…
Reference in New Issue
Block a user