refactor(syncforreddit): DisableSyncForLemmyBottomSheetPatch

This commit is contained in:
Pun Butrach
2026-01-12 16:49:57 +07:00
parent dd5b9ac58d
commit 2e6b7c2fe4
2 changed files with 11 additions and 10 deletions

View File

@@ -1,11 +1,10 @@
package app.revanced.patches.reddit.customclients.sync.syncforreddit.annoyances.startup
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.creatingBytecodePatch
@Suppress("unused")
val disableSyncForLemmyBottomSheetPatch = bytecodePatch(
name = "Disable Sync for Lemmy bottom sheet",
@Suppress("unused", "ObjectPropertyName")
val `Disable Sync for Lemmy bottom sheet` = creatingBytecodePatch(
description = "Disables the bottom sheet at the startup that asks you to signup to \"Sync for Lemmy\".",
) {
compatibleWith(
@@ -15,7 +14,7 @@ val disableSyncForLemmyBottomSheetPatch = bytecodePatch(
)
apply {
mainActivityOnCreateFingerprint.method.apply {
mainActivityOnCreateMethod.apply {
val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1
removeInstruction(showBottomSheetIndex)

View File

@@ -1,9 +1,11 @@
package app.revanced.patches.reddit.customclients.sync.syncforreddit.annoyances.startup
import app.revanced.patcher.fingerprint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.definingClass
import app.revanced.patcher.name
import app.revanced.patcher.patch.BytecodePatchContext
internal val mainActivityOnCreateFingerprint = fingerprint {
custom { method, classDef ->
classDef.endsWith("MainActivity;") && method.name == "onCreate"
}
internal val BytecodePatchContext.mainActivityOnCreateMethod by gettingFirstMutableMethodDeclaratively {
definingClass("MainActivity;")
name("onCreate")
}