mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
PiP and UI improvements
This commit is contained in:
@@ -7,28 +7,34 @@ struct ShareButton: View {
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
#if os(iOS)
|
||||
presentingShareSheet = true
|
||||
#else
|
||||
NSPasteboard.general.clearContents()
|
||||
NSPasteboard.general.setString(shareURL, forType: .string)
|
||||
#endif
|
||||
} label: {
|
||||
#if os(iOS)
|
||||
Label("Share", systemImage: "square.and.arrow.up")
|
||||
#else
|
||||
Group {
|
||||
if let url = shareURL {
|
||||
Button {
|
||||
#if os(iOS)
|
||||
presentingShareSheet = true
|
||||
#else
|
||||
NSPasteboard.general.clearContents()
|
||||
NSPasteboard.general.setString(url, forType: .string)
|
||||
#endif
|
||||
} label: {
|
||||
#if os(iOS)
|
||||
Label("Share", systemImage: "square.and.arrow.up")
|
||||
#else
|
||||
EmptyView()
|
||||
#endif
|
||||
}
|
||||
.keyboardShortcut("c")
|
||||
.foregroundColor(.blue)
|
||||
.buttonStyle(.plain)
|
||||
.labelStyle(.iconOnly)
|
||||
} else {
|
||||
EmptyView()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.keyboardShortcut("c")
|
||||
.foregroundColor(.blue)
|
||||
.buttonStyle(.plain)
|
||||
.labelStyle(.iconOnly)
|
||||
}
|
||||
|
||||
private var shareURL: String {
|
||||
accounts.api.shareURL(contentItem).absoluteString
|
||||
private var shareURL: String? {
|
||||
accounts.api.shareURL(contentItem)?.absoluteString
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user