[iOS] Use UIAlertController API in WKFileUploadPanel instead of SPI
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jul 2014 04:38:13 +0000 (04:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jul 2014 04:38:13 +0000 (04:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134777

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-07-09
Reviewed by Sam Weinig.

* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _showMediaSourceSelectionSheet]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170952 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm

index 862e5a8..d8c45d5 100644 (file)
@@ -1,3 +1,13 @@
+2014-07-09  Joseph Pecoraro  <pecoraro@apple.com>
+
+        [iOS] Use UIAlertController API in WKFileUploadPanel instead of SPI
+        https://bugs.webkit.org/show_bug.cgi?id=134777
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel _showMediaSourceSelectionSheet]):
+
 2014-07-09  Shivakumar JM  <shiva.jm@samsung.com>
 
         [EFL][WK2] Add new Public API in ewk_download_job.h to get size of the data already downloaded.
index 42984c8..46eedca 100644 (file)
@@ -41,7 +41,6 @@
 #import <AVFoundation/AVFoundation.h>
 #import <CoreMedia/CoreMedia.h>
 #import <MobileCoreServices/MobileCoreServices.h>
-#import <UIKit/UIAlertController_Private.h>
 #import <UIKit/UIApplication_Private.h>
 #import <UIKit/UIImagePickerController_Private.h>
 #import <UIKit/UIImage_Private.h>
@@ -388,24 +387,27 @@ static bool stringHasPrefixCaseInsensitive(NSString *str, NSString *prefix)
     else
         cameraString = WEB_UI_STRING_KEY("Take Photo", "Take Photo (file upload action sheet)", "File Upload alert sheet camera button string for taking only photos");
 
-    _actionSheetController = [UIAlertController _alertControllerWithTitle:nil message:nil];
-    [_actionSheetController setPreferredStyle:UIAlertControllerStyleActionSheet];
+    _actionSheetController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
 
-    [_actionSheetController _addActionWithTitle:cancelString style:UIAlertActionStyleCancel handler:^{
+    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelString style:UIAlertActionStyleCancel handler:^(UIAlertAction *){
         [self _cancel];
         // We handled cancel ourselves. Prevent the popover controller delegate from cancelling when the popover dismissed.
         [_presentationPopover setDelegate:nil];
     }];
 
-    [_actionSheetController _addActionWithTitle:cameraString style:UIAlertActionStyleDefault handler:^{
+    UIAlertAction *cameraAction = [UIAlertAction actionWithTitle:cameraString style:UIAlertActionStyleDefault handler:^(UIAlertAction *){
         _usingCamera = YES;
         [self _showPhotoPickerWithSourceType:UIImagePickerControllerSourceTypeCamera];
     }];
 
-    [_actionSheetController _addActionWithTitle:existingString style:UIAlertActionStyleDefault handler:^{
+    UIAlertAction *photoLibraryAction = [UIAlertAction actionWithTitle:existingString style:UIAlertActionStyleDefault handler:^(UIAlertAction *){
         [self _showPhotoPickerWithSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
     }];
 
+    [_actionSheetController addAction:cancelAction];
+    [_actionSheetController addAction:cameraAction];
+    [_actionSheetController addAction:photoLibraryAction];
+
     if (UICurrentUserInterfaceIdiomIsPad())
         [self _presentPopoverWithContentViewController:_actionSheetController.get() animated:YES];
     else