@@ -56,10 +56,9 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
5656 return state. showProgressView
5757 || ( !isContentEmpty && !self . rendered)
5858 }
59-
59+
6060 var body : some View {
6161 contentView
62- . navigatable ( )
6362 . sheet ( isPresented: $showingSafari) {
6463 if let url = safariURL {
6564 SafariView ( url: url)
@@ -70,7 +69,6 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
7069 @ViewBuilder
7170 private var contentView : some View {
7271 VStack ( spacing: 0 ) {
73- // TODO: improve here
7472 VStack ( spacing: 0 ) {
7573 AuthorInfoView ( initData: initData, data: state. model. headerInfo)
7674 if !isContentEmpty {
@@ -89,7 +87,6 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
8987 withAnimation {
9088 hideTitleViews = !( scrollY <= - 100 )
9189 }
92- // replyIsFocused = false
9390 }
9491 . onTapGesture {
9592 replyIsFocused = false
@@ -111,16 +108,15 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
111108 dispatch ( FeedDetailActions . FetchData. Start ( id: instanceId, feedId: initData? . id, autoLoad: !state. hasLoadedOnce) )
112109 }
113110 . onDisappear {
114- if !isPresented {
115- log ( " onPageClosed-----> " )
116- let data : FeedInfo . Item ?
117- if state. model. headerInfo != nil {
118- data = state. model. headerInfo? . toFeedItemInfo ( )
119- } else {
120- data = initData
121- }
122- dispatch ( MyRecentActions . RecordAction ( data: data) )
111+ guard !isPresented else { return }
112+ log ( " onPageClosed-----> " )
113+ let data : FeedInfo . Item ?
114+ if state. model. headerInfo != nil {
115+ data = state. model. headerInfo? . toFeedItemInfo ( )
116+ } else {
117+ data = initData
123118 }
119+ dispatch ( MyRecentActions . RecordAction ( data: data) )
124120 }
125121 }
126122
@@ -150,18 +146,14 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
150146 }
151147 . background ( Color . lightGray)
152148 . clipShape ( RoundedRectangle ( cornerRadius: 12 ) )
153- // if isKeyboardVisiable {
154- // actionBar
155- // .transition(.opacity)
156- // }
157149 }
158150 . padding ( . bottom, isKeyboardVisiable ? 0 : topSafeAreaInset ( ) . bottom * 0.9 )
159151 . padding ( . top, 10 )
160152 . padding ( . horizontal, 10 )
161153 . background ( Color . itemBg)
162154 }
163155 }
164-
156+
165157 @ViewBuilder
166158 private var actionBar : some View {
167159 HStack ( spacing: 10 ) {
@@ -182,7 +174,7 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
182174 . padding ( . vertical, 10 )
183175 . padding ( . horizontal, 16 )
184176 }
185-
177+
186178 @ViewBuilder
187179 private var navBar : some View {
188180 NavbarHostView ( paddingH: 0 ) {
@@ -197,10 +189,7 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
197189 . foregroundColor ( . tintColor)
198190 }
199191 Group {
200- // FIXME: use real value
201- NavigationLink ( destination: UserDetailPage ( userId: initData? . id ?? . empty) ) {
202- AvatarView ( url: state. model. headerInfo? . avatar ?? . empty, size: 32 )
203- }
192+ AvatarView ( url: state. model. headerInfo? . avatar ?? . empty, size: 32 )
204193 VStack ( alignment: . leading) {
205194 Text ( " 话题 " )
206195 . font ( . headline)
@@ -271,7 +260,7 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
271260 }
272261 . visualBlur ( )
273262 }
274-
263+
275264 @ViewBuilder
276265 private var replayListView : some View {
277266 LazyVStack ( spacing: 0 ) {
@@ -280,12 +269,5 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
280269 }
281270 }
282271 }
283-
284- }
285272
286- //struct NewsDetailPage_Previews: PreviewProvider {
287- // static var previews: some View {
288- // FeedDetailPage(id: .empty)
289- // .environmentObject(Store.shared)
290- // }
291- //}
273+ }
0 commit comments