Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions LoopFollow/Alarm/AlarmsContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import SwiftUI

struct AlarmsContainerView: View {
var onDismiss: (() -> Void)?
var onBack: (() -> Void)?

var body: some View {
NavigationStack {
AlarmListView()
.toolbar {
if let onDismiss {
if let onBack {
ToolbarItem(placement: .navigationBarLeading) {
Button(action: onDismiss) {
Image(systemName: "checkmark")
Button(action: onBack) {
Image(systemName: "chevron.left")
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion LoopFollow/Helpers/TabPosition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ enum TabItem: String, CaseIterable, Codable, Identifiable {
}
}

/// Canonical feature order used by menus and customization screens.
static var featureOrder: [TabItem] {
[.home, .alarms, .nightscout, .remote, .snoozer, .stats, .treatments]
}

/// Items that can be moved between tab bar and menu (all except settings which doesn't exist as a tab)
static var movableItems: [TabItem] {
[.home, .alarms, .remote, .nightscout, .snoozer, .treatments, .stats]
featureOrder
}
}
12 changes: 11 additions & 1 deletion LoopFollow/Log/LogView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import SwiftUI

struct LogView: View {
var onBack: (() -> Void)?
@ObservedObject var viewModel = LogViewModel()

var body: some View {
Expand Down Expand Up @@ -35,8 +36,17 @@ struct LogView: View {
.onAppear {
viewModel.loadLogEntries()
}
.navigationBarTitle("Today's Logs", displayMode: .inline)
.toolbar {
if let onBack {
ToolbarItem(placement: .navigationBarLeading) {
Button(action: onBack) {
Image(systemName: "chevron.left")
}
}
}
}
}
.preferredColorScheme(Storage.shared.appearanceMode.value.colorScheme)
.navigationBarTitle("Today's Logs", displayMode: .inline)
}
}
5 changes: 2 additions & 3 deletions LoopFollow/Settings/HomeContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ struct HomeModalView: View {
.navigationTitle("Home")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
ToolbarItem(placement: .cancellationAction) {
Button {
dismiss()
} label: {
Image(systemName: "checkmark")
Image(systemName: "xmark")
}
.foregroundColor(.blue)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct ImportExportSettingsView: View {
}
.navigationTitle("Export \(viewModel.exportType.rawValue)")
.navigationBarTitleDisplayMode(.inline)
.navigationBarItems(trailing: Button("Done") {
.navigationBarItems(trailing: Button("Close") {
viewModel.isShowingQRCodeDisplay = false
})
}
Expand Down
67 changes: 27 additions & 40 deletions LoopFollow/Settings/SettingsMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ struct SettingsMenuView: View {

// MARK: – Local state

@State private var showingTabCustomization = false
var onDismiss: (() -> Void)?
var onBack: (() -> Void)?

// MARK: – Observed objects

Expand All @@ -24,33 +23,40 @@ struct SettingsMenuView: View {
var body: some View {
NavigationStack(path: $settingsPath.value) {
List {
// ───────── Data settings ─────────
dataSection

// ───────── App settings ─────────
Section("App Settings") {
NavigationRow(title: "Background Refresh",
icon: "arrow.clockwise")
{
settingsPath.value.append(Sheet.backgroundRefresh)
}

Section("Display Settings") {
NavigationRow(title: "General",
icon: "gearshape")
{
settingsPath.value.append(Sheet.general)
}

NavigationRow(title: "Graph",
icon: "chart.xyaxis.line")
{
settingsPath.value.append(Sheet.graph)
}

NavigationRow(title: "Tab Settings",
if !nightscoutURL.value.isEmpty {
NavigationRow(title: "Information Display",
icon: "info.circle")
{
settingsPath.value.append(Sheet.infoDisplay)
}
}

NavigationRow(title: "Tabs",
icon: "rectangle.3.group")
{
showingTabCustomization = true
settingsPath.value.append(Sheet.tabSettings)
}
}

Section("App Settings") {
NavigationRow(title: "Background Refresh",
icon: "arrow.clockwise")
{
settingsPath.value.append(Sheet.backgroundRefresh)
}

NavigationRow(title: "Import/Export",
Expand All @@ -60,12 +66,6 @@ struct SettingsMenuView: View {
}

if !nightscoutURL.value.isEmpty {
NavigationRow(title: "Information Display",
icon: "info.circle")
{
settingsPath.value.append(Sheet.infoDisplay)
}

NavigationRow(title: "Remote",
icon: "antenna.radiowaves.left.and.right")
{
Expand All @@ -74,7 +74,6 @@ struct SettingsMenuView: View {
}
}

// ───────── Alarms ─────────
Section("Alarms") {
NavigationRow(title: "Alarms",
icon: "bell.badge")
Expand All @@ -83,7 +82,6 @@ struct SettingsMenuView: View {
}
}

// ───────── Integrations ─────────
Section("Integrations") {
NavigationRow(title: "Calendar",
icon: "calendar")
Expand All @@ -98,7 +96,6 @@ struct SettingsMenuView: View {
}
}

// ───────── Advanced ─────────
Section("Advanced Settings") {
NavigationRow(title: "Advanced",
icon: "exclamationmark.shield")
Expand All @@ -108,24 +105,17 @@ struct SettingsMenuView: View {
}
}
.navigationTitle("Settings")
.navigationBarTitleDisplayMode(.large)
.navigationDestination(for: Sheet.self) { $0.destination }
.toolbar {
if let onDismiss {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: onDismiss) {
Image(systemName: "checkmark")
if let onBack {
ToolbarItem(placement: .navigationBarLeading) {
Button(action: onBack) {
Image(systemName: "chevron.left")
}
}
}
}
.sheet(isPresented: $showingTabCustomization) {
TabCustomizationModal(
isPresented: $showingTabCustomization,
onApply: {
// No-op - changes are applied silently via observers
}
)
}
}
}

Expand Down Expand Up @@ -157,11 +147,6 @@ struct SettingsMenuView: View {
}
}
}

private func handleTabReorganization() {
// Rebuild the tab bar with the new configuration
MainViewController.rebuildTabsIfNeeded()
}
}

// MARK: – Sheet routing
Expand All @@ -170,6 +155,7 @@ private enum Sheet: Hashable, Identifiable {
case nightscout, dexcom
case backgroundRefresh
case general, graph
case tabSettings
case infoDisplay
case alarmSettings
case remote
Expand All @@ -188,6 +174,7 @@ private enum Sheet: Hashable, Identifiable {
case .backgroundRefresh: BackgroundRefreshSettingsView(viewModel: .init())
case .general: GeneralSettingsView()
case .graph: GraphSettingsView()
case .tabSettings: TabCustomizationModal()
case .infoDisplay: InfoDisplaySettingsView(viewModel: .init())
case .alarmSettings: AlarmSettingsView()
case .remote: RemoteSettingsView(viewModel: .init())
Expand Down
Loading