diff options
author | NicoleYarroch <nicole@livio.io> | 2018-05-04 16:33:45 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2018-05-04 16:33:45 -0400 |
commit | e641aff7bab6e2c5fa9c16959f429c1cc36f7bd3 (patch) | |
tree | 0a0b16411d5b859ff2cece6573d41315e782b303 | |
parent | 2a51aa3b92dc8404bda2d3d62c7ba0ab5acc1466 (diff) | |
download | sdl_ios-e641aff7bab6e2c5fa9c16959f429c1cc36f7bd3.tar.gz |
Added `stop` methods to to the screen manager helpers
* added `stop` methods to the screen manager helpers to reset their stored properties on disconnection
* Includes `screenManager`, `menuManager`, `softButtonManager`, `textAndGraphicsManager`, `voiceCommandManager`
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLMenuManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLMenuManager.m | 14 | ||||
-rw-r--r-- | SmartDeviceLink/SDLScreenManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLScreenManager.m | 7 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonManager.m | 7 | ||||
-rw-r--r-- | SmartDeviceLink/SDLTextAndGraphicManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLTextAndGraphicManager.m | 25 | ||||
-rw-r--r-- | SmartDeviceLink/SDLVoiceCommandManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLVoiceCommandManager.m | 11 |
11 files changed, 90 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 854e27848..62deef527 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -228,6 +228,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; [self.fileManager stop]; [self.permissionManager stop]; [self.lockScreenManager stop]; + [self.screenManager stop]; [self.streamManager stop]; [self.systemCapabilityManager stop]; [self.responseDispatcher clear]; diff --git a/SmartDeviceLink/SDLMenuManager.h b/SmartDeviceLink/SDLMenuManager.h index acf1aff99..cd3ead610 100644 --- a/SmartDeviceLink/SDLMenuManager.h +++ b/SmartDeviceLink/SDLMenuManager.h @@ -27,6 +27,11 @@ typedef void(^SDLMenuUpdateCompletionHandler)(NSError *__nullable error); - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager; +/** + * Stops the manager. This method is used internally. + */ +- (void)stop; + @property (copy, nonatomic) NSArray<SDLMenuCell *> *menuCells; @end diff --git a/SmartDeviceLink/SDLMenuManager.m b/SmartDeviceLink/SDLMenuManager.m index 39b6bc91c..4cdc47bc7 100644 --- a/SmartDeviceLink/SDLMenuManager.m +++ b/SmartDeviceLink/SDLMenuManager.m @@ -90,6 +90,20 @@ UInt32 const MenuCellIdMin = 1; return self; } +- (void)stop { + _lastMenuId = MenuCellIdMin; + _menuCells = @[]; + _oldMenuCells = @[]; + + _currentHMILevel = SDLHMILevelNone; + _currentSystemContext = SDLSystemContextMain; + _displayCapabilities = nil; + _inProgressUpdate = nil; + _hasQueuedUpdate = NO; + _waitingOnHMIUpdate = NO; + _waitingUpdateMenuCells = NO; +} + #pragma mark - Setters - (void)setMenuCells:(NSArray<SDLMenuCell *> *)menuCells { diff --git a/SmartDeviceLink/SDLScreenManager.h b/SmartDeviceLink/SDLScreenManager.h index 70d57ccf4..c3dc1e020 100644 --- a/SmartDeviceLink/SDLScreenManager.h +++ b/SmartDeviceLink/SDLScreenManager.h @@ -52,6 +52,11 @@ typedef void(^SDLScreenManagerUpdateCompletionHandler)(NSError *__nullable error - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager; /** + * Stops the manager. This method is used internally. + */ +- (void)stop; + +/** Delays all screen updates until endUpdatesWithCompletionHandler: is called. */ - (void)beginUpdates; diff --git a/SmartDeviceLink/SDLScreenManager.m b/SmartDeviceLink/SDLScreenManager.m index f0de151d2..798659283 100644 --- a/SmartDeviceLink/SDLScreenManager.m +++ b/SmartDeviceLink/SDLScreenManager.m @@ -45,6 +45,13 @@ NS_ASSUME_NONNULL_BEGIN return self; } +- (void)stop { + [self.textAndGraphicManager stop]; + [self.softButtonManager stop]; + [self.menuManager stop]; + [self.voiceCommandMenuManager stop]; +} + - (nullable SDLSoftButtonObject *)softButtonObjectNamed:(NSString *)name { return [self.softButtonManager softButtonObjectNamed:name]; } diff --git a/SmartDeviceLink/SDLSoftButtonManager.h b/SmartDeviceLink/SDLSoftButtonManager.h index 04f646d8d..b163fe599 100644 --- a/SmartDeviceLink/SDLSoftButtonManager.h +++ b/SmartDeviceLink/SDLSoftButtonManager.h @@ -49,6 +49,11 @@ typedef void(^SDLSoftButtonUpdateCompletionHandler)(NSError *__nullable error); - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager; /** + * Stops the manager. This method is used internally. + */ +- (void)stop; + +/** Cause all transitions in between `beginUpdates` and this method call to occur in one RPC update. @param handler The handler called once the update is completed. diff --git a/SmartDeviceLink/SDLSoftButtonManager.m b/SmartDeviceLink/SDLSoftButtonManager.m index 023dcdc85..f419616a6 100644 --- a/SmartDeviceLink/SDLSoftButtonManager.m +++ b/SmartDeviceLink/SDLSoftButtonManager.m @@ -74,6 +74,13 @@ NS_ASSUME_NONNULL_BEGIN return self; } +- (void)stop { + _softButtonObjects = @[]; + _currentMainField1 = nil; + _currentLevel = SDLHMILevelNone; + _waitingOnHMILevelUpdateToSetButtons = NO +} + - (void)setSoftButtonObjects:(NSArray<SDLSoftButtonObject *> *)softButtonObjects { if (self.currentLevel == nil || [self.currentLevel isEqualToString:SDLHMILevelNone]) { _waitingOnHMILevelUpdateToSetButtons = YES; diff --git a/SmartDeviceLink/SDLTextAndGraphicManager.h b/SmartDeviceLink/SDLTextAndGraphicManager.h index 4becbd77d..584c941be 100644 --- a/SmartDeviceLink/SDLTextAndGraphicManager.h +++ b/SmartDeviceLink/SDLTextAndGraphicManager.h @@ -62,6 +62,11 @@ typedef void(^SDLTextAndGraphicUpdateCompletionHandler)(NSError *__nullable erro - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager; /** + * Stops the manager. This method is used internally. + */ +- (void)stop; + +/** Update text fields with new text set into the text field properties. Pass an empty string `\@""` to clear the text field. If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available. diff --git a/SmartDeviceLink/SDLTextAndGraphicManager.m b/SmartDeviceLink/SDLTextAndGraphicManager.m index 7ec1406ea..76a3d8aae 100644 --- a/SmartDeviceLink/SDLTextAndGraphicManager.m +++ b/SmartDeviceLink/SDLTextAndGraphicManager.m @@ -79,6 +79,31 @@ NS_ASSUME_NONNULL_BEGIN return self; } +- (void)stop { + _textField1 = nil; + _textField2 = nil; + _textField3 = nil; + _textField4 = nil; + _mediaTrackTextField = nil; + _primaryGraphic = nil; + _secondaryGraphic = nil; + _alignment = SDLTextAlignmentCenter; + _textField1Type = nil; + _textField2Type = nil; + _textField3Type = nil; + _textField4Type = nil; + + _inProgressUpdate = nil; + _inProgressHandler = nil; + _queuedImageUpdate = nil; + _hasQueuedUpdate = NO; + _queuedUpdateHandler = nil; + _displayCapabilities = nil; + _currentLevel = SDLHMILevelNone; + _blankArtwork = nil; + _isDirty = NO; +} + #pragma mark - Upload / Send - (void)updateWithCompletionHandler:(nullable SDLTextAndGraphicUpdateCompletionHandler)handler { diff --git a/SmartDeviceLink/SDLVoiceCommandManager.h b/SmartDeviceLink/SDLVoiceCommandManager.h index bf8d13fb9..8c3f3f78f 100644 --- a/SmartDeviceLink/SDLVoiceCommandManager.h +++ b/SmartDeviceLink/SDLVoiceCommandManager.h @@ -26,6 +26,11 @@ typedef void(^SDLMenuUpdateCompletionHandler)(NSError *__nullable error); - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager; +/** + * Stops the manager. This method is used internally. + */ +- (void)stop; + @property (copy, nonatomic) NSArray<SDLVoiceCommand *> *voiceCommands; @end diff --git a/SmartDeviceLink/SDLVoiceCommandManager.m b/SmartDeviceLink/SDLVoiceCommandManager.m index 884e5fbf6..d1883d648 100644 --- a/SmartDeviceLink/SDLVoiceCommandManager.m +++ b/SmartDeviceLink/SDLVoiceCommandManager.m @@ -71,6 +71,17 @@ UInt32 const VoiceCommandIdMin = 1900000000; return self; } +- (void)stop { + _lastVoiceCommandId = VoiceCommandIdMin; + _voiceCommands = @[]; + _oldVoiceCommands = @[]; + + _waitingOnHMIUpdate = NO; + _currentHMILevel = SDLHMILevelNone; + _inProgressUpdate = nil; + _hasQueuedUpdate = NO; +} + #pragma mark - Setters - (void)setVoiceCommands:(NSArray<SDLVoiceCommand *> *)voiceCommands { |