summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-03-01 14:27:15 -0800
committerMuller, Alexander (A.) <amulle19@ford.com>2017-03-01 14:27:15 -0800
commit1275e8e115356726239feea97ab1ac331d645cfc (patch)
treeb2e8a3f48bf0fe4d4a4233eee2abffef2f4dc874
parenta8d07e3a5d50258d326b7b4263b46b38a02174ce (diff)
downloadsdl_ios-1275e8e115356726239feea97ab1ac331d645cfc.tar.gz
Updated all classes to use new convenience methods.
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m15
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m3
-rw-r--r--SmartDeviceLink/SDLPermissionManager.m12
-rw-r--r--SmartDeviceLink/SDLResponseDispatcher.m19
4 files changed, 19 insertions, 30 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index dba15fbdd..2416dd214 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -401,16 +401,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
return @(++self.lastCorrelationId);
}
-+ (BOOL)sdl_checkNotification:(NSNotification *)notification containsKindOfClass:(Class)class {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class]) {
- return NO;
- }
-
- return YES;
-}
-
-+ (void)sdl_updateLoggingWithFlags : (SDLLogOutput)logFlags {
++ (void)sdl_updateLoggingWithFlags:(SDLLogOutput)logFlags {
if (logFlags == SDLLogOutputNone) {
[SDLDebugTool disable];
return;
@@ -443,7 +434,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)hmiStatusDidChange:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnHMIStatus class]]) {
+ if (![notification isNotificationKindOfClass:[SDLOnHMIStatus class]]) {
return;
}
@@ -461,7 +452,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)remoteHardwareDidUnregister:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnAppInterfaceUnregistered class]]) {
+ if (![notification isNotificationKindOfClass:[SDLOnAppInterfaceUnregistered class]]) {
return;
}
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m
index f38c2df10..e627d83e0 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -91,8 +91,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Notification Selectors
- (void)sdl_lockScreenStatusDidChange:(SDLRPCNotificationNotification *)notification {
- NSAssert([notification.notification isKindOfClass:[SDLOnLockScreenStatus class]], @"A notification was sent with an unanticipated object");
- if (![notification.notification isKindOfClass:[SDLOnLockScreenStatus class]]) {
+ if (![notification isNotificationKindOfClass:[SDLOnLockScreenStatus class]]) {
return;
}
diff --git a/SmartDeviceLink/SDLPermissionManager.m b/SmartDeviceLink/SDLPermissionManager.m
index 622a5d029..3ed9ecfc3 100644
--- a/SmartDeviceLink/SDLPermissionManager.m
+++ b/SmartDeviceLink/SDLPermissionManager.m
@@ -174,13 +174,12 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - SDL Notification Observers
-- (void)sdl_permissionsDidChange:(NSNotification *)notification {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLOnPermissionsChange class]], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLOnPermissionsChange class]]) {
+- (void)sdl_permissionsDidChange:(SDLRPCNotificationNotification *)notification {
+ if (![notification isNotificationKindOfClass:[SDLOnPermissionsChange class]]) {
return;
}
- SDLOnPermissionsChange *onPermissionChange = notification.userInfo[SDLNotificationUserInfoObject];
+ SDLOnPermissionsChange *onPermissionChange = notification.notification;
NSArray<SDLPermissionItem *> *newPermissionItems = [onPermissionChange.permissionItem copy];
NSArray<SDLPermissionFilter *> *currentFilters = [self.filters copy];
@@ -219,12 +218,11 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)sdl_hmiLevelDidChange:(SDLRPCNotificationNotification *)notification {
- NSAssert([notification.notification isKindOfClass:[SDLOnHMIStatus class]], @"A notification was sent with an unanticipated object");
- if (![notification.notification isKindOfClass:[SDLOnHMIStatus class]]) {
+ if (![notification isNotificationKindOfClass:[SDLOnHMIStatus class]]) {
return;
}
- SDLOnHMIStatus *hmiStatus = notification.userInfo[SDLNotificationUserInfoObject];
+ SDLOnHMIStatus *hmiStatus = notification.notification;
SDLHMILevel oldHMILevel = [self.currentHMILevel copy];
self.currentHMILevel = hmiStatus.hmiLevel;
diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m
index f6e07ea1e..09cfab31d 100644
--- a/SmartDeviceLink/SDLResponseDispatcher.m
+++ b/SmartDeviceLink/SDLResponseDispatcher.m
@@ -18,8 +18,10 @@
#import "SDLOnButtonEvent.h"
#import "SDLOnButtonPress.h"
#import "SDLOnCommand.h"
-#import "SDLRPCResponse.h"
#import "SDLResult.h"
+#import "SDLRPCResponse.h"
+#import "SDLRPCNotificationNotification.h"
+#import "SDLRPCResponseNotification.h"
#import "SDLScrollableMessage.h"
#import "SDLShow.h"
#import "SDLSoftButton.h"
@@ -130,13 +132,12 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Notification Handler
// Called by notifications
-- (void)sdl_runHandlersForResponse:(NSNotification *)notification {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLRPCResponse class]], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLRPCResponse class]]) {
+- (void)sdl_runHandlersForResponse:(SDLRPCResponseNotification *)notification {
+ if (![notification isResponseKindOfClass:[SDLRPCResponse class]]) {
return;
}
- __kindof SDLRPCResponse *response = notification.userInfo[SDLNotificationUserInfoObject];
+ __kindof SDLRPCResponse *response = notification.response;
NSError *error = nil;
if (![response.success boolValue]) {
@@ -173,8 +174,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Command
-- (void)sdl_runHandlerForCommand:(NSNotification *)notification {
- SDLOnCommand *onCommandNotification = notification.userInfo[SDLNotificationUserInfoObject];
+- (void)sdl_runHandlerForCommand:(SDLRPCNotificationNotification *)notification {
+ SDLOnCommand *onCommandNotification = notification.notification;
SDLRPCNotificationHandler handler = nil;
handler = self.commandHandlerMap[onCommandNotification.cmdID];
@@ -185,8 +186,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Button
-- (void)sdl_runHandlerForButton:(NSNotification *)notification {
- __kindof SDLRPCNotification *rpcNotification = notification.userInfo[SDLNotificationUserInfoObject];
+- (void)sdl_runHandlerForButton:(SDLRPCNotificationNotification *)notification {
+ __kindof SDLRPCNotification *rpcNotification = notification.notification;
SDLRPCNotificationHandler handler = nil;
SDLButtonName name = nil;