forked from shadowfacts/Tusker
Fix restored, ducked Compose screen lacking title
This commit is contained in:
parent
b782e66a45
commit
af5109f86c
|
@ -71,6 +71,15 @@ public final class ComposeController: ViewController {
|
||||||
draft.poll == nil || draft.poll!.pollOptions.allSatisfy { !$0.text.isEmpty }
|
draft.poll == nil || draft.poll!.pollOptions.allSatisfy { !$0.text.isEmpty }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var navigationTitle: String {
|
||||||
|
if let id = draft.inReplyToID,
|
||||||
|
let status = fetchStatus(id) {
|
||||||
|
return "Reply to @\(status.account.acct)"
|
||||||
|
} else {
|
||||||
|
return "New Post"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
draft: Draft,
|
draft: Draft,
|
||||||
config: ComposeUIConfig,
|
config: ComposeUIConfig,
|
||||||
|
@ -281,16 +290,7 @@ public final class ComposeController: ViewController {
|
||||||
Text(error.localizedDescription)
|
Text(error.localizedDescription)
|
||||||
})
|
})
|
||||||
.onDisappear(perform: controller.onDisappear)
|
.onDisappear(perform: controller.onDisappear)
|
||||||
.navigationTitle(navTitle)
|
.navigationTitle(controller.navigationTitle)
|
||||||
}
|
|
||||||
|
|
||||||
private var navTitle: String {
|
|
||||||
if let id = draft.inReplyToID,
|
|
||||||
let status = controller.fetchStatus(id) {
|
|
||||||
return "Reply to @\(status.account.acct)"
|
|
||||||
} else {
|
|
||||||
return "New Post"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mainList: some View {
|
private var mainList: some View {
|
||||||
|
|
|
@ -28,7 +28,6 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
|
||||||
let controller: ComposeController
|
let controller: ComposeController
|
||||||
let mastodonController: MastodonController
|
let mastodonController: MastodonController
|
||||||
|
|
||||||
|
|
||||||
private var assetPickerCompletion: (@MainActor ([PHPickerResult]) -> Void)?
|
private var assetPickerCompletion: (@MainActor ([PHPickerResult]) -> Void)?
|
||||||
private var drawingCompletion: ((PKDrawing) -> Void)?
|
private var drawingCompletion: ((PKDrawing) -> Void)?
|
||||||
|
|
||||||
|
@ -56,6 +55,9 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
|
||||||
pasteConfiguration = UIPasteConfiguration(forAccepting: DraftAttachment.self)
|
pasteConfiguration = UIPasteConfiguration(forAccepting: DraftAttachment.self)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(updateConfig), name: .preferencesChanged, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(updateConfig), name: .preferencesChanged, object: nil)
|
||||||
|
|
||||||
|
// set an initial title immediately, in case we're starting ducked
|
||||||
|
self.navigationItem.title = self.controller.navigationTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required init?(coder aDecoder: NSCoder) {
|
||||||
|
|
Loading…
Reference in New Issue