Adds support for syncing Games and GameCollections
This commit is contained in:
parent
db9f43334d
commit
f858a3eb07
@ -9,6 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
import DeltaCore
|
||||
import Harmony
|
||||
|
||||
@objc(Game)
|
||||
public class Game: _Game, GameProtocol
|
||||
@ -109,3 +110,27 @@ extension Game
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Game: Syncable
|
||||
{
|
||||
public static var syncablePrimaryKey: AnyKeyPath {
|
||||
return \Game.identifier
|
||||
}
|
||||
|
||||
public var syncableKeys: Set<AnyKeyPath> {
|
||||
return [\Game.artworkURL, \Game.filename, \Game.name, \Game.type]
|
||||
}
|
||||
|
||||
public var syncableFiles: Set<File> {
|
||||
let gameFile = File(identifier: "game", fileURL: self.fileURL)
|
||||
|
||||
let artworkURL = DatabaseManager.artworkURL(for: self)
|
||||
let artworkFile = File(identifier: "artwork", fileURL: artworkURL)
|
||||
|
||||
return [gameFile, artworkFile]
|
||||
}
|
||||
|
||||
public var syncableRelationships: Set<AnyKeyPath> {
|
||||
return [\Game.gameCollection]
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
import CoreData
|
||||
|
||||
import DeltaCore
|
||||
import Harmony
|
||||
|
||||
@objc(GameCollection)
|
||||
public class GameCollection: _GameCollection
|
||||
@ -28,3 +29,14 @@ public class GameCollection: _GameCollection
|
||||
return system
|
||||
}
|
||||
}
|
||||
|
||||
extension GameCollection: Syncable
|
||||
{
|
||||
public static var syncablePrimaryKey: AnyKeyPath {
|
||||
return \GameCollection.identifier
|
||||
}
|
||||
|
||||
public var syncableKeys: Set<AnyKeyPath> {
|
||||
return [\GameCollection.index as AnyKeyPath]
|
||||
}
|
||||
}
|
||||
|
||||
2
External/Harmony
vendored
2
External/Harmony
vendored
@ -1 +1 @@
|
||||
Subproject commit b6541ab7931e6b8291387d9e5c46e47fc63cfdca
|
||||
Subproject commit 47cc6cd87cd7e04765b05204a03f83c9eab7c159
|
||||
Loading…
Reference in New Issue
Block a user