Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankElias77 committed Apr 13, 2022
2 parents 30652f0 + c56d4b3 commit b99ede4
Show file tree
Hide file tree
Showing 44 changed files with 452 additions and 346 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
# Changelog
## 7.4.0
* Supports [SDL RPC Spec 8.0.0](https://github.com/smartdevicelink/rpc_spec/releases/tag/8.0.0) and [SDL Protocol Spec 5.4.1](https://github.com/smartdevicelink/protocol_spec/releases/tag/5.4.1).

### Testing
* Xcode 13.2/13.3
* iOS 15.4
* Core:
* Core v8.1.0, Generic HMI v0.12.0, SDL HMI v5.7.0
* Core v7.1.1, Generic HMI v0.10.0, SDL HMI v5.5.0
* Ford Sync 3.4 (19353\_DEVTEST) Ford Sync 3.0 (19353\_DEVTEST)

### Bug Fixes
* Fix alert `SDLSoftButton` not being shown when softButtonCapabilities are missing (https://github.com/smartdevicelink/sdl_ios/issues/2079)
* Fix not handling invalid `SoftButtonObject` configurations (https://github.com/smartdevicelink/sdl_ios/issues/2067)
* Fix some race conditions in the `SDLLockScreenManager` (https://github.com/smartdevicelink/sdl_ios/issues/2063)
* Fix not sending error data on security setup failures (https://github.com/smartdevicelink/sdl_ios/issues/2049)
* Fix not sending `subMenu` cell images on RPC connections between v5.0 and v7.0 (https://github.com/smartdevicelink/sdl_ios/issues/2047)
* Deprecate `SDLVideoStreamingRange.init()` because it was confusing (https://github.com/smartdevicelink/sdl_ios/issues/2050)
* Fix handling of 0 length incoming security messages (https://github.com/smartdevicelink/sdl_ios/issues/2054)
* Fix lockScreen not shown after user dismissal (https://github.com/smartdevicelink/sdl_ios/issues/2061)

### Other
* Add warning logs when removing invalid voice commands (https://github.com/smartdevicelink/sdl_ios/issues/2075)

## 7.3.1
* Supports [SDL RPC Spec 8.0.0](https://github.com/smartdevicelink/rpc_spec/releases/tag/8.0.0) and [SDL Protocol Spec 5.4.1](https://github.com/smartdevicelink/protocol_spec/releases/tag/5.4.1).

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SmartDeviceLink-iOS"
s.version = "7.3.1"
s.version = "7.4.0"
s.summary = "Connect your app with cars!"
s.homepage = "https://github.com/smartdevicelink/SmartDeviceLink-iOS"
s.license = { :type => "New BSD", :file => "LICENSE" }
Expand Down
22 changes: 9 additions & 13 deletions SmartDeviceLink-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,6 @@
B38D8E8024A1E3D000B977D0 /* SDLTransmissionTypeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E7F24A1E3D000B977D0 /* SDLTransmissionTypeSpec.m */; };
B38D8E8224A1F53500B977D0 /* SDLCapacityUnitSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B38D8E8124A1F53500B977D0 /* SDLCapacityUnitSpec.m */; };
B3A0BA2925940ED100CC3BDF /* SDLCarWindowSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A0BA212593FE7400CC3BDF /* SDLCarWindowSpec.m */; };
B3A0BA2D259600D100CC3BDF /* SDLSupportedStreamingRangeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A0BA2C259600D100CC3BDF /* SDLSupportedStreamingRangeSpec.m */; };
B3A3CE9E2522241600A7121D /* SDLAppCapabilitySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A3CE9D2522241600A7121D /* SDLAppCapabilitySpec.m */; };
B3A3CEA025222A2900A7121D /* SDLOnAppCapabilityUpdatedSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = B3A3CE9F25222A2900A7121D /* SDLOnAppCapabilityUpdatedSpec.m */; };
B3A9D9E225D2571000CDFD21 /* SDLKeyboardCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A9D9E025D2571000CDFD21 /* SDLKeyboardCapabilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -3642,7 +3641,6 @@
B38D8E7F24A1E3D000B977D0 /* SDLTransmissionTypeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLTransmissionTypeSpec.m; sourceTree = "<group>"; };
B38D8E8124A1F53500B977D0 /* SDLCapacityUnitSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLCapacityUnitSpec.m; sourceTree = "<group>"; };
B3A0BA212593FE7400CC3BDF /* SDLCarWindowSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLCarWindowSpec.m; sourceTree = "<group>"; };
B3A0BA2C259600D100CC3BDF /* SDLSupportedStreamingRangeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLSupportedStreamingRangeSpec.m; sourceTree = "<group>"; };
B3A3CE9D2522241600A7121D /* SDLAppCapabilitySpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLAppCapabilitySpec.m; sourceTree = "<group>"; };
B3A3CE9F25222A2900A7121D /* SDLOnAppCapabilityUpdatedSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLOnAppCapabilityUpdatedSpec.m; sourceTree = "<group>"; };
B3A9D9DF25D2571000CDFD21 /* SDLKeyboardCapabilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLKeyboardCapabilities.m; path = public/SDLKeyboardCapabilities.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6005,7 +6003,6 @@
5DB1BCE41D245629002FFC37 /* State Machine */,
5D6EB4C71BF28D6800693731 /* Categories */,
5DCC458C221C9F6600036C2F /* SDLVersionSpec.m */,
B3A0BA2C259600D100CC3BDF /* SDLSupportedStreamingRangeSpec.m */,
);
name = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -7973,7 +7970,7 @@
attributes = {
CLASSPREFIX = SDL;
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 1310;
LastUpgradeCheck = 1330;
ORGANIZATIONNAME = smartdevicelink;
TargetAttributes = {
5D4019AE1A76EC350006B0C2 = {
Expand Down Expand Up @@ -8779,7 +8776,6 @@
5DA23FF31F2FA35C009C0313 /* SDLControlFramePayloadAudioStartServiceAckSpec.m in Sources */,
1EAA476820369BCF000FE74B /* SDLLightStateSpec.m in Sources */,
1680B11C1A9CD7AD00DBD79E /* SDLProtocolMessageAssemblerSpec.m in Sources */,
B3A0BA2D259600D100CC3BDF /* SDLSupportedStreamingRangeSpec.m in Sources */,
8850DB601F4475D30053A48D /* TestMultipleFilesConnectionManager.m in Sources */,
162E83181A9BDE8B00906325 /* SDLOnKeyboardInputSpec.m in Sources */,
1EE8C4441F34A1B900FDC2CF /* SDLClimateControlDataSpec.m in Sources */,
Expand Down Expand Up @@ -9455,7 +9451,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example Apps/Example ObjC/SmartDeviceLink-Example-ObjC-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SDLTestApp;
PRODUCT_NAME = "SDL Example";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -9474,7 +9470,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example Apps/Example ObjC/SmartDeviceLink-Example-ObjC-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SDLTestApp;
PRODUCT_NAME = "SDL Example";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -9523,7 +9519,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.smartdevicelink;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -9576,7 +9572,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.smartdevicelink;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -9675,7 +9671,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SDLTestApp;
PRODUCT_NAME = "SDL Example Swift";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -9698,7 +9694,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SDLTestApp;
PRODUCT_NAME = "SDL Example Swift";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -9745,7 +9741,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SmartDeviceLinkSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
Expand Down Expand Up @@ -9796,7 +9792,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 7.3.1;
MARKETING_VERSION = 7.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.smartdevicelink.SmartDeviceLinkSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SmartDeviceLink"
s.version = "7.3.1"
s.version = "7.4.0"
s.summary = "Connect your app with cars!"
s.homepage = "https://github.com/smartdevicelink/SmartDeviceLink-iOS"
s.license = { :type => "New BSD", :file => "LICENSE" }
Expand Down
19 changes: 18 additions & 1 deletion SmartDeviceLink/private/SDLImageField+ScreenManagerExtensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,24 @@
@implementation SDLImageField (ScreenManagerExtensions)

+ (NSArray<SDLImageFieldName> *)sdl_allImageFieldNames {
return @[SDLImageFieldNameAppIcon, SDLImageFieldNameGraphic, SDLImageFieldNameMenuIcon, SDLImageFieldNameTurnIcon, SDLImageFieldNameAlertIcon, SDLImageFieldNameChoiceImage, SDLImageFieldNameCommandIcon, SDLImageFieldNameLocationImage, SDLImageFieldNameSoftButtonImage, SDLImageFieldNameSecondaryGraphic, SDLImageFieldNameShowConstantTBTIcon, SDLImageFieldNameChoiceSecondaryImage, SDLImageFieldNameVoiceRecognitionHelpItem, SDLImageFieldNameShowConstantTBTNextTurnIcon];
return @[SDLImageFieldNameAlertIcon,
SDLImageFieldNameAppIcon,
SDLImageFieldNameChoiceImage,
SDLImageFieldNameChoiceSecondaryImage,
SDLImageFieldNameCommandIcon,
SDLImageFieldNameGraphic,
SDLImageFieldNameLocationImage,
SDLImageFieldNameMenuCommandSecondaryImage,
SDLImageFieldNameMenuIcon,
SDLImageFieldNameMenuSubMenuSecondaryImage,
SDLImageFieldNameSecondaryGraphic,
SDLImageFieldNameShowConstantTBTIcon,
SDLImageFieldNameShowConstantTBTNextTurnIcon,
SDLImageFieldNameSoftButtonImage,
SDLImageFieldNameSubMenuIcon,
SDLImageFieldNameSubtleAlertIcon,
SDLImageFieldNameTurnIcon,
SDLImageFieldNameVoiceRecognitionHelpItem];
}

+ (NSArray<SDLFileType> *)sdl_allImageFileTypes {
Expand Down
23 changes: 16 additions & 7 deletions SmartDeviceLink/private/SDLLockScreenManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "SDLNotificationDispatcher.h"
#import "SDLLockScreenStatusInfo.h"
#import "SDLOnDriverDistraction.h"
#import "SDLOnHMIStatus.h"
#import "SDLRPCNotificationNotification.h"
#import "SDLViewControllerPresentable.h"

Expand Down Expand Up @@ -52,7 +53,8 @@ - (instancetype)initWithConfiguration:(SDLLockScreenConfiguration *)config notif
_presenter = presenter;
_lockScreenDismissedByUser = NO;
_statusManager = [[SDLLockScreenStatusManager alloc] initWithNotificationDispatcher:dispatcher];


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_hmiStatusDidChange:) name:SDLDidChangeHMIStatusNotification object:dispatcher];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_lockScreenStatusDidChange:) name:SDLDidChangeLockScreenStatusNotification object:dispatcher];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_lockScreenIconReceived:) name:SDLDidReceiveLockScreenIcon object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
Expand Down Expand Up @@ -131,7 +133,6 @@ - (void)sdl_lockScreenStatusDidChange:(SDLRPCNotificationNotification *)notifica
if (lockScreenStatus == nil) { return; }

self.lastLockNotification = lockScreenStatus;

[self sdl_checkLockScreen];
}

Expand Down Expand Up @@ -161,18 +162,26 @@ - (void)sdl_appDidBecomeActive:(NSNotification *)notification {
});
}

