summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-05-06 13:47:11 -0400
committerJoel Fischer <joeljfischer@gmail.com>2020-05-06 13:47:11 -0400
commitf09d619e482fce2f4476a5d80bcb771a707570e7 (patch)
treee75a60e35273e1c9b3be4184a439e7bd7b29902e
parent546c6b93e21237562a897163c05e9ed355407ced (diff)
downloadsdl_ios-f09d619e482fce2f4476a5d80bcb771a707570e7.tar.gz
Start / Stop FocusableItemLocator
* When the video stream manager starts / stops, start / stop the focusable item locator
-rw-r--r--SmartDeviceLink/SDLFocusableItemLocator.m10
-rw-r--r--SmartDeviceLink/SDLFocusableItemLocatorType.h6
-rw-r--r--SmartDeviceLink/SDLStreamingVideoLifecycleManager.m3
3 files changed, 18 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLFocusableItemLocator.m b/SmartDeviceLink/SDLFocusableItemLocator.m
index b4fc294b5..c33745fc2 100644
--- a/SmartDeviceLink/SDLFocusableItemLocator.m
+++ b/SmartDeviceLink/SDLFocusableItemLocator.m
@@ -47,11 +47,19 @@ NS_ASSUME_NONNULL_BEGIN
_focusableViews = [NSMutableArray array];
_enableHapticDataRequests = NO;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_projectionViewUpdated:) name:SDLDidUpdateProjectionView object:nil];
return self;
}
+- (void)start {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_projectionViewUpdated:) name:SDLDidUpdateProjectionView object:nil];
+}
+
+- (void)stop {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [self.focusableViews removeAllObjects];
+}
+
- (void)updateInterfaceLayout {
if (@available(iOS 9.0, *)) {
[self.focusableViews removeAllObjects];
diff --git a/SmartDeviceLink/SDLFocusableItemLocatorType.h b/SmartDeviceLink/SDLFocusableItemLocatorType.h
index 400d9460d..cc43ad207 100644
--- a/SmartDeviceLink/SDLFocusableItemLocatorType.h
+++ b/SmartDeviceLink/SDLFocusableItemLocatorType.h
@@ -36,6 +36,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)initWithViewController:(UIViewController *)viewController connectionManager:(id<SDLConnectionManagerType>)connectionManager videoScaleManager:(SDLStreamingVideoScaleManager *)videoScaleManager;
+/// Start observing updates
+- (void)start;
+
+/// Stop observing updates and clear data
+- (void)stop;
+
/**
updateInterfaceLayout crawls through the view hierarchy, updates and keep tracks of views to be reported through Haptic RPC. This function is automatically called when SDLDidUpdateProjectionView notification is sent by the application.
*/
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
index be9135cb8..ddee38a90 100644
--- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
+++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
@@ -189,6 +189,8 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
}
}
+ [self.focusableItemManager start];
+
// attempt to start streaming since we may already have necessary conditions met
[self sdl_startVideoSession];
}
@@ -204,6 +206,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
_videoStreamingState = SDLVideoStreamingStateNotStreamable;
_protocol = nil;
[self.videoScaleManager stop];
+ [self.focusableItemManager stop];
_connectedVehicleMake = nil;
[self.videoStreamStateMachine transitionToState:SDLVideoStreamManagerStateStopped];