Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeBlack committed Sep 24, 2024
1 parent 422bcec commit 0190b26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions TweakLoader/DocumentPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ static void NSFMGuestHooksInit() {
fixFilePicker = [NSBundle.mainBundle.infoDictionary[@"doSymlinkInbox"] boolValue];

swizzle(UIDocumentPickerViewController.class, @selector(initForOpeningContentTypes:asCopy:), @selector(hook_initForOpeningContentTypes:asCopy:));
swizzle(UIDocumentPickerViewController.class, @selector(initWithDocumentTypes:inMode:), @selector(hook_initWithDocumentTypes:inMode:));
swizzle(UIDocumentBrowserViewController.class, @selector(initForOpeningContentTypes:), @selector(hook_initForOpeningContentTypes));
if (fixFilePicker) {
swizzle(NSURL.class, @selector(startAccessingSecurityScopedResource), @selector(hook_startAccessingSecurityScopedResource));
Expand Down Expand Up @@ -44,6 +45,10 @@ - (instancetype)hook_initForOpeningContentTypes:(NSArray<UTType *> *)contentType
}
}

- (instancetype)hook_initWithDocumentTypes:(NSArray<UTType *> *)contentTypes inMode:(NSUInteger)mode {
return [self initForOpeningContentTypes:contentTypes asCopy:(mode == 1 ? NO : YES)];
}

- (void)hook_setAllowsMultipleSelection:(BOOL)allowsMultipleSelection {
if([self allowsMultipleSelection]) {
return;
Expand Down

0 comments on commit 0190b26

Please sign in to comment.