Skip to content

Commit

Permalink
feat(Twitter): Added Disable auto timeline scroll on launch patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Swakshan committed May 11, 2024
1 parent 559f4d7 commit b8d431e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package crimera.patches.twitter.timeline.disableAutoScroll


import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.fingerprint.MethodFingerprint
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

object DisableAutoScrollFingerprint:MethodFingerprint(
returnType = "V",
strings = listOf(
"applicationManager",
"releaseCompletable",
"preferences",
"twSystemClock",
"launchTracker",
"cold_start_launch_time_millis",
),
)

//credits to @Ouxyl
@Patch(
name = "Disable auto timeline scroll on launch",
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true,
requiresIntegrations = true
)
object DisableAutoScrollPatch:BytecodePatch(
setOf(DisableAutoScrollFingerprint)
){
override fun execute(context: BytecodeContext) {
val result = DisableAutoScrollFingerprint.result
?:throw PatchException("DisableAutoScrollFingerprint not found")

val method = result.mutableClass.methods.last()

method.addInstructions(0,"""
const v0,0x0
return v0
""".trimIndent())

SettingsStatusLoadFingerprint.enableSettings("disableAutoTimelineScroll")
//end
}
}
1 change: 1 addition & 0 deletions src/main/resources/twitter/settings/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<string name="piko_pref_selectable_text">Selectable text</string>

<string name="piko_title_timeline">Timeline</string>
<string name="piko_pref_disable_auto_timeline_scroll">Disable auto timeline scroll on launch</string>
<string name="piko_pref_hide_for_you">Hide for you tab</string>
<string name="piko_pref_hide_live_threads">Hide live threads</string>
<string name="piko_pref_hide_live_threads_desc">Hides live section in timeline</string>
Expand Down

0 comments on commit b8d431e

Please sign in to comment.