Skip to content

Commit 91c0e72

Browse files
committed
feat: hide suggested users button on profile page
1 parent a72624b commit 91c0e72

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎src/Features/General/NoSuggestedUsers.x‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,40 @@
224224

225225
return [filteredObjs copy];
226226
}
227+
%end
228+
229+
%hook IGProfileActionBarViewModel
230+
- (id)initWithIdentifier:(id)arg1
231+
rows:(id)arg2
232+
allActionsToDisplay:(id)arg3
233+
overflowActions:(id)arg4
234+
actionToBadgeInfoMap:(id)arg5
235+
allBusinessActions:(id)arg6
236+
overflowBusinessActions:(id)arg7
237+
contactSheetActions:(id)arg8
238+
user:(id)arg9
239+
sponsoredInfoProvider:(id)arg10
240+
profileBackgroundColor:(id)arg11
241+
{
242+
NSArray *rows = arg2;
243+
NSOrderedSet *allActions = [arg3 copy];
244+
NSOrderedSet *overflowActions = [arg4 copy];
245+
246+
if ([SCIUtils getBoolPref:@"no_suggested_users"]) {
247+
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NOT (SELF IN %@)", @[ @(3) ]];
248+
249+
// Actions sets
250+
allActions = [allActions filteredOrderedSetUsingPredicate:predicate];
251+
overflowActions = [overflowActions filteredOrderedSetUsingPredicate:predicate];
252+
253+
// Rows of actions sets
254+
NSMutableArray *filteredRows = [NSMutableArray new];
255+
for (NSOrderedSet *set in rows) {
256+
[filteredRows addObject:[set filteredOrderedSetUsingPredicate:predicate]];
257+
}
258+
rows = [filteredRows copy];
259+
}
260+
261+
return %orig(arg1, rows, allActions, overflowActions, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
262+
}
227263
%end

0 commit comments

Comments
 (0)