diff options
author | Satbir Tanda <satbirtanda@gmail.com> | 2019-06-06 07:29:05 -0700 |
---|---|---|
committer | Satbir Tanda <satbirtanda@gmail.com> | 2019-06-06 07:29:05 -0700 |
commit | 1c5fb44403d3438d195a97193e38534085818466 (patch) | |
tree | 3068799d70d0368e7d0f6d0fdcfeb33345e4de6a | |
parent | bc72422a550e6715c10fb1a35bf76f325e353b41 (diff) | |
download | sdl_ios-1c5fb44403d3438d195a97193e38534085818466.tar.gz |
Properly add and remove gesture
-rw-r--r-- | SmartDeviceLink/SDLLockScreenManager.m | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m index 9f67f537f..110f93926 100644 --- a/SmartDeviceLink/SDLLockScreenManager.m +++ b/SmartDeviceLink/SDLLockScreenManager.m @@ -171,10 +171,17 @@ NS_ASSUME_NONNULL_BEGIN } - (void)sdl_toggleLockscreenDismissalableState { + SDLLockScreenManager *__weak weakSelf = self; if (self.lastDriverDistractionNotification == nil || self.lastDriverDistractionNotification.lockScreenDismissalEnabled == nil) { - self.swipeGesture.enabled = NO; + dispatch_async(dispatch_get_main_queue(), ^{ + SDLLockScreenManager *strongSelf = weakSelf; + [strongSelf.lockScreenViewController.view removeGestureRecognizer:strongSelf.swipeGesture]; + }); } else { - self.swipeGesture.enabled = YES; + dispatch_async(dispatch_get_main_queue(), ^{ + SDLLockScreenManager *strongSelf = weakSelf; + [strongSelf.lockScreenViewController.view addGestureRecognizer:strongSelf.swipeGesture]; + }); } } |