Title: [244404] trunk/Source
- Revision
- 244404
- Author
- [email protected]
- Date
- 2019-04-17 15:41:08 -0700 (Wed, 17 Apr 2019)
Log Message
[iOS] Support multiple file selection in UIDocumentPickerViewController
https://bugs.webkit.org/show_bug.cgi?id=197014
<rdar://problem/49963514>
Reviewed by Tim Horton.
Source/WebCore:
* platform/LocalizedStrings.h:
Exported multipleFileUploadText().
Source/WebKit:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _showDocumentPickerMenu]):
Allowed multiple file selection in our UIDocumentPickerViewController when
_allowMultipleFiles is YES.
(displayStringForDocumentsAtURLs):
(-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
Changed to support multiple file selection. When more than one file is selected, use
WebCore::multipleFileUploadText() as the display string.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (244403 => 244404)
--- trunk/Source/WebCore/ChangeLog 2019-04-17 22:10:03 UTC (rev 244403)
+++ trunk/Source/WebCore/ChangeLog 2019-04-17 22:41:08 UTC (rev 244404)
@@ -1,3 +1,14 @@
+2019-04-17 Andy Estes <[email protected]>
+
+ [iOS] Support multiple file selection in UIDocumentPickerViewController
+ https://bugs.webkit.org/show_bug.cgi?id=197014
+ <rdar://problem/49963514>
+
+ Reviewed by Tim Horton.
+
+ * platform/LocalizedStrings.h:
+ Exported multipleFileUploadText().
+
2019-04-17 John Wilander <[email protected]>
Add prioritization of ad click conversions and cleaning of sent ad click conversions
Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (244403 => 244404)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2019-04-17 22:10:03 UTC (rev 244403)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2019-04-17 22:41:08 UTC (rev 244404)
@@ -236,7 +236,7 @@
String unsupportedPluginText();
WEBCORE_EXPORT String pluginTooSmallText();
- String multipleFileUploadText(unsigned numberOfFiles);
+ WEBCORE_EXPORT String multipleFileUploadText(unsigned numberOfFiles);
String unknownFileSizeText();
#if PLATFORM(WIN)
Modified: trunk/Source/WebKit/ChangeLog (244403 => 244404)
--- trunk/Source/WebKit/ChangeLog 2019-04-17 22:10:03 UTC (rev 244403)
+++ trunk/Source/WebKit/ChangeLog 2019-04-17 22:41:08 UTC (rev 244404)
@@ -1,3 +1,21 @@
+2019-04-17 Andy Estes <[email protected]>
+
+ [iOS] Support multiple file selection in UIDocumentPickerViewController
+ https://bugs.webkit.org/show_bug.cgi?id=197014
+ <rdar://problem/49963514>
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/ios/forms/WKFileUploadPanel.mm:
+ (-[WKFileUploadPanel _showDocumentPickerMenu]):
+ Allowed multiple file selection in our UIDocumentPickerViewController when
+ _allowMultipleFiles is YES.
+
+ (displayStringForDocumentsAtURLs):
+ (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
+ Changed to support multiple file selection. When more than one file is selected, use
+ WebCore::multipleFileUploadText() as the display string.
+
2019-04-17 Alex Christensen <[email protected]>
Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (244403 => 244404)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2019-04-17 22:10:03 UTC (rev 244403)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2019-04-17 22:41:08 UTC (rev 244404)
@@ -413,8 +413,7 @@
NSArray *documentTypes = mediaTypes.count ? mediaTypes : @[(__bridge NSString *)kUTTypeItem];
if (shouldPresentDocumentMenuViewController) {
- // FIXME: UIDocumentMenuViewController is deprecated, we should use UIDocumentPickerViewController instead.
- // FIXME 49963514: Support multiple file selection
+ // FIXME 49979442: UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController instead to support multiple file selection.
_documentMenuController = adoptNS([[UIDocumentMenuViewController alloc] _initIgnoringApplicationEntitlementForImportOfTypes:documentTypes]);
[_documentMenuController setDelegate:self];
@@ -433,8 +432,8 @@
[self _presentMenuOptionForCurrentInterfaceIdiom:_documentMenuController.get()];
} else {
// Image and Video types are not accepted so bypass the menu and open the file picker directly.
- // FIXME 49963514: Support multiple file selection
_documentPickerController = adoptNS([[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeImport]);
+ [_documentPickerController setAllowsMultipleSelection:_allowMultipleFiles];
[_documentPickerController setDelegate:self];
[self _presentFullscreenViewController:_documentPickerController.get() animated:YES];
}
@@ -551,13 +550,21 @@
#pragma mark - UIDocumentPickerControllerDelegate implementation
-- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray <NSURL *> *)urls
+static NSString *displayStringForDocumentsAtURLs(NSArray<NSURL *> *urls)
{
- // FIXME 49963514: Support multiple file selection
- ASSERT(urls.count == 1);
- NSURL *url = ""
+ auto urlsCount = urls.count;
+ ASSERT(urlsCount);
+ if (urlsCount == 1)
+ return urls[0].lastPathComponent;
+
+ return WebCore::multipleFileUploadText(urlsCount);
+}
+
+- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls
+{
+ ASSERT(urls.count);
[self _dismissDisplayAnimated:YES];
- [self _chooseFiles:urls displayString:url.lastPathComponent iconImage:iconForFile(url)];
+ [self _chooseFiles:urls displayString:displayStringForDocumentsAtURLs(urls) iconImage:iconForFile(urls[0])];
}
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)documentPicker
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes