diff options
author | Satbir Tanda <satbirtanda@gmail.com> | 2019-07-11 14:18:35 -0700 |
---|---|---|
committer | Satbir Tanda <satbirtanda@gmail.com> | 2019-07-11 14:18:35 -0700 |
commit | 3290619dedd385a5c2068c20b493c5d93ee3603b (patch) | |
tree | bfd0796f4a702fd35712f518efa528fbe9919de1 | |
parent | 2c3a92fd0d55879708698aba8766df516f492e4d (diff) | |
download | sdl_ios-3290619dedd385a5c2068c20b493c5d93ee3603b.tar.gz |
Remove SDLLockScreenStatusManager
Delete LSM from SDLProxy
-rw-r--r-- | SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLockScreenStatusManager.h | 25 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLockScreenStatusManager.m | 103 | ||||
-rw-r--r-- | SmartDeviceLink/SDLProxy.m | 37 |
4 files changed, 2 insertions, 171 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 6c7379d26..23654543a 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -713,8 +713,6 @@ 5D61FCED1A84238C00846EE7 /* SDLListFiles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FB001A84238A00846EE7 /* SDLListFiles.m */; }; 5D61FCEE1A84238C00846EE7 /* SDLListFilesResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FB011A84238A00846EE7 /* SDLListFilesResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D61FCEF1A84238C00846EE7 /* SDLListFilesResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FB021A84238A00846EE7 /* SDLListFilesResponse.m */; }; - 5D61FCF01A84238C00846EE7 /* SDLLockScreenStatusManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FB031A84238A00846EE7 /* SDLLockScreenStatusManager.h */; }; - 5D61FCF11A84238C00846EE7 /* SDLLockScreenStatusManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FB041A84238A00846EE7 /* SDLLockScreenStatusManager.m */; }; 5D61FCF21A84238C00846EE7 /* SDLLockScreenStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FB051A84238A00846EE7 /* SDLLockScreenStatus.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5D61FCF31A84238C00846EE7 /* SDLLockScreenStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FB061A84238A00846EE7 /* SDLLockScreenStatus.m */; }; 5D61FCF41A84238C00846EE7 /* SDLMaintenanceModeStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FB071A84238A00846EE7 /* SDLMaintenanceModeStatus.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2365,8 +2363,6 @@ 5D61FB001A84238A00846EE7 /* SDLListFiles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLListFiles.m; sourceTree = "<group>"; }; 5D61FB011A84238A00846EE7 /* SDLListFilesResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLListFilesResponse.h; sourceTree = "<group>"; }; 5D61FB021A84238A00846EE7 /* SDLListFilesResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLListFilesResponse.m; sourceTree = "<group>"; }; - 5D61FB031A84238A00846EE7 /* SDLLockScreenStatusManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLockScreenStatusManager.h; sourceTree = "<group>"; }; - 5D61FB041A84238A00846EE7 /* SDLLockScreenStatusManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLockScreenStatusManager.m; sourceTree = "<group>"; }; 5D61FB051A84238A00846EE7 /* SDLLockScreenStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLockScreenStatus.h; sourceTree = "<group>"; }; 5D61FB061A84238A00846EE7 /* SDLLockScreenStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLockScreenStatus.m; sourceTree = "<group>"; }; 5D61FB071A84238A00846EE7 /* SDLMaintenanceModeStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLMaintenanceModeStatus.h; sourceTree = "<group>"; }; @@ -4067,8 +4063,6 @@ EE798CA2205611DC008EDE8E /* Secondary Transport */, 5D6CC8ED1C610E490027F60A /* Security */, 5D5934FE1A851B2500687FB9 /* @protocols */, - 5D61FB031A84238A00846EE7 /* SDLLockScreenStatusManager.h */, - 5D61FB041A84238A00846EE7 /* SDLLockScreenStatusManager.m */, 5D61FB441A84238B00846EE7 /* SDLPolicyDataParser.h */, 5D61FB451A84238B00846EE7 /* SDLPolicyDataParser.m */, 5D61FB631A84238B00846EE7 /* SDLProxy.h */, @@ -6700,7 +6694,6 @@ 88F89103221DE29A00E056AD /* SDLAsynchronousRPCOperation.h in Headers */, 5D61FD6F1A84238C00846EE7 /* SDLRPCPayload.h in Headers */, 5D339CF3207C0ACE000CC364 /* SDLMenuManager.h in Headers */, - 5D61FCF01A84238C00846EE7 /* SDLLockScreenStatusManager.h in Headers */, 5D61FD311A84238C00846EE7 /* SDLPolicyDataParser.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -7345,7 +7338,6 @@ 5DA49CE61F1EA83300E65FC5 /* SDLControlFramePayloadRPCStartService.m in Sources */, 5DA102A51D4122C700C15826 /* NSMutableDictionary+SafeRemove.m in Sources */, 5DD60D99221C5D7D00A82A4F /* SDLVersion.m in Sources */, - 5D61FCF11A84238C00846EE7 /* SDLLockScreenStatusManager.m in Sources */, 5D61FDAC1A84238C00846EE7 /* SDLStartTime.m in Sources */, 5D61FDA01A84238C00846EE7 /* SDLSoftButton.m in Sources */, 5D61FCD21A84238C00846EE7 /* SDLImageFieldName.m in Sources */, diff --git a/SmartDeviceLink/SDLLockScreenStatusManager.h b/SmartDeviceLink/SDLLockScreenStatusManager.h deleted file mode 100644 index 2a37b9d83..000000000 --- a/SmartDeviceLink/SDLLockScreenStatusManager.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// SDLLockScreenManager.h -// SmartDeviceLink -// - -#import <Foundation/Foundation.h> - -#import "SDLHMILevel.h" -#import "SDLLockScreenStatus.h" - -@class SDLOnLockScreenStatus; - -NS_ASSUME_NONNULL_BEGIN - -@interface SDLLockScreenStatusManager : NSObject - -@property (assign, nonatomic) BOOL userSelected; -@property (assign, nonatomic) BOOL driverDistracted; -@property (nullable, strong, nonatomic) SDLHMILevel hmiLevel; -@property (strong, nonatomic, readonly) SDLLockScreenStatus lockScreenStatus; -@property (strong, nonatomic, readonly) SDLOnLockScreenStatus *lockScreenStatusNotification; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLLockScreenStatusManager.m b/SmartDeviceLink/SDLLockScreenStatusManager.m deleted file mode 100644 index 82724eb6f..000000000 --- a/SmartDeviceLink/SDLLockScreenStatusManager.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// SDLLockScreenManager.m -// SmartDeviceLink -// - -#import "SDLLockScreenStatusManager.h" - -#import "SDLLockScreenStatus.h" -#import "SDLOnLockScreenStatus.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SDLLockScreenStatusManager () - -@property (assign, nonatomic) BOOL haveDriverDistractionStatus; - -@end - - -@implementation SDLLockScreenStatusManager - -#pragma mark - Lifecycle - -- (instancetype)init { - self = [super init]; - if (self) { - _userSelected = NO; - _driverDistracted = NO; - _haveDriverDistractionStatus = NO; - } - return self; -} - - -#pragma mark - Getters / Setters -#pragma mark Custom setters - -- (void)setDriverDistracted:(BOOL)driverDistracted { - _driverDistracted = driverDistracted; - _haveDriverDistractionStatus = YES; -} - -- (void)setHmiLevel:(nullable SDLHMILevel)hmiLevel { - if (_hmiLevel != hmiLevel) { - _hmiLevel = hmiLevel; - } - - if ([hmiLevel isEqualToEnum:SDLHMILevelFull] || [hmiLevel isEqualToEnum:SDLHMILevelLimited]) { - self.userSelected = YES; - } else if ([hmiLevel isEqualToEnum:SDLHMILevelNone]) { - self.userSelected = NO; - } -} - - -#pragma mark Custom Getters - -- (SDLOnLockScreenStatus *)lockScreenStatusNotification { - SDLOnLockScreenStatus *notification = [[SDLOnLockScreenStatus alloc] init]; - notification.driverDistractionStatus = @(self.driverDistracted); - notification.hmiLevel = self.hmiLevel; - notification.userSelected = @(self.userSelected); - notification.lockScreenStatus = self.lockScreenStatus; - - return notification; -} - -- (SDLLockScreenStatus)lockScreenStatus { - if (self.hmiLevel == nil || [self.hmiLevel isEqualToEnum:SDLHMILevelNone]) { - // App is not active on the car - return SDLLockScreenStatusOff; - } else if ([self.hmiLevel isEqualToEnum:SDLHMILevelBackground]) { - // App is in the background on the car - if (self.userSelected) { - // It was user selected - if (self.haveDriverDistractionStatus && !self.driverDistracted) { - // We have the distraction status, and the driver is not distracted - return SDLLockScreenStatusOptional; - } else { - // We don't have the distraction status, and/or the driver is distracted - return SDLLockScreenStatusRequired; - } - } else { - return SDLLockScreenStatusOff; - } - } else if ([self.hmiLevel isEqualToEnum:SDLHMILevelFull] || [self.hmiLevel isEqualToEnum:SDLHMILevelLimited]) { - // App is in the foreground on the car in some manner - if (self.haveDriverDistractionStatus && !self.driverDistracted) { - // We have the distraction status, and the driver is not distracted - return SDLLockScreenStatusOptional; - } else { - // We don't have the distraction status, and/or the driver is distracted - return SDLLockScreenStatusRequired; - } - } else { - // This shouldn't be possible. - return SDLLockScreenStatusOff; - } -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m index 6ab2006c8..d7ec117a4 100644 --- a/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink/SDLProxy.m @@ -15,7 +15,6 @@ #import "SDLIAPTransport.h" #import "SDLLanguage.h" #import "SDLLayoutMode.h" -#import "SDLLockScreenStatusManager.h" #import "SDLOnButtonEvent.h" #import "SDLOnButtonPress.h" #import "SDLOnHMIStatus.h" @@ -56,9 +55,7 @@ const float NotifyProxyClosedDelay = (float)0.1; const int PoliciesCorrelationId = 65535; static float DefaultConnectionTimeout = 45.0; -@interface SDLProxy () { - SDLLockScreenStatusManager *_lsm; -} +@interface SDLProxy () @property (copy, nonatomic) NSString *appId; @property (strong, nonatomic) NSMutableSet<NSObject<SDLProxyListener> *> *mutableProxyListeners; @@ -76,7 +73,6 @@ static float DefaultConnectionTimeout = 45.0; - (instancetype)initWithTransport:(id<SDLTransportType>)transport delegate:(id<SDLProxyListener>)delegate secondaryTransportManager:(nullable SDLSecondaryTransportManager *)secondaryTransportManager { if (self = [super init]) { SDLLogD(@"Framework Version: %@", self.proxyVersion); - _lsm = [[SDLLockScreenStatusManager alloc] init]; _rpcProcessingQueue = dispatch_queue_create("com.sdl.rpcProcessingQueue", DISPATCH_QUEUE_SERIAL); _mutableProxyListeners = [NSMutableSet setWithObject:delegate]; _securityManagers = [NSMutableDictionary dictionary]; @@ -449,16 +445,7 @@ static float DefaultConnectionTimeout = 45.0; if ([functionName isEqualToString:SDLRPCFunctionNameOnAppInterfaceUnregistered] || [functionName isEqualToString:SDLRPCFunctionNameUnregisterAppInterface]) { [self handleRPCUnregistered:dict]; } - - // When an OnHMIStatus notification comes in, after passing it on (above), generate an "OnLockScreenNotification" - if ([functionName isEqualToString:@"OnHMIStatus"]) { - [self handleAfterHMIStatus:newMessage]; - } - - // When an OnDriverDistraction notification comes in, after passing it on (above), generate an "OnLockScreenNotification" - if ([functionName isEqualToString:@"OnDriverDistraction"]) { - [self handleAfterDriverDistraction:newMessage]; - } + } - (void)sdl_invokeDelegateMethodsWithFunction:(NSString *)functionName message:(SDLRPCMessage *)message { @@ -615,26 +602,6 @@ static float DefaultConnectionTimeout = 45.0; } #pragma clang diagnostic pop - -#pragma mark Handle Post-Invoke of Delegate Methods -- (void)handleAfterHMIStatus:(SDLRPCMessage *)message { - SDLHMILevel hmiLevel = (SDLHMILevel)message.parameters[SDLRPCParameterNameHMILevel]; - _lsm.hmiLevel = hmiLevel; - - SEL callbackSelector = NSSelectorFromString(@"onOnLockScreenNotification:"); - [self invokeMethodOnDelegates:callbackSelector withObject:_lsm.lockScreenStatusNotification]; -} - -- (void)handleAfterDriverDistraction:(SDLRPCMessage *)message { - NSString *stateString = (NSString *)message.parameters[SDLRPCParameterNameState]; - BOOL state = [stateString isEqualToString:@"DD_ON"] ? YES : NO; - _lsm.driverDistracted = state; - - SEL callbackSelector = NSSelectorFromString(@"onOnLockScreenNotification:"); - [self invokeMethodOnDelegates:callbackSelector withObject:_lsm.lockScreenStatusNotification]; -} - - #pragma mark OnSystemRequest Handlers - (void)sdl_handleSystemRequestLaunchApp:(SDLOnSystemRequest *)request { NSURL *URLScheme = [NSURL URLWithString:request.url]; |