-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(androidtwelvewidgets):
unlock-paid-widgets
patch (#1641)
- Loading branch information
Showing
8 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...p/revanced/patches/twelvewidgets/unlock/fingerprints/AgendaDaysWidgetUnlockFingerprint.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,5 @@ | ||
package app.revanced.patches.twelvewidgets.unlock.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object AgendaDaysWidgetUnlockFingerprint : MethodUnlockFingerprint("AgendaDaysWidgetConfigureActivity") |
5 changes: 5 additions & 0 deletions
5
.../revanced/patches/twelvewidgets/unlock/fingerprints/CalendarBigWidgetUnlockFingerprint.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,5 @@ | ||
package app.revanced.patches.twelvewidgets.unlock.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object CalendarBigWidgetUnlockFingerprint : MethodUnlockFingerprint("CalendarBigWidgetConfigureActivity") |
4 changes: 4 additions & 0 deletions
4
...patches/twelvewidgets/unlock/fingerprints/CalendarWideDayEventsWidgetUnlockFingerprint.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,4 @@ | ||
package app.revanced.patches.twelvewidgets.unlock.fingerprints | ||
|
||
object CalendarWideDayEventsWidgetUnlockFingerprint : | ||
MethodUnlockFingerprint("CalendarWideDayEventsWidgetConfigureActivity") |
6 changes: 6 additions & 0 deletions
6
.../patches/twelvewidgets/unlock/fingerprints/CalendarWideTimelineWidgetUnlockFingerprint.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,6 @@ | ||
package app.revanced.patches.twelvewidgets.unlock.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object CalendarWideTimelineWidgetUnlockFingerprint : | ||
MethodUnlockFingerprint("CalendarWideTimelineWidgetConfigureActivity") |
12 changes: 12 additions & 0 deletions
12
.../kotlin/app/revanced/patches/twelvewidgets/unlock/fingerprints/MethodUnlockFingerprint.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,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;") | ||
} | ||
) | ||
|
5 changes: 5 additions & 0 deletions
5
...anced/patches/twelvewidgets/unlock/fingerprints/ScreentimeSmallWidgetUnlockFingerprint.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,5 @@ | ||
package app.revanced.patches.twelvewidgets.unlock.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object ScreentimeSmallWidgetUnlockFingerprint : MethodUnlockFingerprint("ScreentimeSmallWidgetConfigureActivity") |
3 changes: 3 additions & 0 deletions
3
.../app/revanced/patches/twelvewidgets/unlock/fingerprints/WeatherWidgetUnlockFingerprint.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,3 @@ | ||
package app.revanced.patches.twelvewidgets.unlock.fingerprints | ||
|
||
object WeatherWidgetUnlockFingerprint : MethodUnlockFingerprint("WeatherWidgetConfigureActivity") |
54 changes: 54 additions & 0 deletions
54
src/main/kotlin/app/revanced/patches/twelvewidgets/unlock/patch/UnlockPaidWidgetsPatch.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,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() | ||
} | ||
} |