diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt index 382e8cb97..ea3f5ce5e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt @@ -2,15 +2,15 @@ package app.revanced.patches.reddit.customclients import app.revanced.patcher.patch.BytecodePatchBuilder import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.creatingBytecodePatch const val INSTALL_NEW_CLIENT_METHOD = "install(Lokhttp3/OkHttpClient${'$'}Builder;)Lokhttp3/OkHttpClient;" const val CREATE_NEW_CLIENT_METHOD = "createClient()Lokhttp3/OkHttpClient;" -fun fixRedgifsApiPatch( +fun `Fix Redgifs API`( extensionPatch: Patch, block: BytecodePatchBuilder.() -> Unit = {}, -) = bytecodePatch(name = "Fix Redgifs API") { +) = creatingBytecodePatch { dependsOn(extensionPatch) block() diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt index 2c3d89acc..c130a1f7b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt @@ -2,15 +2,15 @@ package app.revanced.patches.reddit.customclients import app.revanced.patcher.patch.BytecodePatchBuilder import app.revanced.patcher.patch.Patch -import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.creatingBytecodePatch const val RESOLVE_S_LINK_METHOD = "patchResolveSLink(Ljava/lang/String;)Z" const val SET_ACCESS_TOKEN_METHOD = "patchSetAccessToken(Ljava/lang/String;)V" -fun fixSLinksPatch( +fun `Fix s links`( extensionPatch: Patch, block: BytecodePatchBuilder.() -> Unit = {}, -) = bytecodePatch(name = "Fix /s/ links") { +) = creatingBytecodePatch { dependsOn(extensionPatch) block() diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/SpoofClientPatch.kt index aeebd02a6..3a3851afb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/SpoofClientPatch.kt @@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients import app.revanced.patcher.patch.BytecodePatchBuilder import app.revanced.patcher.patch.Option -import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.creatingBytecodePatch import app.revanced.patcher.patch.stringOption /** @@ -11,11 +11,10 @@ import app.revanced.patcher.patch.stringOption * @param redirectUri The redirect URI of the Reddit OAuth client. * @param block The patch block. It is called with the client ID option. */ -fun spoofClientPatch( +fun `Spoof client`( redirectUri: String, block: BytecodePatchBuilder.(Option) -> Unit = {}, -) = bytecodePatch( - name = "Spoof client", +) = creatingBytecodePatch( description = "Restores functionality of the app by using custom client ID.", ) { block( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt index e0485dacd..45994659b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt @@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.baconreader.api import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.patches.shared.misc.string.replaceStringPatch import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow @@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference import com.android.tools.smali.dexlib2.mutable.MutableMethod -val spoofClientPatch = spoofClientPatch(redirectUri = "http://baconreader.com/auth") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "http://baconreader.com/auth") { clientIdOption -> dependsOn( // Redirects from SSL to WWW domain are bugged causing auth problems. // Manually rewrite the URLs to fix this. diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt index 8c1fd5614..68ce7ce72 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.removeInstructions import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD import app.revanced.patches.reddit.customclients.baconreader.misc.extension.sharedExtensionPatch -import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch +import app.revanced.patches.reddit.customclients.`Fix Redgifs API` import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode @@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/baconreader/FixRedgifsApiPatch;" @Suppress("unused") -val fixRedgifsApi = fixRedgifsApiPatch( +val fixRedgifsApi = `Fix Redgifs API`( extensionPatch = sharedExtensionPatch ) { compatibleWith( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt index a977099da..3677f9dff 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt @@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.boostforreddit.api import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.returnEarly @@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference @Suppress("unused") -val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "http://rubenmayayo.com") { clientIdOption -> compatibleWith("com.rubenmayayo.reddit") val clientId by clientIdOption diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt index 4db18ee72..bcc53c264 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt @@ -3,7 +3,7 @@ package app.revanced.patches.reddit.customclients.boostforreddit.fix.redgifs import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patches.reddit.customclients.CREATE_NEW_CLIENT_METHOD import app.revanced.patches.reddit.customclients.boostforreddit.misc.extension.sharedExtensionPatch -import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch +import app.revanced.patches.reddit.customclients.`Fix Redgifs API` import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.iface.reference.MethodReference @@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/boostforreddit/FixRedgifsApiPatch;" @Suppress("unused") -val fixRedgifsApi = fixRedgifsApiPatch( +val fixRedgifsApi = `Fix Redgifs API`( extensionPatch = sharedExtensionPatch ) { compatibleWith("com.rubenmayayo.reddit") diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt index e87172b12..8a517551f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt @@ -1,13 +1,13 @@ package app.revanced.patches.reddit.customclients.infinityforreddit.api import app.revanced.patcher.extensions.toInstructions -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable -val spoofClientPatch = spoofClientPatch(redirectUri = "infinity://localhost") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "infinity://localhost") { clientIdOption -> compatibleWith( "ml.docilealligator.infinityforreddit", "ml.docilealligator.infinityforreddit.plus", diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt index 28dba13cf..d14b8ca59 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt @@ -2,11 +2,11 @@ package app.revanced.patches.reddit.customclients.joeyforreddit.api import app.revanced.patches.reddit.customclients.infinity.api.authUtilityUserAgentMethod import app.revanced.patches.reddit.customclients.infinity.api.getClientIdMethod -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.patches.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch import app.revanced.util.returnEarly -val spoofClientPatch = spoofClientPatch(redirectUri = "https://127.0.0.1:65023/authorize_callback") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "https://127.0.0.1:65023/authorize_callback") { clientIdOption -> dependsOn(disablePiracyDetectionPatch) compatibleWith( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt index cb3c262b3..6c2cf9795 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt @@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.redditisfun.api import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.returnEarly @@ -12,7 +12,7 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference import com.android.tools.smali.dexlib2.mutable.MutableMethod @Suppress("unused") -val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "redditisfun://auth") { clientIdOption -> compatibleWith( "com.andrewshu.android.reddit", "com.andrewshu.android.redditdonation", diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt index 58a35990d..534e89c26 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt @@ -3,7 +3,7 @@ package app.revanced.patches.reddit.customclients.relayforreddit.api import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode @@ -13,7 +13,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference @Suppress("unused") -val spoofClientPatch = spoofClientPatch(redirectUri = "dbrady://relay") { clientIdOption -> +val spoofClientPatch = `Spoof client`(redirectUri = "dbrady://relay") { clientIdOption -> compatibleWith( "free.reddit.news", "reddit.news", diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt index 47a5cf815..2b00e2051 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt @@ -2,7 +2,7 @@ package app.revanced.patches.reddit.customclients.sync.syncforreddit.api import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction -import app.revanced.patches.reddit.customclients.spoofClientPatch +import app.revanced.patches.reddit.customclients.`Spoof client` import app.revanced.patches.reddit.customclients.sync.detection.piracy.disablePiracyDetectionPatch import app.revanced.patches.shared.misc.string.replaceStringPatch import app.revanced.util.returnEarly @@ -11,7 +11,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.StringReference import java.util.Base64 -val spoofClientPatch = spoofClientPatch( +val spoofClientPatch = `Spoof client`( redirectUri = "http://redditsync/auth", ) { clientIdOption -> dependsOn( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt index 9d6454198..e1ad4257d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt @@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patches.reddit.customclients.INSTALL_NEW_CLIENT_METHOD -import app.revanced.patches.reddit.customclients.fixRedgifsApiPatch +import app.revanced.patches.reddit.customclients.`Fix Redgifs API` import app.revanced.patches.reddit.customclients.sync.syncforreddit.extension.sharedExtensionPatch import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow @@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/syncforreddit/FixRedgifsApiPatch;" @Suppress("unused") -val fixRedgifsApi = fixRedgifsApiPatch( +val fixRedgifsApi = `Fix Redgifs API`( extensionPatch = sharedExtensionPatch ) { compatibleWith(