mirror of
https://github.com/lumaa-dev/BubbleApp.git
synced 2025-01-30 18:24:55 +01:00
Copy text of status
This commit is contained in:
parent
95c63952e1
commit
3564ceb470
@ -1,30 +1,43 @@
|
||||
//Made by Lumaa
|
||||
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
struct PostMenu: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@Environment(Navigator.self) private var navigator
|
||||
@Environment(AccountManager.self) private var accountManager
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@Environment(\.displayScale) private var displayScale
|
||||
|
||||
var status: Status
|
||||
|
||||
private var isOwner: Bool {
|
||||
if let acc = accountManager.getAccount() {
|
||||
return status.account.id == acc.id
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Menu {
|
||||
Button(role: .destructive) {
|
||||
print("Delete")
|
||||
} label: {
|
||||
Label("status.menu.delete", systemImage: "trash")
|
||||
if isOwner {
|
||||
Button(role: .destructive) {
|
||||
Task {
|
||||
await deleteStatus()
|
||||
}
|
||||
} label: {
|
||||
Label("status.menu.delete", systemImage: "trash")
|
||||
}
|
||||
|
||||
Button {
|
||||
navigator.presentedSheet = .post(content: status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText, replyId: nil, editId: status.reblogAsAsStatus?.id ?? status.id)
|
||||
} label: {
|
||||
Label("status.menu.edit", systemImage: "pencil.and.scribble")
|
||||
}
|
||||
|
||||
Divider()
|
||||
}
|
||||
|
||||
Button {
|
||||
print("Edit")
|
||||
} label: {
|
||||
Label("status.menu.edit", systemImage: "pencil.and.scribble")
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Menu {
|
||||
ShareLink(item: URL(string: status.url ?? "https://joinmastodon.org/")!) {
|
||||
Label("status.menu.share-link", systemImage: "square.and.arrow.up")
|
||||
@ -32,11 +45,19 @@ struct PostMenu: View {
|
||||
|
||||
Button {
|
||||
Task {
|
||||
await createImage()
|
||||
createImage()
|
||||
}
|
||||
} label: {
|
||||
Label("status.menu.share-image", systemImage: "photo")
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Button {
|
||||
UIPasteboard.general.setValue(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText, forPasteboardType: UTType.plainText.identifier)
|
||||
} label: {
|
||||
Label("status.menu.copy-text", systemImage: "list.clipboard")
|
||||
}
|
||||
} label: {
|
||||
Label("status.menu.share", systemImage: "paperplane")
|
||||
}
|
||||
@ -64,7 +85,13 @@ struct PostMenu: View {
|
||||
render.isOpaque = false
|
||||
|
||||
if let image = render.uiImage {
|
||||
navigator.presentedSheet = .shareImage(image: image)
|
||||
navigator.presentedSheet = .shareImage(image: image, status: status)
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteStatus() async {
|
||||
if let client = accountManager.getClient() {
|
||||
_ = try? await client.delete(endpoint: Statuses.status(id: status.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{
|
||||
"sourceLanguage" : "en",
|
||||
"strings" : {
|
||||
"@%@" : {
|
||||
|
||||
},
|
||||
"#%@" : {
|
||||
|
||||
},
|
||||
@ -404,6 +407,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"status.editing" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Editing post"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"status.favourites-%lld" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
@ -426,6 +439,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"status.menu.copy-text" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Copy text"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"status.menu.delete" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
|
Loading…
x
Reference in New Issue
Block a user