Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 4342b04bd3
commit 61ec865b6d

@ -35,7 +35,12 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
@interface TSAccountManager ()
@property (nonatomic, readonly) BOOL isRegistered;
// This property is exposed publicly for testing purposes only.
#ifndef DEBUG
@property (nonatomic, nullable) NSString *phoneNumberAwaitingVerification;
#endif
@property (nonatomic, nullable) NSString *cachedLocalNumber;
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;

@ -985,7 +985,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
deviceMessages:deviceMessages
success:successHandler];
}
failure:^(NSInteger statusCode, NSData *_Nullable responseBody, NSError *error) {
failure:^(NSInteger statusCode, NSData *_Nullable responseData, NSError *error) {
[self messageSendDidFail:message
recipient:recipient
thread:thread
@ -994,7 +994,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
remainingAttempts:remainingAttempts
statusCode:statusCode
error:error
responseData:responseBody
responseData:responseData
success:successHandler
failure:failureHandler];
}];

@ -18,7 +18,7 @@ typedef NS_ENUM(NSUInteger, SocketManagerState) {
typedef void (^TSSocketMessageSuccess)(id _Nullable responseObject);
// statusCode is zero by default, if request never made or failed.
typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable responseBody, NSError *error);
typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable responseData, NSError *error);
@class TSRequest;

@ -102,10 +102,10 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeMessageRequestFailed,
NSLocalizedString(@"ERROR_DESCRIPTION_REQUEST_FAILED", @"Error indicating that a socket request failed."));
[self didFailWithStatusCode:0 responseBody:nil error:error];
[self didFailWithStatusCode:0 responseData:nil error:error];
}
- (void)didFailWithStatusCode:(NSInteger)statusCode responseBody:(nullable NSData *)responseBody error:(NSError *)error
- (void)didFailWithStatusCode:(NSInteger)statusCode responseData:(nullable NSData *)responseData error:(NSError *)error
{
OWSAssert(error);
@ -124,7 +124,7 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
TSSocketMessageFailure failure = self.failure;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
failure(statusCode, responseBody, error);
failure(statusCode, responseData, error);
});
self.success = nil;
@ -570,18 +570,18 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
if (message.hasMessage) {
responseMessage = message.message;
}
NSData *_Nullable responseBody;
NSData *_Nullable responseData;
if (message.hasBody) {
responseBody = message.body;
responseData = message.body;
}
NSArray<NSString *> *_Nullable responseHeaders = message.headers;
BOOL hasValidResponse = YES;
id responseObject = responseBody;
if (responseBody) {
id responseObject = responseData;
if (responseData) {
NSError *error;
id _Nullable responseJson =
[NSJSONSerialization JSONObjectWithData:responseBody options:(NSJSONReadingOptions)0 error:&error];
[NSJSONSerialization JSONObjectWithData:responseData options:(NSJSONReadingOptions)0 error:&error];
if (!responseJson || error) {
OWSProdLogAndFail(@"%@ could not parse WebSocket response JSON: %@.", self.logTag, error);
hasValidResponse = NO;
@ -608,7 +608,7 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeMessageResponseFailed,
NSLocalizedString(
@"ERROR_DESCRIPTION_RESPONSE_FAILED", @"Error indicating that a socket response failed."));
[socketMessage didFailWithStatusCode:(NSInteger)responseStatus responseBody:responseBody error:error];
[socketMessage didFailWithStatusCode:(NSInteger)responseStatus responseData:responseData error:error];
}
}
@ -617,7 +617,7 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
(unsigned long long)requestId,
(NSInteger)responseStatus,
responseMessage,
responseBody.length,
responseData.length,
responseHeaders,
socketMessage != nil,
responseObject);

Loading…
Cancel
Save