diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-01-05 11:37:37 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-01-05 11:37:37 -0500 |
commit | 2920d9af3ada4149942b1d5b6553e3bca78cc261 (patch) | |
tree | b2577b8b5a5b16d29231b19812ff9caea0e4194a | |
parent | a03434ff055a40dd696fcde83d24901799bdd268 (diff) | |
download | sdl_ios-2920d9af3ada4149942b1d5b6553e3bca78cc261.tar.gz |
Simplify some CarWindow configuration
-rwxr-xr-x | SmartDeviceLink/SDLCarWindow.m | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaConfiguration.h | 16 | ||||
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaConfiguration.m | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/SmartDeviceLink/SDLCarWindow.m b/SmartDeviceLink/SDLCarWindow.m index cbfe1fef4..adf82cd63 100755 --- a/SmartDeviceLink/SDLCarWindow.m +++ b/SmartDeviceLink/SDLCarWindow.m @@ -42,7 +42,6 @@ NS_ASSUME_NONNULL_BEGIN _streamManager = streamManager; _renderingType = configuration.carWindowRenderingType; - _drawsAfterScreenUpdates = configuration.carWindowDrawsAfterScreenUpdates; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_didReceiveVideoStreamStarted:) name:SDLVideoStreamDidStartNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_didReceiveVideoStreamStopped:) name:SDLVideoStreamDidStopNotification object:nil]; @@ -73,8 +72,11 @@ NS_ASSUME_NONNULL_BEGIN case SDLCarWindowRenderingTypeLayer: { [self.rootViewController.view.layer renderInContext:UIGraphicsGetCurrentContext()]; } break; - case SDLCarWindowRenderingTypeView: { - [self.rootViewController.view drawViewHierarchyInRect:bounds afterScreenUpdates:self.drawsAfterScreenUpdates]; + case SDLCarWindowRenderingTypeViewAfterScreenUpdates: { + [self.rootViewController.view drawViewHierarchyInRect:bounds afterScreenUpdates:YES]; + } break; + case SDLCarWindowRenderingTypeViewBeforeScreenUpdates: { + [self.rootViewController.view drawViewHierarchyInRect:bounds afterScreenUpdates:NO]; } break; } diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.h b/SmartDeviceLink/SDLStreamingMediaConfiguration.h index d68642116..efc3c0897 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.h +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.h @@ -18,7 +18,8 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSUInteger, SDLCarWindowRenderingType) { SDLCarWindowRenderingTypeLayer, - SDLCarWindowRenderingTypeView + SDLCarWindowRenderingTypeViewAfterScreenUpdates, + SDLCarWindowRenderingTypeViewBeforeScreenUpdates }; @interface SDLStreamingMediaConfiguration : NSObject <NSCopying> @@ -61,18 +62,17 @@ typedef NS_ENUM(NSUInteger, SDLCarWindowRenderingType) { Activates the haptic view parser and CarWindow systems when set. This library will also use that information to attempt to return the touched view to you in `SDLTouchManagerDelegate`. - @note If you wish to alter this rootViewController while streaming via CarWindow, you must set a new `rootViewController` on `SDLStreamingMediaManager` and this will update both the haptic view parser and CarWindow. + @note If you wish to alter this `rootViewController` while streaming via CarWindow, you must set a new `rootViewController` on `SDLStreamingMediaManager` and this will update both the haptic view parser and CarWindow. @warning Apps using views outside of the `UIView` heirarchy (such as OpenGL) are currently unsupported. If you app uses partial views in the heirarchy, only those views will be discovered. Your OpenGL views will not be discoverable to a haptic interface head unit and you will have to manually make these views discoverable via the `SDLSendHapticData` RPC request. - @warning This is a weak property and it's therefore your job to hold a strong reference to this view controller. - */ -@property (strong, nonatomic, nullable) UIViewController *rootViewController; + @warning If the `rootViewController` is app UI and is set from the `UIViewController` class, it should only be set after viewDidAppear:animated is called. Setting the `rootViewController` in `viewDidLoad` or `viewWillAppear:animated` can cause weird behavior when setting the new frame. -/** - Declares if CarWindow will wait until after the screen updates to draw. Only applies to view rendering. Defaults to NO. + @warning If setting the `rootViewController` when the app returns to the foreground, the app should register for the `UIApplicationDidBecomeActive` notification and not the `UIApplicationWillEnterForeground` notification. Setting the frame after a notification from the latter can also cause weird behavior when setting the new frame. + + @warning While `viewDidLoad` will fire, appearance methods will not. */ -@property (assign, nonatomic) BOOL carWindowDrawsAfterScreenUpdates; +@property (strong, nonatomic, nullable) UIViewController *rootViewController; /** Declares if CarWindow will use layer rendering or view rendering. Defaults to layer rendering. diff --git a/SmartDeviceLink/SDLStreamingMediaConfiguration.m b/SmartDeviceLink/SDLStreamingMediaConfiguration.m index 1d619fae9..45c5728d7 100644 --- a/SmartDeviceLink/SDLStreamingMediaConfiguration.m +++ b/SmartDeviceLink/SDLStreamingMediaConfiguration.m @@ -39,7 +39,6 @@ NS_ASSUME_NONNULL_BEGIN _dataSource = dataSource; _rootViewController = rootViewController; _carWindowRenderingType = SDLCarWindowRenderingTypeLayer; - _carWindowDrawsAfterScreenUpdates = NO; _enableForcedFramerateSync = YES; return self; @@ -78,7 +77,6 @@ NS_ASSUME_NONNULL_BEGIN SDLStreamingMediaConfiguration *newConfig = [[self.class allocWithZone:zone] initWithSecurityManagers:_securityManagers encryptionFlag:_maximumDesiredEncryption videoSettings:_customVideoEncoderSettings dataSource:_dataSource rootViewController:_rootViewController]; newConfig.carWindowRenderingType = self.carWindowRenderingType; - newConfig.carWindowDrawsAfterScreenUpdates = self.carWindowDrawsAfterScreenUpdates; return newConfig; } |