Skip to content

Commit

Permalink
feat: hide meta ai in direct message composer
Browse files Browse the repository at this point in the history
  • Loading branch information
SoCuul committed Jun 28, 2024
1 parent 66e7f17 commit 9e8574b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/Features/General/HideMetaAI.xm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,48 @@ accessibilityTraits:(NSUInteger)arg5
}
%end

// Meta AI in message composer
%hook IGDirectCommandSystemListViewController
- (id)objectsForListAdapter:(id)arg1 {
NSMutableArray *newObjs = [%orig mutableCopy];

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

if ([obj isKindOfClass:%c(IGDirectCommandSystemViewModel)]) {

IGDirectCommandSystemViewModel *typedObj = (IGDirectCommandSystemViewModel *)obj;
IGDirectCommandSystemRow *cmdSystemRow = (IGDirectCommandSystemRow *)[typedObj row];

IGDirectCommandSystemResult *_commandResult_command = MSHookIvar<IGDirectCommandSystemResult *>(cmdSystemRow, "_commandResult_command");

// Meta AI
if ([[_commandResult_command title] isEqualToString:@"Meta AI"]) {
if ([SCIManager hideMetaAI]) {
NSLog(@"[SCInsta] Hiding meta ai: direct message composer suggestion");

[newObjs removeObjectAtIndex:idx];
}

}

// Meta AI (Imagine)
if ([[_commandResult_command commandString] isEqualToString:@"/imagine"]) {
if ([SCIManager hideMetaAI]) {
NSLog(@"[SCInsta] Hiding meta ai: direct message composer /imagine suggestion");

[newObjs removeObjectAtIndex:idx];
}

}

}

}];

return [newObjs copy];
}
%end

/////////////////////////////////////////////////////////////////////////////

// Explore
Expand Down
12 changes: 12 additions & 0 deletions src/InstagramHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,18 @@
@interface IGAnimatablePlaceholderTextField : UITextField
@end

@interface IGDirectCommandSystemViewModel : NSObject
- (id)row;
@end

@interface IGDirectCommandSystemRow : NSObject
@end

@interface IGDirectCommandSystemResult : NSObject
- (id)title;
- (id)commandString;
@end




Expand Down

0 comments on commit 9e8574b

Please sign in to comment.