diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-01-08 09:18:17 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-01-08 09:18:17 -0500 |
commit | eccf8e74c5bb5b43c2e729967c127b1616f0875c (patch) | |
tree | 0cab24d9320b11fbf9d86af151035b1c1752eb4f | |
parent | 2920d9af3ada4149942b1d5b6553e3bca78cc261 (diff) | |
download | sdl_ios-eccf8e74c5bb5b43c2e729967c127b1616f0875c.tar.gz |
Don’t resize the CarWindow rootVC in setRootVC if we are not streaming
-rwxr-xr-x | SmartDeviceLink/SDLCarWindow.m | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLCarWindow.m b/SmartDeviceLink/SDLCarWindow.m index adf82cd63..930ddf801 100755 --- a/SmartDeviceLink/SDLCarWindow.m +++ b/SmartDeviceLink/SDLCarWindow.m @@ -16,6 +16,7 @@ #import "SDLImageResolution.h" #import "SDLLogMacros.h" #import "SDLNotificationConstants.h" +#import "SDLStateMachine.h" #import "SDLStreamingMediaConfiguration.h" #import "SDLStreamingMediaLifecycleManager.h" #import "SDLStreamingMediaManagerConstants.h" @@ -32,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN @property (assign, nonatomic, getter=isLockScreenPresenting) BOOL lockScreenPresenting; @property (assign, nonatomic, getter=isLockScreenDismissing) BOOL lockScreenBeingDismissed; +@property (assign, nonatomic, getter=isVideoStreamStarted) BOOL videoStreamStarted; + @end @implementation SDLCarWindow @@ -110,6 +113,8 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - SDLNavigationLifecycleManager Notifications - (void)sdl_didReceiveVideoStreamStarted:(NSNotification *)notification { + self.videoStreamStarted = true; + dispatch_async(dispatch_get_main_queue(), ^{ // If the video stream has started, we want to resize the streamingViewController to the size from the RegisterAppInterface self.rootViewController.view.frame = CGRectMake(0, 0, self.streamManager.screenSize.width, self.streamManager.screenSize.height); @@ -120,6 +125,8 @@ NS_ASSUME_NONNULL_BEGIN } - (void)sdl_didReceiveVideoStreamStopped:(NSNotification *)notification { + self.videoStreamStarted = false; + dispatch_async(dispatch_get_main_queue(), ^{ // And also reset the streamingViewController's frame, because we are about to show it. self.rootViewController.view.frame = [UIScreen mainScreen].bounds; @@ -129,8 +136,8 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Custom Accessors - (void)setRootViewController:(nullable UIViewController *)rootViewController { - if (rootViewController == nil) { - _rootViewController = nil; + if (rootViewController == nil || !self.isVideoStreamStarted) { + _rootViewController = rootViewController; return; } |