SoCuul / SCInsta

A feature-rich tweak for Instagram on iOS!
186 stars 282 forks source link

feat: hide open camera tab #66

Closed jvcliment closed 5 months ago

jvcliment commented 5 months ago

I have eliminated the Open Camera tab because from the Profile tab the same purpose can be done with the button located next to the three configuration bars in new versions of Instagram. This helps reduce visual noise for those who don't want too many distractions.

This button.

Captura de pantalla 2024-06-17 a las 21 02 07

This is the code that I have used, the HideReelTab code should also be changed by adding the two for loops (the second is optional I think) since it is designed to eliminate the reels tab taking into account that none has been previously deleted.

#import "../../InstagramHeaders.h"
#import "../../Manager.h"

// Hide open camera tab
%hook IGTabBar
- (void)didMoveToWindow {
    %orig;

    if ([SCIManager hideOpenCameraTab]) {
        NSMutableArray *tabButtons = [self valueForKey:@"_tabButtons"];
        NSString *targetLabel = @"Open Camera";

        NSLog(@"[SCInsta] Hiding open camera tab");

        for (NSUInteger i = 0; i < [tabButtons count]; i++) {
            UIButton *button = [tabButtons objectAtIndex:i];
            if ([[button accessibilityLabel] isEqualToString:targetLabel]) {
                [tabButtons removeObjectAtIndex:i];
                break;
            }
        }

        for (UIButton *button in self.subviews) {
            if ([[button accessibilityLabel] isEqualToString:targetLabel]) {
                [button setHidden:YES];
                break;
            }
        }
    }
}
%end
SoCuul commented 5 months ago

What I'm probably gonna do is add a toggle to remove any of the bottom buttons, or possibly rearrange them (if I can implement that). Possibly add a messages button as well.