generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Fix /s/ links
patch
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
...otlin/app/revanced/patches/reddit/customclients/syncforreddit/fix/slink/FixSLinksPatch.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,32 @@ | ||
package app.revanced.patches.reddit.customclients.syncforreddit.fix.slink | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.reddit.customclients.syncforreddit.fix.slink.fingerprints.LinkHelperOpenLinkFingerprint | ||
import app.revanced.util.exception | ||
|
||
@Patch( | ||
name = "Fix /s/ links", | ||
description = "Fixes the issue where /s/ links do not work.", | ||
compatiblePackages = [ | ||
CompatiblePackage("com.laurencedawson.reddit_sync"), | ||
CompatiblePackage("com.laurencedawson.reddit_sync.pro"), | ||
CompatiblePackage("com.laurencedawson.reddit_sync.dev") | ||
], | ||
requiresIntegrations = true | ||
) | ||
object FixSLinksPatch : BytecodePatch( | ||
setOf(LinkHelperOpenLinkFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) = | ||
LinkHelperOpenLinkFingerprint.result?.mutableMethod?.addInstructions( | ||
1, | ||
""" | ||
invoke-static { p3 }, Lapp/revanced/integrations/syncforreddit/FixSLinksPatch;->resolveSLink(Ljava/lang/String;)Ljava/lang/String; | ||
move-result-object p3 | ||
""" | ||
) ?: throw LinkHelperOpenLinkFingerprint.exception | ||
} |
7 changes: 7 additions & 0 deletions
7
...eddit/customclients/syncforreddit/fix/slink/fingerprints/LinkHelperOpenLinkFingerprint.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,7 @@ | ||
package app.revanced.patches.reddit.customclients.syncforreddit.fix.slink.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
internal object LinkHelperOpenLinkFingerprint: MethodFingerprint( | ||
strings = listOf("Link title: ") | ||
) |