diff --git a/BHTwitter/BHTManager.h b/BHTwitter/BHTManager.h index 58c9bc83..302a0ff7 100644 --- a/BHTwitter/BHTManager.h +++ b/BHTwitter/BHTManager.h @@ -53,5 +53,6 @@ + (BOOL)forceTweetFullFrame; + (BOOL)stripTrackingParams; + (BOOL)disableImmersive; ++ (BOOL)alwaysFollowingPage; @end diff --git a/BHTwitter/BHTManager.m b/BHTwitter/BHTManager.m index faf36dff..51f7d10d 100644 --- a/BHTwitter/BHTManager.m +++ b/BHTwitter/BHTManager.m @@ -201,6 +201,9 @@ + (BOOL)stripTrackingParams { + (BOOL)disableImmersive { return [[NSUserDefaults standardUserDefaults] boolForKey:@"disable_immersive_player"]; } ++ (BOOL)alwaysFollowingPage { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"always_following_page"]; +} + (UIViewController *)BHTSettingsWithAccount:(TFNTwitterAccount *)twAccount { SettingsViewController *pref = [[SettingsViewController alloc] initWithTwitterAccount:twAccount]; [pref.navigationItem setTitleView:[objc_getClass("TFNTitleView") titleViewWithTitle:@"BHTwitter" subtitle:twAccount.displayUsername]]; diff --git a/BHTwitter/BHTwitter.x b/BHTwitter/BHTwitter.x index cce56603..4372c982 100644 --- a/BHTwitter/BHTwitter.x +++ b/BHTwitter/BHTwitter.x @@ -593,6 +593,29 @@ static void batchSwizzlingOnClass(Class cls, NSArray*origSelectors, I } %end + +// MARK: Always use Following page +%hook TFNScrollingHorizontalLabelView +- (NSUInteger)startingIndex { + if ([BHTManager alwaysFollowingPage]) { + UIViewController *Navigation = self.NearestViewController; + if ([Navigation.childViewControllers[0] isKindOfClass:%c(THFHomeTimelineContainerViewController)] || [Navigation.childViewControllers[0] isKindOfClass:%c(T1HomeTimelineContainerViewController)]) { + [self setValue:[NSNumber numberWithInteger:1] forKey:@"_startingIndex"]; + return 1; + } + } + return %orig; +} + +%new - (UIViewController *)NearestViewController { + UIResponder *responder = self; + while ([responder isKindOfClass:[UIView class]]) + responder = [responder nextResponder]; + return (UIViewController *)responder; +} +%end + + // MARK: Always open in Safrai // Thanks nyuszika7h https://github.com/nyuszika7h/noinappsafari/ %hook SFSafariViewController diff --git a/BHTwitter/Package/DEBIAN/control b/BHTwitter/Package/DEBIAN/control index 392497d2..bc5b266c 100644 --- a/BHTwitter/Package/DEBIAN/control +++ b/BHTwitter/Package/DEBIAN/control @@ -1,6 +1,6 @@ Package: com.bandarhl.BHTwitter Name: BHTwitter -Version: 3.9 +Version: 3.9.1 Description: Awesome tweak for Twitter Section: Tweaks Depends: firmware (>= 13.0), mobilesubstrate, ws.hbang.common (>= 1.17) diff --git a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/Info.plist b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/Info.plist index bef07941..89ae2144 100644 Binary files a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/Info.plist and b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/Info.plist differ diff --git a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings index 2ca12ab1..0632fa8c 100644 --- a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings +++ b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ar.lproj/Localizable.strings @@ -144,6 +144,9 @@ "SHOW_SCOLL_INDICATOR_OPTION_TITLE" = "إظهار شريط التمرير الجانبي"; +"ALWAYS_FOLLOWING_PAGE_OPTION_TITLE" = "فتح التطبيق على صفحة المتابعة"; +"ALWAYS_FOLLOWING_PAGE_OPTION_DETAIL_TITLE" = "إجبار تويتر على إستخدام قسم المتابعة في التايم لاين كصفحة رئيسية عند فتح التطبيق."; + "FONT_OPTION_TITLE" = "تفعيل تغيير خط التطبيق"; "FONT_OPTION_DETAIL_TITLE" = "خيار لتفعيل تغيير خط تويتر"; diff --git a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings index 95f08262..b866d074 100644 --- a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings +++ b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/en.lproj/Localizable.strings @@ -144,6 +144,9 @@ "SHOW_SCOLL_INDICATOR_OPTION_TITLE" = "Show Scroll Bar"; +"ALWAYS_FOLLOWING_PAGE_OPTION_TITLE" = "Always start on Following page"; +"ALWAYS_FOLLOWING_PAGE_OPTION_DETAIL_TITLE" = "Force Twitter to always use Following section of the timeline when the user start the application"; + "FONT_OPTION_TITLE" = "Enable changing font"; "FONT_OPTION_DETAIL_TITLE" = "Option to allow changing Twitter font and show font picker."; diff --git a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings index 2edfc00a..fa8eccd0 100644 --- a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings +++ b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/es.lproj/Localizable.strings @@ -142,6 +142,8 @@ "DISABLE_IMMERSIVE_PLAYER_TITLE" = "Desactivar reproductor inmersivo"; "DISABLE_IMMERSIVE_PLAYER_DETAIL_TITLE" = "Desactivar el nuevo reproductor de vídeo de Twitter (Reproductor inmersivo)"; +"SHOW_SCOLL_INDICATOR_OPTION_TITLE" = "Mostrar barra de desplazamiento"; + "FONT_OPTION_TITLE" = "Activar el cambio de fuente"; "FONT_OPTION_DETAIL_TITLE" = "Opción para permitir cambiar la fuente de Twitter y mostrar el selector de fuentes"; diff --git a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings index 12a588d3..75b0a4d6 100644 --- a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings +++ b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/ja.lproj/Localizable.strings @@ -140,7 +140,9 @@ "FORCE_TWEET_FULL_FRAME_TITLE" = "Twitterで画像を全体表示するように強制する"; "DISABLE_IMMERSIVE_PLAYER_TITLE" = "イマーシブプレーヤーを無効化"; -"DISABLE_IMMERSIVE_PLAYER_DETAIL_TITLE" = "Twitterの新しい動画プレーヤーを無効にする (イマーシブプレーヤー)"; +"DISABLE_IMMERSIVE_PLAYER_DETAIL_TITLE" = "Twitterの新しい動画プレーヤーを無効にします。 (イマーシブプレーヤー)"; + +"SHOW_SCOLL_INDICATOR_OPTION_TITLE" = "スクロールバーを表示します。"; "FONT_OPTION_TITLE" = "カスタムフォントの有効化"; "FONT_OPTION_DETAIL_TITLE" = "Twitterのフォントを変更できるようにします。"; @@ -151,7 +153,7 @@ "DEBUG_SECTION_HEADER_TITLE" = "デバッグ"; "FLEX_OPTION_TITLE" = "FLEXの有効化"; -"FLEX_OPTION_DETAIL_TITLE" = "TwitterアプリでFLEXを表示"; +"FLEX_OPTION_DETAIL_TITLE" = "TwitterアプリでFLEXを表示します。"; "LEGAL_SECTION_HEADER_TITLE" = "法的通知"; "LEGAL_BUTTON_TITLE" = "謝辞"; diff --git a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings index c62d7057..2936e339 100644 --- a/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings +++ b/BHTwitter/Package/Library/Application Support/BHT/BHTwitter.bundle/zh-Hant.lproj/Localizable.strings @@ -142,6 +142,8 @@ "DISABLE_IMMERSIVE_PLAYER_TITLE" = "禁用沉浸式播放器"; "DISABLE_IMMERSIVE_PLAYER_DETAIL_TITLE" = "禁用 Twitter 新版影片播放器(沉浸式播放)"; +"SHOW_SCOLL_INDICATOR_OPTION_TITLE" = "顯示滾動條"; + "FONT_OPTION_TITLE" = "更換字體"; "FONT_OPTION_DETAIL_TITLE" = "啟用此選項,可以更換 Twitter 字體"; diff --git a/BHTwitter/SettingsViewController.m b/BHTwitter/SettingsViewController.m index ee005af3..06362639 100755 --- a/BHTwitter/SettingsViewController.m +++ b/BHTwitter/SettingsViewController.m @@ -206,13 +206,15 @@ - (NSArray *)specifiers { PSSpecifier *showScrollIndicator = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"SHOW_SCOLL_INDICATOR_OPTION_TITLE"] detailTitle:nil key:@"showScollIndicator" defaultValue:false changeAction:nil]; + PSSpecifier *alwaysFollowingPage = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"ALWAYS_FOLLOWING_PAGE_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"ALWAYS_FOLLOWING_PAGE_OPTION_DETAIL_TITLE"] key:@"always_following_page" defaultValue:false changeAction:nil]; + PSSpecifier *font = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"FONT_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"FONT_OPTION_DETAIL_TITLE"] key:@"en_font" defaultValue:false changeAction:nil]; PSSpecifier *regularFontsPicker = [self newButtonCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"REQULAR_FONTS_PICKER_OPTION_TITLE"] detailTitle:[[NSUserDefaults standardUserDefaults] objectForKey:@"bhtwitter_font_1"] dynamicRule:@"en_font, ==, 0" action:@selector(showRegularFontPicker:)]; PSSpecifier *boldFontsPicker = [self newButtonCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"BOLD_FONTS_PICKER_OPTION_TITLE"] detailTitle:[[NSUserDefaults standardUserDefaults] objectForKey:@"bhtwitter_font_2"] dynamicRule:@"en_font, ==, 0" action:@selector(showBoldFontPicker:)]; - // dubug section + // debug section PSSpecifier *flex = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"FLEX_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"FLEX_OPTION_DETAIL_TITLE"] key:@"flex_twitter" defaultValue:false changeAction:@selector(FLEXAction:)]; // legal section @@ -265,6 +267,7 @@ - (NSArray *)specifiers { forceFullFrame, disableImmersive, showScrollIndicator, + alwaysFollowingPage, font, regularFontsPicker, boldFontsPicker, diff --git a/BHTwitter/TWHeaders.h b/BHTwitter/TWHeaders.h index a0012734..512bd47c 100644 --- a/BHTwitter/TWHeaders.h +++ b/BHTwitter/TWHeaders.h @@ -84,6 +84,10 @@ static NSString *_lastCopiedURL; @property (nonatomic, strong) TFNTwitterAccount *account; @end +@interface TFNScrollingHorizontalLabelView : UIView +- (UIViewController *)NearestViewController; +@end + @interface TFNNavigationController : UINavigationController @end