|
7 | 7 | #import <React/RCTUtils.h> |
8 | 8 | #import "RNCPromiseWrapper.h" |
9 | 9 |
|
| 10 | + |
10 | 11 | static NSString *const E_DOCUMENT_PICKER_CANCELED = @"DOCUMENT_PICKER_CANCELED"; |
11 | 12 | static NSString *const E_INVALID_DATA_RETURNED = @"INVALID_DATA_RETURNED"; |
12 | 13 |
|
@@ -87,7 +88,8 @@ - (dispatch_queue_t)methodQueue |
87 | 88 | [promiseWrapper setPromiseWithInProgressCheck:resolve rejecter:reject fromCallSite:@"pick"]; |
88 | 89 |
|
89 | 90 | NSArray *allowedUTIs = [RCTConvert NSArray:options[OPTION_TYPE]]; |
90 | | - UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:(NSArray *)allowedUTIs inMode:mode]; |
| 91 | + UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:allowedUTIs inMode:mode]; |
| 92 | + |
91 | 93 | documentPicker.modalPresentationStyle = presentationStyle; |
92 | 94 |
|
93 | 95 | documentPicker.delegate = self; |
@@ -126,6 +128,7 @@ - (NSMutableDictionary *)getMetadataForUrl:(NSURL *)url error:(NSError **)error |
126 | 128 | [urlsInOpenMode addObject:url]; |
127 | 129 | } |
128 | 130 |
|
| 131 | + // TODO handle error |
129 | 132 | [url startAccessingSecurityScopedResource]; |
130 | 133 |
|
131 | 134 | NSFileCoordinator *coordinator = [NSFileCoordinator new]; |
@@ -158,7 +161,7 @@ - (NSMutableDictionary *)getMetadataForUrl:(NSURL *)url error:(NSError **)error |
158 | 161 | } |
159 | 162 |
|
160 | 163 | if (newURL.pathExtension != nil) { |
161 | | - CFStringRef extension = (__bridge CFStringRef)[newURL pathExtension]; |
| 164 | + CFStringRef extension = (__bridge CFStringRef) newURL.pathExtension; |
162 | 165 | CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension, NULL); |
163 | 166 | CFStringRef mimeType = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType); |
164 | 167 | if (uti) { |
@@ -238,7 +241,8 @@ - (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller |
238 | 241 | [self rejectAsUserCancellationError]; |
239 | 242 | } |
240 | 243 |
|
241 | | -- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController { |
| 244 | +- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController |
| 245 | +{ |
242 | 246 | [self rejectAsUserCancellationError]; |
243 | 247 | } |
244 | 248 |
|
|
0 commit comments