summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-12-13 14:04:05 -0500
committerJoel Fischer <joeljfischer@gmail.com>2017-12-13 14:04:05 -0500
commit23cd45035ae0a21e6d047644845b53dd2186092a (patch)
tree204ba5b51bc65b28e2a024375ea8694b35c89d98
parentdb530d00e105fca277d32a61ee262dc83469c656 (diff)
downloadsdl_ios-23cd45035ae0a21e6d047644845b53dd2186092a.tar.gz
Fixes to CarWindow’s usage of view controllers
-rwxr-xr-xSmartDeviceLink/SDLCarWindow.m13
-rw-r--r--SmartDeviceLink/SDLCarWindowViewController.m4
-rw-r--r--SmartDeviceLink/SDLFocusableItemLocator.h2
-rw-r--r--SmartDeviceLink/SDLFocusableItemLocatorType.h2
-rw-r--r--SmartDeviceLink/SDLLockScreenPresenter.m18
-rw-r--r--SmartDeviceLink/SDLLockScreenViewController.m4
-rw-r--r--SmartDeviceLink/SDLStreamingMediaConfiguration.h2
7 files changed, 22 insertions, 23 deletions
diff --git a/SmartDeviceLink/SDLCarWindow.m b/SmartDeviceLink/SDLCarWindow.m
index a5db14ae8..dfc4377c3 100755
--- a/SmartDeviceLink/SDLCarWindow.m
+++ b/SmartDeviceLink/SDLCarWindow.m
@@ -149,17 +149,14 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Custom Accessors
- (void)setRootViewController:(nullable UIViewController *)rootViewController {
+ _rootViewController = rootViewController;
+
if (rootViewController == nil) {
return;
}
-
- if (!(rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationPortrait ||
- rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeLeft ||
- rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeRight)) {
- NSAssert((rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationPortrait ||
- rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeLeft ||
- rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationLandscapeRight), @"SDLCarWindow rootViewController must support only a single interface orientation");
- }
+ NSAssert((rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationMaskPortrait ||
+ rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationMaskLandscapeLeft ||
+ rootViewController.supportedInterfaceOrientations == UIInterfaceOrientationMaskLandscapeRight), @"SDLCarWindow rootViewController must support only a single interface orientation");
}
#pragma mark - Private Helpers
diff --git a/SmartDeviceLink/SDLCarWindowViewController.m b/SmartDeviceLink/SDLCarWindowViewController.m
index 12bc83401..5f6cbdbde 100644
--- a/SmartDeviceLink/SDLCarWindowViewController.m
+++ b/SmartDeviceLink/SDLCarWindowViewController.m
@@ -41,6 +41,10 @@
// Dispose of any resources that can be recreated.
}
+- (BOOL)shouldAutorotate {
+ return NO;
+}
+
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
if (self.supportedOrientation == 0) {
return UIInterfaceOrientationMaskPortrait;
diff --git a/SmartDeviceLink/SDLFocusableItemLocator.h b/SmartDeviceLink/SDLFocusableItemLocator.h
index 7bfb31d3e..3f065f106 100644
--- a/SmartDeviceLink/SDLFocusableItemLocator.h
+++ b/SmartDeviceLink/SDLFocusableItemLocator.h
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The projection view controller associated with the Haptic Manager
*/
-@property (nonatomic, weak) UIViewController *viewController;
+@property (nonatomic, strong) UIViewController *viewController;
@end
diff --git a/SmartDeviceLink/SDLFocusableItemLocatorType.h b/SmartDeviceLink/SDLFocusableItemLocatorType.h
index a8cd2b8b0..c75d61140 100644
--- a/SmartDeviceLink/SDLFocusableItemLocatorType.h
+++ b/SmartDeviceLink/SDLFocusableItemLocatorType.h
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The projection view controller associated with the Haptic Manager
*/
-@property (nonatomic, weak) UIViewController *viewController;
+@property (nonatomic, strong) UIViewController *viewController;
/**
Initializes haptic interface. After initializing the application must call updateInterfaceLayout to process the UIWindow. Application must update later view changes in the window by sending SDLDidUpdateProjectionView notification.
diff --git a/SmartDeviceLink/SDLLockScreenPresenter.m b/SmartDeviceLink/SDLLockScreenPresenter.m
index dc578a8e5..53ea52fac 100644
--- a/SmartDeviceLink/SDLLockScreenPresenter.m
+++ b/SmartDeviceLink/SDLLockScreenPresenter.m
@@ -45,17 +45,14 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
- // We let ourselves know that the lockscreen will present, because we have to pause streaming video for that 0.3 seconds or else it will be very janky.
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillPresentLockScreenViewController object:nil];
-
dispatch_async(dispatch_get_main_queue(), ^{
+ // We let ourselves know that the lockscreen will present, because we have to pause streaming video for that 0.3 seconds or else it will be very janky.
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillPresentLockScreenViewController object:nil];
+
CGRect firstFrame = appWindow.frame;
firstFrame.origin.x = CGRectGetWidth(firstFrame);
appWindow.frame = firstFrame;
- // Take a screenshot of the appWindow.
- [(SDLScreenshotViewController*)self.lockWindow.rootViewController loadScreenshotOfWindow:appWindow];
-
// We then move the lockWindow to the original appWindow location.
self.lockWindow.frame = appWindow.bounds;
[self.lockWindow makeKeyAndVisible];
@@ -77,14 +74,11 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
- // Let us know we are about to dismiss.
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillDismissLockScreenViewController object:nil];
-
dispatch_async(dispatch_get_main_queue(), ^{
- // Take a screenshot of the appWindow.
- [(SDLScreenshotViewController*)self.lockWindow.rootViewController loadScreenshotOfWindow:appWindow];
+ // Let us know we are about to dismiss.
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLLockScreenManagerWillDismissLockScreenViewController object:nil];
- // Dismiss the lockscreen, showing the screenshot.
+ // Dismiss the lockscreen
SDLLogD(@"Dismiss lock screen window");
[self.lockViewController dismissViewControllerAnimated:YES completion:^{
CGRect lockFrame = self.lockWindow.frame;
diff --git a/SmartDeviceLink/SDLLockScreenViewController.m b/SmartDeviceLink/SDLLockScreenViewController.m
index c69b059bb..f0ef044a0 100644
--- a/SmartDeviceLink/SDLLockScreenViewController.m
+++ b/SmartDeviceLink/SDLLockScreenViewController.m
@@ -39,6 +39,10 @@ NS_ASSUME_NONNULL_BEGIN
return NO;
}
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
+ return UIInterfaceOrientationMaskPortrait;
+}
+
- (UIStatusBarStyle)preferredStatusBarStyle {
BOOL useWhiteIcon = [self.class sdl_shouldUseWhiteForegroundForBackgroundColor:self.backgroundColor];
diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.h b/SmartDeviceLink/SDLStreamingMediaConfiguration.h
index 75896c28b..13e699760 100644
--- a/SmartDeviceLink/SDLStreamingMediaConfiguration.h
+++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.h
@@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
@warning This is a weak property and it's therefore your job to hold a strong reference to this view controller.
*/
-@property (weak, nonatomic, nullable) UIViewController *rootViewController;
+@property (strong, nonatomic, nullable) UIViewController *rootViewController;
/**
Create an insecure video streaming configuration. No security managers will be provided and the encryption flag will be set to None. If you'd like custom video encoder settings, you can set the property manually.