Move show share dialog back to detail controller from coordinator
This commit is contained in:
parent
71343b9e72
commit
b475f52871
|
@ -629,21 +629,6 @@ class AppCoordinator: NSObject, UndoableCommandRunner {
|
|||
UIApplication.shared.open(url, options: [:])
|
||||
}
|
||||
|
||||
func showActivityDialogForCurrentArticle() {
|
||||
guard let detailViewController = detailViewController else {
|
||||
return
|
||||
}
|
||||
guard let preferredLink = currentArticle?.preferredLink, let url = URL(string: preferredLink) else {
|
||||
return
|
||||
}
|
||||
|
||||
let itemSource = ArticleActivityItemSource(url: url, subject: currentArticle?.title)
|
||||
let activityViewController = UIActivityViewController(activityItems: [itemSource], applicationActivities: nil)
|
||||
|
||||
activityViewController.popoverPresentationController?.barButtonItem = detailViewController.actionBarButtonItem
|
||||
detailViewController.present(activityViewController, animated: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: UISplitViewControllerDelegate
|
||||
|
|
|
@ -149,9 +149,15 @@ class DetailViewController: UIViewController {
|
|||
}
|
||||
|
||||
@IBAction func showActivityDialog(_ sender: Any) {
|
||||
coordinator.showActivityDialogForCurrentArticle()
|
||||
guard let currentArticle = coordinator.currentArticle, let preferredLink = currentArticle.preferredLink, let url = URL(string: preferredLink) else {
|
||||
return
|
||||
}
|
||||
|
||||
let itemSource = ArticleActivityItemSource(url: url, subject: currentArticle.title)
|
||||
let activityViewController = UIActivityViewController(activityItems: [itemSource], applicationActivities: nil)
|
||||
activityViewController.popoverPresentationController?.barButtonItem = actionBarButtonItem
|
||||
present(activityViewController, animated: true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ArticleActivityItemSource: NSObject, UIActivityItemSource {
|
||||
|
|
Loading…
Reference in New Issue