You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.8 KiB
86 lines
2.8 KiB
//
|
|
// ELStatusTableViewController.swift
|
|
// elpha-ios
|
|
//
|
|
// Created by Dwayne Harris on 11/9/18.
|
|
// Copyright © 2018 Elpha. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import SafariServices
|
|
|
|
class AbstractStatusTableViewController: UITableViewController, StatusViewDelegate {
|
|
let fetchLimit = 20
|
|
var currentPaginationContext: String = ""
|
|
var cellHeightsDictionary: NSMutableDictionary = [:]
|
|
|
|
var loading: Bool = false {
|
|
didSet {
|
|
DispatchQueue.main.async {
|
|
if self.loading {
|
|
self.refreshControl?.beginRefreshing()
|
|
} else {
|
|
self.refreshControl?.endRefreshing()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func storyboard() -> UIStoryboard {
|
|
return UIStoryboard(name: "Main", bundle: nil)
|
|
}
|
|
|
|
func accountTapped(account: AccountMO) {
|
|
if let controller = storyboard().instantiateViewController(withIdentifier: "AccountTableViewController") as? AccountTableViewController {
|
|
controller.account = account
|
|
self.navigationController?.pushViewController(controller, animated: true)
|
|
}
|
|
}
|
|
|
|
func statusTapped(status: StatusMO) {
|
|
if let controller = storyboard().instantiateViewController(withIdentifier: "StatusTableViewController") as? StatusTableViewController {
|
|
controller.status = status
|
|
self.navigationController?.pushViewController(controller, animated: true)
|
|
}
|
|
}
|
|
|
|
func loadMoreTapped(status: StatusMO, direction: PaginationDirection) {
|
|
|
|
}
|
|
|
|
func replyTapped(status: StatusMO) {
|
|
if let controller = storyboard().instantiateViewController(withIdentifier: "ComposeViewController") as? ComposeViewController {
|
|
controller.replyToStatus = status
|
|
present(controller, animated: true)
|
|
}
|
|
}
|
|
|
|
func attachmentTapped(status: StatusMO, index: Int) {
|
|
if let controller = storyboard().instantiateViewController(withIdentifier: "AttachmentPageViewController") as? AttachmentPageViewController {
|
|
controller.status = status
|
|
controller.attachmentIndex = index
|
|
|
|
present(controller, animated: false)
|
|
}
|
|
}
|
|
|
|
func urlTapped(url: URL) {
|
|
let controller = SFSafariViewController(url: url)
|
|
controller.delegate = self
|
|
controller.dismissButtonStyle = .done
|
|
controller.preferredControlTintColor = UIColor(named: "Primary")
|
|
|
|
present(controller, animated: true)
|
|
}
|
|
|
|
func revealTapped() {}
|
|
func hideTapped() {}
|
|
func boostTapped() {}
|
|
func favoriteTapped() {}
|
|
}
|
|
|
|
extension AbstractStatusTableViewController: SFSafariViewControllerDelegate {
|
|
func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
|
|
controller.dismiss(animated: true)
|
|
}
|
|
}
|