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) {
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]) {

View File

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

View File

@ -33,17 +33,16 @@ class ShareViewController: UIViewController {
let context = ShareMastodonContext(accountInfo: account)
let host = ShareHostingController(draft: draft, mastodonContext: context)
let nav = UINavigationController(rootViewController: host)
self.addChild(nav)
nav.view.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(nav.view)
host.view.translatesAutoresizingMaskIntoConstraints = false
addChild(host)
self.view.addSubview(host.view)
NSLayoutConstraint.activate([
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.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.didMove(toParent: self)
host.didMove(toParent: self)
}
} else {
state = .notLoggedIn

View File

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