Skip to content

Commit d83dff4

Browse files
authored
Update to latest ParseSwift (#183)
1 parent b114365 commit d83dff4

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

Package.resolved

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"repositoryURL": "https://github.com/cbaker6/CareKit.git",
77
"state": {
88
"branch": null,
9-
"revision": "90860442762805ceda874921ff04ff15a91e58a7",
10-
"version": "2.1.1"
9+
"revision": "954185b307222431e50f656d2870019e9ec97c28",
10+
"version": "2.1.8"
1111
}
1212
},
1313
{
@@ -24,8 +24,8 @@
2424
"repositoryURL": "https://github.com/netreconlab/Parse-Swift.git",
2525
"state": {
2626
"branch": null,
27-
"revision": "8c58ad28038d2d2894257ceba98ed1f3d2b11e0c",
28-
"version": "4.15.1"
27+
"revision": "9e7f393744108c796d89be9c91101d106d7ddc67",
28+
"version": "5.0.0-beta.7"
2929
}
3030
}
3131
]

Package.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ let package = Package(
1212
],
1313
dependencies: [
1414
.package(url: "https://github.com/cbaker6/CareKit.git",
15-
.upToNextMajor(from: "2.1.8")),
16-
.package(url: "https://github.com/netreconlab/Parse-Swift.git",
17-
.upToNextMajor(from: "4.16.2"))
15+
.upToNextMajor(from: "2.1.8")),
16+
.package(url: "https://github.com/netreconlab/Parse-Swift.git", .exact("5.0.0-beta.7"))
1817
],
1918
targets: [
2019
.target(

ParseCareKit.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,8 @@
11581158
isa = XCRemoteSwiftPackageReference;
11591159
repositoryURL = "https://github.com/netreconlab/Parse-Swift.git";
11601160
requirement = {
1161-
kind = upToNextMajorVersion;
1162-
minimumVersion = 4.16.2;
1161+
kind = exactVersion;
1162+
version = "5.0.0-beta.7";
11631163
};
11641164
};
11651165
70DF63DA29719D6E002FA5C5 /* XCRemoteSwiftPackageReference "CareKit" */ = {

Sources/ParseCareKit/PCKUtility.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class PCKUtility {
4747
public class func setupServer(fileName: String = "ParseCareKit",
4848
authentication: ((URLAuthenticationChallenge,
4949
(URLSession.AuthChallengeDisposition,
50-
URLCredential?) -> Void) -> Void)? = nil) {
50+
URLCredential?) -> Void) -> Void)? = nil) throws {
5151
var plistConfiguration: [String: AnyObject]
5252
var clientKey: String?
5353
var liveQueryURL: URL?
@@ -81,15 +81,15 @@ public class PCKUtility {
8181
deleteKeychainIfNeeded = deleteKeychain
8282
}
8383

84-
ParseSwift.initialize(applicationId: appID,
85-
clientKey: clientKey,
86-
serverURL: serverURL,
87-
liveQueryServerURL: liveQueryURL,
88-
requiringCustomObjectIds: true,
89-
usingTransactions: useTransactions,
90-
usingPostForQuery: true,
91-
deletingKeychainIfNeeded: deleteKeychainIfNeeded,
92-
authentication: authentication)
84+
try ParseSwift.initialize(applicationId: appID,
85+
clientKey: clientKey,
86+
serverURL: serverURL,
87+
liveQueryServerURL: liveQueryURL,
88+
requiringCustomObjectIds: true,
89+
usingTransactions: useTransactions,
90+
usingPostForQuery: true,
91+
deletingKeychainIfNeeded: deleteKeychainIfNeeded,
92+
authentication: authentication)
9393
}
9494

9595
/**

Sources/ParseCareKit/ParseRemote.swift

+7-5
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,12 @@ public class ParseRemote: OCKRemoteSynchronizable {
255255

256256
Task {
257257
do {
258-
guard try await ParseHealth.check().contains("ok") else {
258+
let status = try await ParseHealth.check()
259+
guard status == .ok else {
259260
if #available(iOS 14.0, watchOS 7.0, *) {
260-
Logger.pullRevisions.error("Server health is not \"ok\"")
261+
Logger.pullRevisions.error("Server health is: \(status.rawValue)")
261262
} else {
262-
os_log("Server health is not \"ok\"", log: .pullRevisions, type: .error)
263+
os_log("Server health is not ok", log: .pullRevisions, type: .error)
263264
}
264265
completion(ParseCareKitError.parseHealthError)
265266
return
@@ -425,9 +426,10 @@ public class ParseRemote: OCKRemoteSynchronizable {
425426

426427
Task {
427428
do {
428-
guard try await ParseHealth.check().contains("ok") else {
429+
let status = try await ParseHealth.check()
430+
guard status == .ok else {
429431
if #available(iOS 14.0, watchOS 7.0, *) {
430-
Logger.pushRevisions.error("Server health is not \"ok\"")
432+
Logger.pushRevisions.error("Server health is: \(status.rawValue)")
431433
} else {
432434
os_log("Server health is not \"ok\"", log: .pushRevisions, type: .error)
433435
}

Tests/ParseCareKitTests/EncodingCareKitTests.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ class ParseCareKitTests: XCTestCase {
8585
XCTFail("Should create valid URL")
8686
return
8787
}
88-
ParseSwift.initialize(applicationId: "applicationId",
89-
clientKey: "clientKey",
90-
primaryKey: "primaryKey",
91-
serverURL: url,
92-
requiringCustomObjectIds: true,
93-
usingPostForQuery: true,
94-
testing: true)
88+
try ParseSwift.initialize(applicationId: "applicationId",
89+
clientKey: "clientKey",
90+
primaryKey: "primaryKey",
91+
serverURL: url,
92+
requiringCustomObjectIds: true,
93+
usingPostForQuery: true,
94+
testing: true)
9595
do {
9696
_ = try userLogin()
9797
parse = try ParseRemote(uuid: UUID(uuidString: "3B5FD9DA-C278-4582-90DC-101C08E7FC98")!,

Tests/ParseCareKitTests/NetworkMocking/MockURLResponse.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct MockURLResponse {
3434
let encoded = try JSONEncoder().encode(string)
3535
self.init(data: encoded, statusCode: statusCode, delay: delay, headerFields: headerFields)
3636
} catch {
37-
throw ParseError(code: .unknownError, message: "unable to convert string to data")
37+
throw ParseError(code: .otherCause, message: "unable to convert string to data")
3838
}
3939
}
4040

Tests/ParseCareKitTests/UtilityTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class UtilityTests: XCTestCase {
2424
}
2525

2626
func testSetupServer() throws {
27-
PCKUtility.setupServer { (_, completionHandler) in
27+
try PCKUtility.setupServer { (_, completionHandler) in
2828
completionHandler(.performDefaultHandling, nil)
2929
}
3030
XCTAssertEqual(ParseSwift.configuration.applicationId, "3B5FD9DA-C278-4582-90DC-101C08E7FC98")

0 commit comments

Comments
 (0)