- (void)sdl_hmiStatusDidChange:(SDLRPCNotificationNotification *)notification {
if (![notification isNotificationMemberOfClass:[SDLOnHMIStatus class]]) { return; }

[self.statusManager updateHMIStatus:notification.notification];
}

- (void)sdl_driverDistractionStateDidChange:(SDLRPCNotificationNotification *)notification {
if (![notification isNotificationMemberOfClass:[SDLOnDriverDistraction class]]) {
return;
}
if (![notification isNotificationMemberOfClass:[SDLOnDriverDistraction class]]) { return; }

// When an `OnDriverDistraction` notification is sent with a `lockScreenDismissalEnabled` value, keep track of said value if subsequent `OnDriverDistraction`s are missing the `lockScreenDismissalEnabled` value. This is done because the `lockScreenDismissalEnabled` state is assumed to be the same value until a new `lockScreenDismissalEnabled` value is received.
SDLOnDriverDistraction *currentDriverDistraction = notification.notification;
if (currentDriverDistraction.lockScreenDismissalEnabled == nil && self.lastDriverDistractionNotification.lockScreenDismissalEnabled != nil){
currentDriverDistraction.lockScreenDismissalEnabled = self.lastDriverDistractionNotification.lockScreenDismissalEnabled;
currentDriverDistraction.lockScreenDismissalWarning = self.lastDriverDistractionNotification.lockScreenDismissalWarning;
}
self.lastDriverDistractionNotification = currentDriverDistraction;

// Update dismissible state, then update the lock screen status itself
[self sdl_updateLockScreenDismissable];
[self.statusManager updateDriverDistractionState:currentDriverDistraction];
}

