diff options
author | Satbir Tanda <satbirtanda@gmail.com> | 2019-07-02 17:03:30 -0700 |
---|---|---|
committer | Satbir Tanda <satbirtanda@gmail.com> | 2019-07-02 17:03:30 -0700 |
commit | 2ecbbe7951830e7f2d48e8ac6819d242424248ef (patch) | |
tree | 477b2ef31776a0fe68ae53711d12ac6934345ac4 | |
parent | 47d2caae9cf4a01c0f8b92c2c331ad2a9d73bc55 (diff) | |
download | sdl_ios-2ecbbe7951830e7f2d48e8ac6819d242424248ef.tar.gz |
Parse & Set lockScreenDismissalWarning
Fix merge conflicts for 6.3.0
-rw-r--r-- | SmartDeviceLink/SDLLockScreenManager.m | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLOnDriverDistraction.h | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLOnDriverDistraction.m | 13 | ||||
-rw-r--r-- | SmartDeviceLink/SDLRPCParameterNames.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLRPCParameterNames.m | 1 |
5 files changed, 24 insertions, 7 deletions
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m index 9c505efc2..6bf604a11 100644 --- a/SmartDeviceLink/SDLLockScreenManager.m +++ b/SmartDeviceLink/SDLLockScreenManager.m @@ -182,25 +182,23 @@ NS_ASSUME_NONNULL_BEGIN } - (void)sdl_toggleLockscreenDismissalableWithState:(BOOL)enabled { + // If the VC is our special type, then set the locked label text and swipe gesture. If they passed in a custom VC, there's no current way to update locked label text or swipe gesture. If they're managing it themselves, they can grab the notification themselves. if (![self.lockScreenViewController isKindOfClass:[UIViewController class]]) { return; } - + SDLLockScreenManager *__weak weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ SDLLockScreenManager *strongSelf = weakSelf; if (enabled) { [strongSelf.lockScreenViewController.view addGestureRecognizer:strongSelf.swipeGesture]; - // If the VC is our special type, then set the locked label text. If they passed in a custom VC, there's no current way to update locked label text. If they're managing it themselves, they can grab the notification themselves. - // Translations needed if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) { - ((SDLLockScreenViewController *)self.lockScreenViewController).lockedLabelText = NSLocalizedString(@"Swipe up to dismiss", nil); + ((SDLLockScreenViewController *)self.lockScreenViewController).lockedLabelText = self.lastDriverDistractionNotification.lockScreenDismissalWarning; } } else { [strongSelf.lockScreenViewController.view removeGestureRecognizer:strongSelf.swipeGesture]; - // If the VC is our special type, then set the locked label text. If they passed in a custom VC, there's no current way to update locked label text. If they're managing it themselves, they can grab the notification themselves. if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) { ((SDLLockScreenViewController *)self.lockScreenViewController).lockedLabelText = nil; } diff --git a/SmartDeviceLink/SDLOnDriverDistraction.h b/SmartDeviceLink/SDLOnDriverDistraction.h index 56a854d5f..6c4010153 100644 --- a/SmartDeviceLink/SDLOnDriverDistraction.h +++ b/SmartDeviceLink/SDLOnDriverDistraction.h @@ -34,6 +34,14 @@ NS_ASSUME_NONNULL_BEGIN */ @property (strong, nonatomic) NSNumber<SDLBool> *lockScreenDismissalEnabled; +/** + Warning message to be displayed on the lock screen when dismissal is enabled. + This warning should be used to ensure that the user is not the driver of the vehicle, + ex. `Swipe up to dismiss, acknowledging that you are not the driver.`. + This parameter must be present if "lockScreenDismissalEnabled" is set to true. + */ +@property (strong, nonatomic) NSString *lockScreenDismissalWarning; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLOnDriverDistraction.m b/SmartDeviceLink/SDLOnDriverDistraction.m index 32dec7777..40fb3afa2 100644 --- a/SmartDeviceLink/SDLOnDriverDistraction.m +++ b/SmartDeviceLink/SDLOnDriverDistraction.m @@ -31,12 +31,21 @@ NS_ASSUME_NONNULL_BEGIN } - (void)setLockScreenDismissalEnabled:(NSNumber<SDLBool> *)lockScreenDismissalEnabled { - [parameters sdl_setObject:lockScreenDismissalEnabled forName:SDLRPCParameterNameLockScreenDismissalEnabled]; + [self.parameters sdl_setObject:lockScreenDismissalEnabled forName:SDLRPCParameterNameLockScreenDismissalEnabled]; } - (NSNumber<SDLBool> *)lockScreenDismissalEnabled { NSError *error = nil; - return [parameters sdl_objectForName:SDLRPCParameterNameLockScreenDismissalEnabled ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameLockScreenDismissalEnabled ofClass:NSNumber.class error:&error]; +} + +- (void)setLockScreenDismissalWarning:(NSString *)lockScreenDismissalWarning { + [self.parameters sdl_setObject:lockScreenDismissalWarning forName:SDLRPCParameterNameLockScreenDismissalWarning]; +} + +- (NSString *)lockScreenDismissalWarning { + NSError *error = nil; + return [self.parameters sdl_objectForName:SDLRPCParameterNameLockScreenDismissalWarning ofClass:NSString.class error:&error]; } @end diff --git a/SmartDeviceLink/SDLRPCParameterNames.h b/SmartDeviceLink/SDLRPCParameterNames.h index fac72800d..e9eee09eb 100644 --- a/SmartDeviceLink/SDLRPCParameterNames.h +++ b/SmartDeviceLink/SDLRPCParameterNames.h @@ -312,6 +312,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameLocationDetails; extern SDLRPCParameterName const SDLRPCParameterNameLocationImage; extern SDLRPCParameterName const SDLRPCParameterNameLocationName; extern SDLRPCParameterName const SDLRPCParameterNameLockScreenDismissalEnabled; +extern SDLRPCParameterName const SDLRPCParameterNameLockScreenDismissalWarning; extern SDLRPCParameterName const SDLRPCParameterNameLongitudeDegrees; extern SDLRPCParameterName const SDLRPCParameterNameLongPress; extern SDLRPCParameterName const SDLRPCParameterNameLongPressAvailable; diff --git a/SmartDeviceLink/SDLRPCParameterNames.m b/SmartDeviceLink/SDLRPCParameterNames.m index e18ccb892..77b3aeb6d 100644 --- a/SmartDeviceLink/SDLRPCParameterNames.m +++ b/SmartDeviceLink/SDLRPCParameterNames.m @@ -310,6 +310,7 @@ SDLRPCParameterName const SDLRPCParameterNameLocationDetails = @"locationDetails SDLRPCParameterName const SDLRPCParameterNameLocationImage = @"locationImage"; SDLRPCParameterName const SDLRPCParameterNameLocationName = @"locationName"; SDLRPCParameterName const SDLRPCParameterNameLockScreenDismissalEnabled = @"lockScreenDismissalEnabled"; +SDLRPCParameterName const SDLRPCParameterNameLockScreenDismissalWarning = @"lockScreenDismissalWarning"; SDLRPCParameterName const SDLRPCParameterNameLongitudeDegrees = @"longitudeDegrees"; SDLRPCParameterName const SDLRPCParameterNameLongPress = @"longPress"; SDLRPCParameterName const SDLRPCParameterNameLongPressAvailable = @"longPressAvailable"; |