From 6b7416fb667c7f0e9d8ef1a94daee0e3567fcc7f Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 4 May 2023 11:43:18 +0200 Subject: [PATCH] Couple of fixes --- LaunchWidget/SingleTimerView.swift | 7 +-- LeCountdown.xcodeproj/project.pbxproj | 12 ++--- LeCountdown/Views/ContentView.swift | 59 ++++++++++++------------ LeCountdown/Views/TimersView.swift | 3 +- LeCountdown/en.lproj/Localizable.strings | 2 +- LeCountdown/fr.lproj/Localizable.strings | 2 +- 6 files changed, 44 insertions(+), 41 deletions(-) diff --git a/LaunchWidget/SingleTimerView.swift b/LaunchWidget/SingleTimerView.swift index f4f2c4a..3f417e1 100644 --- a/LaunchWidget/SingleTimerView.swift +++ b/LaunchWidget/SingleTimerView.swift @@ -170,7 +170,7 @@ struct MultiCountdownView: View { VStack(alignment: .leading) { Spacer() - Text(timer.displayName.uppercased()) + Text(timer.displayName.uppercased()).lineLimit(1) if let countdown = timer as? Countdown { Text(countdown.duration.minuteSecond) } @@ -178,7 +178,7 @@ struct MultiCountdownView: View { } Spacer() } - .padding(.horizontal, 8.0) + .padding(.horizontal, 12.0) .font(.callout) .background(Color.white.opacity(0.2)) // .background(Image(timer.imageName)) @@ -189,7 +189,8 @@ struct MultiCountdownView: View { } } - .padding() + .padding(.horizontal, 12.0) + .padding(.vertical, 16.0) .background(GradientView()) } diff --git a/LeCountdown.xcodeproj/project.pbxproj b/LeCountdown.xcodeproj/project.pbxproj index 7f595f0..446578e 100644 --- a/LeCountdown.xcodeproj/project.pbxproj +++ b/LeCountdown.xcodeproj/project.pbxproj @@ -1640,7 +1640,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1677,7 +1677,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1789,7 +1789,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1817,7 +1817,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1843,7 +1843,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; @@ -1870,7 +1870,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index 05d29ed..d1cc3d4 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -34,7 +34,7 @@ struct ContentView: View { @State private var showStatsSheet: Bool = false @State private var showSubscriptionSheet: Bool = false - + var body: some View { VStack { @@ -76,11 +76,6 @@ struct ContentView: View { .sheet(isPresented: self.$boringContext.isShowingNewData, content: { }) .toolbar { -// if Conductor.maestro.memoryWarningReceived { -// ToolbarItemGroup(placement: .navigationBarTrailing) { -// Image(systemName: "circle.fill").font(.caption2).foregroundColor(.orange) -// } -// } MainToolbarView(isEditing: self.$isEditing) } .onAppear { @@ -147,8 +142,6 @@ struct ContentView: View { } -// print("Start countdown: \(countdown.name ?? ""), \(countdown.duration)") -// self._launchCountdown(countdown) } else { print("timer not found with id = \(urlString)") } @@ -159,7 +152,7 @@ struct ContentView: View { struct MainToolbarView: ToolbarContent { - @Environment(\.managedObjectContext) private var viewContext +// @Environment(\.managedObjectContext) private var viewContext @Binding var isEditing: Bool @@ -169,14 +162,24 @@ struct MainToolbarView: ToolbarContent { @State var showTimerSheet: Bool = false @State var showStopwatchSheet: Bool = false + @FetchRequest( + sortDescriptors: [NSSortDescriptor(keyPath: \AbstractTimer.order, ascending: true)], + animation: .default) + private var timers: FetchedResults + + @FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \Record.start, ascending: true)]) + private var records: FetchedResults + var body: some ToolbarContent { - ToolbarItem(placement: .navigationBarLeading) { - Button { - withAnimation { - self.isEditing.toggle() + if !self.timers.isEmpty { + ToolbarItem(placement: .navigationBarLeading) { + Button { + withAnimation { + self.isEditing.toggle() + } + } label: { + Text(self.isEditing ? "Done" : "Edit") } - } label: { - Text(self.isEditing ? "Done" : "Edit") } } ToolbarItemGroup(placement: .navigationBarTrailing) { @@ -192,7 +195,7 @@ struct MainToolbarView: ToolbarContent { // LogsView().navigationTitle("Logs") // } // }) - if self.haveRecords() { + if !self.records.isEmpty { Button { withAnimation { self.showStatsSheet.toggle() @@ -209,17 +212,19 @@ struct MainToolbarView: ToolbarContent { } }) } - Button { - withAnimation { - self.showSettingsSheet.toggle() + if !self.timers.isEmpty { + Button { + withAnimation { + self.showSettingsSheet.toggle() + } + } label: { + Image(systemName: "gearshape.fill") } - } label: { - Image(systemName: "gearshape.fill") + .sheet(isPresented: self.$showSettingsSheet, content: { + SettingsView() + .presentationDetents([.height(280.0)]) + }) } - .sheet(isPresented: self.$showSettingsSheet, content: { - SettingsView() - .presentationDetents([.height(280.0)]) - }) Button { withAnimation { self.showAddSheet.toggle() @@ -247,10 +252,6 @@ struct MainToolbarView: ToolbarContent { } - func haveRecords() -> Bool { - return self.viewContext.count(entityName: "Record") > 0 - } - } fileprivate extension Countdown { diff --git a/LeCountdown/Views/TimersView.swift b/LeCountdown/Views/TimersView.swift index e6ead01..6f1c14c 100644 --- a/LeCountdown/Views/TimersView.swift +++ b/LeCountdown/Views/TimersView.swift @@ -69,7 +69,8 @@ struct TimersView: View { .padding(.horizontal, itemSpacing) } else { Text("Disclaimer") - .padding() + .monospaced() + .padding(32.0) .multilineTextAlignment(.center) } diff --git a/LeCountdown/en.lproj/Localizable.strings b/LeCountdown/en.lproj/Localizable.strings index f5c092c..480a656 100644 --- a/LeCountdown/en.lproj/Localizable.strings +++ b/LeCountdown/en.lproj/Localizable.strings @@ -1,2 +1,2 @@ "You'll find your timers here. Start by creating them on the left screen" = "You'll find your timers here.\nStart by creating using the top right button!"; -"Disclaimer" = "This is a beta version of Enchant.\n\nPlease don't depend on the app for critical events :)\n\n If you ever encounter an issue, please let me know about it by going in the settings."; +"Disclaimer" = "This is a beta version of Enchant.\n\nPlease don't depend on the app for critical events :)\n\n If you have some feedback or an issue, please tell me about it through the settings or within Testflight!"; diff --git a/LeCountdown/fr.lproj/Localizable.strings b/LeCountdown/fr.lproj/Localizable.strings index 9c803c0..2b6fc3b 100644 --- a/LeCountdown/fr.lproj/Localizable.strings +++ b/LeCountdown/fr.lproj/Localizable.strings @@ -265,4 +265,4 @@ "Default Volume" = "Volume par défaut"; "Cancel %@" = "Annuler %@"; "Calendar" = "Calendrier"; -"Disclaimer" = "Ceci est une version beta d'Enchante.\n\nVeillez à ne dépendre de l'app pour des évènements trop critiques :)\n\n Si jamais vous rencontrez un problème, merci de me contacter en allant dans les réglages."; +"Disclaimer" = "Ceci est une version beta d'Enchante.\n\nPour l'instant, veillez à ne pas dépendre de l'app pour des évènements trop critiques, on ne sait jamais :)\n\nSi vous avez des remarques ou un problème, merci de me contacter en allant dans les réglages.";