forked from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Sync for Reddit): add
Disable Sync for Lemmy bottom sheet
patch
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...eddit/customclients/syncforreddit/annoyances/startup/fingerprints/MainActivityOnCreate.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,9 @@ | ||
package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
|
||
object MainActivityOnCreate : MethodFingerprint( | ||
customFingerprint = custom@{ method, classDef -> | ||
classDef.type.endsWith("MainActivity;") && method.name == "onCreate" | ||
} | ||
) |
35 changes: 35 additions & 0 deletions
35
...stomclients/syncforreddit/annoyances/startup/patch/DisableSyncForLemmyBottomSheetPatch.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,35 @@ | ||
package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.patch | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Package | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction | ||
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.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreate | ||
|
||
@Patch | ||
@Name("Disable Sync for Lemmy bottom sheet") | ||
@Description("Disables the bottom sheet at the startup that asks you to signup to \"Sync for Lemmy\".") | ||
@Compatibility( | ||
[ | ||
Package("com.laurencedawson.reddit_sync", ["v23.06.30-13:39"]), | ||
Package("com.laurencedawson.reddit_sync.pro"), // Version unknown. | ||
Package("com.laurencedawson.reddit_sync.dev") // Version unknown. | ||
] | ||
) | ||
class DisableSyncForLemmyBottomSheetPatch : BytecodePatch(listOf(MainActivityOnCreate)) { | ||
override fun execute(context: BytecodeContext): PatchResult { | ||
MainActivityOnCreate.result?.mutableMethod?.apply { | ||
val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1 | ||
|
||
removeInstruction(showBottomSheetIndex) | ||
} | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |