Skip to content

Commit

Permalink
Fix zip selection
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed Sep 16, 2024
1 parent b6ba71c commit f94e607
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions iOS/GBLoadROMTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
NSString *gbUTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)@"gb", NULL);
NSString *gbcUTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)@"gbc", NULL);
NSString *isxUTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)@"isx", NULL);

NSString *zipUTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)@"zip", NULL);

NSMutableSet *extensions = [NSMutableSet set];
[extensions addObjectsFromArray:(__bridge NSArray *)UTTypeCopyAllTagsWithClass((__bridge CFStringRef)gbUTI, kUTTagClassFilenameExtension)];
[extensions addObjectsFromArray:(__bridge NSArray *)UTTypeCopyAllTagsWithClass((__bridge CFStringRef)gbcUTI, kUTTagClassFilenameExtension)];
Expand All @@ -119,16 +120,15 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
return;
}
}

[extensions addObject:@"zip"];


[self.presentingViewController dismissViewControllerAnimated:true completion:^{
UIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"com.github.liji32.sameboy.gb",
@"com.github.liji32.sameboy.gbc",
@"com.github.liji32.sameboy.isx",
gbUTI ?: @"",
gbcUTI ?: @"",
isxUTI ?: @""]
isxUTI ?: @"",
zipUTI ?: @""]
inMode:UIDocumentPickerModeImport];
picker.allowsMultipleSelection = true;
if (@available(iOS 13.0, *)) {
Expand Down Expand Up @@ -156,7 +156,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray <NSURL *>*)urls
{
[(GBViewController *)[UIApplication sharedApplication] handleOpenURLs:urls openInPlace:false];
[(GBViewController *)[UIApplication sharedApplication].delegate handleOpenURLs:urls
openInPlace:false];
}

- (UIModalPresentationStyle)modalPresentationStyle
Expand Down

0 comments on commit f94e607

Please sign in to comment.