@@ -134,104 +134,14 @@ struct PostView: View {
134134 . font ( . caption)
135135 . foregroundColor ( . gray)
136136 Spacer ( )
137- HStack ( spacing: 0 ) {
138- Menu (
139- content: {
140- if let currentUser = authManager. getCurrentUser ( ) {
141- if currentUser. userId == post. user. userId {
142- Button ( role: . destructive, action: { onPostDeleted ( ) } ) {
143- Label ( " Delete " , systemImage: " trash " )
144- . foregroundColor ( . red)
145- }
146- } else {
147- Button (
148- role: . destructive,
149- action: {
150- Task {
151- isReporting = true
152- let _ = await PostService ( ) . reportPost (
153- postId: post. post. postId
154- )
155- isReporting = false
156- showReportAlert = true
157- }
158- }
159- ) {
160- if isReporting {
161- HStack {
162- Text ( " Reporting... " )
163- Spacer ( )
164- ProgressView ( )
165- }
166- } else {
167- Label ( " Report " , systemImage: " exclamationmark.triangle " )
168- . foregroundColor ( . red)
169- }
170- }
171- . disabled ( isReporting)
172- }
173- }
174- } ,
175- label: {
176- Image ( systemName: " ellipsis " )
177- . font ( . system( size: 22 ) )
178- . frame ( width: 48 , height: 40 )
179- }
180- )
181- . accessibilityLabel ( " More options " )
182-
183- if !isStandalone {
184- Divider ( )
185- . padding ( . vertical, 5 )
186- . padding ( . horizontal, 4 )
187-
188- Button ( action: {
189- isShowingComments = true
190- } ) {
191- ZStack {
192- Image ( systemName: " bubble.middle.bottom " )
193- . font ( . system( size: 22 ) )
194- . frame ( width: 48 , height: 40 )
195-
196- if post. commentCount > 0 {
197- Text ( post. commentCount > 9 ? " 9+ " : " \( post. commentCount) " )
198- . font ( . caption2)
199- . fontWeight ( . medium)
200- . padding ( . bottom, 4 )
201- }
202- }
203- }
204- . buttonStyle ( . plain)
205- . sensoryFeedback ( . impact, trigger: isShowingComments)
206-
207- Divider ( )
208- . padding ( . vertical, 5 )
209- . padding ( . horizontal, 4 )
210- }
211-
212- Button ( action: {
213- onLikeButtonTapped ( )
214- PostHogSDK . shared. capture ( " post_like " )
215- } ) {
216- Image ( systemName: post. isLiked ? " heart.fill " : " heart " )
217- . font ( . system( size: 22 ) )
218- . foregroundStyle (
219- post. isLiked ? Color . red. gradient : Color . primary. gradient
220- )
221- . frame ( width: 48 , height: 40 )
222- . scaleEffect ( post. isLiked ? 1.1 : 1.0 )
223- . animation (
224- . spring( response: 0.4 , dampingFraction: 0.6 , blendDuration: 0 ) ,
225- value: post. isLiked
226- )
137+ if #available( iOS 26 , * ) {
138+ GlassEffectContainer {
139+ postMenu
227140 }
228- . sensoryFeedback ( . impact, trigger: post. isLiked)
141+ . glassEffect ( )
142+ } else {
143+ postMenu
229144 }
230- . buttonStyle ( . plain)
231- . padding ( 3 )
232- . background (
233- RoundedRectangle ( cornerRadius: 12 ) . fill ( . gray. opacity ( 0.15 ) )
234- )
235145 }
236146 }
237147 . padding ( . vertical, 4 )
@@ -249,6 +159,113 @@ struct PostView: View {
249159 Text ( " Thanks. A notification has been sent to the developer. " )
250160 }
251161 }
162+
163+ private var postMenu : some View {
164+ HStack ( spacing: 0 ) {
165+ Menu (
166+ content: {
167+ if let currentUser = authManager. getCurrentUser ( ) {
168+ if currentUser. userId == post. user. userId {
169+ Button ( role: . destructive, action: { onPostDeleted ( ) } ) {
170+ Label ( " Delete " , systemImage: " trash " )
171+ . foregroundColor ( . red)
172+ }
173+ } else {
174+ Button (
175+ role: . destructive,
176+ action: {
177+ Task {
178+ isReporting = true
179+ let _ = await PostService ( ) . reportPost (
180+ postId: post. post. postId
181+ )
182+ isReporting = false
183+ showReportAlert = true
184+ }
185+ }
186+ ) {
187+ if isReporting {
188+ HStack {
189+ Text ( " Reporting... " )
190+ Spacer ( )
191+ ProgressView ( )
192+ }
193+ } else {
194+ Label ( " Report " , systemImage: " exclamationmark.triangle " )
195+ . foregroundColor ( . red)
196+ }
197+ }
198+ . disabled ( isReporting)
199+ }
200+ }
201+ } ,
202+ label: {
203+ Image ( systemName: " ellipsis " )
204+ . font ( . system( size: 22 ) )
205+ . frame ( width: 48 , height: 40 )
206+ }
207+ )
208+
209+ if !isStandalone {
210+ Divider ( )
211+ . padding ( . vertical, 5 )
212+ . padding ( . horizontal, 4 )
213+
214+ Button ( action: {
215+ isShowingComments = true
216+ } ) {
217+ ZStack {
218+ Image ( systemName: " bubble.middle.bottom " )
219+ . font ( . system( size: 22 ) )
220+ . frame ( width: 48 , height: 40 )
221+
222+ if post. commentCount > 0 {
223+ Text ( post. commentCount > 9 ? " 9+ " : " \( post. commentCount) " )
224+ . font ( . caption2)
225+ . fontWeight ( . medium)
226+ . padding ( . bottom, 4 )
227+ }
228+ }
229+ }
230+ . buttonStyle ( . plain)
231+ . sensoryFeedback ( . impact, trigger: isShowingComments)
232+
233+ Divider ( )
234+ . padding ( . vertical, 5 )
235+ . padding ( . horizontal, 4 )
236+ }
237+
238+ Button ( action: {
239+ onLikeButtonTapped ( )
240+ PostHogSDK . shared. capture ( " post_like " )
241+ } ) {
242+ Image ( systemName: post. isLiked ? " heart.fill " : " heart " )
243+ . font ( . system( size: 22 ) )
244+ . foregroundStyle (
245+ post. isLiked ? Color . red. gradient : Color . primary. gradient
246+ )
247+ . frame ( width: 48 , height: 40 )
248+ . scaleEffect ( post. isLiked ? 1.1 : 1.0 )
249+ . animation (
250+ . spring( response: 0.4 , dampingFraction: 0.6 , blendDuration: 0 ) ,
251+ value: post. isLiked
252+ )
253+ }
254+ . sensoryFeedback ( . impact, trigger: post. isLiked)
255+
256+ }
257+ . fixedSize ( )
258+ . buttonStyle ( . plain)
259+ . padding ( 3 )
260+ . background {
261+ if #available( iOS 26 . 0 , * ) {
262+ Color . clear
263+ } else {
264+ RoundedRectangle ( cornerRadius: 12 ) . fill ( . gray. opacity ( 0.15 ) )
265+ }
266+ }
267+ }
268+
252269}
253270
254271#Preview {
@@ -257,15 +274,15 @@ struct PostView: View {
257274 userId: 456 ,
258275 text:
259276 " This is a sample post with some text content. also here's a link: https://google.com, another link: splajompy.com " ,
260- createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-04-01T12:30:45.123Z " ) !,
277+ createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-04-01T12:30:45Z " ) !,
261278 facets: nil
262279 )
263280
264281 let user = User (
265282 userId: 456 ,
266283 email: " wesleynw@pm.me " ,
267284 username: " wesleynw " ,
268- createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-01-15T10:20:30.000Z " ) !,
285+ createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-01-15T10:20:30Z " ) !,
269286 name: " John Doe "
270287 )
271288
@@ -303,7 +320,7 @@ struct PostView: View {
303320 let authManager = AuthManager ( )
304321 let postManager = PostManager ( )
305322
306- NavigationView {
323+ NavigationStack {
307324 PostView (
308325 post: detailedPost,
309326 postManager: postManager,
@@ -320,15 +337,15 @@ struct PostView: View {
320337 userId: 456 ,
321338 text:
322339 " This is a sample post with some text content. also here's a link: https://google.com, another link: splajompy.com " ,
323- createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-04-01T12:30:45.123Z " ) !,
340+ createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-04-01T12:30:45Z " ) !,
324341 facets: nil
325342 )
326343
327344 let user = User (
328345 userId: 456 ,
329346 email: " wesleynw@pm.me " ,
330347 username: " wesleynw " ,
331- createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-01-15T10:20:30.000Z " ) !,
348+ createdAt: ISO8601DateFormatter ( ) . date ( from: " 2025-01-15T10:20:30Z " ) !,
332349 name: " John Doe "
333350 )
334351
0 commit comments