Fix #30: Fade-Timer für Treffen erst nach Rating-Survey starten
Treffen-Momente warten in pendingFadeAfterSurvey bis momentForRating wieder auf nil wechselt (Survey abgeschlossen oder geskipped). Erst dann startet der 5-s-Timer. Notizen und Vorhaben starten den Timer weiterhin sofort. Eingeblendet werden alle neuen Logbuch-Momente bereits beim Schließen des Sheets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,8 @@ struct PersonDetailView: View {
|
||||
// Neu hinzugefügte Logbuch-Momente – 5 s in Momente sichtbar, dann in Verlauf
|
||||
@State private var fadingOutMoments: [Moment] = []
|
||||
@State private var seenMomentIDs: Set<UUID> = []
|
||||
// Treffen-Momente warten auf Rating-Survey-Abschluss bevor der 5-s-Timer startet
|
||||
@State private var pendingFadeAfterSurvey: [Moment] = []
|
||||
|
||||
// Kalender-Lösch-Bestätigung
|
||||
@State private var momentPendingDelete: Moment? = nil
|
||||
@@ -114,15 +116,23 @@ struct PersonDetailView: View {
|
||||
let isActive = moment.isOpen || (moment.isMeeting && moment.createdAt > Date())
|
||||
return !isActive
|
||||
}
|
||||
// Sofort visuell in Momente einblenden
|
||||
for moment in newLogbuchMoments {
|
||||
withAnimation { fadingOutMoments.append(moment) }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
|
||||
withAnimation(.easeOut(duration: 0.35)) {
|
||||
fadingOutMoments.removeAll { $0.id == moment.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Treffen-Momente: Timer erst nach Rating-Survey starten (survey läuft noch)
|
||||
let meetingMoments = newLogbuchMoments.filter { $0.isMeeting }
|
||||
let otherMoments = newLogbuchMoments.filter { !$0.isMeeting }
|
||||
scheduleFadeOut(otherMoments)
|
||||
pendingFadeAfterSurvey.append(contentsOf: meetingMoments)
|
||||
}
|
||||
}
|
||||
.onChange(of: momentForRating) { old, new in
|
||||
// Survey geschlossen (war gesetzt, ist jetzt nil) → Timer für wartende Treffen starten
|
||||
guard old != nil && new == nil, !pendingFadeAfterSurvey.isEmpty else { return }
|
||||
let toFade = pendingFadeAfterSurvey
|
||||
pendingFadeAfterSurvey = []
|
||||
scheduleFadeOut(toFade)
|
||||
}
|
||||
.sheet(isPresented: $showingEditPerson) {
|
||||
AddPersonView(existingPerson: person)
|
||||
@@ -378,6 +388,17 @@ struct PersonDetailView: View {
|
||||
return active + fadingOutMoments
|
||||
}
|
||||
|
||||
/// Startet den 5-s-Ausblend-Timer für die angegebenen Momente.
|
||||
private func scheduleFadeOut(_ moments: [Moment]) {
|
||||
for moment in moments {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
|
||||
withAnimation(.easeOut(duration: 0.35)) {
|
||||
fadingOutMoments.removeAll { $0.id == moment.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var momentsSection: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
HStack {
|
||||
|
||||
Reference in New Issue
Block a user