Files
RyukGram/src/Features/General/Navigation.xm
T
faroukbmiled 0b9992ee30 feat: Confirm story like
feat: Confirm story emoji reaction
feat: Spanish translation
feat: Language switcher + import/export localization from Debug
feat: Swipe down to dismiss media viewer
feat: Manually add users to story/chat exclusion lists by username
feat: Keep stories visually seen locally — split mode (grey ring locally, seen receipt still blockedon server)
feat: Auto-scroll reels — IG default or RyukGram mode, keeps advancing after swiping back (#3)
fix: Messages-only mode — tab swiping disabled
fix: Settings quick-access broken in non-English languages
fix: Story seen-receipt block restored on IG v425+ (Sundial uploader), per-owner, both "Block all" and "Block selected" modes
fix: Block selected mode no longer marks listed stories as seen
imp: Story-interaction pipeline unifies confirm + seen/advance side effects
2026-04-18 00:57:52 +01:00

119 lines
3.5 KiB
Plaintext

#import "../../Utils.h"
BOOL isSurfaceShown(IGMainAppSurfaceIntent *surface) {
BOOL isShown = YES;
// Feed
if ([[surface tabStringFromSurfaceIntent] isEqualToString:@"FEED"] && [SCIUtils getBoolPref:@"hide_feed_tab"]) {
isShown = NO;
}
// Reels
else if ([[surface tabStringFromSurfaceIntent] isEqualToString:@"CLIPS"] && [SCIUtils getBoolPref:@"hide_reels_tab"]) {
isShown = NO;
}
// Messages
else if ([[surface tabStringFromSurfaceIntent] isEqualToString:@"DIRECT"] && [SCIUtils getBoolPref:@"hide_messages_tab"]) {
isShown = NO;
}
// Explore
else if ([[surface tabStringFromSurfaceIntent] isEqualToString:@"SEARCH"] && [SCIUtils getBoolPref:@"hide_explore_tab"]) {
isShown = NO;
}
// Create
else if ([(NSNumber *)[surface valueForKey:@"_subtype"] unsignedIntegerValue] == 3 && [SCIUtils getBoolPref:@"hide_create_tab"]) {
isShown = NO;
}
return isShown;
}
NSArray *filterSurfacesArray(NSArray *surfaces) {
NSMutableArray *filteredSurfaces = [NSMutableArray array];
for (IGMainAppSurfaceIntent *surface in surfaces) {
if (![surface isKindOfClass:%c(IGMainAppSurfaceIntent)]) break;
if (isSurfaceShown(surface)) {
[filteredSurfaces addObject:surface];
}
}
return filteredSurfaces;
}
///////////////////////////////////////////////
%hook IGTabBarControllerSwipeCoordinator
- (id)initWithSurfaces:(id)surfaces parentViewController:(id)controller enableHaptics:(_Bool)haptics launcherSet:(id)set {
// Removes the surface from the main swipeable app collection view
return %orig(filterSurfacesArray(surfaces), controller, haptics, set);
}
%end
%hook IGTabBarController
- (void)_layoutTabBar {
// Prevents the wrong icon from being shown as selected because of mismatched surface array indexes
NSArray *_tabBarSurfaces = [SCIUtils getIvarForObj:self name:"_tabBarSurfaces"];
[SCIUtils setIvarForObj:self name:"_tabBarSurfaces" value:filterSurfacesArray(_tabBarSurfaces)];
%orig;
}
- (id)_buttonForTabBarSurface:(id)surface {
// Prevents the button from being added to the tab bar
id button = %orig(surface);
if (!isSurfaceShown(surface)) {
return nil;
}
return button;
}
%end
// Demangled name: IGNavConfiguration.IGNavConfiguration
%hook _TtC18IGNavConfiguration18IGNavConfiguration
- (NSInteger)tabOrdering {
if ([[SCIUtils getStringPref:@"nav_icon_ordering"] isEqualToString:@"classic"]) return 0;
else if ([[SCIUtils getStringPref:@"nav_icon_ordering"] isEqualToString:@"standard"]) return 1;
else if ([[SCIUtils getStringPref:@"nav_icon_ordering"] isEqualToString:@"alternate"]) return 2;
return %orig;
}
- (void)setTabOrdering:(NSInteger)arg1 {
return;
}
- (BOOL)isTabSwipingEnabled {
// Swipe lands on stripped tabs in messages-only.
if ([SCIUtils getBoolPref:@"messages_only"]) return NO;
if ([[SCIUtils getStringPref:@"swipe_nav_tabs"] isEqualToString:@"enabled"]) return YES;
else if ([[SCIUtils getStringPref:@"swipe_nav_tabs"] isEqualToString:@"disabled"]) return NO;
return %orig;
}
- (void)setIsTabSwipingEnabled:(BOOL)arg1 {
return;
}
%end
%hook IGHomeFeedHeaderView
- (void)didMoveToWindow {
%orig;
if ([SCIUtils getBoolPref:@"hide_messages_tab"]) {
UIButton *rightButton = [self valueForKey:@"rightButton"];
if (rightButton) {
NSLog(@"[SCInsta] Hiding messages tab (on feed)");
[rightButton removeFromSuperview];
}
}
}
%end