From 09cd5815f234877297b272b7d65cc143fd7ecf59 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 26 Apr 2023 15:41:47 +0200 Subject: [PATCH] Fixes undismissable live timer --- LeCountdown/Views/ContentView.swift | 17 +++++------------ LeCountdown/Views/LiveTimerListView.swift | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index 6e2d40d..eacfb93 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -32,9 +32,6 @@ struct ContentView: View { @State private var showSettingsSheet: Bool = false @State private var showStatsSheet: Bool = false -// @State private var showAddSheet: Bool = false -// @State private var showTimerSheet: Bool = false -// @State private var showStopwatchSheet: Bool = false @State private var showSubscriptionSheet: Bool = false @@ -78,16 +75,12 @@ struct ContentView: View { } .sheet(isPresented: self.$boringContext.isShowingNewData, content: { }) -// .sheet(isPresented: self.$showAddSheet, content: { -// NewCountdownView(isPresented: $showAddSheet, tabSelection: .constant(0)) -// .environment(\.managedObjectContext, viewContext) -// }) .toolbar { - if Conductor.maestro.memoryWarningReceived { - ToolbarItemGroup(placement: .navigationBarTrailing) { - Image(systemName: "circle.fill").font(.caption2).foregroundColor(.orange) - } - } +// if Conductor.maestro.memoryWarningReceived { +// ToolbarItemGroup(placement: .navigationBarTrailing) { +// Image(systemName: "circle.fill").font(.caption2).foregroundColor(.orange) +// } +// } MainToolbarView(isEditing: self.$isEditing) } .onAppear { diff --git a/LeCountdown/Views/LiveTimerListView.swift b/LeCountdown/Views/LiveTimerListView.swift index 2118968..87e891a 100644 --- a/LeCountdown/Views/LiveTimerListView.swift +++ b/LeCountdown/Views/LiveTimerListView.swift @@ -102,7 +102,7 @@ struct LiveStopwatchView: View { let duration = self.endDate?.timeIntervalSince(self.date) ?? 0.0 TimeView(text: duration.hourMinuteSecondHS) } - Text(stopwatch.displayName.uppercased()) + Text(self.stopwatch.displayName.uppercased()) } Spacer() @@ -204,7 +204,7 @@ struct LiveCountdownView: View { } .contentShape(Rectangle()) .onTapGesture { - if Conductor.maestro.isCountdownCancelled(self.countdown) { + if Date() > self.date || Conductor.maestro.isCountdownCancelled(self.countdown) { self._dismiss() } }