Skip to content

Commit

Permalink
Update 2.9.7
Browse files Browse the repository at this point in the history
- Add new feature: Theme like Twitter blue
- Add a new feature: Hide spaces bar
- Add a new feature: Disable RTL
- Fix RTL issue with Save tweet as an image
- Fix the colour issue with Save tweet as an image
- Fix voice in DM feature
- Fix issues with the Font feature
- Fix Auto Highest Load feature
  • Loading branch information
BandarHL committed Jul 4, 2022
1 parent 8a01948 commit 5b5a43f
Show file tree
Hide file tree
Showing 14 changed files with 905 additions and 833 deletions.
12 changes: 12 additions & 0 deletions BHTwitter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@
50D73502252CBFC6007838C7 /* SceneKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50D73501252CBFC6007838C7 /* SceneKit.framework */; };
50D73504252CBFD0007838C7 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 50D73503252CBFCB007838C7 /* libsqlite3.tbd */; };
50E7ABEF24F5A8F700A8619D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E7ABEE24F5A8F600A8619D /* WebKit.framework */; };
50EE4D4B286F7F70007DE117 /* BHColorThemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50EE4D4A286F7F70007DE117 /* BHColorThemeViewController.swift */; };
50FCAB7E27268E1600265B5D /* HBlinkCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 50FCAB7C27268E1600265B5D /* HBlinkCell.h */; };
50FCAB7F27268E1600265B5D /* HBlinkCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 50FCAB7D27268E1600265B5D /* HBlinkCell.m */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -1019,6 +1020,7 @@
50D73501252CBFC6007838C7 /* SceneKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SceneKit.framework; path = System/Library/Frameworks/SceneKit.framework; sourceTree = SDKROOT; };
50D73503252CBFCB007838C7 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
50E7ABEE24F5A8F600A8619D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
50EE4D4A286F7F70007DE117 /* BHColorThemeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BHColorThemeViewController.swift; sourceTree = "<group>"; };
50FCAB7C27268E1600265B5D /* HBlinkCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBlinkCell.h; sourceTree = "<group>"; };
50FCAB7D27268E1600265B5D /* HBlinkCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HBlinkCell.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -1123,6 +1125,7 @@
505C0EBD2801ED020028D1C9 /* BHDownloadInlineButton.m */,
50C15C9B271400DA00E8B5E8 /* BHTwitter+UIImage.h */,
50C15C9C271401CB00E8B5E8 /* BHTwitter+NSURL.h */,
50EE4D49286F7F56007DE117 /* ThemeColor */,
5061F3BE2806132400F3D5D3 /* CustomTabBar */,
503FA66D2753F04A00BBB92A /* Classes */,
50C15CA827178C0D00E8B5E8 /* HBPreferences */,
Expand Down Expand Up @@ -2009,6 +2012,14 @@
path = HBPreferences;
sourceTree = "<group>";
};
50EE4D49286F7F56007DE117 /* ThemeColor */ = {
isa = PBXGroup;
children = (
50EE4D4A286F7F70007DE117 /* BHColorThemeViewController.swift */,
);
path = ThemeColor;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -2578,6 +2589,7 @@
503FA9252753F04C00BBB92A /* FLEXKeychain.m in Sources */,
503FA96C2753F04D00BBB92A /* FHSView.m in Sources */,
503FA9392753F04C00BBB92A /* FLEXAddressExplorerCoordinator.m in Sources */,
50EE4D4B286F7F70007DE117 /* BHColorThemeViewController.swift in Sources */,
503FA8412753F04B00BBB92A /* FLEXKeyValueTableViewCell.m in Sources */,
503FA97C2753F04D00BBB92A /* FLEXUtility.m in Sources */,
503FA8722753F04B00BBB92A /* FLEXShortcut.m in Sources */,
Expand Down
4 changes: 1 addition & 3 deletions BHTwitter/BHDownloadInlineButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ - (id)_t1_imageNamed:(id)arg1 fitSize:(struct CGSize)arg2 fillColor:(id)arg3 {
}
- (void)DownloadHandler:(UIButton *)sender {
NSAttributedString *AttString = [[NSAttributedString alloc] initWithString:@"\nSelect video quality you want to download" attributes:@{
NSFontAttributeName: [[objc_getClass("TAEStandardFontGroup") sharedFontGroup] fixedLargeBoldFont],
NSFontAttributeName: [[objc_getClass("TAEStandardFontGroup") sharedFontGroup] headline2BoldFont],
NSForegroundColorAttributeName: UIColor.labelColor
}];
TFNActiveTextItem *title = [[objc_getClass("TFNActiveTextItem") alloc] initWithTextModel:[[objc_getClass("TFNAttributedTextModel") alloc] initWithAttributedString:AttString] activeRanges:nil];
TFNMenuSheetCenteredIconItem *icon = [[objc_getClass("TFNMenuSheetCenteredIconItem") alloc] initWithIconImageName:@"2728" height:55 fillColor:UIColor.clearColor];

NSMutableArray *actions = [[NSMutableArray alloc] init];
[actions addObject:icon];
[actions addObject:title];

for (TFSTwitterEntityMedia *i in self.delegate.viewModel.entities.media) {
Expand Down
4 changes: 3 additions & 1 deletion BHTwitter/BHTManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
+ (BOOL)isVideoCell:(id <T1StatusViewModel>)model;
+ (bool)isDMVideoCell:(T1InlineMediaView *)view;
+ (BOOL)doesContainDigitsOnly:(NSString *)string;
+ (UIViewController *)BHTSettings;
+ (UIViewController *)BHTSettingsWithAccount:(TFNTwitterAccount *)twAccount;
+ (void)showSaveVC:(NSURL *)url;
+ (void)save:(NSURL *)url;
+ (float)TwitterVersion;
Expand Down Expand Up @@ -47,5 +47,7 @@
+ (BOOL)TwitterCircle;
+ (BOOL)CopyProfileInfo;
+ (BOOL)tweetToImage;
+ (BOOL)hideSpacesBar;
+ (BOOL)disableRTL;
@end

66 changes: 56 additions & 10 deletions BHTwitter/BHTManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//

#import "BHTManager.h"
#import "BHTwitter-Swift.h"
#import "BHTwitter+NSURL.h"

@implementation BHTManager
+ (float)TwitterVersion {
Expand Down Expand Up @@ -188,13 +190,22 @@ + (BOOL)CopyProfileInfo {
+ (BOOL)tweetToImage {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"TweetToImage"];
}
+ (UIViewController *)BHTSettings {
+ (BOOL)hideSpacesBar {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_spaces"];
}
+ (BOOL)disableRTL {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"dis_rtl"];
}
+ (UIViewController *)BHTSettingsWithAccount:(TFNTwitterAccount *)twAccount {
HBPreferences *pref = [[HBPreferences alloc] initTableWithTableStyle:UITableViewStyleInsetGrouped title:@"BHTwitter" SeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
[pref.navigationItem setTitleView:[objc_getClass("TFNTitleView") titleViewWithTitle:@"BHTwitter" subtitle:twAccount.displayUsername]];

HBSection *mainSection = [HBSection sectionWithTitle:@"BHTwitter Preferences" footer:nil];
HBSection *twitterBlueSection = [HBSection sectionWithTitle:@"Twitter blue features" footer:@"You may need to restart Twitter app to apply changes"];
HBSection *layoutSection = [HBSection sectionWithTitle:@"Layout customization" footer:@"Restart Twitter app to apply changes"];
HBSection *tabBarLayoutSection = [HBSection sectionWithTitle:@"Tab bar customization" footer:@"Restart Twitter app to apply changes"];
HBSection *debug = [HBSection sectionWithTitle:@"Debugging" footer:nil];
HBSection *developer = [HBSection sectionWithTitle:@"Developer" footer:nil];
HBSection *legalSection = [HBSection sectionWithTitle:@"Legal notices" footer:nil];
HBSection *developer = [HBSection sectionWithTitle:@"Developer" footer:@"BHTwitter v2.9.7"];

HBSwitchCell *download = [[HBSwitchCell alloc] initSwitchCellWithImage:nil Title:@"Downloading videos" DetailTitle:@"Downloading videos. By adding button in tweet and inside video tab bar." switchKey:@"dw_v" withBlock:^(UISwitch *weakSender) {
if (weakSender.isOn) {
Expand Down Expand Up @@ -381,14 +392,30 @@ + (UIViewController *)BHTSettings {
}
}];

HBSwitchCell *tweetToImage = [[HBSwitchCell alloc] initSwitchCellWithImage:nil Title:@"Save tweet as image" DetailTitle:@"You can export tweets as image, by long pressing on the Tweet Share button" switchKey:@"TweetToImage" withBlock:^(UISwitch *weakSender) {
HBSwitchCell *tweetToImage = [[HBSwitchCell alloc] initSwitchCellWithImage:nil Title:@"Save tweet as an image" DetailTitle:@"You can export tweets as image, by long pressing on the Tweet Share button" switchKey:@"TweetToImage" withBlock:^(UISwitch *weakSender) {
if (weakSender.isOn) {
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"TweetToImage"];
} else {
[[NSUserDefaults standardUserDefaults] setBool:false forKey:@"TweetToImage"];
}
}];

HBSwitchCell *hideSpace = [[HBSwitchCell alloc] initSwitchCellWithImage:nil Title:@"Hide spaces bar" DetailTitle:nil switchKey:@"hide_spaces" withBlock:^(UISwitch *weakSender) {
if (weakSender.isOn) {
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"hide_spaces"];
} else {
[[NSUserDefaults standardUserDefaults] setBool:false forKey:@"hide_spaces"];
}
}];

HBSwitchCell *disableRTL = [[HBSwitchCell alloc] initSwitchCellWithImage:nil Title:@"Disable RTL" DetailTitle:@"Force Twitter use LTL with RTL language.\nRestart Twitter app to apply changes" switchKey:@"dis_rtl" withBlock:^(UISwitch *weakSender) {
if (weakSender.isOn) {
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"dis_rtl"];
} else {
[[NSUserDefaults standardUserDefaults] setBool:false forKey:@"dis_rtl"];
}
}];

HBViewControllerCell *fontsPicker = [[HBViewControllerCell alloc] initCellWithTitle:@"Font" detail:[[NSUserDefaults standardUserDefaults] objectForKey:@"bhtwitter_font_1"] action:^UIViewController *{
UIFontPickerViewControllerConfiguration *configuration = [[UIFontPickerViewControllerConfiguration alloc] init];
[configuration setFilteredTraits:UIFontDescriptorClassMask];
Expand All @@ -410,20 +437,31 @@ + (UIViewController *)BHTSettings {
}];

HBViewControllerCell *CustomTabBarVC = [[HBViewControllerCell alloc] initCellWithTitle:@"Custom Tab Bar" detail:nil action:^UIViewController *{
return [[CustomTabBarViewController alloc] init];
CustomTabBarViewController *customTabBArVC = [[CustomTabBarViewController alloc] init];
[customTabBArVC.navigationItem setTitleView:[objc_getClass("TFNTitleView") titleViewWithTitle:@"Custom Tab Bar" subtitle:twAccount.displayUsername]];
return customTabBArVC;
}];

HBViewControllerCell *appTheme = [[HBViewControllerCell alloc] initCellWithTitle:@"Theme" detail:@"Choose a theme color for you Twitter experience that can only be seen by you." action:^UIViewController *{
// I create my own Color Theme ViewController for two main reasons:
// 1- Twitter use swift to build their view controller, so I can't hook anything on it.
// 2- Twitter knows you do not actually subscribe with Twitter Blue, so it keeps resting the changes and resting 'T1ColorSettingsPrimaryColorOptionKey' key, so I had to create another key to track the original one and keep sure no changes, but it still not enough to keep the new theme after relaunching app, so i had to force the changes again with new lunch.
BHColorThemeViewController *themeVC = [[BHColorThemeViewController alloc] init];
[themeVC.navigationItem setTitleView:[objc_getClass("TFNTitleView") titleViewWithTitle:@"Theme" subtitle:twAccount.displayUsername]];
return themeVC;
}];

HBSwitchCell *font = [[HBSwitchCell alloc] initSwitchCellWithImage:nil Title:@"Enable changing font" DetailTitle:@"Option to allow changing Twitter font and show font picker." switchKey:@"en_font" withBlock:^(UISwitch *weakSender) {
if (weakSender.isOn) {
[[NSUserDefaults standardUserDefaults] setBool:true forKey:@"en_font"];
[layoutSection addCells:@[fontsPicker, BoldfontsPicker]];
[pref.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:1], [NSIndexPath indexPathForRow:4 inSection:1]] withRowAnimation:UITableViewRowAnimationAutomatic];
[pref.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:2], [NSIndexPath indexPathForRow:4 inSection:2]] withRowAnimation:UITableViewRowAnimationAutomatic];
} else {
[[NSUserDefaults standardUserDefaults] setBool:false forKey:@"en_font"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"bhtwitter_font_1"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"bhtwitter_font_2"];
[layoutSection removeCells:@[fontsPicker, BoldfontsPicker]];
[pref.tableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:1], [NSIndexPath indexPathForRow:4 inSection:1]] withRowAnimation:UITableViewRowAnimationAutomatic];
[pref.tableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:3 inSection:2], [NSIndexPath indexPathForRow:4 inSection:2]] withRowAnimation:UITableViewRowAnimationAutomatic];
}
}];

