diff options
author | NicoleYarroch <nicole@livio.io> | 2020-06-16 09:53:54 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-06-16 09:53:54 -0400 |
commit | 2d42f7bb8641ef33c56bb22cea30b64576b2a9c2 (patch) | |
tree | 20c1d585b6db77fc89de4206f7c6437f1dfb1d1b | |
parent | 0a23aeb76efa6ab79d80427cccbfc05838e94b0a (diff) | |
download | sdl_ios-2d42f7bb8641ef33c56bb22cea30b64576b2a9c2.tar.gz |
Fixed docs and dispatching to main queue algorithm
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r-- | SmartDeviceLink/SDLLockScreenManager.m | 12 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLockScreenPresenter.m | 12 |
2 files changed, 8 insertions, 16 deletions
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m index cfead40cb..d303f8690 100644 --- a/SmartDeviceLink/SDLLockScreenManager.m +++ b/SmartDeviceLink/SDLLockScreenManager.m @@ -266,15 +266,11 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Threading Utilities -/// Checks if we are already on the main queue. If so, the block is added to the queue; if not, the block is dispatched to the main queue. -/// @discussion Used to ensure that updates to the lock screen UI are done on the main thread. -/// @param block The block to be executed. +/// Dispatches the block to the main queue. +/// @discussion Used to ensure that updates to the lock screen UI are done on the main thread +/// @param block The block to be executed - (void)sdl_runOnMainQueue:(void (^)(void))block { - if ([NSThread isMainThread]) { - block(); - } else { - dispatch_sync(dispatch_get_main_queue(), block); - } + dispatch_async(dispatch_get_main_queue(), block); } @end diff --git a/SmartDeviceLink/SDLLockScreenPresenter.m b/SmartDeviceLink/SDLLockScreenPresenter.m index ea1fd679f..1175670d9 100644 --- a/SmartDeviceLink/SDLLockScreenPresenter.m +++ b/SmartDeviceLink/SDLLockScreenPresenter.m @@ -210,15 +210,11 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Threading Utilities -/// Checks if we are already on the main queue. If so, the block is added to the queue; if not, the block is dispatched to the main queue. -/// @discussion Used to ensure that updates to the lock screen UI are done on the main thread. -/// @param block The block to be executed. +/// Dispatches the block to the main queue. +/// @discussion Used to ensure that updates to the lock screen UI are done on the main thread +/// @param block The block to be executed - (void)sdl_runOnMainQueue:(void (^)(void))block { - if ([NSThread isMainThread]) { - block(); - } else { - dispatch_sync(dispatch_get_main_queue(), block); - } + dispatch_async(dispatch_get_main_queue(), block); } #pragma mark - Custom Presented / Dismissed Getters |