This commit is contained in:
kolpazar 2025-05-10 18:51:28 +02:00 committed by GitHub
commit 1181685dec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 0 deletions

View file

@ -551,6 +551,14 @@ public final class app/revanced/patches/reddit/customclients/sync/syncforreddit/
public static final fun getFixSLinksPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/thumbnail/FingerprintsKt {
public static final fun getCustomImageViewLoadFingerprint ()Lapp/revanced/patcher/Fingerprint;
}
public final class app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/thumbnail/FixPostThumbnailsPatchKt {
public static final fun getFixPostThumbnailsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/user/UseUserEndpointPatchKt {
public static final fun getUseUserEndpointPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View file

@ -0,0 +1,12 @@
package app.revanced.patches.reddit.customclients.sync.syncforreddit.fix.thumbnail
import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
val customImageViewLoadFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC)
parameters("Ljava/lang/String;", "Z", "Z", "I", "I")
custom { _, classDef ->
classDef.type == "Lcom/laurencedawson/reddit_sync/ui/views/images/CustomImageView;"
}
}

View file

@ -0,0 +1,31 @@
package app.revanced.patches.reddit.customclients.sync.syncforreddit.fix.thumbnail
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
@Suppress("unused")
val fixPostThumbnailsPatch = bytecodePatch(
name = "Fix post thumbnails",
description = "Fixes loading post thumbnails by correcting their URLs.",
) {
compatibleWith(
"com.laurencedawson.reddit_sync",
"com.laurencedawson.reddit_sync.pro",
"com.laurencedawson.reddit_sync.dev"
)
// Image URLs contain escaped ampersands (&), let's replace these with unescaped ones (&).
execute {
customImageViewLoadFingerprint.method.addInstructions(
0,
"""
# url = url.replace("&", "&");
const-string v0, "&"
const-string v1, "&"
invoke-virtual { p1, v0, v1 }, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object p1
"""
)
}
}