Open SafariVC on homepage row tap

This commit is contained in:
Mihael Cholakov 2020-01-11 23:31:47 +02:00
parent 1a58118a73
commit 7849c66e03
1 changed files with 14 additions and 0 deletions

View File

@ -8,6 +8,7 @@
import UIKit
import Account
import SafariServices
class WebFeedInspectorViewController: UITableViewController {
@ -31,6 +32,8 @@ class WebFeedInspectorViewController: UITableViewController {
return FaviconGenerator.favicon(webFeed)
}
private let homePageIndexPath = IndexPath(row: 0, section: 1)
override func viewDidLoad() {
tableView.register(InspectorIconHeaderView.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
@ -91,6 +94,17 @@ extension WebFeedInspectorViewController {
}
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath == homePageIndexPath,
let homePageUrlString = webFeed.homePageURL,
let homePageUrl = URL(string: homePageUrlString) {
let safari = SFSafariViewController(url: homePageUrl)
present(safari, animated: true)
}
}
}
// MARK: UITextFieldDelegate