Compare commits

..

No commits in common. "7b218bfd759f415dc695bfafe197f1ef965f489d" and "ad558510906c6a2da3397f4ee5a8c2386d959229" have entirely different histories.

4 changed files with 20 additions and 21 deletions

View File

@ -76,9 +76,7 @@ class AttachmentsListController: ViewController {
} }
private func deleteAttachments(at indices: IndexSet) { private func deleteAttachments(at indices: IndexSet) {
var array = draft.draftAttachments draft.attachments.removeObjects(at: indices)
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 {
deleteDraftOnDisappear = true DraftsPersistentContainer.shared.viewContext.delete(draft)
config.dismiss(.cancel) config.dismiss(.cancel)
} }
} }
@ -162,7 +162,9 @@ public final class ComposeController: ViewController {
@MainActor @MainActor
func cancel(deleteDraft: Bool) { func cancel(deleteDraft: Bool) {
deleteDraftOnDisappear = true if deleteDraft {
DraftsPersistentContainer.shared.viewContext.delete(draft)
}
config.dismiss(.cancel) config.dismiss(.cancel)
} }

View File

@ -33,16 +33,17 @@ 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)
host.view.translatesAutoresizingMaskIntoConstraints = false let nav = UINavigationController(rootViewController: host)
addChild(host) self.addChild(nav)
self.view.addSubview(host.view) nav.view.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(nav.view)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
host.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), nav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
host.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), nav.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
host.view.topAnchor.constraint(equalTo: self.view.topAnchor), nav.view.topAnchor.constraint(equalTo: self.view.topAnchor),
host.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), nav.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
]) ])
host.didMove(toParent: self) nav.didMove(toParent: self)
} }
} else { } else {
state = .notLoggedIn state = .notLoggedIn

View File

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