|
7 | 7 | // |
8 | 8 |
|
9 | 9 | import SwiftUI |
| 10 | +import SafariServices |
10 | 11 |
|
11 | 12 | struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable { |
12 | 13 | @Environment(\.isPresented) private var isPresented |
13 | 14 | @Environment(\.dismiss) var dismiss |
14 | 15 | @EnvironmentObject private var store: Store |
15 | 16 | @State var rendered: Bool = false |
| 17 | + @State private var showingSafari = false |
| 18 | + @State private var safariURL: URL? |
16 | 19 |
|
17 | 20 | var bindingState: Binding<FeedDetailState> { |
18 | 21 | if store.appState.feedDetailStates[instanceId] == nil { |
@@ -57,6 +60,11 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable { |
57 | 60 | var body: some View { |
58 | 61 | contentView |
59 | 62 | .navigatable() |
| 63 | + .sheet(isPresented: $showingSafari) { |
| 64 | + if let url = safariURL { |
| 65 | + SafariView(url: url) |
| 66 | + } |
| 67 | + } |
60 | 68 | } |
61 | 69 |
|
62 | 70 | @ViewBuilder |
@@ -134,7 +142,7 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable { |
134 | 142 | } label: { |
135 | 143 | Image(systemName: "arrow.up.circle.fill") |
136 | 144 | .font(.title.weight(.regular)) |
137 | | - .foregroundColor(Color.bodyText.opacity(hasReplyContent ? 1.0 : 0.6)) |
| 145 | + .foregroundColor(Color.tintColor.opacity(hasReplyContent ? 1.0 : 0.6)) |
138 | 146 | .padding(.trailing, 6) |
139 | 147 | .padding(.vertical, 3) |
140 | 148 | } |
@@ -231,6 +239,17 @@ struct FeedDetailPage: StateView, KeyboardReadable, InstanceIdentifiable { |
231 | 239 | Label(reported ? "已举报" : "举报", systemImage: "person.crop.circle.badge.exclamationmark") |
232 | 240 | } |
233 | 241 | .disabled(reported) |
| 242 | + |
| 243 | + Divider() |
| 244 | + |
| 245 | + Button { |
| 246 | + if let url = URL(string: APIService.baseUrlString + "/t/\(id)") { |
| 247 | + safariURL = url |
| 248 | + showingSafari = true |
| 249 | + } |
| 250 | + } label: { |
| 251 | + Label("使用浏览器打开", systemImage: "safari") |
| 252 | + } |
234 | 253 | } label: { |
235 | 254 | Image(systemName: "ellipsis") |
236 | 255 | .padding(8) |
|
0 commit comments