diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-10-18 11:17:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-18 11:17:38 -0400 |
commit | 21fdcf9499cef7fae3672b0e96e275714fd5dec2 (patch) | |
tree | 77bf55abd609feaa4b6c5f5e9657f0c45d2ec711 | |
parent | c47dd1c44fac56f9af9aa85535280f5a0e5f76da (diff) | |
parent | e279b7699ad775a5a6b48bc6bd0044ee9c5c92a2 (diff) | |
download | sdl_ios-21fdcf9499cef7fae3672b0e96e275714fd5dec2.tar.gz |
Merge pull request #1109 from smartdevicelink/bugfix/issue_1108_setdisplaylayout_screenmanager_fail
Fix screen sub-managers failing if Register or SetDisplayLayout responses are failures
-rw-r--r-- | SmartDeviceLink/SDLChoiceSetManager.m | 14 | ||||
-rw-r--r-- | SmartDeviceLink/SDLMenuManager.m | 14 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonManager.m | 13 | ||||
-rw-r--r-- | SmartDeviceLink/SDLTextAndGraphicManager.m | 15 |
4 files changed, 56 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLChoiceSetManager.m b/SmartDeviceLink/SDLChoiceSetManager.m index 35037ccc0..8d1ac4ffe 100644 --- a/SmartDeviceLink/SDLChoiceSetManager.m +++ b/SmartDeviceLink/SDLChoiceSetManager.m @@ -404,11 +404,25 @@ UInt16 const ChoiceCellIdMin = 1; - (void)sdl_registerResponse:(SDLRPCResponseNotification *)notification { SDLRegisterAppInterfaceResponse *response = (SDLRegisterAppInterfaceResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"RegisterAppInterface succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.displayCapabilities = response.displayCapabilities; } - (void)sdl_displayLayoutResponse:(SDLRPCResponseNotification *)notification { SDLSetDisplayLayoutResponse *response = (SDLSetDisplayLayoutResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"SetDisplayLayout succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.displayCapabilities = response.displayCapabilities; } diff --git a/SmartDeviceLink/SDLMenuManager.m b/SmartDeviceLink/SDLMenuManager.m index bbd61252b..aa8528a17 100644 --- a/SmartDeviceLink/SDLMenuManager.m +++ b/SmartDeviceLink/SDLMenuManager.m @@ -413,11 +413,25 @@ UInt32 const MenuCellIdMin = 1; - (void)sdl_registerResponse:(SDLRPCResponseNotification *)notification { SDLRegisterAppInterfaceResponse *response = (SDLRegisterAppInterfaceResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"RegisterAppInterface succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.displayCapabilities = response.displayCapabilities; } - (void)sdl_displayLayoutResponse:(SDLRPCResponseNotification *)notification { SDLSetDisplayLayoutResponse *response = (SDLSetDisplayLayoutResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"SetDisplayLayout succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.displayCapabilities = response.displayCapabilities; } diff --git a/SmartDeviceLink/SDLSoftButtonManager.m b/SmartDeviceLink/SDLSoftButtonManager.m index e3e9278b2..10e61fa1d 100644 --- a/SmartDeviceLink/SDLSoftButtonManager.m +++ b/SmartDeviceLink/SDLSoftButtonManager.m @@ -355,6 +355,13 @@ NS_ASSUME_NONNULL_BEGIN - (void)sdl_registerResponse:(SDLRPCResponseNotification *)notification { SDLRegisterAppInterfaceResponse *response = (SDLRegisterAppInterfaceResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"RegisterAppInterface succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.softButtonCapabilities = response.softButtonCapabilities ? response.softButtonCapabilities.firstObject : nil; self.displayCapabilities = response.displayCapabilities; } @@ -362,6 +369,12 @@ NS_ASSUME_NONNULL_BEGIN - (void)sdl_displayLayoutResponse:(SDLRPCResponseNotification *)notification { SDLSetDisplayLayoutResponse *response = (SDLSetDisplayLayoutResponse *)notification.response; + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"SetDisplayLayout succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.softButtonCapabilities = response.softButtonCapabilities ? response.softButtonCapabilities.firstObject : nil; self.displayCapabilities = response.displayCapabilities; diff --git a/SmartDeviceLink/SDLTextAndGraphicManager.m b/SmartDeviceLink/SDLTextAndGraphicManager.m index 644200215..aaeba7187 100644 --- a/SmartDeviceLink/SDLTextAndGraphicManager.m +++ b/SmartDeviceLink/SDLTextAndGraphicManager.m @@ -674,11 +674,26 @@ NS_ASSUME_NONNULL_BEGIN - (void)sdl_registerResponse:(SDLRPCResponseNotification *)notification { SDLRegisterAppInterfaceResponse *response = (SDLRegisterAppInterfaceResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"RegisterAppInterface succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.displayCapabilities = response.displayCapabilities; } - (void)sdl_displayLayoutResponse:(SDLRPCResponseNotification *)notification { SDLSetDisplayLayoutResponse *response = (SDLSetDisplayLayoutResponse *)notification.response; + + if (!response.success.boolValue) { return; } + if (!response.success.boolValue) { return; } + if (response.displayCapabilities == nil) { + SDLLogE(@"SetDisplayLayout succeeded but didn't send a display capabilities. A lot of things will probably break."); + return; + } + self.displayCapabilities = response.displayCapabilities; // Auto-send an updated show |