summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-03-11 12:12:50 -0400
committerJoel Fischer <joeljfischer@gmail.com>2020-03-11 12:12:50 -0400
commit0f6d87743610028cd5f71540c0cb23a6e18ff134 (patch)
tree1f3d54b26f47e9f5d5f19aad78bae7e39f2b477b
parent8509481ddac038bbb481b1a818c46fea6812348f (diff)
downloadsdl_ios-0f6d87743610028cd5f71540c0cb23a6e18ff134.tar.gz
Fix documentation and potential crash
-rw-r--r--SmartDeviceLink/SDLMenuManager.m14
-rw-r--r--SmartDeviceLink/SDLSoftButtonManager.m2
-rw-r--r--SmartDeviceLink/SDLSoftButtonReplaceOperation.h2
-rw-r--r--SmartDeviceLink/SDLSoftButtonReplaceOperation.m2
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; }