Series Picker now works together with series import/export
This commit is contained in:
@@ -79,6 +79,14 @@ class LibraryImport {
|
||||
cdGame.isFinished = game.isFinished
|
||||
cdGame.lentTo = game.lentTo
|
||||
cdGame.cover_icloud_path = game.cover_icloud_path
|
||||
cdGame.pickupDescription = game.pickupDescription
|
||||
|
||||
if let date = Date.from(string: game.createdAt) {
|
||||
cdGame.createdAt = date
|
||||
}else{
|
||||
print("Could not decode date '\(game.createdAt)' for game '\(cdGame.name)'")
|
||||
}
|
||||
|
||||
//TODO: cdGame.createdAt = game.createdAt.
|
||||
|
||||
cdConsole.addToGames(cdGame)
|
||||
@@ -127,7 +135,7 @@ class LibraryImport {
|
||||
|
||||
func importLIB(from filename: String) {
|
||||
do {
|
||||
let documentDirectory = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false)
|
||||
let documentDirectory = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false)
|
||||
|
||||
let file = documentDirectory.appendingPathComponent(filename)
|
||||
|
||||
@@ -190,7 +198,8 @@ struct BHLGame : Decodable {
|
||||
let inWishlist : Bool
|
||||
let isFinished : Bool
|
||||
let notes : String?
|
||||
let createdAt : String?
|
||||
let createdAt : String
|
||||
let pickupDescription : String?
|
||||
let publisher : String?
|
||||
let console : UUID?
|
||||
let series : UUID?
|
||||
@@ -205,6 +214,7 @@ struct BHLGame : Decodable {
|
||||
case isFinished
|
||||
case notes
|
||||
case createdAt
|
||||
case pickupDescription
|
||||
case publisher
|
||||
case console
|
||||
case series
|
||||
@@ -220,12 +230,16 @@ struct BHLGame : Decodable {
|
||||
inWishlist = try container.decode(Bool.self, forKey: .inWishlist)
|
||||
isFinished = try container.decode(Bool.self, forKey: .isFinished)
|
||||
notes = try container.decode(String?.self, forKey: .notes)
|
||||
createdAt = try container.decode(String?.self, forKey: .notes)
|
||||
createdAt = try container.decode(String.self, forKey: .createdAt)
|
||||
pickupDescription = try container.decode(String?.self, forKey: .pickupDescription)
|
||||
publisher = try container.decode(String?.self, forKey: .publisher)
|
||||
cover_icloud_path = try container.decode(String?.self, forKey: .cover_icloud_path)
|
||||
console = try container.decode(UUID?.self, forKey: .console)
|
||||
series = try container.decode(UUID?.self, forKey: .console)
|
||||
|
||||
do {
|
||||
series = try container.decode(UUID?.self, forKey: .series)
|
||||
}catch {
|
||||
series = .none
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +306,6 @@ struct BHLConsole : Decodable {
|
||||
shortName = try container.decode(String?.self, forKey: .shortName)
|
||||
accessories = try container.decode([UUID].self, forKey: .accessories)
|
||||
releaseDate = try container.decode(Date.self, forKey: .releaseDate)
|
||||
print("Decode releaseDate: \(releaseDate)")
|
||||
games = try container.decode([UUID].self, forKey: .games)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user