Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 9619104

Browse files
cbaker6TomWFox
andauthored
Update sockets (#236)
* Update starscream to latest * update carthage files * Update pod spec * update podspec * Add reconnect because of change in logic from dependency * Improve connection logic * Improve connection logic * Fix subscriptions * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Tom Fox <[email protected]> * Update versions to 2.8.0, add watchOS and tvOS to circle build * Update version numbers of watchOS and tvOS * Show warnings from pod trunk push * fix cart files * remove dups from merge Co-authored-by: Tom Fox <[email protected]>
1 parent db0458f commit 9619104

File tree

12 files changed

+67
-56
lines changed

12 files changed

+67
-56
lines changed

.circleci/config.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,14 @@ jobs:
7979
- run: |
8080
xcodebuild clean -workspace ParseLiveQuery.xcworkspace -scheme LiveQueryDemo | xcpretty -c;
8181
xcodebuild build -workspace ParseLiveQuery.xcworkspace -scheme LiveQueryDemo -configuration Debug | xcpretty -c;
82-
- run: |
83-
xcodebuild clean -workspace ParseLiveQuery.xcworkspace -scheme LiveQueryDemo-ObjC | xcpretty -c;
84-
xcodebuild build -workspace ParseLiveQuery.xcworkspace -scheme LiveQueryDemo-ObjC -configuration Debug | xcpretty -c;
8582
carthage:
8683
<<: *defaults
8784
steps:
8885
- checkout
8986
- restore_cache: *cache-pull
9087
- run: *prepare
9188
- save_cache: *cache-push
92-
- run: carthage build --no-skip-current --platform macos,ios
89+
- run: carthage build --no-skip-current --platform macos,ios,tvos,watchos
9390

9491
workflows:
9592
version: 2

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
deploy:
2424
provider: script
2525
skip_cleanup: true
26-
script: travis_wait bundle exec pod trunk push ParseLiveQuery.podspec --allow-warnings
26+
script: bundle exec pod trunk push ParseLiveQuery.podspec --allow-warnings
2727
on:
2828
tags: true
2929
all_branches: true

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
### Master
44

5-
[Full Changelog](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/compare/2.7.3...master)
5+
[Full Changelog](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/compare/2.8.0...master)
6+
7+
### 2.8.0
8+
9+
[Full Changelog](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/compare/2.7.3...2.8.0)
10+
11+
- Bump Starscream dependency to >= 4.0.4 ([#236](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/236)), thanks to [Corey Baker](https://github.com/cbaker6).
12+
- Bump Parse SDK to v.1.19.1 ([#236](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/236)), thanks to [Corey Baker](https://github.com/cbaker6).
13+
- Minimum support due to Xcode 12 and dependencies (iOS 9) ([#236](https://github.com/parse-community/ParseLiveQuery-iOS-OSX/pull/236)), thanks to [Corey Baker](https://github.com/cbaker6).
614

715
### 2.7.3
816

Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
github "BoltsFramework/Bolts-Swift" >= 1.5.0
22
github "ParsePlatform/Parse-SDK-iOS-OSX" >= 1.19.1
3-
github "daltoniam/Starscream" == 3.1.1
3+
github "daltoniam/Starscream" >= 4.0.4

Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
github "BoltsFramework/Bolts-ObjC" "1.9.1"
22
github "BoltsFramework/Bolts-Swift" "1.5.0"
33
github "ParsePlatform/Parse-SDK-iOS-OSX" "1.19.1"
4-
github "daltoniam/Starscream" "3.1.1"
4+
github "daltoniam/Starscream" "4.0.4"
55
github "facebook/facebook-objc-sdk" "v6.5.2"

Carthage/Checkouts/Starscream

Submodule Starscream updated 46 files

ParseLiveQuery.podspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ParseLiveQuery'
3-
s.version = '2.7.3'
3+
s.version = '2.8.0'
44
s.license = { :type => 'BSD' }
55
s.summary = 'Allows for subscriptions to queries in conjunction with parse-server.'
66
s.homepage = 'http://parseplatform.org'
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
1515
s.swift_version = '5.0'
1616
s.cocoapods_version = '>= 1.4'
1717

18-
s.ios.deployment_target = '8.0'
18+
s.ios.deployment_target = '9.0'
1919
s.tvos.deployment_target = '10.0'
2020
s.watchos.deployment_target = '2.0'
2121
s.osx.deployment_target = '10.10'
@@ -25,6 +25,6 @@ Pod::Spec.new do |s|
2525

2626
s.dependency 'Parse', '~> 1.19.0'
2727
s.dependency 'Bolts-Swift', '~> 1.5.0'
28-
s.dependency 'Starscream', '3.1.0'
28+
s.dependency 'Starscream', '~> 4.0.4'
2929

3030
end

Sources/ParseLiveQuery-tvOS/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
18+
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
</dict>

Sources/ParseLiveQuery-watchOS/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
18+
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
</dict>

Sources/ParseLiveQuery.xcodeproj/project.pbxproj

+12-8
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,7 @@
10641064
INFOPLIST_FILE = "ParseLiveQuery-watchOS/Info.plist";
10651065
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
10661066
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1067+
MARKETING_VERSION = 2.8.0;
10671068
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
10681069
MTL_FAST_MATH = YES;
10691070
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.livequery.watchos.ParseLiveQuery-watchOS";
@@ -1111,6 +1112,7 @@
11111112
INFOPLIST_FILE = "ParseLiveQuery-watchOS/Info.plist";
11121113
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
11131114
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1115+
MARKETING_VERSION = 2.8.0;
11141116
MTL_ENABLE_DEBUG_INFO = NO;
11151117
MTL_FAST_MATH = YES;
11161118
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.livequery.watchos.ParseLiveQuery-watchOS";
@@ -1161,6 +1163,7 @@
11611163
INFOPLIST_FILE = "ParseLiveQuery-tvOS/Info.plist";
11621164
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
11631165
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1166+
MARKETING_VERSION = 2.8.0;
11641167
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
11651168
MTL_FAST_MATH = YES;
11661169
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.livequery.tvos.ParseLiveQuery-tvOS";
@@ -1207,6 +1210,7 @@
12071210
INFOPLIST_FILE = "ParseLiveQuery-tvOS/Info.plist";
12081211
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
12091212
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1213+
MARKETING_VERSION = 2.8.0;
12101214
MTL_ENABLE_DEBUG_INFO = NO;
12111215
MTL_FAST_MATH = YES;
12121216
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.livequery.tvos.ParseLiveQuery-tvOS";
@@ -1252,7 +1256,7 @@
12521256
GCC_WARN_UNINITIALIZED_AUTOS = YES;
12531257
GCC_WARN_UNUSED_FUNCTION = YES;
12541258
GCC_WARN_UNUSED_VARIABLE = YES;
1255-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1259+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
12561260
MACOSX_DEPLOYMENT_TARGET = 10.12;
12571261
ONLY_ACTIVE_ARCH = YES;
12581262
SWIFT_OBJC_BRIDGING_HEADER = "";
@@ -1289,7 +1293,7 @@
12891293
GCC_WARN_UNINITIALIZED_AUTOS = YES;
12901294
GCC_WARN_UNUSED_FUNCTION = YES;
12911295
GCC_WARN_UNUSED_VARIABLE = YES;
1292-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1296+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
12931297
MACOSX_DEPLOYMENT_TARGET = 10.12;
12941298
SWIFT_OBJC_BRIDGING_HEADER = "";
12951299
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -1314,7 +1318,7 @@
13141318
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
13151319
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
13161320
MACOSX_DEPLOYMENT_TARGET = 10.10;
1317-
MARKETING_VERSION = 2.7.3;
1321+
MARKETING_VERSION = 2.8.0;
13181322
PRODUCT_BUNDLE_IDENTIFIER = com.parse.livequery.osx;
13191323
PRODUCT_NAME = ParseLiveQuery;
13201324
SDKROOT = macosx;
@@ -1341,7 +1345,7 @@
13411345
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
13421346
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
13431347
MACOSX_DEPLOYMENT_TARGET = 10.10;
1344-
MARKETING_VERSION = 2.7.3;
1348+
MARKETING_VERSION = 2.8.0;
13451349
PRODUCT_BUNDLE_IDENTIFIER = com.parse.livequery.osx;
13461350
PRODUCT_NAME = ParseLiveQuery;
13471351
SDKROOT = macosx;
@@ -1364,10 +1368,10 @@
13641368
FRAMEWORK_VERSION = A;
13651369
INFOPLIST_FILE = ParseLiveQuery/Info.plist;
13661370
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1367-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1371+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
13681372
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13691373
LIBRARY_SEARCH_PATHS = "$(inherited)";
1370-
MARKETING_VERSION = 2.7.3;
1374+
MARKETING_VERSION = 2.8.0;
13711375
PRODUCT_BUNDLE_IDENTIFIER = com.parse.livequery.ios;
13721376
PRODUCT_NAME = ParseLiveQuery;
13731377
SDKROOT = iphoneos;
@@ -1393,10 +1397,10 @@
13931397
FRAMEWORK_VERSION = A;
13941398
INFOPLIST_FILE = ParseLiveQuery/Info.plist;
13951399
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1396-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1400+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
13971401
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
13981402
LIBRARY_SEARCH_PATHS = "$(inherited)";
1399-
MARKETING_VERSION = 2.7.3;
1403+
MARKETING_VERSION = 2.8.0;
14001404
PRODUCT_BUNDLE_IDENTIFIER = com.parse.livequery.ios;
14011405
PRODUCT_NAME = ParseLiveQuery;
14021406
SDKROOT = iphoneos;

Sources/ParseLiveQuery/Client.swift

+10-9
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,18 @@ extension Client {
152152
requestId: requestIdGenerator(),
153153
handler: handler
154154
)
155-
subscriptions.append(subscriptionRecord)
155+
156+
self.subscriptions.append(subscriptionRecord)
156157

157-
if let socket = socket, socket.isConnected == true {
158-
_ = sendOperationAsync(.subscribe(requestId: subscriptionRecord.requestId, query: query as! PFQuery<PFObject>,
158+
if socket != nil {
159+
_ = self.sendOperationAsync(.subscribe(requestId: subscriptionRecord.requestId, query: query as! PFQuery<PFObject>,
159160
sessionToken: PFUser.current()?.sessionToken))
161+
} else if !self.userDisconnected {
162+
self.reconnect()
163+
self.subscriptions.removeLast()
164+
return self.subscribe(query, handler: handler)
160165
} else {
161-
if !userDisconnected {
162-
reconnect()
163-
} else {
164-
NSLog("ParseLiveQuery: Warning: The client was explicitly disconnected! You must explicitly call .reconnect() in order to process your subscriptions.")
165-
}
166+
NSLog("ParseLiveQuery: Warning: The client was explicitly disconnected! You must explicitly call .reconnect() in order to process your subscriptions.")
166167
}
167168

168169
return handler
@@ -233,7 +234,7 @@ extension Client {
233234
guard socket == nil || !isConnecting else { return }
234235
socket?.disconnect()
235236
socket = {
236-
let socket = WebSocket(url: host)
237+
let socket = WebSocket(request: .init(url: host))
237238
socket.delegate = self
238239
socket.callbackQueue = queue
239240
socket.connect()

Sources/ParseLiveQuery/Internal/ClientPrivate.swift

+26-25
Original file line numberDiff line numberDiff line change
@@ -115,32 +115,33 @@ func == (first: Client.RequestId, second: Client.RequestId) -> Bool {
115115
// ---------------
116116

117117
extension Client: WebSocketDelegate {
118-
119-
public func websocketDidReceiveData(socket: WebSocketClient, data: Data) {
120-
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: Received binary data but we don't handle it...") }
121-
}
122-
123-
public func websocketDidReceiveMessage(socket: WebSocketClient, text: String) {
124-
handleOperationAsync(text).continueWith { [weak self] task in
125-
if let error = task.error, self?.shouldPrintWebSocketLog == true {
126-
NSLog("ParseLiveQuery: Error processing message: \(error)")
118+
public func didReceive(event: WebSocketEvent, client: WebSocket) {
119+
switch event {
120+
121+
case .connected(_):
122+
isConnecting = false
123+
let sessionToken = PFUser.current()?.sessionToken ?? ""
124+
_ = self.sendOperationAsync(.connect(applicationId: applicationId, sessionToken: sessionToken, clientKey: clientKey))
125+
case .disconnected(let reason, let code):
126+
isConnecting = false
127+
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: WebSocket did disconnect with error: \(reason) code:\(code)") }
128+
129+
// TODO: Better retry logic, unless `disconnect()` was explicitly called
130+
if !userDisconnected {
131+
reconnect()
127132
}
128-
}
129-
}
130-
131-
public func websocketDidConnect(socket: WebSocketClient) {
132-
isConnecting = false
133-
let sessionToken = PFUser.current()?.sessionToken ?? ""
134-
_ = self.sendOperationAsync(.connect(applicationId: applicationId, sessionToken: sessionToken, clientKey: clientKey))
135-
}
136-
137-
public func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {
138-
isConnecting = false
139-
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: WebSocket did disconnect with error: \(String(describing: error))") }
140-
141-
// TODO: Better retry logic, unless `disconnect()` was explicitly called
142-
if !userDisconnected {
143-
reconnect()
133+
case .text(let text):
134+
handleOperationAsync(text).continueWith { [weak self] task in
135+
if let error = task.error, self?.shouldPrintWebSocketLog == true {
136+
NSLog("ParseLiveQuery: Error processing message: \(error)")
137+
}
138+
}
139+
case .binary(_):
140+
if shouldPrintWebSocketLog { NSLog("ParseLiveQuery: Received binary data but we don't handle it...") }
141+
case .error(let error):
142+
NSLog("ParseLiveQuery: Error processing message: \(String(describing: error))")
143+
default:
144+
break
144145
}
145146
}
146147
}

0 commit comments

Comments
 (0)