Forward status visibility to the editor for reply / edit + prevent quote on non public status

This commit is contained in:
Thomas Ricouard 2023-01-03 21:14:42 +01:00
parent 5d86935e5d
commit d5f4462f3e
3 changed files with 10 additions and 5 deletions

View file

@ -114,6 +114,7 @@ public class StatusEditorViewModel: ObservableObject {
} }
mentionString += " " mentionString += " "
replyToStatus = status replyToStatus = status
visibility = status.visibility
statusText = .init(string: mentionString) statusText = .init(string: mentionString)
selectedRange = .init(location: mentionString.utf16.count, length: 0) selectedRange = .init(location: mentionString.utf16.count, length: 0)
case let .edit(status): case let .edit(status):
@ -121,6 +122,7 @@ public class StatusEditorViewModel: ObservableObject {
selectedRange = .init(location: statusText.string.utf16.count, length: 0) selectedRange = .init(location: statusText.string.utf16.count, length: 0)
spoilerOn = !status.spoilerText.isEmpty spoilerOn = !status.spoilerText.isEmpty
spoilerText = status.spoilerText spoilerText = status.spoilerText
visibility = status.visibility
mediasImages = status.mediaAttachments.map{ .init(image: nil, mediaAttachement: $0, error: nil )} mediasImages = status.mediaAttachments.map{ .init(image: nil, mediaAttachement: $0, error: nil )}
case let .quote(status): case let .quote(status):
self.embededStatus = status self.embededStatus = status

View file

@ -238,10 +238,13 @@ public struct StatusRowView: View {
} } label: { } } label: {
Label(viewModel.isReblogged ? "Unboost" : "Boost", systemImage: "arrow.left.arrow.right.circle") Label(viewModel.isReblogged ? "Unboost" : "Boost", systemImage: "arrow.left.arrow.right.circle")
} }
Button {
routeurPath.presentedSheet = .quoteStatusEditor(status: viewModel.status) if viewModel.status.visibility == .pub {
} label: { Button {
Label("Quote this post", systemImage: "quote.bubble") routeurPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
} label: {
Label("Quote this post", systemImage: "quote.bubble")
}
} }
if let url = viewModel.status.reblog?.url ?? viewModel.status.url { if let url = viewModel.status.reblog?.url ?? viewModel.status.url {

View file

@ -36,7 +36,7 @@ For contributors and myself, here is a todo list of features that could be added
- [ ] Edit filters. - [ ] Edit filters.
- [X] Open remote status locally - [X] Open remote status locally
- [ ] More context menu everywhere - [ ] More context menu everywhere
- [ ] Support pinned posts - [X] Support pinned posts
- [ ] Support IceCubesApp://any mastodon links - [ ] Support IceCubesApp://any mastodon links
- [ ] Add a share sheet - [ ] Add a share sheet
- [ ] Translate button - [ ] Translate button