Expand All @@ -445,22 +483,30 @@ + (UIViewController *)BHTSettings {
}
}];

HBViewControllerCell *acknowledgements = [[HBViewControllerCell alloc] initCellWithTitle:@"Acknowledgements" detail:nil action:^UIViewController *{
T1RichTextFormatViewController *acknowledgementsVC = [[objc_getClass("T1RichTextFormatViewController") alloc] initWithRichTextFormatDocumentPath:[NSURL bhtwitter_fileURLWithPath:@"Acknowledgements.rtf"].path];
[acknowledgementsVC.navigationItem setTitleView:[objc_getClass("TFNTitleView") titleViewWithTitle:@"Acknowledgements" subtitle:twAccount.displayUsername]];
return acknowledgementsVC;
}];

HBTwitterCell *bandarhl = [[HBTwitterCell alloc] initTwitterCellWithTitle:@"BandarHelal" detail:@"@BandarHL" AccountLink:@"https://twitter.com/BandarHL"];
HBlinkCell *tipJar = [[HBlinkCell alloc] initLinkCellWithTitle:@"Tip Jar" detailTitle:@"Donate" link:@"https://www.paypal.me/BandarHL"];
HBGithubCell *sourceCode = [[HBGithubCell alloc] initGithubCellWithTitle:@"BHTwitter" detailTitle:@"Code source of BHTwitter" GithubURL:@"https://github.com/BandarHL/BHTwitter/"];


