DispatchQueue.main.async

This commit is contained in:
Jed Fox 2022-12-15 07:39:05 -05:00
parent 4f8ca8d481
commit cd6bdead01
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
1 changed files with 33 additions and 35 deletions

View File

@ -195,12 +195,12 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & AuthConte
) { _ in ) { _ in
UIPasteboard.general.url = url UIPasteboard.general.url = url
}, },
UIAction( UIAction(
title: L10n.Common.Controls.Actions.share, title: L10n.Common.Controls.Actions.share,
image: Asset.Arrow.squareAndArrowUp.image.withRenderingMode(.alwaysTemplate) image: Asset.Arrow.squareAndArrowUp.image.withRenderingMode(.alwaysTemplate)
) { _ in ) { _ in
Task { DispatchQueue.main.async {
await MainActor.run {
let activityViewController = UIActivityViewController( let activityViewController = UIActivityViewController(
activityItems: [ activityItems: [
URLActivityItemWithMetadata(url: url) { metadata in URLActivityItemWithMetadata(url: url) { metadata in
@ -222,14 +222,13 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & AuthConte
transition: .activityViewControllerPresent(animated: true) transition: .activityViewControllerPresent(animated: true)
) )
} }
}
}, },
UIAction( UIAction(
title: L10n.Common.Controls.Status.Actions.shareLinkInPost, title: L10n.Common.Controls.Status.Actions.shareLinkInPost,
image: Asset.ObjectsAndTools.squareAndPencil.image.withRenderingMode(.alwaysTemplate) image: Asset.ObjectsAndTools.squareAndPencil.image.withRenderingMode(.alwaysTemplate)
) { _ in ) { _ in
Task { DispatchQueue.main.async {
await MainActor.run {
self.coordinator.present( self.coordinator.present(
scene: .compose(viewModel: ComposeViewModel( scene: .compose(viewModel: ComposeViewModel(
context: self.context, context: self.context,
@ -242,7 +241,6 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & AuthConte
) )
} }
} }
}
]) ])
} }