diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-04-20 10:20:56 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-04-20 10:20:56 -0400 |
commit | 7662210d89041780f861b160a8b8aeadd724d584 (patch) | |
tree | fe47e0352ebeffffba79a174b5c9e9f7438de484 | |
parent | 251f96f9a6df9b42a30e5499c761c00e495b5002 (diff) | |
download | sdl_ios-7662210d89041780f861b160a8b8aeadd724d584.tar.gz |
Fixed requests with no requests actually in them causing SDL to stop sending requests in some cases
* Made request operations easier to debug
* Fixed warnings
-rw-r--r-- | SmartDeviceLink/SDLAsynchronousRPCRequestOperation.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m | 9 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLMenuCell.m | 2 |
4 files changed, 12 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.h b/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.h index b08c700a2..a24165dad 100644 --- a/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.h +++ b/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.h @@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLAsynchronousRPCRequestOperation : SDLAsynchronousOperation +@property (copy, nonatomic) NSArray<SDLRPCRequest *> *requests; + - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager requests:(NSArray<SDLRPCRequest *> *)requests progressHandler:(nullable SDLMultipleAsyncRequestProgressHandler)progressHandler completionHandler:(nullable SDLMultipleRequestCompletionHandler)completionHandler; - (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager request:(SDLRPCRequest *)request responseHandler:(nullable SDLResponseHandler)responseHandler; diff --git a/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m b/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m index a79b30b09..c92a23c74 100644 --- a/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m +++ b/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m @@ -16,7 +16,6 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLAsynchronousRPCRequestOperation () -@property (copy, nonatomic) NSArray<SDLRPCRequest *> *requests; @property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager; @property (copy, nonatomic, nullable) SDLMultipleAsyncRequestProgressHandler progressHandler; @property (copy, nonatomic, nullable) SDLMultipleRequestCompletionHandler completionHandler; @@ -160,6 +159,14 @@ NS_ASSUME_NONNULL_BEGIN return NSOperationQueuePriorityNormal; } +- (NSString *)description { + return [NSString stringWithFormat:@"%@, request count=%lu, requests started=%lu, finished=%lu, failed=%@", self.name, self.requests.count, self.requestsStarted, self.requestsComplete, (self.requestFailed ? @"YES": @"NO")]; +} + +- (NSString *)debugDescription { + return [NSString stringWithFormat:@"%@, request count=%lu, requests started=%lu, finished=%lu, failed=%@, requests=%@", self.name, self.requests.count, self.requestsStarted, self.requestsComplete, (self.requestFailed ? @"YES": @"NO"), self.requests]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index 0c8c2cf06..08684cb98 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -490,6 +490,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; - (void)sendRequests:(NSArray<SDLRPCRequest *> *)requests progressHandler:(nullable SDLMultipleAsyncRequestProgressHandler)progressHandler completionHandler:(nullable SDLMultipleRequestCompletionHandler)completionHandler { if (requests.count == 0) { completionHandler(YES); + return; } SDLAsynchronousRPCRequestOperation *op = [[SDLAsynchronousRPCRequestOperation alloc] initWithConnectionManager:self requests:requests progressHandler:progressHandler completionHandler:completionHandler]; diff --git a/SmartDeviceLink/SDLMenuCell.m b/SmartDeviceLink/SDLMenuCell.m index cad9380aa..b5a259544 100644 --- a/SmartDeviceLink/SDLMenuCell.m +++ b/SmartDeviceLink/SDLMenuCell.m @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN } - (NSString *)description { - return [NSString stringWithFormat:@"SDLMenuCell: %u-\"%@\", artworkName: %@, voice commands: %u, isSubcell: %@, hasSubcells: %@", (unsigned int)_cellId, _title, _icon.name, _voiceCommands.count, (_parentCellId != UINT32_MAX ? @"YES" : @"NO"), (_subCells.count > 0 ? @"YES" : @"NO")]; + return [NSString stringWithFormat:@"SDLMenuCell: %u-\"%@\", artworkName: %@, voice commands: %lu, isSubcell: %@, hasSubcells: %@", (unsigned int)_cellId, _title, _icon.name, _voiceCommands.count, (_parentCellId != UINT32_MAX ? @"YES" : @"NO"), (_subCells.count > 0 ? @"YES" : @"NO")]; } @end |