diff options
| author | Joel Fischer <joeljfischer@gmail.com> | 2016-08-30 08:43:28 -0400 |
|---|---|---|
| committer | Joel Fischer <joeljfischer@gmail.com> | 2016-08-30 08:43:28 -0400 |
| commit | 1abe0fa8d351a4c06ac5325bee8fb12fc595a0e5 (patch) | |
| tree | 6c1649eb714ff13128ebc27d9139c40e6b98784e /SmartDeviceLink/SDLUploadFileOperation.m | |
| parent | c9e77a95ab8d298f620cd7cd6c4d8b7d4b6f86b0 (diff) | |
| download | sdl_ios-1abe0fa8d351a4c06ac5325bee8fb12fc595a0e5.tar.gz | |
Run clang-format
Diffstat (limited to 'SmartDeviceLink/SDLUploadFileOperation.m')
| -rw-r--r-- | SmartDeviceLink/SDLUploadFileOperation.m | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/SmartDeviceLink/SDLUploadFileOperation.m b/SmartDeviceLink/SDLUploadFileOperation.m index ebdb4297c..6a278d9e8 100644 --- a/SmartDeviceLink/SDLUploadFileOperation.m +++ b/SmartDeviceLink/SDLUploadFileOperation.m @@ -81,43 +81,43 @@ NS_ASSUME_NONNULL_BEGIN dispatch_group_enter(putFileGroup); __weak typeof(self) weakself = self; [self.connectionManager sendManagerRequest:putFile - withResponseHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) { - typeof(weakself) strongself = weakself; - // If we've already encountered an error, then just abort - // TODO: Is this the right way to handle this case? Should we just abort everything in the future? Should we be deleting what we sent? Should we have an automatic retry strategy based on what the error was? - if (strongself.isCancelled) { - stop = YES; - } - - if (stop) { - dispatch_group_leave(putFileGroup); - BLOCK_RETURN; - } - - // If we encounted an error, abort in the future and call the completion handler - if (error != nil || response == nil || ![response.success boolValue]) { - stop = YES; - streamError = error; - - if (completion != nil) { - completion(NO, 0, error); - } - - dispatch_group_leave(putFileGroup); - BLOCK_RETURN; - } - - // If we haven't encounted an error - SDLPutFileResponse *putFileResponse = (SDLPutFileResponse *)response; - - // We need to do this to make sure our bytesAvailable is accurate - if ([request.correlationID integerValue] > highestCorrelationIDReceived) { - highestCorrelationIDReceived = [request.correlationID integerValue]; - bytesAvailable = [putFileResponse.spaceAvailable unsignedIntegerValue]; - } - - dispatch_group_leave(putFileGroup); - }]; + withResponseHandler:^(__kindof SDLRPCRequest *_Nullable request, __kindof SDLRPCResponse *_Nullable response, NSError *_Nullable error) { + typeof(weakself) strongself = weakself; + // If we've already encountered an error, then just abort + // TODO: Is this the right way to handle this case? Should we just abort everything in the future? Should we be deleting what we sent? Should we have an automatic retry strategy based on what the error was? + if (strongself.isCancelled) { + stop = YES; + } + + if (stop) { + dispatch_group_leave(putFileGroup); + BLOCK_RETURN; + } + + // If we encounted an error, abort in the future and call the completion handler + if (error != nil || response == nil || ![response.success boolValue]) { + stop = YES; + streamError = error; + + if (completion != nil) { + completion(NO, 0, error); + } + + dispatch_group_leave(putFileGroup); + BLOCK_RETURN; + } + + // If we haven't encounted an error + SDLPutFileResponse *putFileResponse = (SDLPutFileResponse *)response; + + // We need to do this to make sure our bytesAvailable is accurate + if ([request.correlationID integerValue] > highestCorrelationIDReceived) { + highestCorrelationIDReceived = [request.correlationID integerValue]; + bytesAvailable = [putFileResponse.spaceAvailable unsignedIntegerValue]; + } + + dispatch_group_leave(putFileGroup); + }]; } dispatch_group_leave(putFileGroup); |
