summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLLockScreenManager.m
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2018-09-11 10:55:52 -0400
committerNicoleYarroch <nicole@livio.io>2018-09-11 10:55:52 -0400
commite6a7a2450a956e2535070d6e9023f54a150b6dea (patch)
tree72a0e63fffafa4d98a89f843edb2e320081414b5 /SmartDeviceLink/SDLLockScreenManager.m
parent914360e56fd8b95859e927d669d7facfd5e8ae18 (diff)
downloadsdl_ios-e6a7a2450a956e2535070d6e9023f54a150b6dea.tar.gz
Fixed lock screen optional logic
Signed-off-by: NicoleYarroch <nicole@livio.io>
Diffstat (limited to 'SmartDeviceLink/SDLLockScreenManager.m')
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m49
1 files changed, 1 insertions, 48 deletions
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m
index 692505a1e..2e6e784e0 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -140,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if ([self.lastLockNotification.lockScreenStatus isEqualToEnum:SDLLockScreenStatusOptional]) {
if (self.config.showInOptionalState && !self.presenter.presented && self.canPresent) {
[self.presenter present];
- } else if (self.presenter.presented && [self.class sdl_canDismissLockScreenWithLockScreenStatus:self.lastLockNotification previousHMILevel:self.previousHMILevel showInOptionalState:self.config.showInOptionalState]) {
+ } else if (!self.config.showInOptionalState && self.presenter.presented) {
[self.presenter dismiss];
}
} else if ([self.lastLockNotification.lockScreenStatus isEqualToEnum:SDLLockScreenStatusOff]) {
@@ -150,53 +150,6 @@ NS_ASSUME_NONNULL_BEGIN
}
}
-/**
- * Checks if the lock screen can be dismissed. If the the app is currently in the "lock screen optional" state and the `showInOptionalState` has been set to true, then the lock screen should not be dismissed.
- *
- * @param lockScreenStatus The most recent lock screen status received from SDL Core
- * @param previousHMILevel The previous `hmiLevel`
- * @param showInOptionalState Whether or not the lock screen should be shown in the "lock screen optional" state
- * @return True if the lock screen can be dismissed; false if not
- */
-+ (BOOL)sdl_canDismissLockScreenWithLockScreenStatus:(nullable SDLOnLockScreenStatus *)lockScreenStatus previousHMILevel:(nullable SDLHMILevel)previousHMILevel showInOptionalState:(BOOL)showInOptionalState {
- BOOL currentlyInShowInOptionalState = [self sdl_inLockScreenOptionalStateForLockScreenStatus:lockScreenStatus previousHMILevel:previousHMILevel];
-
- if (currentlyInShowInOptionalState && showInOptionalState) {
- return false;
- }
-
- return true;
-}
-
-/**
- * Checks if the app is currently in the "lock screen optional" state.
- *
- * @discussion In order for the "lock screen optional" state to occur, the following must be true:
- * 1. The app should have received at least 1 driver distraction notification (i.e. a `OnDriverDistraction` notification) from SDL Core. Older versions of Core did not send a notification immediately on connection.
- * 2. The driver is not distracted (i.e. the last `OnDriverDistraction` notification received was for a driver distraction state off).
- * 3. The `hmiLevel` can not be `NONE`.
- * 4. If the `hmiLevel` is currently `BACKGROUND` then the previous `hmiLevel` should have been `FULL` or `LIMITED` (i.e. the user should have interacted with app before it was backgrounded).
- *
- * @param lockScreenStatus The most recent lock screen status received from SDL Core
- * @param previousHMILevel The previous `hmiLevel`
- * @return True if currently if the "lock screen optional" state; false if not
- */
-+ (BOOL)sdl_inLockScreenOptionalStateForLockScreenStatus:(nullable SDLOnLockScreenStatus *)lockScreenStatus previousHMILevel:(nullable SDLHMILevel)previousHMILevel {
- if (lockScreenStatus == nil ||
- lockScreenStatus.driverDistractionStatus.boolValue ||
- [lockScreenStatus.hmiLevel isEqualToEnum:SDLHMILevelNone]) {
- return false;
- }
-
- if ([lockScreenStatus.hmiLevel isEqualToEnum:SDLHMILevelFull] || [lockScreenStatus.hmiLevel isEqualToEnum:SDLHMILevelLimited]) {
- return true;
- } else if ([lockScreenStatus.hmiLevel isEqualToEnum:SDLHMILevelBackground] && ([previousHMILevel isEqualToEnum:SDLHMILevelLimited] || [previousHMILevel isEqualToEnum:SDLHMILevelFull])) {
- return true;
- }
-
- return false;
-}
-
@end
NS_ASSUME_NONNULL_END