Skip to content

Commit

Permalink
Update 3.3
Browse files Browse the repository at this point in the history
- Fix downloading videos from multiple media tweet
- Translate Custom tab bar ViewController
- Translate Theme ViewController
- Update FLEX
  • Loading branch information
BandarHL committed Nov 25, 2022
1 parent 7df9ae2 commit 3607ba0
Show file tree
Hide file tree
Showing 458 changed files with 356 additions and 54,970 deletions.
2,172 changes: 53 additions & 2,119 deletions BHTwitter.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"pins" : [
{
"identity" : "flex",
"kind" : "remoteSourceControl",
"location" : "https://github.com/FLEXTool/FLEX",
"state" : {
"revision" : "e0acf59d06d498041f65bbea1e5914b6e4b39733",
"version" : "5.22.10"
}
},
{
"identity" : "jgprogresshud",
"kind" : "remoteSourceControl",
"location" : "https://github.com/JonasGessner/JGProgressHUD",
"state" : {
"branch" : "master",
"revision" : "103d67f308b8c0c18926061025549af98cdfd6fc"
}
}
],
"version" : 2
}
80 changes: 71 additions & 9 deletions BHTwitter/BHDownloadInlineButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,83 @@ - (void)DownloadHandler:(UIButton *)sender {

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


for (TFSTwitterEntityMedia *i in self.delegate.viewModel.entities.media) {
for (TFSTwitterEntityMediaVideoVariant *k in i.videoInfo.variants) {
if ([k.contentType isEqualToString:@"video/mp4"]) {
TFNActionItem *download = [objc_getClass("TFNActionItem") actionItemWithTitle:[BHTManager getVideoQuality:k.url] imageName:@"arrow_down_circle_stroke" action:^{
BHDownload *DownloadManager = [[BHDownload alloc] init];
[DownloadManager downloadFileWithURL:[NSURL URLWithString:k.url]];
[DownloadManager setDelegate:self];
if (!([BHTManager DirectSave])) {
if ([self.delegate.delegate isKindOfClass:objc_getClass("T1SlideshowStatusView")]) {
T1SlideshowStatusView *selectedMedia = self.delegate.delegate;

for (TFSTwitterEntityMediaVideoVariant *video in selectedMedia.media.videoInfo.variants) {
if ([video.contentType isEqualToString:@"video/mp4"]) {

TFNActionItem *option = [objc_getClass("TFNActionItem") actionItemWithTitle:[BHTManager getVideoQuality:video.url] imageName:@"arrow_down_circle_stroke" action:^{
BHDownload *dwManager = [[BHDownload alloc] init];
[dwManager downloadFileWithURL:[NSURL URLWithString:video.url]];
[dwManager setDelegate:self];

if (![BHTManager DirectSave]) {
self.hud = [JGProgressHUD progressHUDWithStyle:JGProgressHUDStyleDark];
self.hud.textLabel.text = [[BHTBundle sharedBundle] localizedStringForKey:@"PROGRESS_DOWNLOADING_STATUS_TITLE"];
[self.hud showInView:topMostController().view];
}
}];
[actions addObject:download];

[actions addObject:option];
}
}
} else {
if (self.delegate.viewModel.representedMediaEntities.count > 1) {
[self.delegate.viewModel.representedMediaEntities enumerateObjectsUsingBlock:^(TFSTwitterEntityMedia * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {

if (obj.mediaType == 2 || obj.mediaType == 3) {
TFNActionItem *option = [objc_getClass("TFNActionItem") actionItemWithTitle:[NSString stringWithFormat:@"Video %lu", (unsigned long)idx+1] imageName:@"arrow_down_circle_stroke" action:^{

for (TFSTwitterEntityMediaVideoVariant *video in obj.videoInfo.variants) {
if ([video.contentType isEqualToString:@"video/mp4"]) {
TFNActionItem *innerOption = [objc_getClass("TFNActionItem") actionItemWithTitle:[BHTManager getVideoQuality:video.url] imageName:@"arrow_down_circle_stroke" action:^{

BHDownload *dwManager = [[BHDownload alloc] init];
[dwManager downloadFileWithURL:[NSURL URLWithString:video.url]];
[dwManager setDelegate:self];

if (![BHTManager DirectSave]) {
self.hud = [JGProgressHUD progressHUDWithStyle:JGProgressHUDStyleDark];
self.hud.textLabel.text = [[BHTBundle sharedBundle] localizedStringForKey:@"PROGRESS_DOWNLOADING_STATUS_TITLE"];
[self.hud showInView:topMostController().view];
}

}];

[innerActions addObject:innerOption];
}
}

TFNMenuSheetViewController *innerAlert = [[objc_getClass("TFNMenuSheetViewController") alloc] initWithActionItems:[NSArray arrayWithArray:innerActions]];
[innerAlert tfnPresentedCustomPresentFromViewController:topMostController() animated:YES completion:nil];
}];

[actions addObject:option];
}
}];
} else {
for (TFSTwitterEntityMediaVideoVariant *video in self.delegate.viewModel.representedMediaEntities.firstObject.videoInfo.variants) {
if ([video.contentType isEqualToString:@"video/mp4"]) {

TFNActionItem *option = [objc_getClass("TFNActionItem") actionItemWithTitle:[BHTManager getVideoQuality:video.url] imageName:@"arrow_down_circle_stroke" action:^{
BHDownload *dwManager = [[BHDownload alloc] init];
[dwManager downloadFileWithURL:[NSURL URLWithString:video.url]];
[dwManager setDelegate:self];

if (![BHTManager DirectSave]) {
self.hud = [JGProgressHUD progressHUDWithStyle:JGProgressHUDStyleDark];
self.hud.textLabel.text = [[BHTBundle sharedBundle] localizedStringForKey:@"PROGRESS_DOWNLOADING_STATUS_TITLE"];
[self.hud showInView:topMostController().view];
}
}];

[actions addObject:option];
}
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions BHTwitter/BHTManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,7 @@ + (NSString *)getVideoQuality:(NSString *)url {
return [NSString stringWithFormat:@"%@x%@", q.firstObject, q.lastObject];
}
+ (BOOL)isVideoCell:(id <T1StatusViewModel>)model {
TFSTwitterEntityMedia *i = model.entities.media.firstObject;
if (i.videoInfo == nil) {
return false;
} else {
return true;
}
return model.isMediaEntityVideo || model.isGIF;
}
+ (void)save:(NSURL *)url {
[[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
Expand Down
1 change: 1 addition & 0 deletions BHTwitter/BHTwitter-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
//

#import "TWHeaders.h"
#import "BHTBundle.h"
14 changes: 7 additions & 7 deletions BHTwitter/BHTwitter.xm
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@
%hook T1TweetComposeViewController
- (void)_t1_didTapSendButton:(UIButton *)tweetButton {
if ([BHTManager TweetConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand All @@ -771,7 +771,7 @@
}
- (void)_t1_handleTweet {
if ([BHTManager TweetConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand Down Expand Up @@ -800,7 +800,7 @@
%hook TUIFollowControl
- (void)_followUser:(id)arg1 event:(id)arg2 {
if ([BHTManager FollowConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand All @@ -817,7 +817,7 @@
%hook TTAStatusInlineFavoriteButton
- (void)didTap {
if ([BHTManager LikeConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand All @@ -833,7 +833,7 @@
%hook T1StatusInlineFavoriteButton
- (void)didTap {
if ([BHTManager LikeConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand All @@ -849,7 +849,7 @@
%hook T1ImmersiveExploreCardView
- (void)handleDoubleTap:(id)arg1 {
if ([BHTManager LikeConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand All @@ -865,7 +865,7 @@
%hook T1TweetDetailsViewController
- (void)_t1_toggleFavoriteOnCurrentStatus {
if ([BHTManager LikeConfirm]) {
[FLEXAlert makeAlert:^(FLEXAlert *make) {
[%c(FLEXAlert) makeAlert:^(FLEXAlert *make) {
make.message([[BHTBundle sharedBundle] localizedStringForKey:@"CONFIRM_ALERT_MESSAGE"]);
make.button([[BHTBundle sharedBundle] localizedStringForKey:@"YES_BUTTON_TITLE"]).handler(^(NSArray<NSString *> *strings) {
%orig;
Expand Down

This file was deleted.

Loading

0 comments on commit 3607ba0

Please sign in to comment.