-
-
Save ichitaso/5354245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
static BOOL isActivatingFromLongPress; | |
%hook BrowserToolbar | |
- (void)_installGestureRecognizers | |
{ | |
%orig; | |
id bookmarkButton = MSHookIvar<id>(self, "_bookmarksItem"); | |
UILongPressGestureRecognizer *longGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressBookmarkButton:)]; | |
[[bookmarkButton view] addGestureRecognizer:longGesture]; | |
[longGesture release]; | |
} | |
%new(v@:@) | |
- (void)longPressBookmarkButton:(UIGestureRecognizer *)gesture | |
{ | |
if (gesture.state == UIGestureRecognizerStateBegan) { | |
isActivatingFromLongPress = YES; | |
[BC toggleCloudTabsFromButtonBar]; | |
} | |
} | |
%end | |
%hook CloudTabViewController | |
- (void)_done | |
{ | |
if (isActivatingFromLongPress) { | |
isActivatingFromLongPress = NO; | |
return [self dismissViewControllerAnimated:YES completion:^{}]; | |
} | |
%orig; | |
} | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment