Skip to content

Commit 6037b85

Browse files
committed
Merge branch 'development'
* development: correct beta version in podspec beta version swift 5 call closeOutEngine to clean up after a ping timeout
2 parents 19a1774 + bd74284 commit 6037b85

17 files changed

+44
-35
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: objective-c
22
xcode_project: Socket.IO-Client-Swift.xcodeproj # path to your xcodeproj folder
33
xcode_scheme: SocketIO-Mac
4-
osx_image: xcode10
4+
osx_image: xcode10.2
55
branches:
66
only:
77
- master

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v15.0.0
2+
3+
- Swift 5
4+
15
# v14.0.0
26

37
- Minimum version of the client is now Swift 4.2.

Diff for: Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "daltoniam/Starscream" ~> 3.0
1+
github "daltoniam/Starscream" ~> 3.1

Diff for: Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "daltoniam/Starscream" "3.0.6"
1+
github "daltoniam/Starscream" "3.1.0"

Diff for: Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"repositoryURL": "https://github.com/daltoniam/Starscream",
77
"state": {
88
"branch": null,
9-
"revision": "ebdc260ea64e68f7569c62e8744b5cd15d3a49d6",
10-
"version": "3.0.6"
9+
"revision": "9c03ef715d1bc9334b446c90df53586dd38cf849",
10+
"version": "3.1.0"
1111
}
1212
}
1313
]

Diff for: Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.2
1+
// swift-tools-version:5.0
22

33
import PackageDescription
44

