Compare commits

..

4 Commits

4 changed files with 21 additions and 20 deletions

View File

@ -76,7 +76,9 @@ class AttachmentsListController: ViewController {
} }
private func deleteAttachments(at indices: IndexSet) { private func deleteAttachments(at indices: IndexSet) {
draft.attachments.removeObjects(at: indices) var array = draft.draftAttachments
array.remove(atOffsets: indices)
draft.attachments = NSMutableOrderedSet(array: array)
} }
private func insertAttachments(at offset: Int, itemProviders: [NSItemProvider]) { private func insertAttachments(at offset: Int, itemProviders: [NSItemProvider]) {

View File

@ -154,7 +154,7 @@ public final class ComposeController: ViewController {
if draft.hasContent { if draft.hasContent {
isShowingSaveDraftSheet = true isShowingSaveDraftSheet = true
} else { } else {
DraftsPersistentContainer.shared.viewContext.delete(draft) deleteDraftOnDisappear = true
config.dismiss(.cancel) config.dismiss(.cancel)
} }
} }
@ -162,9 +162,7 @@ public final class ComposeController: ViewController {
@MainActor @MainActor
func cancel(deleteDraft: Bool) { func cancel(deleteDraft: Bool) {
if deleteDraft { deleteDraftOnDisappear = true
DraftsPersistentContainer.shared.viewContext.delete(draft)
}
config.dismiss(.cancel) config.dismiss(.cancel)
} }

View File

@ -33,17 +33,16 @@ class ShareViewController: UIViewController {
let context = ShareMastodonContext(accountInfo: account) let context = ShareMastodonContext(accountInfo: account)
let host = ShareHostingController(draft: draft, mastodonContext: context) let host = ShareHostingController(draft: draft, mastodonContext: context)
let nav = UINavigationController(rootViewController: host) host.view.translatesAutoresizingMaskIntoConstraints = false
self.addChild(nav) addChild(host)
nav.view.translatesAutoresizingMaskIntoConstraints = false self.view.addSubview(host.view)
self.view.addSubview(nav.view)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
nav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), host.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
nav.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), host.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
nav.view.topAnchor.constraint(equalTo: self.view.topAnchor), host.view.topAnchor.constraint(equalTo: self.view.topAnchor),
nav.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), host.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
]) ])
nav.didMove(toParent: self) host.didMove(toParent: self)
} }
} else { } else {
state = .notLoggedIn state = .notLoggedIn

View File

@ -143,15 +143,17 @@ struct ReportView: View {
.appGroupedListRowBackground() .appGroupedListRowBackground()
Button(action: self.sendReport) { Button(action: self.sendReport) {
if isReporting { let label = Text(isReporting ? "Sending Report" : "Send Report")
Text("Sending Report") HStack {
label
Spacer() Spacer()
if isReporting {
ProgressView() ProgressView()
.progressViewStyle(.circular) .progressViewStyle(.circular)
} else {
Text("Send Report")
} }
} }
.accessibilityLabel(label)
}
.disabled(isReporting) .disabled(isReporting)
.appGroupedListRowBackground() .appGroupedListRowBackground()
} }