Skip to content

Commit

Permalink
Feat: Show FLEX explorer with 5-finger gesture
Browse files Browse the repository at this point in the history
  • Loading branch information
SoCuul committed Mar 4, 2024
1 parent b8fd970 commit 104f312
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Controllers/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ - (NSArray *)specifiers {

// Section 7: Debugging
[self newSectionWithTitle:@"Debugging" footer:nil],
[self newSwitchCellWithTitle:@"Enable FLEX" detailTitle:@"Show FLEX on instagram app." key:@"flex_instagram" defaultValue:false changeAction:@selector(FLEXAction:)],
[self newSwitchCellWithTitle:@"Enable FLEX gesture" detailTitle:@"Allows you to hold 5 fingers on the screen to open the FLEX explorer" key:@"flex_instagram" defaultValue:false changeAction:@selector(FLEXAction:)],

// Section 8: Credits
[self newSectionWithTitle:@"Credits" footer:nil],
Expand Down
9 changes: 9 additions & 0 deletions src/InstagramHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#import "Controllers/SecurityViewController.h"
#import "../modules/JGProgressHUD/JGProgressHUD.h"

@interface IGRootViewController: UIViewController
- (void)addHandleLongPress; // new
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender; // new
@end

@interface IGViewController: UIViewController
- (void)_superPresentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(id)completion;
@end
Expand Down Expand Up @@ -81,6 +86,7 @@
- (void)addHandleLongPress; // new
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender; // new
@end

@interface IGProfilePicturePreviewViewController () <BHIDownloadDelegate>
@end

Expand All @@ -105,6 +111,7 @@
@property (nonatomic, strong) JGProgressHUD *hud;
@property(readonly, nonatomic) IGMedia *video;
@end

@interface IGSundialViewerVideoCell () <BHIDownloadDelegate>
@end

Expand All @@ -114,6 +121,7 @@
@property (nonatomic, strong) JGProgressHUD *hud;
@property (nonatomic, strong) id delegate;
@end

@interface IGModernFeedVideoCell () <BHIDownloadDelegate>
@end

Expand Down Expand Up @@ -178,6 +186,7 @@
@property (nonatomic, retain) NSString *fileextension;
- (void)hDownloadButtonPressed:(UIButton *)sender;
@end

@interface IGStoryViewerContainerView () <BHIDownloadDelegate>
@end

Expand Down
26 changes: 21 additions & 5 deletions src/Tweak.x
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ static BOOL isAuthenticationShowed = FALSE;
- (void)applicationDidBecomeActive:(id)arg1 {
%orig;

// Show FLEX when application becomes active
if ([BHIManager FLEX]) {
[[objc_getClass("FLEXManager") sharedManager] showExplorer];
}

// Padlock (biometric auth)
if ([BHIManager Padlock] && !isAuthenticationShowed) {
UIViewController *rootController = [[self window] rootViewController];
Expand Down Expand Up @@ -119,6 +114,27 @@ static BOOL isAuthenticationShowed = FALSE;
}
%end

// FLEX explorer gesture handler
%hook IGRootViewController
- (void)viewDidLoad {
%orig;
/* if ([BHIManager profileImageSave]) { */
[self addHandleLongPress];
/* } */
}
%new - (void)addHandleLongPress {
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
longPress.minimumPressDuration = 1;
longPress.numberOfTouchesRequired = 5;
[self.view addGestureRecognizer:longPress];
}
%new - (void)handleLongPress:(UILongPressGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateBegan) {
[[objc_getClass("FLEXManager") sharedManager] showExplorer];
}
}
%end


//////////

Expand Down

0 comments on commit 104f312

Please sign in to comment.