mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Implement share/activity button on iOS
This commit is contained in:
@@ -11,6 +11,7 @@ import SwiftUI
|
||||
struct ArticleToolbarModifier: ViewModifier {
|
||||
|
||||
@EnvironmentObject private var sceneModel: SceneModel
|
||||
@State private var showActivityView = false
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
@@ -98,11 +99,17 @@ struct ArticleToolbarModifier: ViewModifier {
|
||||
|
||||
ToolbarItem(placement: .bottomBar) {
|
||||
Button {
|
||||
showActivityView.toggle()
|
||||
} label: {
|
||||
AppAssets.shareImage.font(.title3)
|
||||
}
|
||||
.disabled(sceneModel.shareButtonState == nil)
|
||||
.help("Share")
|
||||
.sheet(isPresented: $showActivityView) {
|
||||
if let article = sceneModel.selectedArticles.first, let link = article.preferredLink, let url = URL(string: link) {
|
||||
ActivityViewController(title: article.title, url: url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,10 @@ final class SceneModel: ObservableObject {
|
||||
@Published var openInBrowserButtonState: Bool?
|
||||
@Published var shareButtonState: Bool?
|
||||
|
||||
var selectedArticles: [Article] {
|
||||
timelineModel.selectedArticles
|
||||
}
|
||||
|
||||
private var refreshProgressModel: RefreshProgressModel? = nil
|
||||
private var articleIconSchemeHandler: ArticleIconSchemeHandler? = nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user