diff --git a/BHTwitter/BHDownloadInlineButton.h b/BHTwitter/BHDownloadInlineButton.h index 31911113..5c6a75f9 100644 --- a/BHTwitter/BHDownloadInlineButton.h +++ b/BHTwitter/BHDownloadInlineButton.h @@ -10,29 +10,28 @@ @interface BHDownloadInlineButton : UIButton { - unsigned long long _displayType; - unsigned long long _inlineActionType; + NSUInteger _displayType; + NSUInteger _inlineActionType; T1StatusInlineActionsView *_delegate; id _buttonAnimator; } -+ (CGSize)buttonImageSizeUsingViewModel:(id)arg1 options:(unsigned long long)arg2 overrideButtonSize:(CGSize)arg3 account:(id)arg4; ++ (CGSize)buttonImageSizeUsingViewModel:(id)arg1 options:(NSUInteger)arg2 overrideButtonSize:(CGSize)arg3 account:(id)arg4; @property(retain, nonatomic) id buttonAnimator; @property(retain, nonatomic) T1StatusInlineActionsView *delegate; -@property(nonatomic) unsigned long long inlineActionType; -@property(nonatomic) unsigned long long displayType; -- (id)_t1_imageNamed:(id)arg1 fitSize:(struct CGSize)arg2 fillColor:(id)arg3; -- (void)setTouchInsets:(struct UIEdgeInsets)arg1; +@property(nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; +@property(nonatomic) NSUInteger inlineActionType; +@property(nonatomic) NSUInteger displayType; +- (void)setTouchInsets:(UIEdgeInsets)arg1; +- (id)_t1_imageNamed:(id)arg1 fitSize:(CGSize)arg2 fillColor:(id)arg3; - (_Bool)shouldShowCount; - (double)extraWidth; -- (unsigned long long)touchInsetPriority; -- (unsigned long long)alternateInlineActionType; -- (unsigned long long)visibility; +- (NSUInteger)touchInsetPriority; +- (NSUInteger)alternateInlineActionType; +- (NSUInteger)visibility; - (NSString *)actionSheetTitle; - (_Bool)enabled; - (void)statusDidUpdate:(id)arg1 options:(NSUInteger)arg2 displayTextOptions:(NSUInteger)arg3 animated:(BOOL)arg4; - (void)statusDidUpdate:(id)arg1 options:(NSUInteger)arg2 displayTextOptions:(NSUInteger)arg3 animated:(BOOL)arg4 featureSwitches:(id)arg5; -- (id)initWithOptions:(unsigned long long)arg1 overrideSize:(struct CGSize)arg2 account:(id)arg3; - +- (instancetype)initWithOptions:(NSUInteger)arg1 overrideSize:(CGSize)arg2 account:(id)arg3; @end - diff --git a/BHTwitter/BHDownloadInlineButton.m b/BHTwitter/BHDownloadInlineButton.m index c86b214d..e0b3fe16 100644 --- a/BHTwitter/BHDownloadInlineButton.m +++ b/BHTwitter/BHDownloadInlineButton.m @@ -14,7 +14,9 @@ @interface BHDownloadInlineButton () @end @implementation BHDownloadInlineButton -+ (CGSize)buttonImageSizeUsingViewModel:(id)arg1 options:(unsigned long long)arg2 overrideButtonSize:(CGSize)arg3 account:(id)arg4 { +static const NSString *KEY_HIT_TEST_EDGE_INSETS = @"HitTestEdgeInsets"; + ++ (CGSize)buttonImageSizeUsingViewModel:(id)arg1 options:(NSUInteger)arg2 overrideButtonSize:(CGSize)arg3 account:(id)arg4 { return CGSizeZero; } @@ -31,7 +33,7 @@ - (void)statusDidUpdate:(id)arg1 options:(NSUInteger)arg2 displayTextOptions:(NS [self setTintColor:[UIColor colorFromHexString:@"6D6E70"]]; } } -- (id)initWithOptions:(unsigned long long)arg1 overrideSize:(struct CGSize)arg2 account:(id)arg3 { +- (instancetype)initWithOptions:(NSUInteger)arg1 overrideSize:(CGSize)arg2 account:(id)arg3 { self = [super initWithFrame:CGRectMake(0, 0, arg2.width, arg2.height)]; if (self != nil) { [self setInlineActionType:80]; @@ -41,7 +43,7 @@ - (id)initWithOptions:(unsigned long long)arg1 overrideSize:(struct CGSize)arg2 } return self; } -- (id)_t1_imageNamed:(id)arg1 fitSize:(struct CGSize)arg2 fillColor:(id)arg3 { +- (id)_t1_imageNamed:(id)arg1 fitSize:(CGSize)arg2 fillColor:(id)arg3 { return nil; } - (void)DownloadHandler:(UIButton *)sender { @@ -137,46 +139,88 @@ - (void)DownloadHandler:(UIButton *)sender { TFNMenuSheetViewController *alert = [[objc_getClass("TFNMenuSheetViewController") alloc] initWithActionItems:[NSArray arrayWithArray:actions]]; [alert tfnPresentedCustomPresentFromViewController:topMostController() animated:YES completion:nil]; } -- (void)setTouchInsets:(struct UIEdgeInsets)arg1 { - return; + +- (void)setTouchInsets:(UIEdgeInsets)arg1 { + if ([self.delegate.delegate isKindOfClass:objc_getClass("T1StandardStatusInlineActionsViewAdapter")]) { + [self setImageEdgeInsets:arg1]; + [self setHitTestEdgeInsets:arg1]; + } } + +// https://stackoverflow.com/a/13067285 +- (void)setHitTestEdgeInsets:(UIEdgeInsets)hitTestEdgeInsets { + NSValue *value = [NSValue value:&hitTestEdgeInsets withObjCType:@encode(UIEdgeInsets)]; + objc_setAssociatedObject(self, &KEY_HIT_TEST_EDGE_INSETS, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (UIEdgeInsets)hitTestEdgeInsets { + NSValue *value = objc_getAssociatedObject(self, &KEY_HIT_TEST_EDGE_INSETS); + if (value) { + UIEdgeInsets edgeInsets; [value getValue:&edgeInsets]; return edgeInsets; + } else { + return UIEdgeInsetsZero; + } +} + - (bool)enabled { return true; } + - (NSString *)actionSheetTitle { return @"BHDownload"; } -- (unsigned long long)visibility { + +- (NSUInteger)visibility { return 1; } -- (unsigned long long)alternateInlineActionType { + +- (NSUInteger)alternateInlineActionType { return 6; } -- (unsigned long long)touchInsetPriority { + +- (NSUInteger)touchInsetPriority { return 2; } + - (double)extraWidth { - return 48; + return 40; } + - (bool)shouldShowCount { return false; } -- (unsigned long long)displayType { + +- (NSUInteger)displayType { return self->_displayType; } -- (unsigned long long)inlineActionType { + +- (NSUInteger)inlineActionType { return self->_inlineActionType; } + - (T1StatusInlineActionsView *)delegate { return self->_delegate; } + - (id)buttonAnimator { return self->_buttonAnimator; } + - (void)downloadProgress:(float)progress { self.hud.detailTextLabel.text = [BHTManager getDownloadingPersent:progress]; } +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { + if (UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero) || !self.enabled || self.hidden) { + return [super pointInside:point withEvent:event]; + } + + CGRect relativeFrame = self.bounds; + CGRect hitFrame = UIEdgeInsetsInsetRect(relativeFrame, self.hitTestEdgeInsets); + + return CGRectContainsPoint(hitFrame, point); +} + - (void)downloadDidFinish:(NSURL *)filePath Filename:(NSString *)fileName { NSString *DocPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true).firstObject; NSFileManager *manager = [NSFileManager defaultManager]; diff --git a/BHTwitter/BHTManager.h b/BHTwitter/BHTManager.h index 7494d9ba..5e23b762 100644 --- a/BHTwitter/BHTManager.h +++ b/BHTwitter/BHTManager.h @@ -48,5 +48,6 @@ + (BOOL)alwaysOpenSafari; + (BOOL)hideWhoToFollow; + (BOOL)hideTopicsToFollow; ++ (BOOL)hideViewCount; @end diff --git a/BHTwitter/BHTManager.m b/BHTwitter/BHTManager.m index a430a06e..848d61c3 100644 --- a/BHTwitter/BHTManager.m +++ b/BHTwitter/BHTManager.m @@ -186,6 +186,9 @@ + (BOOL)hideWhoToFollow { + (BOOL)hideTopicsToFollow { return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_topics_to_follow"]; } ++ (BOOL)hideViewCount { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_view_count"]; +} + (UIViewController *)BHTSettingsWithAccount:(TFNTwitterAccount *)twAccount { SettingsViewController *pref = [[SettingsViewController alloc] initWithTwitterAccount:twAccount]; diff --git a/BHTwitter/BHTwitter.xm b/BHTwitter/BHTwitter.xm index ddf4f2be..8ed3593b 100644 --- a/BHTwitter/BHTwitter.xm +++ b/BHTwitter/BHTwitter.xm @@ -457,6 +457,8 @@ tweetView = [(T1StandardStatusView *)actionsView.superview eventHandler]; } else if ([actionsView.superview isKindOfClass:%c(T1TweetDetailsFocalStatusView)]) { // Focus tweet tweetView = [(T1TweetDetailsFocalStatusView *)actionsView.superview eventHandler]; + } else if ([actionsView.superview isKindOfClass:%c(T1ConversationFocalStatusView)]) { // Focus tweet + tweetView = [(T1ConversationFocalStatusView *)actionsView.superview eventHandler]; } else { return %orig; } @@ -487,6 +489,8 @@ tweetView = [(T1StandardStatusView *)actionsView.superview eventHandler]; } else if ([actionsView.superview isKindOfClass:%c(T1TweetDetailsFocalStatusView)]) { // Focus tweet tweetView = [(T1TweetDetailsFocalStatusView *)actionsView.superview eventHandler]; + } else if ([actionsView.superview isKindOfClass:%c(T1ConversationFocalStatusView)]) { // Focus tweet + tweetView = [(T1ConversationFocalStatusView *)actionsView.superview eventHandler]; } else { return %orig; } @@ -518,6 +522,10 @@ [newOrig addObject:%c(BHDownloadInlineButton)]; } + if ([newOrig containsObject:%c(TTAStatusInlineAnalyticsButton)] && [BHTManager hideViewCount]) { + [newOrig removeObject:%c(TTAStatusInlineAnalyticsButton)]; + } + return [newOrig copy]; } %end diff --git a/BHTwitter/Package/DEBIAN/control b/BHTwitter/Package/DEBIAN/control index e530261d..1bf77745 100644 --- a/BHTwitter/Package/DEBIAN/control +++ b/BHTwitter/Package/DEBIAN/control @@ -1,6 +1,6 @@ Package: com.bandarhl.BHTwitter Name: BHTwitter -Version: 3.4 +Version: 3.5 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 50f07801..7eef3bd0 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 f219d083..969b1ba7 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 @@ -131,6 +131,9 @@ "ORIG_TWEET_STYLE_OPTION_TITLE" = "تعطيل النمط الجديد للتغريدة"; "ORIG_TWEET_STYLE_OPTION_DETAIL_TITLE" = "إجبار التطبيق على استخدام النمط الأساسي"; +"HIDE_VIEW_COUNT_OPTION_TITLE" = "إخفاء عدد مُشاهدة التغريدة"; +"HIDE_VIEW_COUNT_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 902ebdfa..f877572a 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 @@ -131,6 +131,9 @@ "ORIG_TWEET_STYLE_OPTION_TITLE" = "Disable edge to edge tweet style"; "ORIG_TWEET_STYLE_OPTION_DETAIL_TITLE" = "Force Twitter to use the original tweet style."; +"HIDE_VIEW_COUNT_OPTION_TITLE" = "Hide view count"; +"HIDE_VIEW_COUNT_OPTION_DETAIL_TITLE" = "Remove view count from tweet"; + "FONT_OPTION_TITLE" = "Enable changing font"; "FONT_OPTION_DETAIL_TITLE" = "Option to allow changing Twitter font and show font picker."; diff --git a/BHTwitter/SettingsViewController.m b/BHTwitter/SettingsViewController.m index de2ec76b..8c6aa9af 100755 --- a/BHTwitter/SettingsViewController.m +++ b/BHTwitter/SettingsViewController.m @@ -196,6 +196,8 @@ - (NSArray *)specifiers { // Layout customization section PSSpecifier *origTweetStyle = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"ORIG_TWEET_STYLE_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"ORIG_TWEET_STYLE_OPTION_DETAIL_TITLE"] key:@"old_style" defaultValue:true changeAction:nil]; + PSSpecifier *hideViewCount = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_VIEW_COUNT_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_VIEW_COUNT_OPTION_DETAIL_TITLE"] key:@"hide_view_count" 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:)]; @@ -249,6 +251,7 @@ - (NSArray *)specifiers { layoutSection, // 2 origTweetStyle, + hideViewCount, font, regularFontsPicker, boldFontsPicker, diff --git a/BHTwitter/TWHeaders.h b/BHTwitter/TWHeaders.h index 27d4984e..a01c5d13 100644 --- a/BHTwitter/TWHeaders.h +++ b/BHTwitter/TWHeaders.h @@ -245,6 +245,10 @@ @property(nonatomic) __weak id eventHandler; @end +@interface T1ConversationFocalStatusView : UIView +@property(nonatomic) __weak id eventHandler; +@end + @interface TFNButtonBarView : UIView @property(nonatomic) double trailingViewsSpacing; @property(nonatomic) double leadingViewsSpacing;