generated from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #474 from crimera/dev
chore: Merge branch `dev` to `main`
- Loading branch information
Showing
9 changed files
with
101 additions
and
81 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
org.gradle.parallel = true | ||
org.gradle.caching = true | ||
kotlin.code.style = official | ||
version = 1.45.0 | ||
version = 1.45.1-dev.2 |
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
...ain/kotlin/crimera/patches/twitter/misc/sensitivemediasettings/ShowSensitiveMediaPatch.kt
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...es/twitter/misc/sensitivemediasettings/fingerprints/ShowSensitiveMediaPatchFingerprint.kt
This file was deleted.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
...kotlin/crimera/patches/twitter/timeline/sensitivemediasettings/ShowSensitiveMediaPatch.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,48 @@ | ||
package crimera.patches.twitter.timeline.sensitivemediasettings | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchException | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import crimera.patches.twitter.misc.settings.SettingsPatch | ||
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint | ||
import crimera.patches.twitter.timeline.sensitivemediasettings.fingerprints.SensitiveMediaSettingsPatchFingerprint | ||
|
||
// Credits to @Cradlesofashes | ||
@Patch( | ||
name = "Show sensitive media", | ||
description = "Shows sensitive media", | ||
dependencies = [SettingsPatch::class], | ||
compatiblePackages = [CompatiblePackage("com.twitter.android")], | ||
) | ||
@Suppress("unused") | ||
object SensitiveMediaPatch : BytecodePatch( | ||
setOf(SensitiveMediaSettingsPatchFingerprint, SettingsStatusLoadFingerprint), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
val TIMELINE_ENTRY_DESCRIPTOR = "${SettingsPatch.PATCHES_DESCRIPTOR}/TimelineEntry" | ||
|
||
val result = | ||
SensitiveMediaSettingsPatchFingerprint.result | ||
?: throw PatchException("SensitiveMediaSettingsPatchFingerprint not found") | ||
|
||
val methods = result.mutableMethod | ||
val instructions = methods.getInstructions() | ||
|
||
val returnObj = instructions.last { it.opcode == Opcode.RETURN_OBJECT }.location.index | ||
|
||
methods.addInstructions( | ||
returnObj, | ||
""" | ||
invoke-static {p1}, $TIMELINE_ENTRY_DESCRIPTOR;->sensitiveMedia(Lcom/twitter/model/json/core/JsonSensitiveMediaWarning;)Lcom/twitter/model/json/core/JsonSensitiveMediaWarning; | ||
move-result-object p1 | ||
""".trimIndent(), | ||
) | ||
|
||
SettingsStatusLoadFingerprint.enableSettings("showSensitiveMedia") | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...witter/timeline/sensitivemediasettings/fingerprints/ShowSensitiveMediaPatchFingerprint.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,10 @@ | ||
package crimera.patches.twitter.timeline.sensitivemediasettings.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
object SensitiveMediaSettingsPatchFingerprint : MethodFingerprint( | ||
returnType = "Ljava/lang/Object", | ||
customFingerprint = { it, _ -> | ||
it.definingClass == "Lcom/twitter/model/json/core/JsonSensitiveMediaWarning\$\$JsonObjectMapper;" && it.name == "parse" | ||
}, | ||
) |
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