summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLLockScreenConfiguration.h
blob: 317beabe4f0bae6f01e8d191558aed5f73247a63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
//  SDLLockScreenConfiguration.h
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 10/13/15.
//  Copyright © 2015 smartdevicelink. All rights reserved.
//

#import <UIKit/UIKit.h>


NS_ASSUME_NONNULL_BEGIN

/**
 Describes when the lock screen should be shown.

 - SDLLockScreenConfigurationModeNever: The lock screen should never be shown. This should almost always mean that you will build your own lock screen.
 - SDLLockScreenConfigurationModeRequiredOnly: The lock screen should only be shown when it is required by the head unit.
 - SDLLockScreenConfigurationModeOptionalOrRequired: The lock screen should be shown when required by the head unit or when the head unit says that its optional, but *not* in other cases, such as before the user has interacted with your app on the head unit.
 - SDLLockScreenConfigurationModeAlways: The lock screen should always be shown after connection.
 */
typedef NS_ENUM(NSUInteger, SDLLockScreenConfigurationDisplayMode) {
    SDLLockScreenConfigurationDisplayModeNever,
    SDLLockScreenConfigurationDisplayModeRequiredOnly,
    SDLLockScreenConfigurationDisplayModeOptionalOrRequired,
    SDLLockScreenConfigurationDisplayModeAlways
};

/**
 A configuration describing how the lock screen should be used by the internal SDL system for your application. This configuration is provided before SDL starts and will govern the entire SDL lifecycle of your application.
 */
@interface SDLLockScreenConfiguration : NSObject <NSCopying>

/**
 Describes when the lock screen will be displayed. Defaults to `SDLLockScreenConfigurationDisplayModeRequiredOnly`.
 */
@property (assign, nonatomic) SDLLockScreenConfigurationDisplayMode displayMode;

/**
 *  Whether or not the lock screen should be shown in the "lock screen optional" state. Defaults to NO.
 *
 *  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).

 *  Since this has been deprecated, setting this to true will set `displayMode` to `OptionalOrRequired` if `enableAutomaticLockScreen` is true, or will have no effect if it is false.
 */
@property (assign, nonatomic) BOOL showInOptionalState __deprecated_msg("Use displayMode SDLLockScreenConfigurationDisplayModeOptionalOrRequired to replicate this being YES");

/**
 If YES, then the lock screen can be dismissed with a downward swipe on compatible head units. Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to YES.
 */
@property (assign, nonatomic) BOOL enableDismissGesture;

/**
 If YES, then the lockscreen will show the vehicle's logo if the vehicle has made it available. If NO, then the lockscreen will not show the vehicle logo. Defaults to YES.
*/
@property (assign, nonatomic) BOOL showDeviceLogo;

/**
 If YES, the lock screen should be managed by SDL and automatically engage when necessary. If NO, then the lock screen will never be engaged. Defaults to YES.

 Since this has been deprecated, setting this to false will set `displayMode` to `Never`. Setting it back to true will set it to `RequiredOnly` if `showInOptionalState` is false, or `OptionalOrRequired` if it is true.
 */
@property (assign, nonatomic, readonly) BOOL enableAutomaticLockScreen __deprecated_msg("Use displayMode SDLLockScreenConfigurationDisplayModeNever to replicate this being NO");

/**
 *  The background color of the lock screen. This could be a branding color, or leave at the default for a dark blue-gray.
 */
@property (copy, nonatomic, readonly) UIColor *backgroundColor;

/**
 *  Your app icon as it will appear on the lock screen.
 */
@property (copy, nonatomic, readonly, nullable) UIImage *appIcon;

/**
 *  A custom view controller that the lock screen will manage the presentation of.
 */
@property (strong, nonatomic, readonly, nullable) UIViewController *customViewController;

- (instancetype)init NS_UNAVAILABLE;

/**
 *  Use this configuration if you wish to manage a lock screen yourself. This may be useful if the automatic presentation feature of SDLLockScreenManager is failing for some reason.
 *
 *  @return The configuration
 */
+ (instancetype)disabledConfiguration;

/**
 *  Use this configuration for the basic default lock screen. A custom app icon will not be used.
 *
 *  @return The configuration
 */
+ (instancetype)enabledConfiguration;

/**
 *  Use this configuration to provide a custom lock screen icon and a custom background color, or nil if you wish to use the default background color. This will use the default lock screen layout.
 *
 *  @param lockScreenAppIcon         The app icon to be shown on the lock screen
 *  @param lockScreenBackgroundColor The color of the lock screen background
 *
 *  @return The configuration
 */
+ (instancetype)enabledConfigurationWithAppIcon:(UIImage *)lockScreenAppIcon backgroundColor:(nullable UIColor *)lockScreenBackgroundColor;

/**
 *  Use this configuration if you wish to provide your own view controller for the lock screen. This view controller's presentation and dismissal will still be managed by the lock screen manager. Note that you may subclass SDLLockScreenViewController and pass it here to continue to have the vehicle icon set to your view controller by the manager.
 *
 *  @param viewController The view controller to be managed
 *
 *  @return The configuration
 */
+ (instancetype)enabledConfigurationWithViewController:(UIViewController *)viewController;

@end

NS_ASSUME_NONNULL_END