From affb3b4959c20c4296492805d5978697fff629cf Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 2 Jun 2023 15:25:03 +0200 Subject: [PATCH] Replace the current + system with the StartView --- LeCountdown.xcodeproj/project.pbxproj | 25 ++++++------- LeCountdown/Views/ContentView.swift | 38 ++------------------ LeCountdown/Views/StartView.swift | 51 ++++++++++++++++++--------- 3 files changed, 50 insertions(+), 64 deletions(-) diff --git a/LeCountdown.xcodeproj/project.pbxproj b/LeCountdown.xcodeproj/project.pbxproj index ca9421d..f499de2 100644 --- a/LeCountdown.xcodeproj/project.pbxproj +++ b/LeCountdown.xcodeproj/project.pbxproj @@ -1221,6 +1221,7 @@ /* Begin PBXShellScriptBuildPhase section */ C454891F2A2649DC0047D39E /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -1684,7 +1685,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1701,7 +1702,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.6; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -1721,7 +1722,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1738,7 +1739,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.6; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -1833,7 +1834,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1844,7 +1845,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.6; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1861,7 +1862,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1872,7 +1873,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.6; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1887,7 +1888,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; @@ -1899,7 +1900,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.6; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1914,7 +1915,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; @@ -1926,7 +1927,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.5; + MARKETING_VERSION = 1.0.6; PRODUCT_BUNDLE_IDENTIFIER = com.staxriver.LeCountdown.LaunchIntents; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/LeCountdown/Views/ContentView.swift b/LeCountdown/Views/ContentView.swift index 8329856..edae94c 100644 --- a/LeCountdown/Views/ContentView.swift +++ b/LeCountdown/Views/ContentView.swift @@ -108,11 +108,6 @@ struct ContentView: View { } // MARK: - Business - -// fileprivate func _hideTip(_ tip: Tip) { -// Preferences.lastShownTip = tip.rawValue -// self.tipsShown = true -// } fileprivate func _performActionIfPossible(url: URL) { @@ -154,15 +149,11 @@ struct ContentView: View { struct MainToolbarView: ToolbarContent { -// @Environment(\.managedObjectContext) private var viewContext - @Binding var isEditing: Bool @State var showSettingsSheet: Bool = false @State var showStatsSheet: Bool = false @State var showAddSheet: Bool = false - @State var showTimerSheet: Bool = false - @State var showStopwatchSheet: Bool = false @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \AbstractTimer.order, ascending: true)], @@ -185,18 +176,6 @@ struct MainToolbarView: ToolbarContent { } } ToolbarItemGroup(placement: .navigationBarTrailing) { -// Button { -// withAnimation { -// self.showLogsSheet.toggle() -// } -// } label: { -// Image(systemName: "list.dash") -// } -// .sheet(isPresented: self.$showLogsSheet, content: { -// NavigationStack { -// LogsView().navigationTitle("Logs") -// } -// }) if !self.records.isEmpty { Button { withAnimation { @@ -233,21 +212,8 @@ struct MainToolbarView: ToolbarContent { } label: { Image(systemName: "plus") } - .confirmationDialog("Please select", isPresented: self.$showAddSheet) { - Button("Timer") { - self.showAddSheet = false - self.showTimerSheet.toggle() - } - Button("Stopwatch") { - self.showAddSheet = false - self.showStopwatchSheet.toggle() - } - } - .sheet(isPresented: self.$showStopwatchSheet, content: { - NewStopwatchView(isPresented: $showStopwatchSheet) - }) - .sheet(isPresented: self.$showTimerSheet, content: { - NewCountdownView(isPresented: $showTimerSheet) + .sheet(isPresented: self.$showAddSheet, content: { + StartView(isPresented: self.$showAddSheet) }) } diff --git a/LeCountdown/Views/StartView.swift b/LeCountdown/Views/StartView.swift index 523b16e..fed26b1 100644 --- a/LeCountdown/Views/StartView.swift +++ b/LeCountdown/Views/StartView.swift @@ -14,7 +14,8 @@ struct StartView: View { @Binding var isPresented: Bool - @State var showAddScreen: Bool = false + @State var showTimerScreen: Bool = false + @State var showStopwatchScreen: Bool = false var body: some View { VStack(spacing: 0.5) { @@ -28,22 +29,40 @@ struct StartView: View { PresetSelectionView(model: self.model).monospaced() - Button { - self.showAddScreen = true - } label: { - HStack { - Image(systemName: "plus.circle").font(.title) - Text("Create your own").font(.title3) + HStack(spacing: 2.0) { + Button { + self.showTimerScreen = true + } label: { + HStack { + Image(systemName: "timer")//.font(.title) + Text("Create your own timer") + } + .padding() + .frame(maxWidth: .infinity) + .foregroundColor(.white) + .background(Color.accentColor) + }.sheet(isPresented: self.$showTimerScreen) { + NewCountdownView(isPresented: $showTimerScreen) + .environment(\.managedObjectContext, viewContext) } - .padding() - .frame(maxWidth: .infinity) - .foregroundColor(.white) - .background(Color.accentColor) - }.sheet(isPresented: self.$showAddScreen) { - NewCountdownView(isPresented: $showAddScreen) - .environment(\.managedObjectContext, viewContext) - } - + + Button { + self.showStopwatchScreen = true + } label: { + HStack { + Image(systemName: "stopwatch")//.font(.title) + Text("Create your own stopwatch") + } + .padding() + .frame(maxWidth: .infinity) + .foregroundColor(.white) + .background(Color.accentColor) + }.sheet(isPresented: self.$showStopwatchScreen) { + NewStopwatchView(isPresented: $showStopwatchScreen) + .environment(\.managedObjectContext, viewContext) + } + }.frame(maxHeight: 80.0) + Button { self._done() } label: {