Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Source/ARTAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ - (NSMutableURLRequest *)buildRequest:(ARTAuthOptions *)options withParams:(ARTT
NSURL *url = [self buildURL:options withParams:params];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = options.authMethod;
[request setTimeoutInterval:_options.httpRequestTimeout];

// HTTP Header Fields
if ([options isMethodPOST]) {
Expand Down Expand Up @@ -370,7 +371,7 @@ - (void)requestToken:(ARTTokenParams *)tokenParams

ARTLogDebug(self.logger, @"RS:%p using authUrl (%@ %@)", _rest, request.HTTPMethod, request.URL);

task = [_rest executeRequest:request withAuthOption:ARTAuthenticationOff wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
task = [_rest executeExternalRequest:request completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
checkerCallback(nil, error);
} else {
Expand Down Expand Up @@ -508,7 +509,7 @@ - (void)handleAuthUrlResponse:(NSHTTPURLResponse *)response
[request setValue:[encoder mimeType] forHTTPHeaderField:@"Accept"];
[request setValue:[encoder mimeType] forHTTPHeaderField:@"Content-Type"];

return [_rest executeRequest:request withAuthOption:ARTAuthenticationOff wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
return [_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOff wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
callback(nil, error);
} else {
Expand Down
2 changes: 1 addition & 1 deletion Source/ARTHTTPPaginatedResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ + (void)executePaginated:(ARTRestInternal *)rest
callback:(ARTHTTPPaginatedCallback)callback {
ARTLogDebug(logger, @"HTTP Paginated request: %@", request);

[rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error && ![error.domain isEqualToString:ARTAblyErrorDomain]) {
callback(nil, [ARTErrorInfo createFromNSError:error]);
return;
Expand Down
2 changes: 1 addition & 1 deletion Source/ARTPaginatedResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ - (void)next:(void (^)(ARTPaginatedResult<id> *_Nullable result, ARTErrorInfo *_
+ (void)executePaginated:(ARTRestInternal *)rest withRequest:(NSMutableURLRequest *)request andResponseProcessor:(ARTPaginatedResultResponseProcessor)responseProcessor wrapperSDKAgents:(nullable NSStringDictionary *)wrapperSDKAgents logger:(ARTInternalLog *)logger callback:(void (^)(ARTPaginatedResult<id> *_Nullable result, ARTErrorInfo *_Nullable error))callback {
ARTLogDebug(logger, @"Paginated request: %@", request);

[rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
callback(nil, [ARTErrorInfo createFromNSError:error]);
} else {
Expand Down
8 changes: 4 additions & 4 deletions Source/ARTPushActivationStateMachine.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ - (void)deviceRegistration:(ARTErrorInfo *)error {
[request setValue:[[self->_rest defaultEncoder] mimeType] forHTTPHeaderField:@"Content-Type"];

ARTLogDebug(self->_logger, @"%@: device registration with request %@", NSStringFromClass(self.class), request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: device registration failed (%@)", NSStringFromClass(self.class), error.localizedDescription);
[self sendEvent:[ARTPushActivationEventGettingDeviceRegistrationFailed newWithError:[ARTErrorInfo createFromNSError:error]]];
Expand Down Expand Up @@ -263,7 +263,7 @@ - (void)deviceUpdateRegistration:(ARTErrorInfo *)error {
[request setDeviceAuthentication:local];

ARTLogDebug(_logger, @"%@: update device with request %@", NSStringFromClass(self.class), request);
[_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: update device failed (%@)", NSStringFromClass(self.class), error.localizedDescription);
[self sendEvent:[ARTPushActivationEventSyncRegistrationFailed newWithError:[ARTErrorInfo createFromNSError:error]]];
Expand Down Expand Up @@ -311,7 +311,7 @@ - (void)syncDevice {
[request setDeviceAuthentication:local];

ARTLogDebug(self->_logger, @"%@: sync device with request %@", NSStringFromClass(self.class), request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: device registration failed (%@)", NSStringFromClass(self.class), error.localizedDescription);
[self sendEvent:[ARTPushActivationEventSyncRegistrationFailed newWithError:[ARTErrorInfo createFromNSError:error]]];
Expand Down Expand Up @@ -366,7 +366,7 @@ - (void)deviceUnregistration:(ARTErrorInfo *)error {
[request setDeviceAuthentication:local];

ARTLogDebug(_logger, @"%@: device deregistration with request %@", NSStringFromClass(self.class), request);
[_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:nil completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
// RSH3d2c1: ignore unauthorized or invalid credentials errors
if (response.statusCode == 401 || error.code == 40005) {
Expand Down
2 changes: 1 addition & 1 deletion Source/ARTPushAdmin.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (void)publish:(ARTPushRecipient *)recipient data:(ARTJsonObject *)data wrapper
[request setValue:[[self->_rest defaultEncoder] mimeType] forHTTPHeaderField:@"Content-Type"];

ARTLogDebug(self->_logger, @"push notification to a single device %@", request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: push notification to a single device failed (%@)", NSStringFromClass(self.class), error.localizedDescription);
if (callback) callback([ARTErrorInfo createFromNSError:error]);
Expand Down
8 changes: 4 additions & 4 deletions Source/ARTPushChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ - (void)subscribeDeviceWithWrapperSDKAgents:(nullable NSStringDictionary *)wrapp
[request setDeviceAuthentication:deviceId localDevice:device];

ARTLogDebug(self->_logger, @"subscribe notifications for device %@ in channel %@", deviceId, self->_channel.name);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: subscribe notifications for device %@ in channel %@ failed (%@)", NSStringFromClass(self.class), deviceId, self->_channel.name, error.localizedDescription);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ - (void)subscribeClientWithWrapperSDKAgents:(nullable NSStringDictionary *)wrapp
[request setValue:[[self->_rest defaultEncoder] mimeType] forHTTPHeaderField:@"Content-Type"];

ARTLogDebug(self->_logger, @"subscribe notifications for clientId %@ in channel %@", clientId, self->_channel.name);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: subscribe notifications for clientId %@ in channel %@ failed (%@)", NSStringFromClass(self.class), clientId, self->_channel.name, error.localizedDescription);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ - (void)unsubscribeDeviceWithWrapperSDKAgents:(nullable NSStringDictionary *)wra
[request setDeviceAuthentication:deviceId localDevice:device];

ARTLogDebug(self->_logger, @"unsubscribe notifications for device %@ in channel %@", deviceId, self->_channel.name);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: unsubscribe notifications for device %@ in channel %@ failed (%@)", NSStringFromClass(self.class), deviceId, self->_channel.name, error.localizedDescription);
}
Expand Down Expand Up @@ -236,7 +236,7 @@ - (void)unsubscribeClientWithWrapperSDKAgents:(nullable NSStringDictionary *)wra
request.HTTPMethod = @"DELETE";

ARTLogDebug(self->_logger, @"unsubscribe notifications for clientId %@ in channel %@", clientId, self->_channel.name);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (error) {
ARTLogError(self->_logger, @"%@: unsubscribe notifications for clientId %@ in channel %@ failed (%@)", NSStringFromClass(self.class), clientId, self->_channel.name, error.localizedDescription);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ARTPushChannelSubscriptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ - (void)save:(ARTPushChannelSubscription *)channelSubscription wrapperSDKAgents:
[request setDeviceAuthentication:channelSubscription.deviceId localDevice:local];

ARTLogDebug(self->_logger, @"save channel subscription with request %@", request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (response.statusCode == 200 /*Ok*/ || response.statusCode == 201 /*Created*/) {
ARTLogDebug(self->_logger, @"channel subscription saved successfully");
callback(nil);
Expand Down Expand Up @@ -209,7 +209,7 @@ - (void)_removeWhere:(NSStringDictionary *)params wrapperSDKAgents:(nullable NSS
#endif

ARTLogDebug(_logger, @"remove channel subscription with request %@", request);
[_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (response.statusCode == 200 /*Ok*/ || response.statusCode == 204 /*not returning any content*/) {
ARTLogDebug(self->_logger, @"%@: channel subscription removed successfully", NSStringFromClass(self.class));
callback(nil);
Expand Down
8 changes: 4 additions & 4 deletions Source/ARTPushDeviceRegistrations.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ - (void)save:(ARTDeviceDetails *)deviceDetails wrapperSDKAgents:(nullable NSStri
[request setDeviceAuthentication:deviceDetails.id localDevice:local logger:self->_logger];

ARTLogDebug(self->_logger, @"save device with request %@", request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (response.statusCode == 200 /*OK*/) {
NSError *decodeError = nil;
ARTDeviceDetails *deviceDetails = [[self->_rest defaultEncoder] decodeDeviceDetails:data error:&decodeError];
Expand Down Expand Up @@ -140,7 +140,7 @@ - (void)get:(ARTDeviceId *)deviceId wrapperSDKAgents:(nullable NSStringDictionar
[request setDeviceAuthentication:deviceId localDevice:local logger:self->_logger];

ARTLogDebug(self->_logger, @"get device with request %@", request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (response.statusCode == 200 /*OK*/) {
NSError *decodeError = nil;
ARTDeviceDetails *device = [self->_rest.encoders[response.MIMEType] decodeDeviceDetails:data error:&decodeError];
Expand Down Expand Up @@ -213,7 +213,7 @@ - (void)remove:(NSString *)deviceId wrapperSDKAgents:(nullable NSStringDictionar
[request setValue:[[self->_rest defaultEncoder] mimeType] forHTTPHeaderField:@"Content-Type"];

ARTLogDebug(self->_logger, @"remove device with request %@", request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (response.statusCode == 200 /*Ok*/ || response.statusCode == 204 /*not returning any content*/) {
ARTLogDebug(self->_logger, @"%@: save device successfully", NSStringFromClass(self.class));
callback(nil);
Expand Down Expand Up @@ -258,7 +258,7 @@ - (void)removeWhere:(NSStringDictionary *)params wrapperSDKAgents:(nullable NSSt
[request setDeviceAuthentication:[params objectForKey:@"deviceId"] localDevice:local];

ARTLogDebug(self->_logger, @"remove devices with request %@", request);
[self->_rest executeRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
[self->_rest executeAblyRequest:request withAuthOption:ARTAuthenticationOn wrapperSDKAgents:wrapperSDKAgents completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if (response.statusCode == 200 /*Ok*/ || response.statusCode == 204 /*not returning any content*/) {
ARTLogDebug(self->_logger, @"%@: remove devices successfully", NSStringFromClass(self.class));
callback(nil);
Expand Down
Loading
Loading