@@ -8,7 +8,7 @@ let package = Package(
88
.library(name: "SocketIO", targets: ["SocketIO"])
99
],
1010
dependencies: [
11-
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.0.0")),
11+
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMinor(from: "3.1.0")),
1212
],
1313
targets: [
1414
.target(name: "SocketIO", dependencies: ["Starscream"]),

Diff for: Socket.IO-Client-Swift.podspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "Socket.IO-Client-Swift"
33
s.module_name = "SocketIO"
4-
s.version = "14.0.0"
4+
s.version = "15.0.0-beta1"
55
s.summary = "Socket.IO-client for iOS and OS X"
66
s.description = <<-DESC
77
Socket.IO-client for iOS and OS X.
@@ -18,14 +18,14 @@ Pod::Spec.new do |s|
1818
s.requires_arc = true
1919
s.source = {
2020
:git => "https://github.com/socketio/socket.io-client-swift.git",
21-
:tag => 'v14.0.0',
21+
:tag => 'v15.0.0-beta1',
2222
:submodules => true
2323
}
2424

25-
s.swift_version = "4.2"
25+
s.swift_version = "5"
2626
s.pod_target_xcconfig = {
27-
'SWIFT_VERSION' => '4.2'
27+
'SWIFT_VERSION' => '5.0'
2828
}
2929
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
30-
s.dependency "Starscream", "~> 3.0.6"
30+
s.dependency "Starscream", "~> 3.1"
3131
end

Diff for: Socket.IO-Client-Swift.xcodeproj/project.pbxproj

+10-7
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
attributes = {
395395
LastSwiftMigration = 0730;
396396
LastSwiftUpdateCheck = 0730;
397-
LastUpgradeCheck = 1000;
397+
LastUpgradeCheck = 1020;
398398
TargetAttributes = {
399399
572EF2371B51F18A00EEBB58 = {
400400
CreatedOnToolsVersion = 6.4;
@@ -411,6 +411,7 @@
411411
developmentRegion = English;
412412
hasScannedForEncodings = 0;
413413
knownRegions = (
414+
English,
414415
en,
415416
);
416417
mainGroup = 572EF20D1B51F12F00EEBB58;
@@ -523,6 +524,7 @@
523524
isa = XCBuildConfiguration;
524525
buildSettings = {
525526
BITCODE_GENERATION_MODE = bitcode;
527+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
526528
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
527529
CLANG_WARN_BOOL_CONVERSION = YES;
528530
CLANG_WARN_COMMA = YES;
@@ -587,7 +589,7 @@
587589
PRODUCT_NAME = SocketIO;
588590
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
589591
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
590-
SWIFT_VERSION = 3.0;
592+
SWIFT_VERSION = 5.0;
591593
TVOS_DEPLOYMENT_TARGET = 9.0;
592594
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
593595
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@@ -598,6 +600,7 @@
598600
isa = XCBuildConfiguration;
599601
buildSettings = {
600602
BITCODE_GENERATION_MODE = bitcode;
603+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
601604
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
602605
CLANG_WARN_BOOL_CONVERSION = YES;
603606
CLANG_WARN_COMMA = YES;
@@ -659,7 +662,7 @@
659662
PRODUCT_NAME = SocketIO;
660663
SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos iphonesimulator iphoneos watchos watchsimulator";
661664
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
662-
SWIFT_VERSION = 3.0;
665+
SWIFT_VERSION = 5.0;
663666
TVOS_DEPLOYMENT_TARGET = 9.0;
664667
VALID_ARCHS = "i386 x86_64 armv7 armv7s arm64 armv7k";
665668
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@@ -727,7 +730,7 @@
727730
SWIFT_INCLUDE_PATHS = "";
728731
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
729732
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
730-
SWIFT_VERSION = 4.0;
733+
SWIFT_VERSION = 5.0;
731734
TARGETED_DEVICE_FAMILY = "1,2,3,4";
732735
TVOS_DEPLOYMENT_TARGET = 10.0;
733736
VALID_ARCHS = "$(inherited)";
@@ -790,7 +793,7 @@
790793
SUPPORTED_PLATFORMS = "$(inherited)";
791794
SWIFT_INCLUDE_PATHS = "";
792795
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
793-
SWIFT_VERSION = 4.0;
796+
SWIFT_VERSION = 5.0;
794797
TARGETED_DEVICE_FAMILY = "1,2,3,4";
795798
TVOS_DEPLOYMENT_TARGET = 10.0;
796799
VALID_ARCHS = "$(inherited)";
@@ -875,7 +878,7 @@
875878
SUPPORTED_PLATFORMS = "$(inherited)";
876879
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
877880
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
878-
SWIFT_VERSION = 4.0;
881+
SWIFT_VERSION = 5.0;
879882
TVOS_DEPLOYMENT_TARGET = 10.0;
880883
VALID_ARCHS = "$(inherited)";
881884
};
@@ -949,7 +952,7 @@
949952
SDKROOT = macosx;
950953
SUPPORTED_PLATFORMS = "$(inherited)";
951954
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
952-
SWIFT_VERSION = 4.0;
955+
SWIFT_VERSION = 5.0;
953956
TVOS_DEPLOYMENT_TARGET = 10.0;
954957
VALID_ARCHS = "$(inherited)";
955958
};

Diff for: Socket.IO-Client-Swift.xcodeproj/xcshareddata/xcschemes/SocketIO.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1000"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Diff for: Source/SocketIO/Ack/SocketAckManager.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ public enum SocketAckStatus : String {
3636
private struct SocketAck : Hashable {
3737
let ack: Int
3838
var callback: AckCallback!
39-
var hashValue: Int {
40-
return ack.hashValue
41-
}
4239

4340
init(ack: Int) {
4441
self.ack = ack
@@ -49,6 +46,10 @@ private struct SocketAck : Hashable {
4946
self.callback = callback
5047
}
5148

49+
func hash(into hasher: inout Hasher) {
50+
ack.hash(into: &hasher)
51+
}
52+
5253
fileprivate static func <(lhs: SocketAck, rhs: SocketAck) -> Bool {
5354
return lhs.ack < rhs.ack
5455
}

Diff for: Source/SocketIO/Client/SocketIOClientSpec.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public protocol SocketIOClientSpec : AnyObject {
237237

238238
public extension SocketIOClientSpec {
239239
/// Default implementation.
240-
public func didError(reason: String) {
240+
func didError(reason: String) {
241241
DefaultSocketLogger.Logger.error("\(reason)", type: "SocketIOClient")
242242

243243
handleClientEvent(.error, data: [reason])

Diff for: Source/SocketIO/Engine/SocketEngine.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,7 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
544544

545545
// Server is not responding
546546
if pongsMissed > pongsMissedMax {
547-
client?.engineDidClose(reason: "Ping timeout")
548-
547+
closeOutEngine(reason: "Ping timeout")
549548
return
550549
}
551550

Diff for: Source/SocketIO/Engine/SocketEngineSpec.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ extension SocketEngineSpec {
175175
if polling {
176176
return .right("b4" + data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)))
177177
} else {
178-
return .left(Data(bytes: [0x4]) + data)
178+
return .left(Data([0x4]) + data)
179179
}
180180
}
181181

Diff for: Source/SocketIO/Parse/SocketPacket.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public extension SocketPacket {
158158
// MARK: PacketType enum
159159

160160
/// The type of packets.
161-
public enum PacketType: Int {
161+
enum PacketType: Int {
162162
// MARK: Cases
163163

164164
/// Connect: 0

Diff for: Source/SocketIO/Parse/SocketParsable.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
140140
///
141141
/// - parameter message: The string that needs parsing.
142142
/// - returns: A completed socket packet or nil if the packet is invalid.
143-
public func parseSocketMessage(_ message: String) -> SocketPacket? {
143+
func parseSocketMessage(_ message: String) -> SocketPacket? {
144144
guard !message.isEmpty else { return nil }
145145

146146
DefaultSocketLogger.Logger.log("Parsing \(message)", type: "SocketParser")
@@ -166,7 +166,7 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
166166
///
167167
/// - parameter data: The data that should be attached to a packet.
168168
/// - returns: A completed socket packet if there is no more data left to collect.
169-
public func parseBinaryData(_ data: Data) -> SocketPacket? {
169+
func parseBinaryData(_ data: Data) -> SocketPacket? {
170170
guard !waitingPackets.isEmpty else {
171171
DefaultSocketLogger.Logger.error("Got data when not remaking packet", type: "SocketParser")
172172

Diff for: Source/SocketIO/Util/SocketLogger.swift

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ public protocol SocketLogger : AnyObject {
5151
public extension SocketLogger {
5252
/// Default implementation.
5353
func log(_ message: @autoclosure () -> String, type: String) {
54-
abstractLog("LOG", message: message, type: type)
54+
guard log else { return }
55+
56+
abstractLog("LOG", message: message(), type: type)
5557
}
5658

5759
/// Default implementation.
5860
func error(_ message: @autoclosure () -> String, type: String) {
59-
abstractLog("ERROR", message: message, type: type)
61+
guard log else { return }
62+
63+
abstractLog("ERROR", message: message(), type: type)
6064
}
6165

6266
private func abstractLog(_ logType: String, message: @autoclosure () -> String, type: String) {
63-
guard log else { return }
64-
6567
NSLog("\(logType) \(type): %@", message())
6668
}
6769
}

Diff for: Source/SocketIO/Util/SocketStringReader.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct SocketStringReader {
5656
mutating func readUntilOccurence(of string: String) -> String {
5757
let substring = message.utf16[currentIndex...]
5858

59-
guard let foundIndex = substring.index(of: string.utf16.first!) else {
59+
guard let foundIndex = substring.firstIndex(where: { $0 == string.utf16.first! }) else {
6060
currentIndex = message.utf16.endIndex
6161

6262
return String(substring)!

0 commit comments

Comments
 (0)