#pragma mark - Private Helpers
Expand All @@ -190,7 +199,7 @@ - (void)sdl_checkLockScreen {

- (void)sdl_updatePresentation {
if (self.config.displayMode == SDLLockScreenConfigurationDisplayModeAlways) {
if (self.canPresent && !self.lockScreenDismissedByUser && !self.lockScreenDismissable) {
if (self.canPresent && !self.lockScreenDismissable) {
[self.presenter updateLockScreenToShow:YES withCompletionHandler:nil];
}
} else if (self.lastLockNotification.lockScreenStatus == SDLLockScreenStatusRequired) {
Expand Down Expand Up @@ -224,7 +233,7 @@ - (void)sdl_updateLockScreenDismissable {
self.lockScreenDismissedByUser = NO;
}

if (!self.lockScreenDismissedByUser) {
if (!self.lockScreenDismissedByUser || !self.lockScreenDismissable) {
[self sdl_updateLockscreenViewControllerWithDismissableState:self.lockScreenDismissable];
}
}
Expand Down
10 changes: 9 additions & 1 deletion SmartDeviceLink/private/SDLLockScreenStatusInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ - (instancetype)initWithDriverDistractionStatus:(nullable NSNumber<SDLBool> *)dr
}

- (NSString *)description {
return [NSString stringWithFormat:@"driverDistractionStatus: %@, userSelected: %@, lockScreenStatus: %lu, hmiLevel: %@", self.driverDistractionStatus, self.userSelected, (unsigned long)self.lockScreenStatus, self.hmiLevel];
return [NSString stringWithFormat:@"driverDistractionStatus: %@, userSelected: %@, lockScreenStatus: %@, hmiLevel: %@", (self.driverDistractionStatus ? @"ON" : @"OFF"), (self.userSelected ? @"YES" : @"NO"), [self descriptionForStatus:self.lockScreenStatus], self.hmiLevel];
}

- (NSString *)descriptionForStatus:(SDLLockScreenStatus)status {
switch (status) {
case SDLLockScreenStatusOff: return @"Off";
case SDLLockScreenStatusOptional: return @"Optional";
case SDLLockScreenStatusRequired: return @"Required";
}
}

@end
Expand Down
7 changes: 6 additions & 1 deletion SmartDeviceLink/private/SDLLockScreenStatusManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#import "SDLHMILevel.h"
#import "SDLLockScreenConstants.h"

@class SDLNotificationDispatcher;
@class SDLLockScreenStatusInfo;
@class SDLNotificationDispatcher;
@class SDLOnDriverDistraction;
@class SDLOnHMIStatus;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -27,6 +29,9 @@ static NSString *const SDLDidChangeLockScreenStatusNotification = @"com.sdl.noti
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithNotificationDispatcher:(SDLNotificationDispatcher *)dispatcher;

- (void)updateHMIStatus:(SDLOnHMIStatus *)hmiStatus;
- (void)updateDriverDistractionState:(SDLOnDriverDistraction *)driverDistraction;

@end

NS_ASSUME_NONNULL_END
32 changes: 12 additions & 20 deletions SmartDeviceLink/private/SDLLockScreenStatusManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,25 @@ - (instancetype)initWithNotificationDispatcher:(SDLNotificationDispatcher *)disp
self = [super init];
if (!self) { return nil; }

_notificationDispatcher = dispatcher;
_userSelected = NO;
_driverDistracted = NO;
_haveDriverDistractionStatus = NO;
_notificationDispatcher = dispatcher;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_hmiStatusDidUpdate:) name:SDLDidChangeHMIStatusNotification object:dispatcher];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_driverDistractionDidUpdate:) name:SDLDidChangeDriverDistractionStateNotification object:dispatcher];

