Skip to content

Commit 303f27a

Browse files
committed
feat: hide suggested users on follow requests page
Closes #241
1 parent c9caccd commit 303f27a

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

src/Features/General/NoSuggestedUsers.x

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,45 @@
183183

184184
return %orig(arg1, arg2);
185185
}
186+
%end
187+
188+
// Follow request/discover section (accessed through notifications page)
189+
// Demangled name: IGFriendingCenter.IGFriendingCenterViewController
190+
%hook _TtC17IGFriendingCenter31IGFriendingCenterViewController
191+
- (id)objectsForListAdapter:(id)arg1 {
192+
NSArray *originalObjs = %orig(arg1);
193+
NSMutableArray *filteredObjs = [NSMutableArray arrayWithCapacity:[originalObjs count]];
194+
195+
for (IGStoryTrayViewModel *obj in originalObjs) {
196+
BOOL shouldHide = NO;
197+
198+
if ([SCIUtils getBoolPref:@"no_suggested_users"]) {
199+
200+
// Suggested user
201+
if ([obj isKindOfClass:%c(IGDiscoverPeopleItemConfiguration)]) {
202+
NSLog(@"[SCInsta] Hiding suggested users: follow list suggested user");
203+
204+
shouldHide = YES;
205+
}
206+
207+
// Section header
208+
else if ([obj isKindOfClass:%c(IGLabelItemViewModel)]) {
209+
210+
// "Suggested for you" search results header
211+
if ([[obj valueForKey:@"labelTitle"] isEqualToString:@"Suggested for you"]) {
212+
shouldHide = YES;
213+
}
214+
215+
}
216+
217+
}
218+
219+
// Populate new objs array
220+
if (!shouldHide) {
221+
[filteredObjs addObject:obj];
222+
}
223+
}
224+
225+
return [filteredObjs copy];
226+
}
186227
%end

0 commit comments

Comments
 (0)