55// Created by BandarHelal
66//
77
8+
89#import " SettingsViewController.h"
910#import " BHTBundle/BHTBundle.h"
1011#import " Colours/Colours.h"
1112#import " AppIcon/BHAppIconViewController.h"
1213#import " ThemeColor/BHColorThemeViewController.h"
1314#import " CustomTabBar/BHCustomTabBarViewController.h"
1415
16+ typedef NS_ENUM (NSInteger , TwitterFontWeight) {
17+ TwitterFontWeightRegular,
18+ TwitterFontWeightMedium,
19+ TwitterFontWeightSemibold,
20+ TwitterFontWeightBold
21+ };
22+
23+ typedef NS_ENUM (NSInteger , TwitterFontStyle) {
24+ TwitterFontStyleRegular,
25+ TwitterFontStyleSemibold,
26+ TwitterFontStyleBold
27+ };
28+
29+ static UIFont *TwitterChirpFont (TwitterFontStyle style) {
30+ switch (style) {
31+ case TwitterFontStyleBold:
32+ return [UIFont fontWithName: @" ChirpUIVF_wght3200000_opsz150000" size: 17 ] ?:
33+ [UIFont systemFontOfSize: 17 weight: UIFontWeightBold];
34+
35+ case TwitterFontStyleSemibold:
36+ return [UIFont fontWithName: @" ChirpUIVF_wght2BC0000_opszE0000" size: 14 ] ?:
37+ [UIFont systemFontOfSize: 14 weight: UIFontWeightSemibold];
38+
39+ case TwitterFontStyleRegular:
40+ default :
41+ return [UIFont fontWithName: @" ChirpUIVF_wght1900000_opszE0000" size: 12 ] ?:
42+ [UIFont systemFontOfSize: 12 weight: UIFontWeightRegular];
43+ }
44+ }
1545@interface SettingsViewController () <UIFontPickerViewControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIColorPickerViewControllerDelegate>
1646@property (nonatomic , strong ) TFNTwitterAccount *twAccount;
1747@property (nonatomic , assign ) BOOL hasDynamicSpecifiers;
@@ -66,8 +96,112 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
6696 }
6797}
6898
99+
100+ // Add this method to configure the table view appearance
101+ - (void )viewDidLoad {
102+ [super viewDidLoad ];
103+
104+
105+
106+
107+ // Set the background color to match system background
108+ self.view .backgroundColor = [UIColor systemBackgroundColor ];
109+
110+ // Configure the table view to blend with background
111+ self.table .backgroundColor = [UIColor systemBackgroundColor ];
112+ self.table .separatorColor = [UIColor separatorColor ];
113+
114+ // Remove extra separators below content
115+ self.table .tableFooterView = [UIView new ];
116+ self.table .separatorStyle = UITableViewCellSeparatorStyleNone;
117+
118+ if (@available (iOS 15.0 , *)) {
119+ self.table .sectionHeaderTopPadding = 8 ;
120+ }
121+
122+ // These ensure cells align with headers
123+ self.table .separatorInset = UIEdgeInsetsMake (0 , 16 , 0 , 0 );
124+ self.table .layoutMargins = UIEdgeInsetsMake (0 , 16 , 0 , 16 );
125+
126+
127+ }
128+
129+ - (UIView *)tableView : (UITableView *)tableView viewForHeaderInSection : (NSInteger )section {
130+ NSString *title = [self tableView: tableView titleForHeaderInSection: section];
131+ if (!title) {
132+ return nil ;
133+ }
134+
135+ UIView *headerView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , tableView.frame.size.width, 52 )];
136+
137+ // Top separator - modified to extend full width
138+ UIView *topSeparator = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , tableView.frame.size.width, 0.5 )];
139+ topSeparator.backgroundColor = [UIColor separatorColor ];
140+ topSeparator.autoresizingMask = UIViewAutoresizingFlexibleWidth; // Ensure it stays full width
141+ [headerView addSubview: topSeparator];
142+
143+ // Header label
144+ UILabel *label = [[UILabel alloc ] initWithFrame: CGRectMake (16 , 16 , tableView.frame.size.width - 32 , 28 )];
145+ label.text = title;
146+ label.font = TwitterChirpFont (TwitterFontStyleBold); // 17pt bold
147+ label.textColor = [UIColor labelColor ];
148+ [headerView addSubview: label];
149+
150+ return headerView;
151+ }
152+ - (CGFloat)tableView : (UITableView *)tableView heightForHeaderInSection : (NSInteger )section {
153+ return 52 ; // Increased from 44 to accommodate larger text
154+ }
155+
156+ - (UIView *)tableView : (UITableView *)tableView viewForFooterInSection : (NSInteger )section {
157+ NSString *footerText = [self tableView: tableView titleForFooterInSection: section];
158+ if (!footerText) {
159+ return nil ;
160+ }
161+
162+ UIView *footerView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , tableView.frame.size.width, 44 )];
163+
164+ UILabel *label = [[UILabel alloc ] initWithFrame: CGRectMake (16 , 8 , tableView.frame.size.width - 32 , 36 )];
165+ label.text = footerText;
166+ label.font = TwitterChirpFont (TwitterFontStyleRegular); // 12pt regular
167+ label.textColor = [UIColor secondaryLabelColor ];
168+ label.numberOfLines = 0 ;
169+ [footerView addSubview: label];
170+
171+ return footerView;
172+ }
173+
174+ - (CGFloat)tableView : (UITableView *)tableView heightForFooterInSection : (NSInteger )section {
175+ NSString *footerText = [self tableView: tableView titleForFooterInSection: section];
176+ if (!footerText) {
177+ return CGFLOAT_MIN; // Use minimal height when no footer
178+ }
179+
180+ // Calculate dynamic height
181+ CGFloat width = tableView.frame .size .width - 32 ;
182+ CGRect rect = [footerText boundingRectWithSize: CGSizeMake (width, CGFLOAT_MAX)
183+ options: NSStringDrawingUsesLineFragmentOrigin
184+ attributes: @{NSFontAttributeName : TwitterChirpFont (TwitterFontStyleRegular)}
185+ context: nil ];
186+
187+ return ceil (rect.size .height ) + 24 ; // Top/bottom padding
188+ }
189+
190+ // And replace with this single implementation:
191+ - (void )tableView : (UITableView *)tableView willDisplayCell : (UITableViewCell *)cell forRowAtIndexPath : (NSIndexPath *)indexPath {
192+ // Remove any default separator insets
193+ cell.separatorInset = UIEdgeInsetsMake (0 , 0 , 0 , CGRectGetWidth (tableView.bounds ));
194+
195+ // Set cell background
196+ cell.backgroundColor = [UIColor systemBackgroundColor ];
197+
198+ // Remove selection highlight if needed
199+ cell.selectionStyle = UITableViewCellSelectionStyleDefault;
200+ }
201+
202+
69203- (UITableViewStyle)tableViewStyle {
70- return UITableViewStyleInsetGrouped ;
204+ return UITableViewStyleGrouped ;
71205}
72206
73207- (PSSpecifier *)newSectionWithTitle : (NSString *)header footer : (NSString *)footer {
@@ -226,24 +360,22 @@ - (NSArray *)specifiers {
226360 PSSpecifier *acknowledgements = [self newButtonCellWithTitle: [[BHTBundle sharedBundle ] localizedStringForKey: @" LEGAL_BUTTON_TITLE" ] detailTitle: nil dynamicRule: nil action: @selector (showAcknowledgements: )];
227361
228362 // dvelopers section
363+
364+ PSSpecifier *actuallyaridan = [self newHBTwitterCellWithTitle: @" aridan" twitterUsername: @" actuallyaridan" customAvatarURL: @" https://avatars.githubusercontent.com/u/96298432?v=4" ];
365+ PSSpecifier *timi2506 = [self newHBTwitterCellWithTitle: @" timi2506" twitterUsername: @" timi2506" customAvatarURL: @" https://avatars.githubusercontent.com/u/172171055?v=4" ];
366+ PSSpecifier *nyathea = [self newHBTwitterCellWithTitle: @" nyathea" twitterUsername: @" nyaathea" customAvatarURL: @" https://avatars.githubusercontent.com/u/108613931?v=4" ];
229367 PSSpecifier *bandarHL = [self newHBTwitterCellWithTitle: @" BandarHelal" twitterUsername: @" BandarHL" customAvatarURL: @" https://unavatar.io/twitter/BandarHL" ];
230- PSSpecifier *tipJar = [self newHBLinkCellWithTitle: @" Tip Jar" detailTitle: @" Donate Via Paypal" url: @" https://www.paypal.me/BandarHL" ];
231- PSSpecifier *buymecoffee = [self newHBLinkCellWithTitle: @" Buy Me A Coffee" detailTitle: nil url: @" https://www.buymeacoffee.com/bandarHL" ];
232- PSSpecifier *sourceCode = [self newHBLinkCellWithTitle: @" BHTwitter" detailTitle: @" Code source of BHTwitter" url: @" https://github.com/BandarHL/BHTwitter/" ];
233368
234369 _specifiers = [NSMutableArray arrayWithArray: @[
235370
236371 mainSection, // 0
237- download,
238- hideAds,
239372 customVoice,
240373 hideTopics,
241374 hideWhoToFollow,
242375 hideTopicsToFollow,
243- hidePremiumOffer,
244376 hideTrendVideos,
377+ hideSpace,
245378 videoLayerCaption,
246- directSave,
247379 noHistory,
248380 bioTranslate,
249381 likeConfrim,
@@ -254,14 +386,17 @@ - (NSArray *)specifiers {
254386 disableSensitiveTweetWarnings,
255387 copyProfileInfo,
256388 tweetToImage,
257- hideSpace,
258389 disableRTL,
259390 alwaysOpenSafari,
260391 stripTrackingParams,
261392 urlHost,
262393
263394 twitterBlueSection, // 1
264395 undoTweet,
396+ download,
397+ directSave,
398+ hideAds,
399+ hidePremiumOffer,
265400 appTheme,
266401 appIcon,
267402 customTabBarVC,
@@ -285,10 +420,10 @@ - (NSArray *)specifiers {
285420 flex,
286421
287422 developer, // 5
288- bandarHL ,
289- tipJar ,
290- buymecoffee ,
291- sourceCode
423+ actuallyaridan ,
424+ timi2506 ,
425+ nyathea ,
426+ bandarHL
292427 ]];
293428
294429 [self collectDynamicSpecifiersFromArray: _specifiers];
@@ -503,7 +638,7 @@ - (void)showURLHostSelectionViewController:(PSSpecifier *)specifier {
503638 UITableViewCell *specifierCell = [specifier propertyForKey: PSTableCellKey];
504639 PSSpecifier *selectionSpecifier = [self specifierForID: @" Select URL host" ];
505640
506- UIAlertController *alert = [UIAlertController alertControllerWithTitle: @" BHTwitter " message: @" plaese select what host you prefre " preferredStyle: UIAlertControllerStyleActionSheet];
641+ UIAlertController *alert = [UIAlertController alertControllerWithTitle: @" NeoFreeBird " message: @" URL " preferredStyle: UIAlertControllerStyleActionSheet];
507642
508643 if (alert.popoverPresentationController != nil ) {
509644 CGFloat midX = CGRectGetMidX (specifierCell.frame );
@@ -612,7 +747,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
612747
613748 if ([manager fileExistsAtPath: newImgPath.path]) {
614749 [manager removeItemAtURL: newImgPath error: nil ];
615- }
750+ }
616751
617752 [manager copyItemAtURL: oldImgPath toURL: newImgPath error: nil ];
618753
@@ -633,23 +768,38 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
633768 if (self) {
634769 NSString *subTitle = [specifier.properties[@" subtitle" ] copy ];
635770 BOOL isBig = specifier.properties [@" big" ] ? ((NSNumber *)specifier.properties [@" big" ]).boolValue : NO ;
771+
772+ // Get the default font size and make it bold
773+ UIFont *defaultFont = self.textLabel .font ;
774+ self.textLabel .font = TwitterChirpFont (TwitterFontStyleSemibold); // 14pt semibold
775+
776+ // Keep subtitle style exactly as before
636777 self.detailTextLabel .text = subTitle;
637778 self.detailTextLabel .numberOfLines = isBig ? 0 : 1 ;
638779 self.detailTextLabel .textColor = [UIColor secondaryLabelColor ];
780+ self.detailTextLabel .font = TwitterChirpFont (TwitterFontStyleRegular); // Match footer font
781+ self.selectionStyle = UITableViewCellSelectionStyleDefault; // or .None if you don't want selection highlight
639782 }
640783 return self;
641784}
642-
643785@end
644786
645787@implementation BHSwitchTableCell
646788- (instancetype )initWithStyle : (UITableViewCellStyle)style reuseIdentifier : (NSString *)reuseIdentifier specifier : (PSSpecifier *)specifier {
647789 if ((self = [super initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: reuseIdentifier specifier: specifier])) {
648790 NSString *subTitle = [specifier.properties[@" subtitle" ] copy ];
649791 BOOL isBig = specifier.properties [@" big" ] ? ((NSNumber *)specifier.properties [@" big" ]).boolValue : NO ;
792+
793+ // Get the default font size and make it bold
794+ UIFont *defaultFont = self.textLabel .font ;
795+ self.textLabel .font = TwitterChirpFont (TwitterFontStyleSemibold); // 14pt semibold
796+
797+ // Keep subtitle style exactly as before
650798 self.detailTextLabel .text = subTitle;
651799 self.detailTextLabel .numberOfLines = isBig ? 0 : 1 ;
652800 self.detailTextLabel .textColor = [UIColor secondaryLabelColor ];
801+ self.detailTextLabel .font = TwitterChirpFont (TwitterFontStyleRegular); // Match footer font
802+ self.selectionStyle = UITableViewCellSelectionStyleDefault; // or .None if you don't want selection highlight
653803
654804 if (specifier.properties [@" switchAction" ]) {
655805 UISwitch *targetSwitch = ((UISwitch *)[self control ]);
0 commit comments