From 26c95214297d6ab6d6fd330f54d0b27d5c6387a8 Mon Sep 17 00:00:00 2001 From: Andrey Kartashov Date: Sun, 8 Oct 2017 11:11:27 -0400 Subject: [PATCH 1/3] deprecated characters Xcode 9.1 beta --- SwiftDDP/DDPClient.swift | 2 +- SwiftDDP/DDPUtilities.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SwiftDDP/DDPClient.swift b/SwiftDDP/DDPClient.swift index fe5ab1b..745297d 100644 --- a/SwiftDDP/DDPClient.swift +++ b/SwiftDDP/DDPClient.swift @@ -221,7 +221,7 @@ open class DDPClient: NSObject { let numbers = Set(["0","1","2","3","4","5","6","7","8","9"]) let uuid = UUID().uuidString.replacingOccurrences(of: "-", with: "") var id = "" - for character in uuid.characters { + for character in uuid { if (!numbers.contains(character) && (round(Float(arc4random()) / Float(UINT32_MAX)) == 1)) { id += String(character).lowercased() } else { diff --git a/SwiftDDP/DDPUtilities.swift b/SwiftDDP/DDPUtilities.swift index 0cced73..38740e4 100644 --- a/SwiftDDP/DDPUtilities.swift +++ b/SwiftDDP/DDPUtilities.swift @@ -28,8 +28,8 @@ func randomBase64String(_ n: Int = 20) -> String { let BASE64_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_" for _ in 1...n { - let r = arc4random() % UInt32(BASE64_CHARS.characters.count) - let index = BASE64_CHARS.characters.index(BASE64_CHARS.startIndex, offsetBy: Int(r)) + let r = arc4random() % UInt32(BASE64_CHARS.count) + let index = BASE64_CHARS.index(BASE64_CHARS.startIndex, offsetBy: Int(r)) let c = BASE64_CHARS[index] string += String(c) } From 5e3f23c194b159be9aaf87822f738465729691a2 Mon Sep 17 00:00:00 2001 From: Andrey Kartashov Date: Sun, 8 Oct 2017 11:16:44 -0400 Subject: [PATCH 2/3] version? --- SwiftDDP.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SwiftDDP.podspec b/SwiftDDP.podspec index fca643a..85afa74 100644 --- a/SwiftDDP.podspec +++ b/SwiftDDP.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftDDP" - s.version = "0.6.0" + s.version = "0.6.1" s.summary = "A DDP Client for communicating with Meteor servers, written in Swift. Supports OAuth login with Facebook, Google, Twitter & Github." s.description = <<-DESC "A DDP Client for communicating with DDP Servers (Meteor JS), written in Swift. Supports OAuth authentication with Facebook, Google, Twitter & Github." From 6282b50c3e56f6edaf2ac0cdcd616d81b0183809 Mon Sep 17 00:00:00 2001 From: Andrey Kartashov Date: Sun, 8 Oct 2017 11:29:43 -0400 Subject: [PATCH 3/3] Starscream 3.0.2 compatible --- SwiftDDP.podspec | 2 +- SwiftDDP/DDPClient.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SwiftDDP.podspec b/SwiftDDP.podspec index 85afa74..e546771 100644 --- a/SwiftDDP.podspec +++ b/SwiftDDP.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SwiftDDP" - s.version = "0.6.1" + s.version = "0.6.2" s.summary = "A DDP Client for communicating with Meteor servers, written in Swift. Supports OAuth login with Facebook, Google, Twitter & Github." s.description = <<-DESC "A DDP Client for communicating with DDP Servers (Meteor JS), written in Swift. Supports OAuth authentication with Facebook, Google, Twitter & Github." diff --git a/SwiftDDP/DDPClient.swift b/SwiftDDP/DDPClient.swift index 745297d..e171e6b 100644 --- a/SwiftDDP/DDPClient.swift +++ b/SwiftDDP/DDPClient.swift @@ -49,7 +49,7 @@ public protocol SwiftDDPDelegate { extension DDPClient: WebSocketDelegate { - public func websocketDidConnect(socket: WebSocket) { + public func websocketDidConnect(socket: WebSocketClient) { self.heartbeat.addOperation() { [weak self] in // Add a subscription to loginServices to each connection event let callbackWithServiceConfiguration = { (session:String) in @@ -77,7 +77,7 @@ extension DDPClient: WebSocketDelegate { } } - public func websocketDidDisconnect(socket: WebSocket, error: NSError?) { + public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) { log.warning("Socket connection closed with error: \(String(describing: error))") self.backOff.createBackoff({ [weak self] in self?.socket.connect() @@ -85,14 +85,14 @@ extension DDPClient: WebSocketDelegate { }) } - public func websocketDidReceiveMessage(socket: WebSocket, text: String) { + public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) { self.background.addOperation() { [weak self] in do { try self?.ddpMessageHandler(DDPMessage(message: text)) } catch { log.debug("Message handling error. Raw message: \(text)")} } } - public func websocketDidReceiveData(socket: WebSocket, data: Data) { + public func websocketDidReceiveData(socket: WebSocketClient, data: Data) { guard let text = String(data: data, encoding: .utf8) else { log.warning("Could not decode data received: \(data)"); return } self.background.addOperation() { [weak self] in do { try self?.ddpMessageHandler(DDPMessage(message: text)) } @@ -103,7 +103,7 @@ extension DDPClient: WebSocketDelegate { } extension DDPClient: WebSocketPongDelegate { - public func websocketDidReceivePong(socket: WebSocket, data: Data?) { + public func websocketDidReceivePong(socket: WebSocketClient, data: Data?) { heartbeat.addOperation() { self.server.pong = Date() } } }