Tagebuch-Decode-Fix: media_items statt media, is_milestone als Int 0/1
Backend liefert das Foto-Array unter 'media_items' (in _entry_dict), nicht 'media'. Außerdem ist is_milestone wieder eine SQLite-Int-Spalte 0/1 — der bekannte Bool-Quirk. Mit Bool? in der DTO bricht die Decoder ab und die ganze Liste verschwindet stillschweigend in den Fehler-Zustand.
This commit is contained in:
parent
ef7907d74b
commit
3373305b23
2 changed files with 7 additions and 4 deletions
|
|
@ -204,9 +204,12 @@ struct DiaryEntry: Decodable, Identifiable {
|
||||||
let gpsLat: Double?
|
let gpsLat: Double?
|
||||||
let gpsLon: Double?
|
let gpsLon: Double?
|
||||||
let locationName: String?
|
let locationName: String?
|
||||||
let isMilestone: Bool?
|
// is_milestone kommt als SQLite-Int 0/1 — Backend bool-konvertiert es nicht.
|
||||||
let media: [DiaryMedia]?
|
let isMilestone: Int?
|
||||||
|
let mediaItems: [DiaryMedia]?
|
||||||
let createdAt: String?
|
let createdAt: String?
|
||||||
|
|
||||||
|
var isMilestoneFlag: Bool { isMilestone == 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DiaryMedia: Decodable, Identifiable {
|
struct DiaryMedia: Decodable, Identifiable {
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ private struct DiaryRow: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
HStack(alignment: .firstTextBaseline) {
|
HStack(alignment: .firstTextBaseline) {
|
||||||
if entry.isMilestone == true || entry.typ == "meilenstein" {
|
if entry.isMilestoneFlag || entry.typ == "meilenstein" {
|
||||||
Image(systemName: "star.fill").foregroundStyle(.orange)
|
Image(systemName: "star.fill").foregroundStyle(.orange)
|
||||||
}
|
}
|
||||||
if let titel = entry.titel, !titel.isEmpty {
|
if let titel = entry.titel, !titel.isEmpty {
|
||||||
|
|
@ -103,7 +103,7 @@ private struct DiaryRow: View {
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundStyle(.tertiary)
|
.foregroundStyle(.tertiary)
|
||||||
}
|
}
|
||||||
if let media = entry.media, !media.isEmpty {
|
if let media = entry.mediaItems, !media.isEmpty {
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
HStack(spacing: 6) {
|
HStack(spacing: 6) {
|
||||||
ForEach(media) { m in
|
ForEach(media) { m in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue