Change how view controller delegate extensions work
This commit is contained in:
parent
75111f2827
commit
3e2549e8f8
|
@ -10,7 +10,7 @@ import UIKit
|
|||
import MastodonKit
|
||||
import SafariServices
|
||||
|
||||
extension UIViewController: StatusTableViewCellDelegate {
|
||||
extension StatusTableViewCellDelegate where Self: UIViewController {
|
||||
|
||||
func selected(account: Account) {
|
||||
// don't open if the account is the same as the current one
|
||||
|
@ -59,6 +59,7 @@ extension UIViewController: StatusTableViewCellDelegate {
|
|||
}
|
||||
|
||||
func showLargeImage(_ image: UIImage, description: String?, animatingFrom originView: UIView) {
|
||||
guard let self = self as? UIViewController & LargeImageViewControllerDelegate else { return }
|
||||
let vc = LargeImageViewController.create(image: image, description: description)
|
||||
vc.delegate = self
|
||||
var frame = originView.convert(originView.bounds, to: view)
|
||||
|
@ -78,7 +79,7 @@ extension UIViewController: StatusTableViewCellDelegate {
|
|||
|
||||
}
|
||||
|
||||
extension UIViewController: LargeImageViewControllerDelegate {
|
||||
extension LargeImageViewControllerDelegate where Self: UIViewController {
|
||||
func closeLargeImage() {
|
||||
dismiss(animated: true)
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class ComposeViewController: UIViewController {
|
|||
guard let status = status else { fatalError("postComplete segue can't occur without Status") }
|
||||
guard let dest = segue.destination as? MainTabBarViewController,
|
||||
let navController = dest.selectedViewController as? UINavigationController,
|
||||
let topVC = navController.topViewController else { return }
|
||||
let topVC = navController.topViewController as? StatusTableViewCellDelegate else { return }
|
||||
topVC.selected(status: status)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,3 +120,6 @@ class ConversationViewController: UIViewController, UITableViewDataSource, UITab
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
extension ConversationViewController: StatusTableViewCellDelegate {}
|
||||
extension ConversationViewController: LargeImageViewControllerDelegate {}
|
||||
|
|
|
@ -138,3 +138,6 @@ class NotificationsTableViewController: UITableViewController {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
extension NotificationsTableViewController: StatusTableViewCellDelegate {}
|
||||
extension NotificationsTableViewController: LargeImageViewControllerDelegate {}
|
||||
|
|
|
@ -174,3 +174,5 @@ extension ProfileTableViewController: ProfileHeaderTableViewCellDelegate {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
extension ProfileTableViewController: LargeImageViewControllerDelegate {}
|
||||
|
|
|
@ -132,3 +132,6 @@ class TimelineTableViewController: UITableViewController {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
extension TimelineTableViewController: StatusTableViewCellDelegate {}
|
||||
extension TimelineTableViewController: LargeImageViewControllerDelegate {}
|
||||
|
|
Loading…
Reference in New Issue