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) {
var array = draft.draftAttachments
array.remove(atOffsets: indices)
draft.attachments = NSMutableOrderedSet(array: array)
draft.attachments.removeObjects(at: indices)
}
private func insertAttachments(at offset: Int, itemProviders: [NSItemProvider]) {

View File

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

View File

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

View File

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