Skip to content

Commit

Permalink
feat: hide suggested reels
Browse files Browse the repository at this point in the history
* This might be unstable.
* It remove suggested reels in the data source (same as ads hiding)
* Immediately hide suggested reels when they appear loading at the end of the feed
  • Loading branch information
vlourme committed Feb 4, 2024
1 parent 0eb4ca9 commit 5282260
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Controllers/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ - (NSArray *)specifiers {
// Section 5: Focus mode
[self newSectionWithTitle:@"Focus mode" footer:nil],
[self newSwitchCellWithTitle:@"Hide Reels tab" detailTitle:@"Remove the access to Instagram Reels feed" key:@"remove_reels_tab" defaultValue:false changeAction:nil],
[self newSwitchCellWithTitle:@"Remove Explore posts" detailTitle:@"Remove every posts in Explore tab (search still works)." key:@"remove_explore_posts" defaultValue:false changeAction:nil],
[self newSwitchCellWithTitle:@"Remove Explore posts" detailTitle:@"Remove every posts in Explore tab (search still works)" key:@"remove_explore_posts" defaultValue:false changeAction:nil],
[self newSwitchCellWithTitle:@"Hide suggested reels" detailTitle:@"Hide suggested reels in main feed" key:@"remove_suggested_reels" defaultValue:false changeAction:nil],

// Section 6: Security
[self newSectionWithTitle:@"Security" footer:nil],
Expand Down
6 changes: 6 additions & 0 deletions src/InstagramHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
- (id)initWithReuseIdentifier:(NSString *)identifier;
@end

@interface IGListCollectionView: UICollectionView
@end

@interface _IGListScrollWhileAnimateCollectionView: IGListCollectionView
@end

@interface IGProfileSheetTableViewCell: IGTableViewCell
@end

Expand Down
1 change: 1 addition & 0 deletions src/Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
+ (BOOL)hideLastSeen;
+ (BOOL)hideReelsTab;
+ (BOOL)removeExplorePosts;
+ (BOOL)hideSuggestedReels;
+ (BOOL)noScreenShotAlert;
+ (BOOL)unlimitedReplay;
+ (BOOL)noSeenReceipt;
Expand Down
3 changes: 3 additions & 0 deletions src/Manager.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ + (BOOL)hideReelsTab {
+ (BOOL)removeExplorePosts {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"remove_explore_posts"];
}
+ (BOOL)hideSuggestedReels {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"remove_suggested_reels"];
}
+ (BOOL)noScreenShotAlert {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"remove_screenshot_alert"];
}
Expand Down
21 changes: 21 additions & 0 deletions src/Tweak.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ static NSArray *removeAdsItemsInList(NSArray *list) {
}
}

if ([BHIManager hideSuggestedReels]) {
if ([obj respondsToSelector:@selector(accessibilityLabel)] && [[obj accessibilityLabel] isEqualToString:@"Suggested reels"]) {
[orig removeObjectAtIndex:idx];
}
}

if (([obj isKindOfClass:%c(IGFeedItem)] && ([obj isSponsored] || [obj isSponsoredApp])) || [obj isKindOfClass:%c(IGAdItem)]) {
[orig removeObjectAtIndex:idx];
}
Expand Down Expand Up @@ -120,6 +126,21 @@ static BOOL isAuthenticationShowed = FALSE;
}
%end

// Hide suggested reels
%hook _IGListScrollWhileAnimateCollectionView
- (void)_didModifySections:(id)arg1 {
if ([BHIManager hideSuggestedReels]) {
for (UIView *subview in self.subviews) {
if ([subview respondsToSelector:@selector(accessibilityLabel)] && [[subview accessibilityLabel] isEqualToString:@"Suggested reels"]) {
[subview setHidden:YES];
}
}
}

return %orig;
}
%end

// Keep deleted messages
%hook IGDirectRealtimeIrisThreadDelta
+ (id)removeItemWithMessageId:(id)arg1 {
Expand Down

0 comments on commit 5282260

Please sign in to comment.