Tweak Posted Successfully toast

This commit is contained in:
Shadowfacts 2025-03-02 10:27:41 -05:00
parent 85a9f9fb49
commit 57e21176f0

View File

@ -132,12 +132,20 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
if let presentingViewController, if let presentingViewController,
let host = findNavDelegate(in: presentingViewController) { let host = findNavDelegate(in: presentingViewController) {
_ = mastodonController.persistentContainer.addOrUpdateOnViewContext(status: status) _ = mastodonController.persistentContainer.addOrUpdateOnViewContext(status: status)
var config = ToastConfiguration(title: "Posted Successfully") let title = switch mode {
config.actionTitle = "View" case .edit(_): "Edited Successfully"
case .post(_): "Posted Successfully"
default: fatalError()
}
var config = ToastConfiguration(title: title)
config.dismissAutomaticallyAfter = 5
config.systemImageName = "checkmark" config.systemImageName = "checkmark"
config.action = { toast in if case .post(_) = mode {
host.selected(status: status.id) config.actionTitle = "View"
toast.dismissToast(animated: true) config.action = { toast in
host.selected(status: status.id)
toast.dismissToast(animated: true)
}
} }
host.showToast(configuration: config, animated: true) host.showToast(configuration: config, animated: true)
} }