Skip to content
Permalink
Browse files
CB-9249 Fix iOS warnings in Media Capture plugin
  • Loading branch information
macdonst committed Sep 1, 2015
1 parent 3e73fce commit 4c85fa5f1a09d2c7e6c97edba3e13a7d8f3107f5
Showing 1 changed file with 34 additions and 18 deletions.
@@ -544,12 +544,18 @@ - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker

@implementation CDVAudioNavigationController

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
- (NSUInteger)supportedInterfaceOrientations
{
// delegate to CVDAudioRecorderViewController
return [self.topViewController supportedInterfaceOrientations];
}
#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
@@ -709,7 +715,8 @@ - (void)viewDidLoad
NSURL* fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];

// create AVAudioPlayer
self.avRecorder = [[AVAudioRecorder alloc] initWithURL:fileURL settings:nil error:&err];
NSDictionary *recordSetting = [[NSMutableDictionary alloc] init];
self.avRecorder = [[AVAudioRecorder alloc] initWithURL:fileURL settings:recordSetting error:&err];
if (err) {
NSLog(@"Failed to initialize AVAudioRecorder: %@\n", [err localizedDescription]);
self.avRecorder = nil;
@@ -724,15 +731,24 @@ - (void)viewDidLoad
}
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger orientation = UIInterfaceOrientationMaskPortrait; // must support portrait
NSUInteger supported = [captureCommand.viewController supportedInterfaceOrientations];

orientation = orientation | (supported & UIInterfaceOrientationMaskPortraitUpsideDown);
return orientation;
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
UIInterfaceOrientationMask orientation = UIInterfaceOrientationMaskPortrait;
UIInterfaceOrientationMask supported = [captureCommand.viewController supportedInterfaceOrientations];

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
@@ -816,8 +832,8 @@ - (void)stopRecordingCleanup
}
if (self.duration && self.isTimed) {
// VoiceOver announcement so user knows timed recording has finished
BOOL isUIAccessibilityAnnouncementNotification = (&UIAccessibilityAnnouncementNotification != NULL);
if (isUIAccessibilityAnnouncementNotification) {
//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));
});

0 comments on commit 4c85fa5

Please sign in to comment.