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

@ -86,7 +86,6 @@ struct ContentView<T : AbstractTimer>: View {
var body: some View {
NavigationStack {
GeometryReader { reader in
let width: CGFloat = reader.size.width / 2 - 15.0
@ -136,18 +135,6 @@ struct ContentView<T : AbstractTimer>: View {
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)
@ -161,7 +148,7 @@ struct ContentView<T : AbstractTimer>: View {
}
}
}
// .navigationTitle("Yeah!")
.navigationTitle("Home")
.alert(boringContext.error?.localizedDescription ?? "missing error", isPresented: $boringContext.showDefaultAlert) {
Button("OK", role: .cancel) { }
}
@ -199,7 +186,6 @@ struct ContentView<T : AbstractTimer>: View {
.onOpenURL { url in
self._performActionIfPossible(url: url)
}
}
}

@ -82,29 +82,27 @@ struct PresetsView: View {
var body: some View {
NavigationStack {
List {
ForEach(PresetSection.allCases) { section in
Section(header: Text(section.localizedName)) {
ForEach(section.presets) { preset in
Button {
self.model.selectedPreset = preset
self.isPresented = true
} label: {
Text(preset.localizedName)
}
List {
ForEach(PresetSection.allCases) { section in
Section(header: Text(section.localizedName)) {
ForEach(section.presets) { preset in
Button {
self.model.selectedPreset = preset
self.isPresented = true
} label: {
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 {
Group {
VStack {
if records.isEmpty {
Text("You don't have any recorded activity yet")
} else {

Loading…
Cancel
Save