Replace the current + system with the StartView

main
Laurent 2 years ago
parent 2b062b04a4
commit affb3b4959
  1. 25
      LeCountdown.xcodeproj/project.pbxproj
  2. 38
      LeCountdown/Views/ContentView.swift
  3. 31
      LeCountdown/Views/StartView.swift

@ -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;

@ -109,11 +109,6 @@ struct ContentView<T : AbstractTimer>: View {
// MARK: - Business
// fileprivate func _hideTip(_ tip: Tip) {
// Preferences.lastShownTip = tip.rawValue
// self.tipsShown = true
// }
fileprivate func _performActionIfPossible(url: URL) {
// hide new window if launching a timer
@ -154,15 +149,11 @@ struct ContentView<T : AbstractTimer>: 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)
})
}

@ -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()
HStack(spacing: 2.0) {
Button {
self.showAddScreen = true
self.showTimerScreen = true
} label: {
HStack {
Image(systemName: "plus.circle").font(.title)
Text("Create your own").font(.title3)
Image(systemName: "timer")//.font(.title)
Text("Create your own timer")
}
.padding()
.frame(maxWidth: .infinity)
.foregroundColor(.white)
.background(Color.accentColor)
}.sheet(isPresented: self.$showAddScreen) {
NewCountdownView(isPresented: $showAddScreen)
}.sheet(isPresented: self.$showTimerScreen) {
NewCountdownView(isPresented: $showTimerScreen)
.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: {

Loading…
Cancel
Save