This is an automated email from the ASF dual-hosted git repository.

jcesarmobile pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/cordova-plugin-media-capture.git


The following commit(s) were added to refs/heads/master by this push:
     new 09bc0b1  breaking(ios): remove code warnings (#177)
09bc0b1 is described below

commit 09bc0b1ef5c7e0138279e67bd06ecf3089de1d2d
Author: jcesarmobile <[email protected]>
AuthorDate: Wed Aug 26 00:46:15 2020 +0200

    breaking(ios): remove code warnings (#177)
---
 src/ios/CDVCapture.m | 90 ++++++++++++++--------------------------------------
 1 file changed, 23 insertions(+), 67 deletions(-)

diff --git a/src/ios/CDVCapture.m b/src/ios/CDVCapture.m
index f2fe258..24e111f 100644
--- a/src/ios/CDVCapture.m
+++ b/src/ios/CDVCapture.m
@@ -311,23 +311,27 @@
 
 - (void)showPermissionsAlert
 {
-    __weak CDVCapture* weakSelf = self;
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[[UIAlertView alloc] initWithTitle:[[NSBundle mainBundle]
-                                             
objectForInfoDictionaryKey:@"CFBundleDisplayName"]
-                                    message:NSLocalizedString(@"Access to the 
camera has been prohibited; please enable it in the Settings app to continue.", 
nil)
-                                   delegate:weakSelf
-                          cancelButtonTitle:NSLocalizedString(@"OK", nil)
-                          otherButtonTitles:NSLocalizedString(@"Settings", 
nil), nil] show];
-    });
-}
-
-- (void)alertView:(UIAlertView *)alertView 
clickedButtonAtIndex:(NSInteger)buttonIndex
+    UIAlertController *alertController = [UIAlertController 
alertControllerWithTitle:[[NSBundle mainBundle] 
objectForInfoDictionaryKey:@"CFBundleDisplayName"]
+        message:NSLocalizedString(@"Access to the camera has been prohibited; 
please enable it in the Settings app to continue.", nil)
+        preferredStyle:UIAlertControllerStyleAlert];
+    [alertController addAction:[UIAlertAction 
actionWithTitle:NSLocalizedString(@"OK", nil)
+    style:UIAlertActionStyleDefault
+    handler:^(UIAlertAction * action)
+    {
+        [self returnNoPermissionError];
+    }]];
+    [alertController addAction:[UIAlertAction 
actionWithTitle:NSLocalizedString(@"Settings", nil)
+    style:UIAlertActionStyleDefault
+    handler:^(UIAlertAction * action)
+    {
+        [[UIApplication sharedApplication] openURL:[NSURL 
URLWithString:UIApplicationOpenSettingsURLString]options:@{} 
completionHandler:nil];
+        [self returnNoPermissionError];
+    }]];
+    [self.viewController presentViewController:alertController animated:YES 
completion:^{}];
+}
+
+- (void)returnNoPermissionError
 {
-    if (buttonIndex == 1) {
-        [[UIApplication sharedApplication] openURL:[NSURL 
URLWithString:UIApplicationOpenSettingsURLString]];
-    }
-
     CDVPluginResult* result = [CDVPluginResult 
resultWithStatus:CDVCommandStatus_ERROR 
messageToErrorObject:CAPTURE_PERMISSION_DENIED];
 
     [[pickerController presentingViewController] 
dismissViewControllerAnimated:YES completion:nil];
@@ -588,19 +592,11 @@
 
 @implementation CDVAudioNavigationController
 
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations
 {
     // delegate to CVDAudioRecorderViewController
     return [self.topViewController supportedInterfaceOrientations];
 }
-#else
-- (NSUInteger)supportedInterfaceOrientations
-{
-    // delegate to CVDAudioRecorderViewController
-    return [self.topViewController supportedInterfaceOrientations];
-}
-#endif
 
 @end
 
@@ -654,7 +650,7 @@
     }
 
     // create view and display
-    CGRect viewRect = [[UIScreen mainScreen] applicationFrame];
+    CGRect viewRect = [[UIScreen mainScreen] bounds];
     UIView* tmp = [[UIView alloc] initWithFrame:viewRect];
 
     // make backgrounds
@@ -696,12 +692,7 @@
     // timerLabel.autoresizingMask = reSizeMask;
     [self.timerLabel setBackgroundColor:[UIColor clearColor]];
     [self.timerLabel setTextColor:[UIColor whiteColor]];
-#ifdef __IPHONE_6_0
     [self.timerLabel setTextAlignment:NSTextAlignmentCenter];
-#else
-    // for iOS SDK < 6.0
-    [self.timerLabel setTextAlignment:UITextAlignmentCenter];
-#endif
     [self.timerLabel setText:@"0:00"];
     [self.timerLabel 
setAccessibilityHint:PluginLocalizedString(captureCommand, @"recorded time in 
minutes and seconds", nil)];
     self.timerLabel.accessibilityTraits |= 
UIAccessibilityTraitUpdatesFrequently;
@@ -776,7 +767,6 @@
     }
 }
 
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations
 {
     UIInterfaceOrientationMask orientation = 
UIInterfaceOrientationMaskPortrait;
@@ -785,22 +775,6 @@
     orientation = orientation | (supported & 
UIInterfaceOrientationMaskPortraitUpsideDown);
     return orientation;
 }
-#else
-- (NSUInteger)supportedInterfaceOrientations
-{
-    NSUInteger orientation = UIInterfaceOrientationMaskPortrait; // must 
support portrait
-    NSUInteger supported = [captureCommand.viewController 
supportedInterfaceOrientations];
-
-    orientation = orientation | (supported & 
UIInterfaceOrientationMaskPortraitUpsideDown);
-    return orientation;
-}
-#endif
-
-- (void)viewDidUnload
-{
-    [self setView:nil];
-    [self.captureCommand setInUse:NO];
-}
 
 - (void)processButton:(id)sender
 {
@@ -828,7 +802,7 @@
             } else {
                 if (weakSelf.duration) {
                     weakSelf.isTimed = true;
-                    [weakSelf.avRecorder recordForDuration:[duration 
doubleValue]];
+                    [weakSelf.avRecorder recordForDuration:[weakSelf.duration 
doubleValue]];
                 } else {
                     [weakSelf.avRecorder record];
                 }
@@ -882,7 +856,7 @@
         //BOOL isUIAccessibilityAnnouncementNotification = 
(&UIAccessibilityAnnouncementNotification != NULL);
         if (UIAccessibilityAnnouncementNotification) {
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 500ull * 
NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
-                    
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, 
PluginLocalizedString(captureCommand, @"timed recording complete", nil));
+                
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, 
PluginLocalizedString(self->captureCommand, @"timed recording complete", nil));
                 });
         }
     } else {
@@ -908,10 +882,6 @@
     UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, 
nil);
     // return result
     [self.captureCommand.commandDelegate sendPluginResult:pluginResult 
callbackId:callbackId];
-
-    if (IsAtLeastiOSVersion(@"7.0")) {
-        [[UIApplication sharedApplication] 
setStatusBarStyle:_previousStatusBarStyle];
-    }
 }
 
 - (void)updateTime
@@ -962,18 +932,4 @@
     [self dismissAudioView:nil];
 }
 
-- (UIStatusBarStyle)preferredStatusBarStyle
-{
-    return UIStatusBarStyleDefault;
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    if (IsAtLeastiOSVersion(@"7.0")) {
-        [[UIApplication sharedApplication] setStatusBarStyle:[self 
preferredStatusBarStyle]];
-    }
-
-    [super viewWillAppear:animated];
-}
-
 @end


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to