[mainSection addCells:@[download, hide_ads, hide_topics, disable_VODCaptions, direct_save, voice, voice_in_replay, UndoTweet, ReaderMode, ReplyLater, VideoZoom, NoHistory, BioTranslate, like_confirm, tweet_confirm, follow_confirm, padlock, DmModularSearch, autoHighestLoad, disableSensitiveTweetWarnings, copyProfileInfo, trustedFriends, tweetToImage]];
[mainSection addCells:@[download, hide_ads, hide_topics, disable_VODCaptions, direct_save, voice, voice_in_replay, ReplyLater, VideoZoom, NoHistory, BioTranslate, like_confirm, tweet_confirm, follow_confirm, padlock, DmModularSearch, autoHighestLoad, disableSensitiveTweetWarnings, copyProfileInfo, tweetToImage, hideSpace, disableRTL]];

[twitterBlueSection addCells:@[UndoTweet, ReaderMode, trustedFriends, appTheme, CustomTabBarVC]];
[layoutSection addCells:@[oldTweetStyle, dwbLayout, font]];
if ([BHTManager changeFont]) {
[layoutSection addCells:@[fontsPicker, BoldfontsPicker]];
}
[tabBarLayoutSection addCell:CustomTabBarVC];

[debug addCell:flex];
[legalSection addCell:acknowledgements];
[developer addCells:@[bandarhl, sourceCode, tipJar]];

[pref addSections:@[mainSection, layoutSection, tabBarLayoutSection, debug, developer]];
[pref addSections:@[mainSection, twitterBlueSection, layoutSection, debug, legalSection, developer]];
return pref;
}

Expand Down
4 changes: 3 additions & 1 deletion BHTwitter/BHTwitter+NSURL.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
if ([fileManager fileExistsAtPath:@"/Library/Application Support/BHT/Ressources.bundle"]) {
return [NSURL fileURLWithPath:[NSString stringWithFormat:@"/Library/Application Support/BHT/Ressources.bundle/%@", path]];
} else {
return [NSURL fileURLWithPath:[NSString stringWithFormat:@"Ressources.bundle/%@", path]];
NSURL *ressourcesBundle = [[NSBundle mainBundle] URLForResource:@"Ressources" withExtension:@"bundle"];
// return [NSURL fileURLWithPath:[NSString stringWithFormat:@"Ressources.bundle/%@", path]];
return [ressourcesBundle URLByAppendingPathComponent:path];
}
}
@end
2 changes: 2 additions & 0 deletions BHTwitter/BHTwitter-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "BHTwitter+UIImage.h"
#import "TWHeaders.h"
Loading

0 comments on commit 5b5a43f

Please sign in to comment.