diff --git a/CHANGES.md b/CHANGES.md index 995b4cde..4a06739a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +# 1.6 - March 2015 + +* Swift and 64-bit compatibility +* Added new delegate method to support extracting auth response from wrapped payloads (#171) +* Removed SocketRocket from the public interface (#157) +* Fix deprecation warning for willAuthorizeChannelWithRequest (#147) +* Use NSDate instead of C API for setting timestamp on auth request (#133) + # 1.5 - December 2013 This release contains some significant bug fixes and API changes. All deprecated API in this release will be removed in the next release after this one. diff --git a/Library/PTPusher.m b/Library/PTPusher.m index 916f5fd4..f5ec9e1e 100644 --- a/Library/PTPusher.m +++ b/Library/PTPusher.m @@ -281,6 +281,9 @@ - (void)subscribeToChannel:(PTPusherChannel *)channel { [channel authorizeWithCompletionHandler:^(BOOL isAuthorized, NSDictionary *authData, NSError *error) { if (isAuthorized && self.connection.isConnected) { + if ([self.delegate respondsToSelector:@selector(pusher:authorizationPayloadFromResponseData:)]) { + authData = [self.delegate pusher:self authorizationPayloadFromResponseData:authData]; + } [channel subscribeWithAuthorization:authData]; } else { diff --git a/Library/PTPusherDelegate.h b/Library/PTPusherDelegate.h index d495e1d5..967dea72 100644 --- a/Library/PTPusherDelegate.h +++ b/Library/PTPusherDelegate.h @@ -109,6 +109,21 @@ */ - (void)pusher:(PTPusher *)pusher willAuthorizeChannel:(PTPusherChannel *)channel withRequest:(NSMutableURLRequest *)request; +/** Allows the delegate to return authorization data in the format required by Pusher from a + non-standard respnse. + + When using a remote server to authorize access to a private channel, the server is expected to + return an authorization payload in a specific format which is then sent to Pusher when connecting + to a private channel. + + Sometimes, a server might return a non-standard response, for example, the auth data may be a sub-set + of some bigger response. + + If implemented, Pusher will call this method with the response data returned from the authorization + URL and will use whatever dictionary is returned instead. +*/ + - (NSDictionary *)pusher:(PTPusher *)pusher authorizationPayloadFromResponseData:(NSDictionary *)responseData; + /** Notifies the delegate that the PTPusher instance has subscribed to the specified channel. This method will be called after any channel authorization has taken place and when a subscribe event has been received. diff --git a/libPusher.xcodeproj/project.pbxproj b/libPusher.xcodeproj/project.pbxproj index 83687fb3..6f57b361 100755 --- a/libPusher.xcodeproj/project.pbxproj +++ b/libPusher.xcodeproj/project.pbxproj @@ -384,8 +384,10 @@ A315780A14D0751C000136A9 /* Pods.xcconfig */, A31577F714D0731B000136A9 /* Pods-specs.xcconfig */, ); + indentWidth = 2; name = CustomTemplate; sourceTree = ""; + tabWidth = 2; }; 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup;