@@ -12,9 +12,8 @@ struct SettingsMenuView: View {
1212
1313 // MARK: – Local state
1414
15- @State private var latestVersion : String ?
16- @State private var versionTint : Color = . secondary
1715 @State private var showingTabCustomization = false
16+ var onDismiss : ( ( ) -> Void ) ?
1817
1918 // MARK: – Observed objects
2019
@@ -30,19 +29,19 @@ struct SettingsMenuView: View {
3029
3130 // ───────── App settings ─────────
3231 Section ( " App Settings " ) {
33- NavigationRow ( title: " Background Refresh Settings " ,
32+ NavigationRow ( title: " Background Refresh " ,
3433 icon: " arrow.clockwise " )
3534 {
3635 settingsPath. value. append ( Sheet . backgroundRefresh)
3736 }
3837
39- NavigationRow ( title: " General Settings " ,
38+ NavigationRow ( title: " General " ,
4039 icon: " gearshape " )
4140 {
4241 settingsPath. value. append ( Sheet . general)
4342 }
4443
45- NavigationRow ( title: " Graph Settings " ,
44+ NavigationRow ( title: " Graph " ,
4645 icon: " chart.xyaxis.line " )
4746 {
4847 settingsPath. value. append ( Sheet . graph)
@@ -54,20 +53,20 @@ struct SettingsMenuView: View {
5453 showingTabCustomization = true
5554 }
5655
57- NavigationRow ( title: " Import/Export Settings " ,
56+ NavigationRow ( title: " Import/Export " ,
5857 icon: " square.and.arrow.down " )
5958 {
6059 settingsPath. value. append ( Sheet . importExport)
6160 }
6261
6362 if !nightscoutURL. value. isEmpty {
64- NavigationRow ( title: " Information Display Settings " ,
63+ NavigationRow ( title: " Information Display " ,
6564 icon: " info.circle " )
6665 {
6766 settingsPath. value. append ( Sheet . infoDisplay)
6867 }
6968
70- NavigationRow ( title: " Remote Settings " ,
69+ NavigationRow ( title: " Remote " ,
7170 icon: " antenna.radiowaves.left.and.right " )
7271 {
7372 settingsPath. value. append ( Sheet . remote)
@@ -77,7 +76,7 @@ struct SettingsMenuView: View {
7776
7877 // ───────── Alarms ─────────
7978 Section ( " Alarms " ) {
80- NavigationRow ( title: " Alarm Settings " ,
79+ NavigationRow ( title: " Alarms " ,
8180 icon: " bell.badge " )
8281 {
8382 settingsPath. value. append ( Sheet . alarmSettings)
@@ -99,32 +98,26 @@ struct SettingsMenuView: View {
9998 }
10099 }
101100
102- // ───────── Advanced / Logs ─────────
101+ // ───────── Advanced ─────────
103102 Section ( " Advanced Settings " ) {
104- NavigationRow ( title: " Advanced Settings " ,
103+ NavigationRow ( title: " Advanced " ,
105104 icon: " exclamationmark.shield " )
106105 {
107106 settingsPath. value. append ( Sheet . advanced)
108107 }
109108 }
110-
111- Section ( " Logging " ) {
112- NavigationRow ( title: " View Log " ,
113- icon: " doc.text.magnifyingglass " )
114- {
115- settingsPath. value. append ( Sheet . viewLog)
116- }
117-
118- ActionRow ( title: " Share Logs " ,
119- icon: " square.and.arrow.up " ,
120- action: shareLogs)
121- }
122-
123- // ───────── Build info ─────────
124- buildInfoSection
125109 }
126110 . navigationTitle ( " Settings " )
127111 . navigationDestination ( for: Sheet . self) { $0. destination }
112+ . toolbar {
113+ if let onDismiss {
114+ ToolbarItem ( placement: . navigationBarTrailing) {
115+ Button ( action: onDismiss) {
116+ Image ( systemName: " checkmark " )
117+ }
118+ }
119+ }
120+ }
128121 . sheet ( isPresented: $showingTabCustomization) {
129122 TabCustomizationModal (
130123 isPresented: $showingTabCustomization,
@@ -134,7 +127,6 @@ struct SettingsMenuView: View {
134127 )
135128 }
136129 }
137- . task { await refreshVersionInfo ( ) }
138130 }
139131
140132 // MARK: – Section builders
@@ -152,78 +144,20 @@ struct SettingsMenuView: View {
152144 }
153145 . pickerStyle ( . segmented)
154146
155- NavigationRow ( title: " Nightscout Settings " ,
147+ NavigationRow ( title: " Nightscout " ,
156148 icon: " network " )
157149 {
158150 settingsPath. value. append ( Sheet . nightscout)
159151 }
160152
161- NavigationRow ( title: " Dexcom Settings " ,
153+ NavigationRow ( title: " Dexcom " ,
162154 icon: " sensor.tag.radiowaves.forward " )
163155 {
164156 settingsPath. value. append ( Sheet . dexcom)
165157 }
166158 }
167159 }
168160
169- @ViewBuilder
170- private var buildInfoSection : some View {
171- let build = BuildDetails . default
172- let ver = AppVersionManager ( ) . version ( )
173-
174- Section ( " Build Information " ) {
175- keyValue ( " Version " , ver, tint: versionTint)
176- keyValue ( " Latest version " , latestVersion ?? " Fetching… " )
177-
178- if !( build. isMacApp ( ) || build. isSimulatorBuild ( ) ) {
179- keyValue ( build. expirationHeaderString,
180- dateTimeUtils. formattedDate ( from: build. calculateExpirationDate ( ) ) )
181- }
182- keyValue ( " Built " ,
183- dateTimeUtils. formattedDate ( from: build. buildDate ( ) ) )
184- keyValue ( " Branch " , build. branchAndSha)
185- }
186- }
187-
188- // MARK: – Helpers
189-
190- private func keyValue( _ key: String ,
191- _ value: String ,
192- tint: Color = . secondary) -> some View
193- {
194- HStack {
195- Text ( key)
196- Spacer ( )
197- Text ( value) . foregroundColor ( tint)
198- }
199- }
200-
201- private func refreshVersionInfo( ) async {
202- let mgr = AppVersionManager ( )
203- let ( latest, newer, blacklisted) = await mgr. checkForNewVersionAsync ( )
204- latestVersion = latest ?? " Unknown "
205-
206- let current = mgr. version ( )
207- versionTint = blacklisted ? . red
208- : newer ? . orange
209- : latest == current ? . green
210- : . secondary
211- }
212-
213- private func shareLogs( ) {
214- let files = LogManager . shared. logFilesForTodayAndYesterday ( )
215- guard !files. isEmpty else {
216- UIApplication . shared. topMost? . presentSimpleAlert (
217- title: " No Logs Available " ,
218- message: " There are no logs to share. "
219- )
220- return
221- }
222- let avc = UIActivityViewController ( activityItems: files,
223- applicationActivities: nil )
224- UIApplication . shared. topMost? . present ( avc, animated: true )
225- }
226-
227161 private func handleTabReorganization( ) {
228162 // Rebuild the tab bar with the new configuration
229163 MainViewController . rebuildTabsIfNeeded ( )
@@ -242,7 +176,6 @@ private enum Sheet: Hashable, Identifiable {
242176 case importExport
243177 case calendar, contact
244178 case advanced
245- case viewLog
246179 case aggregatedStats
247180
248181 var id : Self { self }
@@ -262,7 +195,6 @@ private enum Sheet: Hashable, Identifiable {
262195 case . calendar: CalendarSettingsView ( )
263196 case . contact: ContactSettingsView ( viewModel: . init( ) )
264197 case . advanced: AdvancedSettingsView ( viewModel: . init( ) )
265- case . viewLog: LogView ( viewModel: . init( ) )
266198 case . aggregatedStats:
267199 AggregatedStatsViewWrapper ( )
268200 }
0 commit comments