@@ -6,6 +6,7 @@ struct NotificationSettingsButton: View {
66 @EnvironmentObject private var notificationSettings : NotificationSettingsManager
77
88 @State private var presented = false
9+ @State private var showMentionsSettings = false
910
1011 var body : some View {
1112 button
@@ -22,8 +23,18 @@ struct NotificationSettingsButton: View {
2223 }
2324 }
2425 }
26+ . background (
27+ NavigationLink (
28+ destination: MentionsNotificationSettingsView (
29+ disableDmNotifications: $notificationSettings. disableDmNotifications
30+ ) ,
31+ isActive: $showMentionsSettings
32+ ) {
33+ EmptyView ( )
34+ }
35+ . hidden ( )
36+ )
2537
26- . presentationDetents ( [ . medium] )
2738 . presentationDragIndicator ( . visible)
2839 }
2940 }
@@ -86,7 +97,7 @@ struct NotificationSettingsButton: View {
8697 onChange: {
8798 notificationSettings. mode = $0
8899 close ( )
89- } ,
100+ }
90101 )
91102
92103 NotificationSettingsItem (
@@ -136,48 +147,96 @@ private struct NotificationSettingsItem<Value: Equatable>: View {
136147 var selected : Bool
137148 var value : Value
138149 var onChange : ( Value ) -> Void
150+ var customizeAction : ( ( ) -> Void ) ?
139151 let theme = ThemeManager . shared. selected
140152
141153 var body : some View {
142- Button {
154+ HStack ( spacing: 12 ) {
155+ Circle ( )
156+ . fill ( selected ? Color ( theme. accent) : Color ( . systemGray5) )
157+ . frame ( width: 36 , height: 36 )
158+ . overlay {
159+ Image ( systemName: systemImage)
160+ . font ( . system( size: 18 , weight: . medium) )
161+ . foregroundStyle ( selected ? Color . white : Color ( . systemGray) )
162+ }
163+
164+ VStack ( alignment: . leading, spacing: 2 ) {
165+ Text ( title)
166+ . font ( . body)
167+ . fontWeight ( . medium)
168+
169+ Text ( description)
170+ . font ( . caption)
171+
172+ }
173+
174+ Spacer ( )
175+
176+ if let customizeAction {
177+ Button ( action: customizeAction) {
178+ Circle ( )
179+ . frame ( width: 28 , height: 28 )
180+ . foregroundStyle ( Color ( . systemGray5) )
181+ . overlay {
182+ Image ( systemName: " ellipsis " )
183+ . font ( . system( size: 13 , weight: . medium) )
184+ . foregroundStyle ( . secondary)
185+ }
186+ . contentShape ( Circle ( ) )
187+ }
188+ . buttonStyle ( . plain)
189+ }
190+
191+ if selected {
192+ Image ( systemName: " checkmark " )
193+ . font ( . system( size: 16 , weight: . semibold) )
194+ . foregroundStyle ( Color ( theme. accent) )
195+ }
196+ }
197+ . padding ( . vertical, 8 )
198+ . padding ( . horizontal, 12 )
199+ . background (
200+ RoundedRectangle ( cornerRadius: 12 )
201+ . fill ( selected ? Color ( theme. accent) . opacity ( 0.1 ) : ThemeManager . shared. cardBackgroundColor)
202+ )
203+ . contentShape ( Rectangle ( ) )
204+ . onTapGesture {
143205 onChange ( value)
144- } label: {
145- HStack ( spacing: 12 ) {
146- Circle ( )
147- . fill ( selected ? Color ( theme. accent) : Color ( . systemGray5) )
148- . frame ( width: 36 , height: 36 )
149- . overlay {
150- Image ( systemName: systemImage)
151- . font ( . system( size: 18 , weight: . medium) )
152- . foregroundStyle ( selected ? Color . white : Color ( . systemGray) )
153- }
206+ }
207+ . animation ( . easeOut( duration: 0.08 ) , value: selected)
208+ }
209+ }
210+
211+ private struct MentionsNotificationSettingsView : View {
212+ @Binding var disableDmNotifications : Bool
213+
214+ var body : some View {
215+ VStack ( alignment: . leading, spacing: 16 ) {
216+ VStack ( alignment: . leading, spacing: 6 ) {
217+ Text ( " Direct Messages " )
218+ . font ( . headline)
154219
220+ Text ( " Control DM notification behavior " )
221+ . font ( . subheadline)
222+ . foregroundStyle ( . secondary)
223+ }
224+
225+ Toggle ( isOn: $disableDmNotifications) {
155226 VStack ( alignment: . leading, spacing: 2 ) {
156- Text ( title )
227+ Text ( " Disable DM notifications " )
157228 . font ( . body)
158- . fontWeight ( . medium)
159-
160- Text ( description)
229+ Text ( " Mentions and nudges will still notify you " )
161230 . font ( . caption)
162-
163- }
164-
165- Spacer ( )
166-
167- if selected {
168- Image ( systemName: " checkmark " )
169- . font ( . system( size: 16 , weight: . semibold) )
170- . foregroundStyle ( Color ( theme. accent) )
231+ . foregroundStyle ( . secondary)
171232 }
172233 }
173- . padding ( . vertical, 8 )
174- . padding ( . horizontal, 12 )
175- . background (
176- RoundedRectangle ( cornerRadius: 12 )
177- . fill ( selected ? Color ( theme. accent) . opacity ( 0.1 ) : ThemeManager . shared. cardBackgroundColor)
178- )
234+ . toggleStyle ( . switch)
235+
236+ Spacer ( )
179237 }
180- . buttonStyle ( . plain)
181- . animation ( . easeOut( duration: 0.08 ) , value: selected)
238+ . padding ( 16 )
239+ . navigationTitle ( " Direct Messages " )
240+ . navigationBarTitleDisplayMode ( . inline)
182241 }
183242}
0 commit comments