diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2020-03-11 12:12:50 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2020-03-11 12:12:50 -0400 |
commit | 0f6d87743610028cd5f71540c0cb23a6e18ff134 (patch) | |
tree | 1f3d54b26f47e9f5d5f19aad78bae7e39f2b477b | |
parent | 8509481ddac038bbb481b1a818c46fea6812348f (diff) | |
download | sdl_ios-0f6d87743610028cd5f71540c0cb23a6e18ff134.tar.gz |
Fix documentation and potential crash
-rw-r--r-- | SmartDeviceLink/SDLMenuManager.m | 14 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonManager.m | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonReplaceOperation.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonReplaceOperation.m | 2 |
4 files changed, 14 insertions, 6 deletions
diff --git a/SmartDeviceLink/SDLMenuManager.m b/SmartDeviceLink/SDLMenuManager.m index 8cfa4d7b0..28a70f754 100644 --- a/SmartDeviceLink/SDLMenuManager.m +++ b/SmartDeviceLink/SDLMenuManager.m @@ -208,8 +208,12 @@ UInt32 const MenuCellIdMin = 1; SDLShowAppMenu *openMenu = [[SDLShowAppMenu alloc] init]; [self.connectionManager sendConnectionRequest:openMenu withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { - if (error != nil) { + if ([response.resultCode isEqualToEnum:SDLResultWarnings]) { + SDLLogW(@"Warning opening application menu: %@", error); + } else if (![response.resultCode isEqualToEnum:SDLResultSuccess]) { SDLLogE(@"Error opening application menu: %@", error); + } else { + SDLLogD(@"Successfully opened application main menu"); } }]; @@ -231,8 +235,12 @@ UInt32 const MenuCellIdMin = 1; SDLShowAppMenu *subMenu = [[SDLShowAppMenu alloc] initWithMenuID:cell.cellId]; [self.connectionManager sendConnectionRequest:subMenu withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { - if (error != nil) { - SDLLogE(@"Error opening application to submenu cell: %@, with error: %@", cell, error); + if ([response.resultCode isEqualToEnum:SDLResultWarnings]) { + SDLLogW(@"Warning opening application menu to submenu cell %@, with error: %@", cell, error); + } else if (![response.resultCode isEqualToEnum:SDLResultSuccess]) { + SDLLogE(@"Error opening application menu to submenu cell %@, with error: %@", cell, error); + } else { + SDLLogD(@"Successfully opened application menu to submenu cell: %@", cell); } }]; diff --git a/SmartDeviceLink/SDLSoftButtonManager.m b/SmartDeviceLink/SDLSoftButtonManager.m index 244e72c47..f54e9d4bc 100644 --- a/SmartDeviceLink/SDLSoftButtonManager.m +++ b/SmartDeviceLink/SDLSoftButtonManager.m @@ -140,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN _softButtonObjects = softButtonObjects; // We assume that all soft button capabilities are the same, so we only need to send one - SDLSoftButtonReplaceOperation *op = [[SDLSoftButtonReplaceOperation alloc] initWithConnectionManager:self.connectionManager fileManager:self.fileManager capabilities:self.windowCapability.softButtonCapabilities[0] softButtonObjects:_softButtonObjects mainField1:self.currentMainField1]; + SDLSoftButtonReplaceOperation *op = [[SDLSoftButtonReplaceOperation alloc] initWithConnectionManager:self.connectionManager fileManager:self.fileManager capabilities:self.windowCapability.softButtonCapabilities.firstObject softButtonObjects:_softButtonObjects mainField1:self.currentMainField1]; if (self.isBatchingUpdates) { [self.batchQueue removeAllObjects]; diff --git a/SmartDeviceLink/SDLSoftButtonReplaceOperation.h b/SmartDeviceLink/SDLSoftButtonReplaceOperation.h index 9adb5afb4..f7a66b331 100644 --- a/SmartDeviceLink/SDLSoftButtonReplaceOperation.h +++ b/SmartDeviceLink/SDLSoftButtonReplaceOperation.h @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN @param mainField1 The primary text field of the system template @return The operation */ -- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager capabilities:(SDLSoftButtonCapabilities *)capabilities softButtonObjects:(NSArray<SDLSoftButtonObject *> *)softButtonObjects mainField1:(NSString *)mainField1; +- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager capabilities:(nullable SDLSoftButtonCapabilities *)capabilities softButtonObjects:(NSArray<SDLSoftButtonObject *> *)softButtonObjects mainField1:(NSString *)mainField1; @end diff --git a/SmartDeviceLink/SDLSoftButtonReplaceOperation.m b/SmartDeviceLink/SDLSoftButtonReplaceOperation.m index ba7c0033d..a0899b8d5 100644 --- a/SmartDeviceLink/SDLSoftButtonReplaceOperation.m +++ b/SmartDeviceLink/SDLSoftButtonReplaceOperation.m @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLSoftButtonReplaceOperation -- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager capabilities:(SDLSoftButtonCapabilities *)capabilities softButtonObjects:(NSArray<SDLSoftButtonObject *> *)softButtonObjects mainField1:(NSString *)mainField1 { +- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager fileManager:(SDLFileManager *)fileManager capabilities:(nullable SDLSoftButtonCapabilities *)capabilities softButtonObjects:(NSArray<SDLSoftButtonObject *> *)softButtonObjects mainField1:(NSString *)mainField1 { self = [super init]; if (!self) { return nil; } |