mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 09:41:02 +00:00
Make status rows draggable (#2141)
This commit is contained in:
parent
9af98c3921
commit
33c2646ea1
4 changed files with 10 additions and 6 deletions
|
@ -124,6 +124,7 @@ public struct StatusRowView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.if(viewModel.url != nil) { $0.draggable(viewModel.url!) }
|
||||
.contextMenu {
|
||||
contextMenu
|
||||
.onAppear {
|
||||
|
|
|
@ -105,7 +105,11 @@ import SwiftUI
|
|||
status.reblog?.inReplyToId != nil || status.reblog?.inReplyToAccountId != nil ||
|
||||
status.inReplyToId != nil || status.inReplyToAccountId != nil
|
||||
}
|
||||
|
||||
|
||||
var url: URL? {
|
||||
(status.reblog?.url ?? status.url).flatMap(URL.init(string:))
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func makeBackgroundColor(isHomeTimeline: Bool) -> some View {
|
||||
if isHomeTimeline, theme.showContentGradient {
|
||||
|
|
|
@ -81,6 +81,7 @@ public struct StatusRowCardView: View {
|
|||
.stroke(.gray.opacity(0.35), lineWidth: 1)
|
||||
}
|
||||
}
|
||||
.draggable(url)
|
||||
.contextMenu {
|
||||
ShareLink(item: url) {
|
||||
Label("status.card.share", systemImage: "square.and.arrow.up")
|
||||
|
|
|
@ -88,9 +88,7 @@ struct StatusRowContextMenu: View {
|
|||
Divider()
|
||||
|
||||
Menu("status.action.share-title") {
|
||||
if let urlString = viewModel.status.reblog?.url ?? viewModel.status.url,
|
||||
let url = URL(string: urlString)
|
||||
{
|
||||
if let url = viewModel.url {
|
||||
ShareLink(item: url,
|
||||
subject: Text(viewModel.status.reblog?.account.safeDisplayName ?? viewModel.status.account.safeDisplayName),
|
||||
message: Text(viewModel.status.reblog?.content.asRawText ?? viewModel.status.content.asRawText))
|
||||
|
@ -133,7 +131,7 @@ struct StatusRowContextMenu: View {
|
|||
}
|
||||
}
|
||||
|
||||
if let url = URL(string: viewModel.status.reblog?.url ?? viewModel.status.url ?? "") {
|
||||
if let url = viewModel.url {
|
||||
Button { UIApplication.shared.open(url) } label: {
|
||||
Label("status.action.view-in-browser", systemImage: "safari")
|
||||
}
|
||||
|
@ -152,7 +150,7 @@ struct StatusRowContextMenu: View {
|
|||
}
|
||||
|
||||
Button {
|
||||
UIPasteboard.general.string = viewModel.status.reblog?.url ?? viewModel.status.url
|
||||
UIPasteboard.general.url = viewModel.url
|
||||
} label: {
|
||||
Label("status.action.copy-link", systemImage: "link")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue