iOS client for Grain grain.social
ios photography atproto
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: rightward swipe anywhere dismisses feed views

Apply the same outside-carousel swipe-back gesture used in
ProfileGalleryFeedView to HashtagFeedView, LocationFeedView, and
CameraFeedView. Exclusive .gesture so the child TabView still claims
swipes on the image area.

authored by

Hima Aramona and committed by
Chad Miller
8921576c 1d5e569a

+45
+15
Grain/Views/Feed/CameraFeedView.swift
··· 2 2 3 3 struct CameraFeedView: View { 4 4 @Environment(AuthManager.self) private var auth 5 + @Environment(\.dismiss) private var dismiss 5 6 @State private var galleries: [GrainGallery] = [] 6 7 @State private var cursor: String? 7 8 @State private var isLoading = false ··· 37 38 } 38 39 } 39 40 } 41 + .gesture( 42 + // Rightward swipe outside the carousel pops the nav. Exclusive 43 + // .gesture so the child TabView in GalleryCardView claims swipes 44 + // on the image area first. 45 + DragGesture(minimumDistance: 30) 46 + .onEnded { value in 47 + let dx = value.translation.width 48 + let dy = value.translation.height 49 + let predicted = value.predictedEndTranslation.width 50 + if dx > 80, abs(dy) < 60, predicted > 120 { 51 + dismiss() 52 + } 53 + } 54 + ) 40 55 .environment(zoomState) 41 56 .modifier(ImageZoomOverlay(zoomState: zoomState)) 42 57 .navigationTitle(camera)
+15
Grain/Views/Feed/HashtagFeedView.swift
··· 2 2 3 3 struct HashtagFeedView: View { 4 4 @Environment(AuthManager.self) private var auth 5 + @Environment(\.dismiss) private var dismiss 5 6 @State private var galleries: [GrainGallery] = [] 6 7 @State private var cursor: String? 7 8 @State private var isLoading = false ··· 37 38 } 38 39 } 39 40 } 41 + .gesture( 42 + // Rightward swipe outside the carousel pops the nav. Exclusive 43 + // .gesture so the child TabView in GalleryCardView claims swipes 44 + // on the image area first. 45 + DragGesture(minimumDistance: 30) 46 + .onEnded { value in 47 + let dx = value.translation.width 48 + let dy = value.translation.height 49 + let predicted = value.predictedEndTranslation.width 50 + if dx > 80, abs(dy) < 60, predicted > 120 { 51 + dismiss() 52 + } 53 + } 54 + ) 40 55 .environment(zoomState) 41 56 .modifier(ImageZoomOverlay(zoomState: zoomState)) 42 57 .navigationTitle("#\(tag)")
+15
Grain/Views/Feed/LocationFeedView.swift
··· 3 3 4 4 struct LocationFeedView: View { 5 5 @Environment(AuthManager.self) private var auth 6 + @Environment(\.dismiss) private var dismiss 6 7 @State private var galleries: [GrainGallery] = [] 7 8 @State private var cursor: String? 8 9 @State private var isLoading = false ··· 93 94 } 94 95 } 95 96 } 97 + .gesture( 98 + // Rightward swipe outside the carousel pops the nav. Exclusive 99 + // .gesture so the child TabView in GalleryCardView claims swipes 100 + // on the image area first. 101 + DragGesture(minimumDistance: 30) 102 + .onEnded { value in 103 + let dx = value.translation.width 104 + let dy = value.translation.height 105 + let predicted = value.predictedEndTranslation.width 106 + if dx > 80, abs(dy) < 60, predicted > 120 { 107 + dismiss() 108 + } 109 + } 110 + ) 96 111 .environment(zoomState) 97 112 .modifier(ImageZoomOverlay(zoomState: zoomState)) 98 113 .navigationTitle(locationName)