From 695e51240b099fd48ecdf892dd0849649e0c7a90 Mon Sep 17 00:00:00 2001 From: haxibami Date: Sat, 19 Oct 2024 11:32:00 +0900 Subject: [PATCH] add option to hide trending videos --- BHTManager.h | 1 + BHTManager.m | 3 +++ SettingsViewController.m | 3 +++ Tweak.x | 7 +++++++ .../BHT/BHTwitter.bundle/ar.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/en.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/es.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/fr.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/id.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/ja.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/ru.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/tr.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings | 3 +++ .../BHT/BHTwitter.bundle/zh_CN.lproj/Localizable.strings | 3 +++ 14 files changed, 44 insertions(+) diff --git a/BHTManager.h b/BHTManager.h index c4915de2..e1e556c6 100644 --- a/BHTManager.h +++ b/BHTManager.h @@ -48,6 +48,7 @@ + (BOOL)hideTopicsToFollow; + (BOOL)hideViewCount; + (BOOL)hidePremiumOffer; ++ (BOOL)hideTrendVideos; + (BOOL)forceTweetFullFrame; + (BOOL)stripTrackingParams; + (BOOL)alwaysFollowingPage; diff --git a/BHTManager.m b/BHTManager.m index e77ab856..6b627211 100644 --- a/BHTManager.m +++ b/BHTManager.m @@ -229,6 +229,9 @@ + (BOOL)hideViewCount { + (BOOL)hidePremiumOffer { return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_premium_offer"]; } ++ (BOOL)hideTrendVideos { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_trend_videos"]; +} + (BOOL)forceTweetFullFrame { return [[NSUserDefaults standardUserDefaults] boolForKey:@"force_tweet_full_frame"]; } diff --git a/SettingsViewController.m b/SettingsViewController.m index 7d21e5a3..8d3a9342 100644 --- a/SettingsViewController.m +++ b/SettingsViewController.m @@ -154,6 +154,8 @@ - (NSArray *)specifiers { PSSpecifier *hideTopicsToFollow = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_TOPICS_TO_FOLLOW_OPTION"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_TOPICS_TO_FOLLOW_OPTION_DETAIL_TITLE"] key:@"hide_topics_to_follow" defaultValue:false changeAction:nil]; PSSpecifier *hidePremiumOffer = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_PREMIUM_OFFER_OPTION"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE"] key:@"hide_premium_offer" defaultValue:false changeAction:nil]; + + PSSpecifier *hideTrendVideos = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_TREND_VIDEOS_OPTION"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE"] key:@"hide_trend_videos" defaultValue:false changeAction:nil]; PSSpecifier *videoLayerCaption = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE"] detailTitle:nil key:@"dis_VODCaptions" defaultValue:false changeAction:nil]; @@ -239,6 +241,7 @@ - (NSArray *)specifiers { hideWhoToFollow, hideTopicsToFollow, hidePremiumOffer, + hideTrendVideos, videoLayerCaption, directSave, noHistory, diff --git a/Tweak.x b/Tweak.x index 88263474..4be24b13 100644 --- a/Tweak.x +++ b/Tweak.x @@ -307,6 +307,9 @@ static void batchSwizzlingOnClass(Class cls, NSArray*origSelectors, I [_orig setHidden:true]; } } + if ([BHTManager hideTrendVideos] && ([class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"] || [class_name isEqualToString:@"T1TwitterSwift.URTTimelineCarouselViewModel"])) { + [_orig setHidden:true]; + } } if ([self.adDisplayLocation isEqualToString:@"TIMELINE_HOME"]) { @@ -366,6 +369,10 @@ static void batchSwizzlingOnClass(Class cls, NSArray*origSelectors, I return 0; } } + + if ([BHTManager hideTrendVideos] && ([class_name isEqualToString:@"TwitterURT.URTModuleHeaderViewModel"] || [class_name isEqualToString:@"TwitterURT.URTModuleFooterViewModel"] || [class_name isEqualToString:@"T1TwitterSwift.URTTimelineCarouselViewModel"])) { + return 0; + } } if ([self.adDisplayLocation isEqualToString:@"TIMELINE_HOME"]) { diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings index 40748e05..ba2ab898 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings @@ -53,6 +53,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "إخفاء عرض التسجيل المميز"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "إخفاء زر وثِّق حسابك وترقية في الملف الشخصي وشريط التنقل"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "إخفاء الفيديوهات الرائجة"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "إخفاء الفيديوهات الرائجة في علامة تبويب البحث"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "تعطيل وصف الفيديو"; "VOICE_OPTION_TITLE" = "الملاحظة الصوتية"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings index 7a9c4c38..f4744977 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings @@ -53,6 +53,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "Hide Premium registration offer"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "Hide Get verified and Upgrade button in the profile and navigation bar"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "Hide trending videos"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "Hide trending videos in the Search tab"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "Disable video layer captions"; "VOICE_OPTION_TITLE" = "Voice feature"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings index a89cecc3..6cfdb073 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings @@ -53,6 +53,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "Ocultar la oferta de registro Premium"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "Ocultar los botones Obtener verificación y Actualizar a nivel superior en el perfil y en la barra de navegación"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "Ocultar los vídeos que son tendencia"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "Ocultar los vídeos que son tendencia en la pestaña de búsqueda"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "Desactivar subtítulos"; "VOICE_OPTION_TITLE" = "Función de voz"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/fr.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/fr.lproj/Localizable.strings index ab046053..8c8aca20 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/fr.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/fr.lproj/Localizable.strings @@ -53,6 +53,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "Masquer l'offre d'enregistrement Premium"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "Masquer les boutons Obtenir la certification et Mettre à niveau dans le profil et la barre de navigation"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "Masquer les vidéos tendance"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "Masquer les vidéos tendance dans l'onglet de recherche"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "Désactiver les sous-titres du calque vidéo"; "VOICE_OPTION_TITLE" = "Fonction vocale"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/id.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/id.lproj/Localizable.strings index af25ce99..7284c795 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/id.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/id.lproj/Localizable.strings @@ -46,6 +46,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "Sembunyikan penawaran pendaftaran Premium"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "Sembunyikan tombol Dapatkan verifikasi dan Tingkatkan di profil dan bilah navigasi"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "Sembunyikan video yang sedang tren"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "Sembunyikan video yang sedang tren di tab pencarian"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "nonaktifkan text video"; "VOICE_OPTION_TITLE" = "Fitur Suara"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings index c543640c..fa37b5f2 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings @@ -53,6 +53,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "プレミアムの登録オファーを消す"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "プロフィールとナビゲーションバーの「認証される」「アップグレード」ボタンを削除します。"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "トレンドの動画を消す"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "検索タブからトレンドの動画を削除します。"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "動画の字幕を無効にする"; "VOICE_OPTION_TITLE" = "音声機能の有効化"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/ru.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/ru.lproj/Localizable.strings index d2586fc7..0f5313ce 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/ru.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/ru.lproj/Localizable.strings @@ -52,6 +52,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "Скрыть предложение премиум-регистрации"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "Скрыть кнопку «Подтвердить подлинность» и «Улучшить подписку» в профиле и на панели навигации"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "Скрыть популярные видео"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "Скрыть популярные видео во вкладке «Поиск»"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "Отключить описания видео"; "VOICE_OPTION_TITLE" = "Голосовые"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/tr.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/tr.lproj/Localizable.strings index b92f364c..94f346db 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/tr.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/tr.lproj/Localizable.strings @@ -52,6 +52,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "Premium kayıt teklifini gizle"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "Profil ve gezinti çubuğundaki Onaylanmış hesap sahibi ol ve Yükselt düğmelerini gizleyin"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "Trend olan videoları gizle"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "Arama sekmesinde trend olan videoları gizle"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "Video katmanı altyazılarını devre dışı bırak"; "VOICE_OPTION_TITLE" = "Ses özelliği"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings index 69a19286..d5e36695 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings @@ -53,6 +53,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "隱藏高級註冊優惠"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "在個人檔案和導覽列中隱藏獲得認證和升級按鈕"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "隱藏熱門影片"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "在搜尋標籤中隱藏熱門影片"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "關閉影片字幕"; "VOICE_OPTION_TITLE" = "語音訊息"; diff --git a/layout/Library/Application Support/BHT/BHTwitter.bundle/zh_CN.lproj/Localizable.strings b/layout/Library/Application Support/BHT/BHTwitter.bundle/zh_CN.lproj/Localizable.strings index 7a5c7fbc..07df1b03 100644 --- a/layout/Library/Application Support/BHT/BHTwitter.bundle/zh_CN.lproj/Localizable.strings +++ b/layout/Library/Application Support/BHT/BHTwitter.bundle/zh_CN.lproj/Localizable.strings @@ -52,6 +52,9 @@ "HIDE_PREMIUM_OFFER_OPTION" = "隐藏高级注册优惠"; "HIDE_PREMIUM_OFFER_OPTION_DETAIL_TITLE" = "在个人资料和导航栏中隐藏通过验证和升级按钮"; +"HIDE_TREND_VIDEOS_OPTION_TITLE" = "隐藏热门视频"; +"HIDE_TREND_VIDEOS_OPTION_DETAIL_TITLE" = "隐藏搜索标签中的热门视频"; + "DISABLE_VIDEO_LAYER_CAPTIONS_OPTION_TITLE" = "开启视频字幕"; "VOICE_OPTION_TITLE" = "语音功能";