Sane defaults for metadata #42

Merged
vegardbm merged 1 commits from metadata-defaults into master 2026-08-05 19:57:44 +02:00
+37 -24
View File
@@ -772,23 +772,23 @@ final class ViewController: UIViewController, UIGestureRecognizerDelegate {
}
let title = builder.create(string: titleValue)
let originalLanguage = builder.create(string: "Japanese")
let countryOfOrigin = builder.create(string: "Japan")
let description = builder.create(string: "")
let originalLanguage = builder.create(string: nil)
let countryOfOrigin = builder.create(string: nil)
let description = builder.create(string: nil)
let tags = builder.createVector(ofOffsets: [])
let volumeOffsets = builder.createVector(ofOffsets: volumes)
let metadata = Metadata.createMetadata(
&builder,
titleOffset: title,
format: Format.manga,
format: nil,
originalLanguageOffset: originalLanguage,
countryOfOriginOffset: countryOfOrigin,
publicationDemographic: PublicationDemographic.shounen,
status: Status.finished,
contentRating: ContentRating.safe,
source: Source.original,
startReleaseDate: Date(year: 2000, month: 1, day: 1),
endReleaseDate: Date(year: 2000, month: 1, day: 1),
publicationDemographic: nil,
status: nil,
contentRating: nil,
source: nil,
startReleaseDate: Date(year: 0, month: 0, day: 0),
endReleaseDate: Date(year: 0, month: 0, day: 0),
tagsVectorOffset: tags,
descriptionOffset: description,
volumesVectorOffset: volumeOffsets,
@@ -2012,23 +2012,27 @@ class ComicMetadataViewController: UITableViewController {
}
let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
switch indexPath.row {
case 0: cell.textLabel?.text = "Title"; cell.detailTextLabel?.text = comic.title
case 1: cell.textLabel?.text = "AniList ID"; cell.detailTextLabel?.text = anId
case 2: cell.textLabel?.text = "Format"; cell.detailTextLabel?.text = comic.format != nil
? "\(comic.format!)" : ""
case 3: cell.textLabel?.text = "Original Language"; cell.detailTextLabel?.text = comic.originalLanguage
case 0: cell.textLabel?.text = "Title"
cell.detailTextLabel?.text = comic.title
case 1: cell.textLabel?.text = "AniList ID"
cell.detailTextLabel?.text = anId
case 2: cell.textLabel?.text = "Format"
cell.detailTextLabel?.text = comic.format != nil ? "\(comic.format!)" : ""
case 3: cell.textLabel?.text = "Original Language"
cell.detailTextLabel?.text = comic.originalLanguage
case 4: cell.textLabel?.text = "Publication Demographic"
cell.detailTextLabel?.text = comic.publicationDemographic != nil
? "\(comic.publicationDemographic!)" : ""
case 5: cell.textLabel?.text = "Country of Origin"; cell.detailTextLabel?.text = comic.countryOfOrigin
case 6: cell.textLabel?.text = "Status"; cell.detailTextLabel?.text = comic.status != nil
? "\(comic.status!)" : ""
case 7: cell.textLabel?.text = "Content Rating"; cell.detailTextLabel?.text = comic.contentRating != nil
? "\(comic.contentRating!)" : ""
cell.detailTextLabel?.text = comic.publicationDemographic != nil ? "\(comic.publicationDemographic!)" : ""
case 5: cell.textLabel?.text = "Country of Origin"
cell.detailTextLabel?.text = comic.countryOfOrigin
case 6: cell.textLabel?.text = "Status"
cell.detailTextLabel?.text = comic.status != nil ? "\(comic.status!)" : ""
case 7: cell.textLabel?.text = "Content Rating"
cell.detailTextLabel?.text = comic.contentRating != nil ? "\(comic.contentRating!)" : ""
case 8: cell.textLabel?.text = "First Release"
cell.detailTextLabel?.text = "\(dateToString(comic.startReleaseDate))"
cell.detailTextLabel?.text =
comic.startReleaseDate != Date() ? "\(dateToString(comic.startReleaseDate))" : ""
case 9: cell.textLabel?.text = "Last Release"
cell.detailTextLabel?.text = "\(dateToString(comic.endReleaseDate))"
cell.detailTextLabel?.text = comic.endReleaseDate != Date() ? "\(dateToString(comic.endReleaseDate))" : ""
case 10: cell.textLabel?.text = "Tags"
cell.detailTextLabel?.text = comic.tags.map { $0.value ?? "" }.joined(separator: ", ")
default: break
@@ -3253,3 +3257,12 @@ extension PageTurnMode: CustomStringConvertible {
}
}
}
extension Date: Equatable {
public static func == (lhs: Date, rhs: Date) -> Bool {
return
lhs.year == rhs.year &&
lhs.month == rhs.month &&
lhs.day == rhs.day
}
}