Skip to content

Commit

Permalink
Merge pull request #483 from crimera/dev
Browse files Browse the repository at this point in the history
chore: Merge branch `dev` to `main`
crimera authored Dec 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents a1ca8ff + d4b6cb1 commit 5b76fbe
Showing 8 changed files with 85 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.46.0-dev.1](https://github.com/crimera/piko/compare/v1.45.1...v1.46.0-dev.1) (2024-11-27)

### Features

* **Twitter:** Added `Customize explore tabs` patch ([4be6a7f](https://github.com/crimera/piko/commit/4be6a7fe6ace42ca299d2e4bc7f9a963774f3bcd))

## [1.45.1](https://github.com/crimera/piko/compare/v1.45.0...v1.45.1) (2024-11-27)

### Bug Fixes
2 changes: 1 addition & 1 deletion gradle.properties
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.1
version = 1.46.0-dev.1
2 changes: 1 addition & 1 deletion patches.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package crimera.patches.twitter.misc.customize.timelinetabs

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 CustomiseExploreTabsFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.NEW_INSTANCE),
customFingerprint = { it, _ ->
it.definingClass.endsWith("JsonPageTabs;")
},
)

@Patch(
name = "Customize explore tabs",
dependencies = [SettingsPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true,
)
@Suppress("unused")
object CustomiseExploreTabsPatch : BytecodePatch(
setOf(CustomiseExploreTabsFingerprint, SettingsStatusLoadFingerprint),
) {
override fun execute(context: BytecodeContext) {
val result =
CustomiseExploreTabsFingerprint.result
?: throw PatchException("CustomiseExploreTabsFingerprint not found")

val method = result.mutableMethod

val instructions = method.getInstructions()

val index = instructions.first { it.opcode == Opcode.IGET_OBJECT }.location.index

method.addInstructions(
index + 1,
"""
invoke-static {v1}, ${SettingsPatch.CUSTOMISE_DESCRIPTOR};->exploretabs(Ljava/util/ArrayList;)Ljava/util/ArrayList;
move-result-object v1
""".trimIndent(),
)

SettingsStatusLoadFingerprint.enableSettings("exploreTabCustomisation")
}
}
9 changes: 5 additions & 4 deletions src/main/resources/twitter/settings/values-ja/strings.xml
Original file line number Diff line number Diff line change
@@ -33,9 +33,9 @@
<string name="piko_title_ads">広告</string>
<string name="piko_pref_hide_promoted_posts">プロモーションポスト</string>
<string name="piko_pref_hide_g_ads">Google広告</string>
<string name="piko_pref_hide_main_event">話題を検索(メイン)</string>
<string name="piko_pref_hide_superhero_event">話題を検索(スーパーヒーロー)</string>
<string name="piko_pref_hide_videos_for_you">話題を検索(おすすめ動画)</string>
<string name="piko_pref_hide_main_event">メイン(「話題を検索」タブ)</string>
<string name="piko_pref_hide_superhero_event">スーパーヒーロー(「話題を検索」タブ)</string>
<string name="piko_pref_hide_videos_for_you">おすすめ動画(「話題を検索」タブ)</string>
<string name="piko_pref_wtf_section">「Who to follow」</string>
<string name="piko_pref_cts_section">「おすすめクリエイター」</string>
<string name="piko_pref_ctj_section">「新しいコミュニティを見つける」</string>
@@ -83,7 +83,7 @@
<string name="piko_pref_hide_live_threads">ライブスレッド</string>
<string name="piko_pref_hide_live_threads_desc">タイムラインからライブセクションを非表示にします</string>
<string name="piko_pref_hide_banner">バナー</string>
<string name="piko_pref_hide_banner_desc">「新しい投稿」バナーを非表示にします</string>
<string name="piko_pref_hide_banner_desc">「新しい投稿」バナー</string>
<string name="piko_pref_hide_bmk_timeline">TLのブックマークアイコン</string>
<string name="piko_pref_force_translate">翻訳を強制的に有効化</string>
<string name="piko_pref_force_translate_desc">すべてのポストで翻訳を利用できるようにします</string>
@@ -112,6 +112,7 @@
<string name="piko_pref_customisation_sidebartabs">非表示にするサイドバーの項目</string>
<string name="piko_pref_customisation_navbartabs">非表示にするナビゲーションバーの項目</string>
<string name="piko_pref_customisation_inlinetabs">非表示にするインラインバーの項目</string>
<string name="piko_pref_customisation_exploretabs">「話題を検索」タブ</string>
<string name="piko_pref_customisation_reply_sorting">デフォルトの返信の並び替え</string>
<string name="piko_pref_customisation_reply_sorting_remember">前回の選択を記憶</string>
<string name="piko_pref_customisation_post_font_size">ポストのフォントサイズ</string>
9 changes: 9 additions & 0 deletions src/main/resources/twitter/settings/values-v21/arrays.xml
Original file line number Diff line number Diff line change
@@ -14,6 +14,15 @@
<item>hide_following</item>
</string-array>

<string-array name="piko_array_exploretabs_val">
<item>for_you</item>
<item>trending</item>
<item>fun</item>
<item>news</item>
<item>sports</item>
<item>entertainment</item>
</string-array>

<string-array name="piko_array_download_media_handle_val">
<item>download_media</item>
<item>copy_media_link</item>
9 changes: 9 additions & 0 deletions src/main/resources/twitter/settings/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -12,6 +12,15 @@
<item>@string/profile_tab_title_likes</item>
</string-array>

<string-array name="piko_array_exploretabs">
<item>@string/guide_tab_title_for_you</item>
<item>@string/guide_tab_title_trending</item>
<item>@string/guide_tab_title_fun</item>
<item>@string/guide_tab_title_news</item>
<item>@string/guide_tab_title_sports</item>
<item>@string/guide_tab_title_entertainment</item>
</string-array>

<string-array name="piko_array_timelinetabs">
<item>@string/piko_pref_customisation_timelinetabs_both</item>
<item>@string/piko_pref_customisation_timelinetabs_foryou</item>
1 change: 1 addition & 0 deletions src/main/resources/twitter/settings/values/strings.xml
Original file line number Diff line number Diff line change
@@ -119,6 +119,7 @@
<string name="piko_pref_customisation_sidebartabs">Side bar items to hide</string>
<string name="piko_pref_customisation_navbartabs">Navigation bar items to hide</string>
<string name="piko_pref_customisation_inlinetabs">Inline bar items to hide</string>
<string name="piko_pref_customisation_exploretabs">Explore tabs</string>
<string name="piko_pref_customisation_reply_sorting">Default reply sorting filter</string>
<string name="piko_pref_customisation_reply_sorting_remember">Previously selected</string>
<string name="piko_pref_customisation_post_font_size">Post font size</string>

0 comments on commit 5b76fbe

Please sign in to comment.