Fixes navigation stack

release
Laurent 3 years ago
parent 87d15add1b
commit f2656068d0
  1. 7
      LeCountdown/LeCountdownApp.swift
  2. 16
      LeCountdown/Views/ContentView.swift
  3. 34
      LeCountdown/Views/PresetsView.swift
  4. 2
      LeCountdown/Views/RecordsView.swift

@ -36,7 +36,6 @@ struct LeCountdownApp: App {
WindowGroup { WindowGroup {
NavigationStack { NavigationStack {
TabView(selection: $tabSelection) { TabView(selection: $tabSelection) {
PresetsView(tabSelection: $tabSelection) PresetsView(tabSelection: $tabSelection)
.environment(\.managedObjectContext, persistenceController.container.viewContext) .environment(\.managedObjectContext, persistenceController.container.viewContext)
@ -50,10 +49,8 @@ struct LeCountdownApp: App {
RecordsView().environment(\.managedObjectContext, persistenceController.container.viewContext) RecordsView().environment(\.managedObjectContext, persistenceController.container.viewContext)
.tabItem { Label("Stats", systemImage: "chart.bar.fill") } .tabItem { Label("Stats", systemImage: "chart.bar.fill") }
.tag(2) .tag(2)
}
}.tabViewStyle(.page) }.tabViewStyle(.page)
.foregroundColor(Color.accentColor)
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in .onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
self._willEnterForegroundNotification() self._willEnterForegroundNotification()
} }

@ -86,7 +86,6 @@ struct ContentView<T : AbstractTimer>: View {
var body: some View { var body: some View {
NavigationStack {
GeometryReader { reader in GeometryReader { reader in
let width: CGFloat = reader.size.width / 2 - 15.0 let width: CGFloat = reader.size.width / 2 - 15.0
@ -136,18 +135,6 @@ struct ContentView<T : AbstractTimer>: View {
self._reorderSpots(from: from, to: to) self._reorderSpots(from: from, to: to)
} }
} }
// ReorderableForEach(items: timersArray) { timer in
//
// DialView(timer: timer, isEditingBinding: self.$isEditing, frameSize: width)
// .environment(\.managedObjectContext, viewContext)
// .environmentObject(Conductor.maestro)
// .environmentObject(boringContext)
//
// } moveAction: { from, to in
// self._reorder(from: from, to: to)
// }
} }
}.padding(.horizontal, itemSpacing) }.padding(.horizontal, itemSpacing)
@ -161,7 +148,7 @@ struct ContentView<T : AbstractTimer>: View {
} }
} }
} }
// .navigationTitle("Yeah!") .navigationTitle("Home")
.alert(boringContext.error?.localizedDescription ?? "missing error", isPresented: $boringContext.showDefaultAlert) { .alert(boringContext.error?.localizedDescription ?? "missing error", isPresented: $boringContext.showDefaultAlert) {
Button("OK", role: .cancel) { } Button("OK", role: .cancel) { }
} }
@ -199,7 +186,6 @@ struct ContentView<T : AbstractTimer>: View {
.onOpenURL { url in .onOpenURL { url in
self._performActionIfPossible(url: url) self._performActionIfPossible(url: url)
} }
}
} }

@ -82,29 +82,27 @@ struct PresetsView: View {
var body: some View { var body: some View {
NavigationStack { List {
List { ForEach(PresetSection.allCases) { section in
ForEach(PresetSection.allCases) { section in Section(header: Text(section.localizedName)) {
Section(header: Text(section.localizedName)) { ForEach(section.presets) { preset in
ForEach(section.presets) { preset in
Button {
Button { self.model.selectedPreset = preset
self.model.selectedPreset = preset self.isPresented = true
self.isPresented = true } label: {
} label: { Text(preset.localizedName)
Text(preset.localizedName)
}
} }
} }
} }
} }
.sheet(isPresented: $isPresented, content: {
CountdownEditView(isPresented: $isPresented, preset: self.model.selectedPreset, tabSelection: self.tabSelection)
.environment(\.managedObjectContext, viewContext)
})
.navigationTitle("Presets")
} }
.sheet(isPresented: $isPresented, content: {
CountdownEditView(isPresented: $isPresented, preset: self.model.selectedPreset, tabSelection: self.tabSelection)
.environment(\.managedObjectContext, viewContext)
})
.navigationTitle("Presets")
} }
} }

@ -21,7 +21,7 @@ struct RecordsView: View {
var body: some View { var body: some View {
Group { VStack {
if records.isEmpty { if records.isEmpty {
Text("You don't have any recorded activity yet") Text("You don't have any recorded activity yet")
} else { } else {

Loading…
Cancel
Save