forked from shadowfacts/Tusker
Add opening URLs in SFSafariViewController
This commit is contained in:
parent
03c87105d3
commit
02fcea8675
|
@ -9,6 +9,7 @@
|
|||
import UIKit
|
||||
import MastodonKit
|
||||
import SwiftSoup
|
||||
import SafariServices
|
||||
|
||||
class TimelineTableViewController: UITableViewController {
|
||||
|
||||
|
@ -91,6 +92,8 @@ class TimelineTableViewController: UITableViewController {
|
|||
|
||||
cell.updateUI(for: status)
|
||||
|
||||
cell.delegate = self
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
|
@ -123,3 +126,18 @@ class TimelineTableViewController: UITableViewController {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
extension TimelineTableViewController: StatusTableViewCellDelegate {
|
||||
func selected(mention: Mention) {
|
||||
|
||||
}
|
||||
|
||||
func selected(tag: MastodonKit.Tag) {
|
||||
|
||||
}
|
||||
|
||||
func selected(url: URL) {
|
||||
let vc = SFSafariViewController(url: url)
|
||||
present(vc, animated: true)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,20 @@ import UIKit
|
|||
import MastodonKit
|
||||
import SwiftSoup
|
||||
|
||||
protocol StatusTableViewCellDelegate {
|
||||
|
||||
func selected(mention: Mention)
|
||||
|
||||
func selected(tag: MastodonKit.Tag)
|
||||
|
||||
func selected(url: URL)
|
||||
|
||||
}
|
||||
|
||||
class StatusTableViewCell: UITableViewCell {
|
||||
|
||||
var delegate: StatusTableViewCellDelegate?
|
||||
|
||||
@IBOutlet weak var displayNameLabel: UILabel!
|
||||
@IBOutlet weak var usernameLabel: UILabel!
|
||||
@IBOutlet weak var contentLabel: StatusContentLabel!
|
||||
|
@ -64,15 +76,15 @@ class StatusTableViewCell: UITableViewCell {
|
|||
extension StatusTableViewCell: StatusContentLabelDelegate {
|
||||
|
||||
func selected(mention: Mention) {
|
||||
print("selected mention: \(mention.acct)")
|
||||
delegate?.selected(mention: mention)
|
||||
}
|
||||
|
||||
func selected(tag: MastodonKit.Tag) {
|
||||
print("selected tag: \(tag.name)")
|
||||
delegate?.selected(tag: tag)
|
||||
}
|
||||
|
||||
func selected(url: URL) {
|
||||
print("selected url: \(url)")
|
||||
delegate?.selected(url: url)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue