Merge branch 'development'

* development:
  correct beta version in podspec
  beta version
  swift 5
  call closeOutEngine to clean up after a ping timeout
This commit is contained in:
Erik Little 2019-03-28 06:26:13 -04:00
commit 6037b85f4b
No known key found for this signature in database
GPG Key ID: 62F837E56F4E9320
17 changed files with 44 additions and 35 deletions

View File

@ -1,7 +1,7 @@
language: objective-c
xcode_project: Socket.IO-Client-Swift.xcodeproj # path to your xcodeproj folder
xcode_scheme: SocketIO-Mac
osx_image: xcode10
osx_image: xcode10.2
branches:
only:
- master

View File

@ -1,3 +1,7 @@
# v15.0.0
- Swift 5
# v14.0.0
- Minimum version of the client is now Swift 4.2.

View File

@ -1 +1 @@
github "daltoniam/Starscream" ~> 3.0
github "daltoniam/Starscream" ~> 3.1

View File

@ -1 +1 @@
github "daltoniam/Starscream" "3.0.6"
github "daltoniam/Starscream" "3.1.0"

View File

@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/daltoniam/Starscream",
"state": {
"branch": null,
"revision": "ebdc260ea64e68f7569c62e8744b5cd15d3a49d6",
"version": "3.0.6"
"revision": "9c03ef715d1bc9334b446c90df53586dd38cf849",
"version": "3.1.0"
}
}
]

View File

@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.0
import PackageDescription
@ -8,7 +8,7 @@ let package = Package(
.library(name: "SocketIO", targets: ["SocketIO"])
],
dependencies: [
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.0.0")),
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.1.0")),
],
targets: [
.target(name: "SocketIO", dependencies: ["Starscream"]),

View File

@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.module_name = "SocketIO"
s.version = "14.0.0"
s.version = "15.0.0-beta1"
s.summary = "Socket.IO-client for iOS and OS X"
s.description = <<-DESC
Socket.IO-client for iOS and OS X.
@ -18,14 +18,14 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.source = {
:git => "https://github.com/socketio/socket.io-client-swift.git",
:tag => 'v14.0.0',
:tag => 'v15.0.0-beta1',
:submodules => true
}
s.swift_version = "4.2"
s.swift_version = "5"
s.pod_target_xcconfig = {
'SWIFT_VERSION' => '4.2'
'SWIFT_VERSION' => '5.0'
}
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
s.dependency "Starscream", "~> 3.0.6"
s.dependency "Starscream", "~> 3.1"
end

View File

@ -394,7 +394,7 @@
attributes = {
LastSwiftMigration = 0730;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1020;
TargetAttributes = {
572EF2371B51F18A00EEBB58 = {
CreatedOnToolsVersion = 6.4;
@ -411,6 +411,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 572EF20D1B51F12F00EEBB58;
@ -523,6 +524,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -587,7 +589,7 @@
PRODUCT_NAME = SocketIO;
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -598,6 +600,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@ -659,7 +662,7 @@
PRODUCT_NAME = SocketIO;
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -727,7 +730,7 @@
SWIFT_INCLUDE_PATHS = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)";
@ -790,7 +793,7 @@
SUPPORTED_PLATFORMS = "$(inherited)";
SWIFT_INCLUDE_PATHS = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)";
@ -875,7 +878,7 @@
SUPPORTED_PLATFORMS = "$(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)";
};
@ -949,7 +952,7 @@
SDKROOT = macosx;
SUPPORTED_PLATFORMS = "$(inherited)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VALID_ARCHS = "$(inherited)";
};

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -36,9 +36,6 @@ public enum SocketAckStatus : String {
private struct SocketAck : Hashable {
let ack: Int
var callback: AckCallback!
var hashValue: Int {
return ack.hashValue
}
init(ack: Int) {
self.ack = ack
@ -49,6 +46,10 @@ private struct SocketAck : Hashable {
self.callback = callback
}
func hash(into hasher: inout Hasher) {
ack.hash(into: &hasher)
}
fileprivate static func <(lhs: SocketAck, rhs: SocketAck) -> Bool {
return lhs.ack < rhs.ack
}

View File

@ -237,7 +237,7 @@ public protocol SocketIOClientSpec : AnyObject {
public extension SocketIOClientSpec {
/// Default implementation.
public func didError(reason: String) {
func didError(reason: String) {
DefaultSocketLogger.Logger.error("\(reason)", type: "SocketIOClient")
handleClientEvent(.error, data: [reason])

View File

@ -544,8 +544,7 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
// Server is not responding
if pongsMissed > pongsMissedMax {
client?.engineDidClose(reason: "Ping timeout")
closeOutEngine(reason: "Ping timeout")
return
}

View File

@ -175,7 +175,7 @@ extension SocketEngineSpec {
if polling {
return .right("b4" + data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)))
} else {
return .left(Data(bytes: [0x4]) + data)
return .left(Data([0x4]) + data)
}
}

View File

@ -158,7 +158,7 @@ public extension SocketPacket {
// MARK: PacketType enum
/// The type of packets.
public enum PacketType: Int {
enum PacketType: Int {
// MARK: Cases
/// Connect: 0

View File

@ -140,7 +140,7 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
///
/// - parameter message: The string that needs parsing.
/// - returns: A completed socket packet or nil if the packet is invalid.
public func parseSocketMessage(_ message: String) -> SocketPacket? {
func parseSocketMessage(_ message: String) -> SocketPacket? {
guard !message.isEmpty else { return nil }
DefaultSocketLogger.Logger.log("Parsing \(message)", type: "SocketParser")
@ -166,7 +166,7 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
///
/// - parameter data: The data that should be attached to a packet.
/// - returns: A completed socket packet if there is no more data left to collect.
public func parseBinaryData(_ data: Data) -> SocketPacket? {
func parseBinaryData(_ data: Data) -> SocketPacket? {
guard !waitingPackets.isEmpty else {
DefaultSocketLogger.Logger.error("Got data when not remaking packet", type: "SocketParser")

View File

@ -51,17 +51,19 @@ public protocol SocketLogger : AnyObject {
public extension SocketLogger {
/// Default implementation.
func log(_ message: @autoclosure () -> String, type: String) {
abstractLog("LOG", message: message, type: type)
guard log else { return }
abstractLog("LOG", message: message(), type: type)
}
/// Default implementation.
func error(_ message: @autoclosure () -> String, type: String) {
abstractLog("ERROR", message: message, type: type)
guard log else { return }
abstractLog("ERROR", message: message(), type: type)
}
private func abstractLog(_ logType: String, message: @autoclosure () -> String, type: String) {
guard log else { return }
NSLog("\(logType) \(type): %@", message())
}
}

View File

@ -56,7 +56,7 @@ struct SocketStringReader {
mutating func readUntilOccurence(of string: String) -> String {
let substring = message.utf16[currentIndex...]
guard let foundIndex = substring.index(of: string.utf16.first!) else {
guard let foundIndex = substring.firstIndex(where: { $0 == string.utf16.first! }) else {
currentIndex = message.utf16.endIndex
return String(substring)!