Skip to content

Commit

Permalink
fix: no suggested chats functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
SoCuul committed May 17, 2024
1 parent b59f47e commit 78ad3d1
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions src/Features/General/NoSuggestedChats.x
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
#import "../../InstagramHeaders.h"
#import "../../Manager.h"

// Suggested recipients (messages & channels tab)
/* %hook IGDirectInboxSuggestedThreadSectionController
- (id)initWithUserSession:(id)arg1 analyticsModule:(id)arg2 delegate:(id)arg3 igvpController:(id)arg4 viewPointActionBlock:(id)arg5 entryPointProvider:(id)arg6 {
if ([SCIManager noSuggestedChats]) {
NSLog(@"[SCInsta] Hiding suggested chats (recipients: channels tab)");
return nil;
}
return %orig;
}
%end */

// Channels dms tab (header)
%hook IGDirectInboxHeaderSectionController
- (id)viewModel {
if ([[%orig title] isEqualToString:@"Suggested"]) {

if ([SCIManager noSuggestedChats]) {
NSLog(@"[SCInsta] Hiding suggested chats");
NSLog(@"[SCInsta] Hiding suggested chats (header: channels tab)");

return nil;
}
Expand All @@ -18,15 +31,38 @@
}
%end

// Channels dms tab (recipients)
%hook IGDirectInboxSuggestedThreadSectionController
- (id)initWithUserSession:(id)arg1 analyticsModule:(id)arg2 delegate:(id)arg3 igvpController:(id)arg4 viewPointActionBlock:(id)arg5 entryPointProvider:(id)arg6 {
if ([SCIManager noSuggestedChats]) {
NSLog(@"[SCInsta] Hiding suggested chats");
// Messaages dms tab (suggestions header)
%hook IGDirectInboxListAdapterDataSource
- (id)objectsForListAdapter:(id)arg1 {
NSMutableArray *newObjs = [%orig mutableCopy];

return nil;
}
[newObjs enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {

return %orig;
// Section header
if ([obj isKindOfClass:%c(IGDirectInboxHeaderCellViewModel)]) {

// "Suggestions" header
if ([[obj title] isEqualToString:@"Suggestions"]) {
if ([SCIManager hideMetaAI]) {
NSLog(@"[SCInsta] Hiding suggested chats (header: messages tab)");

[newObjs removeObjectAtIndex:idx];
}
}

}

// Suggested recipients
if ([obj isKindOfClass:%c(IGDirectInboxSuggestedThreadCellViewModel)]) {
if ([SCIManager hideMetaAI]) {
NSLog(@"[SCInsta] Hiding suggested chats (recipients: channels tab)");

[newObjs removeObjectAtIndex:idx];
}
}

}];

return [newObjs copy];
}
%end
%end

0 comments on commit 78ad3d1

Please sign in to comment.