Skip to content

Commit e3fff80

Browse files
committed
Deprecate old requestFor function and make new one (using URLRequest as
the return value) the recommended one, but with only the channel name, instead of the whole channel object, passed in as a parameter.
1 parent 7cf1b46 commit e3fff80

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Source/PusherClientOptions.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ public enum PusherHost {
1919
}
2020

2121
@objc public protocol AuthRequestBuilderProtocol {
22-
func requestFor(socketID: String, channel: PusherChannel) -> URLRequest?
22+
@available(*, deprecated: 4.0.2, message: "use requestFor(socketID: String, channelName: String) -> URLRequest? instead")
23+
@objc optional func requestFor(socketID: String, channel: PusherChannel) -> NSMutableURLRequest?
24+
25+
@objc optional func requestFor(socketID: String, channelName: String) -> URLRequest?
2326
}
2427

2528
public enum AuthMethod {

Source/PusherConnection.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@ open class PusherConnection: NSObject {
523523
return true
524524

525525
case .authRequestBuilder(authRequestBuilder: let builder):
526-
if let request = builder.requestFor(socketID: socketID, channel: channel) {
526+
if let request = builder.requestFor?(socketID: socketID, channel: channel) {
527+
sendAuthorisationRequest(request: request as URLRequest, channel: channel, callback: callback)
528+
529+
return true
530+
} else if let request = builder.requestFor?(socketID: socketID, channelName: channel.name) {
527531
sendAuthorisationRequest(request: request, channel: channel, callback: callback)
528532

529533
return true

0 commit comments

Comments
 (0)