From 345097ca62eabe7b4ef6f7aa5993e9504db2403e Mon Sep 17 00:00:00 2001 From: Huge_Black Date: Tue, 17 Sep 2024 14:04:51 +0800 Subject: [PATCH] bugfix --- TweakLoader/DocumentPicker.m | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/TweakLoader/DocumentPicker.m b/TweakLoader/DocumentPicker.m index 34c968a..b1ffbac 100644 --- a/TweakLoader/DocumentPicker.m +++ b/TweakLoader/DocumentPicker.m @@ -22,23 +22,17 @@ @implementation UIDocumentPickerViewController(LiveContainerHook) - (instancetype)hook_initForOpeningContentTypes:(NSArray *)contentTypes asCopy:(BOOL)asCopy { - // if app is going to choose any unrecognized file type, then we replace it with @[UTTypeItem, UTTypeFolder]; - NSArray * contentTypesNew = contentTypes; - for(UTType* type in contentTypes) { - if(!type) { - contentTypesNew = @[UTTypeItem, UTTypeFolder]; - break; - } - } - // prevent crash when selecting only folder BOOL shouldMultiselect = NO; - if (fixFilePicker && [contentTypes count] == 1 && contentTypes[0] == UTTypeFolder) { - contentTypesNew = @[UTTypeItem, UTTypeFolder]; shouldMultiselect = YES; } + // if app is going to choose any unrecognized file type, then we replace it with @[UTTypeItem, UTTypeFolder]; + NSArray * contentTypesNew = @[UTTypeItem, UTTypeFolder]; + + + if(fixFilePicker) { UIDocumentPickerViewController* ans = [self hook_initForOpeningContentTypes:contentTypesNew asCopy:YES]; if(shouldMultiselect) {