Skip to content

Commit 5a74b6b

Browse files
committed
Remove knowledgeVector class
1 parent f3d4431 commit 5a74b6b

File tree

4 files changed

+7
-69
lines changed

4 files changed

+7
-69
lines changed

ParseCareKit.xcodeproj/project.pbxproj

-6
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@
9898
9181F1A429EC47D800C50391 /* PCKRevisionRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9181F1A229EC47D800C50391 /* PCKRevisionRecord.swift */; };
9999
9181F1A629EC48B700C50391 /* PCKEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9181F1A529EC48B700C50391 /* PCKEntity.swift */; };
100100
9181F1A729EC48B700C50391 /* PCKEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9181F1A529EC48B700C50391 /* PCKEntity.swift */; };
101-
9181F1A929EC6ADC00C50391 /* PCKKnowledgeVector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9181F1A829EC6ADC00C50391 /* PCKKnowledgeVector.swift */; };
102-
9181F1AA29EC6ADC00C50391 /* PCKKnowledgeVector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9181F1A829EC6ADC00C50391 /* PCKKnowledgeVector.swift */; };
103101
918F07EE247D66C800C3A205 /* PCKObjectable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 918F07ED247D66C800C3A205 /* PCKObjectable.swift */; };
104102
91AA07232466F0CD00B39452 /* PCKClock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91AA07222466F0CD00B39452 /* PCKClock.swift */; };
105103
91D5287A24813AF70022292B /* PCKSynchronizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91D5287924813AF70022292B /* PCKSynchronizable.swift */; };
@@ -209,7 +207,6 @@
209207
916570D62462DABC008F2997 /* ParseRemote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseRemote.swift; sourceTree = "<group>"; };
210208
9181F1A229EC47D800C50391 /* PCKRevisionRecord.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PCKRevisionRecord.swift; sourceTree = "<group>"; };
211209
9181F1A529EC48B700C50391 /* PCKEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PCKEntity.swift; sourceTree = "<group>"; };
212-
9181F1A829EC6ADC00C50391 /* PCKKnowledgeVector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PCKKnowledgeVector.swift; sourceTree = "<group>"; };
213210
918F07ED247D66C800C3A205 /* PCKObjectable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PCKObjectable.swift; sourceTree = "<group>"; };
214211
91AA07222466F0CD00B39452 /* PCKClock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PCKClock.swift; sourceTree = "<group>"; };
215212
91D5287924813AF70022292B /* PCKSynchronizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PCKSynchronizable.swift; sourceTree = "<group>"; };
@@ -418,7 +415,6 @@
418415
9119D5F824561A28001B7AA3 /* PCKContact.swift */,
419416
9181F1A529EC48B700C50391 /* PCKEntity.swift */,
420417
70D5A29325E0D2D30036A8AD /* PCKHealthKitTask.swift */,
421-
9181F1A829EC6ADC00C50391 /* PCKKnowledgeVector.swift */,
422418
9119D5FF24561A28001B7AA3 /* PCKOutcome.swift */,
423419
9119D5FB24561A28001B7AA3 /* PCKPatient.swift */,
424420
9181F1A229EC47D800C50391 /* PCKRevisionRecord.swift */,
@@ -736,7 +732,6 @@
736732
700B0ED4270DD62200EEF103 /* PCKObjectable+async.swift in Sources */,
737733
70F2E185254EFC8000B2EA5C /* PCKCarePlan.swift in Sources */,
738734
910734BB29E447ED002169C2 /* RemoteSynchronizing.swift in Sources */,
739-
9181F1AA29EC6ADC00C50391 /* PCKKnowledgeVector.swift in Sources */,
740735
70F2E18A254EFC8000B2EA5C /* PCKSynchronizable.swift in Sources */,
741736
709D1819258699840002E772 /* ParseRemoteDelegate.swift in Sources */,
742737
70F2E18C254EFC8000B2EA5C /* PCKVersionable.swift in Sources */,
@@ -751,7 +746,6 @@
751746
isa = PBXSourcesBuildPhase;
752747
buildActionMask = 2147483647;
753748
files = (
754-
9181F1A929EC6ADC00C50391 /* PCKKnowledgeVector.swift in Sources */,
755749
709D175D258551D20002E772 /* ParseCareKitLog.swift in Sources */,
756750
700B0ED3270DD62200EEF103 /* PCKObjectable+async.swift in Sources */,
757751
700B0ED6270DD7D900EEF103 /* PCKVersionable+async.swift in Sources */,

Sources/ParseCareKit/Models/PCKKnowledgeVector.swift

-56
This file was deleted.

Sources/ParseCareKit/Models/PCKRevisionRecord.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct PCKRevisionRecord: ParseObject, Equatable, Codable {
4242

4343
/// A knowledge vector indicating the last known state of each other device
4444
/// by the device that authored this revision record.
45-
var knowledgeVector: PCKKnowledgeVector?
45+
var knowledgeVector: OCKRevisionRecord.KnowledgeVector?
4646

4747
var objects: [any PCKVersionable] {
4848
guard let entities = entities else {
@@ -106,7 +106,7 @@ struct PCKRevisionRecord: ParseObject, Equatable, Codable {
106106
}
107107
let careKitEntities = try entities.compactMap { try $0.careKit() }
108108
return OCKRevisionRecord(entities: careKitEntities,
109-
knowledgeVector: try knowledgeVector.currentVector())
109+
knowledgeVector: knowledgeVector)
110110
}
111111

112112
func save(options: API.Options = []) async throws -> Self {
@@ -203,7 +203,8 @@ extension PCKRevisionRecord {
203203
self.createdAt = try container.decodeIfPresent(Date.self, forKey: .createdAt)
204204
self.updatedAt = try container.decodeIfPresent(Date.self, forKey: .updatedAt)
205205
self.ACL = try container.decodeIfPresent(ParseACL.self, forKey: .ACL)
206-
self.knowledgeVector = try container.decodeIfPresent(PCKKnowledgeVector.self, forKey: .knowledgeVector)
206+
self.knowledgeVector = try container.decodeIfPresent(OCKRevisionRecord.KnowledgeVector.self,
207+
forKey: .knowledgeVector)
207208
self.entities = try container.decodeIfPresent([PCKEntity].self, forKey: .entities)
208209
self.clock = try container.decodeIfPresent(PCKClock.self, forKey: .clock)
209210
self.logicalClock = try container.decodeIfPresent(Int.self, forKey: .logicalClock)
@@ -240,6 +241,7 @@ extension PCKRevisionRecord {
240241
self.clockUUID = remoteClockUUID
241242
self.logicalClock = remoteClockValue
242243
self.clock = remoteClock
244+
self.knowledgeVector = record.knowledgeVector
243245
self.entities = try record.entities.compactMap { entity in
244246
var parseEntity = try entity.parseEntity().value
245247
parseEntity.logicalClock = remoteClockValue // Stamp Entity
@@ -278,6 +280,5 @@ extension PCKRevisionRecord {
278280
return PCKEntity.outcome(parseEntity)
279281
}
280282
}
281-
self.knowledgeVector = PCKKnowledgeVector(record.knowledgeVector)
282283
}
283284
}

Tests/ParseCareKitTests/EncodingCareKitTests.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -1297,12 +1297,11 @@ class ParseCareKitTests: XCTestCase {
12971297
// Test PCKRevisionRecord encoding/decoding to Parse Server
12981298
let encoded = try ParseCoding.jsonEncoder().encode(parseRecord)
12991299
let decoded = try ParseCoding.jsonDecoder().decode(PCKRevisionRecord.self, from: encoded)
1300-
guard let decodedKnowledgeVector = decoded.knowledgeVector,
1301-
let decodedEntities = decoded.entities else {
1300+
guard let decodedEntities = decoded.entities else {
13021301
XCTFail("Should have unwrapped")
13031302
return
13041303
}
1305-
XCTAssertEqual(try decodedKnowledgeVector.currentVector(), careKitRecord.knowledgeVector)
1304+
XCTAssertEqual(decoded.knowledgeVector, careKitRecord.knowledgeVector)
13061305
XCTAssertEqual(decodedEntities.count, careKitRecord.entities.count)
13071306
guard let decodedPatient2 = decodedEntities.first else {
13081307
XCTFail("Should have unwrapped")

0 commit comments

Comments
 (0)