Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions V2er/View/FeedDetail/FeedDetailPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
@Environment(\.isPresented) private var isPresented
@Environment(\.dismiss) var dismiss
@EnvironmentObject private var store: Store
@State var rendered: Bool = false
@State private var showingSafari = false
@State private var safariURL: URL?
@State private var showingMobileWeb = false
Expand Down Expand Up @@ -62,11 +61,6 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
return contentInfo == nil || contentInfo!.html.isEmpty
}

private var showProgressView: Bool {
return state.showProgressView
|| (!isContentEmpty && !self.rendered)
}

private func shareTopicContent() {
let title = state.model.headerInfo?.title ?? "V2EX 话题"
let urlString = APIService.baseUrlString + "/t/\(id)"
Expand Down Expand Up @@ -155,7 +149,7 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {

// Content Section
if !isContentEmpty {
NewsContentView(state.model.contentInfo, rendered: $rendered)
NewsContentView(state.model.contentInfo)
.padding(.horizontal, 10)
.listRowInsets(EdgeInsets())
.listRowSeparator(.hidden)
Expand Down Expand Up @@ -210,12 +204,6 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable {
.refreshable {
await run(action: FeedDetailActions.FetchData.Start(id: instanceId, feedId: initData?.id))
}
.overlay {
if showProgressView {
ProgressView()
.scaleEffect(1.5)
}
}
.onTapGesture {
replyIsFocused = false
}
Expand Down
14 changes: 1 addition & 13 deletions V2er/View/FeedDetail/NewsContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import SwiftUI

struct NewsContentView: View {
var contentInfo: FeedDetailInfo.ContentInfo?
@Binding var rendered: Bool
@EnvironmentObject var store: Store
@Environment(\.colorScheme) var colorScheme
@State private var showingSafari = false
@State private var safariURL: URL?

init(_ contentInfo: FeedDetailInfo.ContentInfo?, rendered: Binding<Bool>) {
init(_ contentInfo: FeedDetailInfo.ContentInfo?) {
self.contentInfo = contentInfo
self._rendered = rendered
}

var body: some View {
Expand All @@ -34,16 +32,6 @@ struct NewsContentView: View {
// Open image in SafariView for now
openInSafari(url)
}
.onRenderCompleted { metadata in
// Mark as rendered after content is ready
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.rendered = true
}
}
.onRenderFailed { error in
print("Render error: \(error)")
self.rendered = true
}
.padding(.horizontal, 12)
.padding(.vertical, 8)

Expand Down
Loading