Move show share dialog back to detail controller from coordinator

This commit is contained in:
Maurice Parker 2019-08-19 18:13:21 -05:00
parent 71343b9e72
commit b475f52871
2 changed files with 8 additions and 17 deletions

View File

@ -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

View File

@ -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 {