Skip to content

Commit dbca3b9

Browse files
authored
Merge pull request #165 from pusher/escaping-authorizer-completion-handler
Escaping authorizer completion handler
2 parents b63fc40 + 19f0c17 commit dbca3b9

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

PusherSwift/PusherSwift.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@
138138
3389F5751CAEDE2800563F49 /* PusherGlobalChannel.swift */,
139139
3389F5711CAEDDF300563F49 /* PusherChannels.swift */,
140140
3341A3391D819FBC007191AD /* NativePusher.swift */,
141-
33C1FD6E1D81BFC300921AD7 /* ObjectiveC.swift */,
142141
3390D1E51F054D0400E1944D /* AuthRequestBuilderProtocol.swift */,
143142
3390D1E71F054D1E00E1944D /* Authorizer.swift */,
143+
33C1FD6E1D81BFC300921AD7 /* ObjectiveC.swift */,
144144
33C0D2E71CB5C54C003FE13E /* Dependencies */,
145145
33831CD61A9CFFF200B124F1 /* PusherSwift.h */,
146146
33831C8C1A9CF61600B124F1 /* Supporting Files */,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
22

33
@objc public protocol AuthRequestBuilderProtocol {
4+
@objc optional func requestFor(socketID: String, channelName: String) -> URLRequest?
5+
46
@available(*, deprecated: 4.0.2, message: "use requestFor(socketID: String, channelName: String) -> URLRequest? instead")
57
@objc optional func requestFor(socketID: String, channel: PusherChannel) -> NSMutableURLRequest?
6-
7-
@objc optional func requestFor(socketID: String, channelName: String) -> URLRequest?
88
}

Sources/Authorizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Foundation
22

33
@objc public protocol Authorizer {
4-
@objc func fetchAuthValue(socketID: String, channelName: String, completionHandler: (PusherAuth?) -> ())
4+
@objc func fetchAuthValue(socketID: String, channelName: String, completionHandler: @escaping (PusherAuth?) -> ())
55
}

Sources/PusherConnection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ public typealias PusherEventJSON = [String: AnyObject]
613613
return
614614
}
615615

616-
handleAuthInfo(authString: authInfo.auth, channelData: authInfo.channelData, channel: channel)
616+
self.handleAuthInfo(authString: authInfo.auth, channelData: authInfo.channelData, channel: channel)
617617
}
618618

619619
return true

Tests/AuthenticationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class AuthenticationTests: XCTestCase {
250250
func testAuthorizationUsingSomethingConformingToTheAuthorizerProtocol() {
251251

252252
class SomeAuthorizer: Authorizer {
253-
func fetchAuthValue(socketID: String, channelName: String, completionHandler: (PusherAuth?) -> ()) {
253+
func fetchAuthValue(socketID: String, channelName: String, completionHandler: @escaping (PusherAuth?) -> ()) {
254254
completionHandler(PusherAuth(auth: "testKey123:authorizerblah123"))
255255
}
256256
}
@@ -280,7 +280,7 @@ class AuthenticationTests: XCTestCase {
280280
func testAuthorizationOfPresenceChannelSubscriptionUsingSomethingConformingToTheAuthorizerProtocol() {
281281

282282
class SomeAuthorizer: Authorizer {
283-
func fetchAuthValue(socketID: String, channelName: String, completionHandler: (PusherAuth?) -> ()) {
283+
func fetchAuthValue(socketID: String, channelName: String, completionHandler: @escaping (PusherAuth?) -> ()) {
284284
completionHandler(PusherAuth(
285285
auth: "testKey123:authorizerblah1234",
286286
channelData: "{\"user_id\":\"777\", \"user_info\":{\"twitter\":\"hamchapman\"}}"

0 commit comments

Comments
 (0)