generated from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Twitter): Added
Hide bookmark icon in timeline
- Loading branch information
Showing
4 changed files
with
74 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
49 changes: 49 additions & 0 deletions
49
...in/crimera/patches/twitter/timeline/hidebookmarkintimeline/HideBookmarkInTimelinePatch.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,49 @@ | ||
package crimera.patches.twitter.timeline.hidebookmarkintimeline | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.PatchException | ||
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.hidebookmarkintimeline.fingerprints.HideBookmarkInTimelineFingerprint1 | ||
import crimera.patches.twitter.timeline.hidebookmarkintimeline.fingerprints.HideBookmarkInTimelineFingerprint2 | ||
|
||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
|
||
@Patch( | ||
name = "Hide bookmark icon in timeline", | ||
dependencies = [SettingsPatch::class], | ||
compatiblePackages = [CompatiblePackage("com.twitter.android")], | ||
) | ||
object HideBookmarkInTimelinePatch:BytecodePatch( | ||
setOf(HideBookmarkInTimelineFingerprint1,HideBookmarkInTimelineFingerprint2, SettingsStatusLoadFingerprint) | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
val result1 = HideBookmarkInTimelineFingerprint1.result | ||
?:throw PatchException("HideBookmarkInTimelineFingerprint1 not found") | ||
|
||
val PREF = "invoke-static {}, ${SettingsPatch.PREF_DESCRIPTOR};->hideInlineBookmark()Z" | ||
|
||
val method1 = result1.mutableMethod | ||
val loc = method1.getInstructions().first { it.opcode == Opcode.CONST_STRING }.location.index+2 | ||
method1.addInstruction(loc,PREF) | ||
|
||
val result2 = HideBookmarkInTimelineFingerprint2.result | ||
?:throw PatchException("HideBookmarkInTimelineFingerprint2 not found") | ||
val method2 = result2.mutableMethod | ||
val loc2 = method2.getInstructions().first { it.opcode == Opcode.CONST_STRING }.location.index+2 | ||
method2.addInstruction(loc2,PREF) | ||
|
||
SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction( | ||
0, | ||
"${SettingsPatch.SSTS_DESCRIPTOR}->hideInlineBmk()V" | ||
) | ||
|
||
//end | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...witter/timeline/hidebookmarkintimeline/fingerprints/HideBookmarkInTimelineFingerprint1.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 crimera.patches.twitter.timeline.hidebookmarkintimeline.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
object HideBookmarkInTimelineFingerprint1: MethodFingerprint( | ||
strings = listOf("bookmarks_in_timelines_enabled"), | ||
returnType = "Z" | ||
|
||
) |
9 changes: 9 additions & 0 deletions
9
...witter/timeline/hidebookmarkintimeline/fingerprints/HideBookmarkInTimelineFingerprint2.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 crimera.patches.twitter.timeline.hidebookmarkintimeline.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
|
||
object HideBookmarkInTimelineFingerprint2 :MethodFingerprint( | ||
strings = listOf("bookmarks_in_timelines_enabled"), | ||
returnType = "Ljava/util/List;" | ||
|
||
) |