return self;
}

#pragma mark - Component Updates

- (void)updateHMIStatus:(SDLOnHMIStatus *)hmiStatus {
self.hmiLevel = hmiStatus.hmiLevel;
[self sdl_postLockScreenStatus:self.lockScreenStatusNotification];
}

- (void)updateDriverDistractionState:(SDLOnDriverDistraction *)driverDistraction {
self.driverDistracted = [driverDistraction.state isEqualToEnum:SDLDriverDistractionStateOn];
[self sdl_postLockScreenStatus:self.lockScreenStatusNotification];
}

#pragma mark - Getters / Setters
#pragma mark Custom setters
Expand Down Expand Up @@ -112,22 +120,6 @@ - (void)sdl_postLockScreenStatus:(SDLLockScreenStatusInfo *)statusNotification {
[self.notificationDispatcher postNotificationName:SDLDidChangeLockScreenStatusNotification infoObject:statusNotification];
}

#pragma mark - Observers

- (void)sdl_hmiStatusDidUpdate:(SDLRPCNotificationNotification *)notification {
SDLOnHMIStatus *hmiStatus = notification.notification;

self.hmiLevel = hmiStatus.hmiLevel;
[self sdl_postLockScreenStatus:self.lockScreenStatusNotification];
}

- (void)sdl_driverDistractionDidUpdate:(SDLRPCNotificationNotification *)notification {
SDLOnDriverDistraction *driverDistraction = notification.notification;

self.driverDistracted = [driverDistraction.state isEqualToEnum:SDLDriverDistractionStateOn];
[self sdl_postLockScreenStatus:self.lockScreenStatusNotification];
}

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit b99ede4

Please sign in to comment.