Dwayne Harris
6 years ago
12 changed files with 291 additions and 193 deletions
-
3.gitmodules
-
1Frameworks/FLAnimatedImage
-
65elpha-ios.xcodeproj/project.pbxproj
-
65elpha-ios/AbstractStatusTableViewController.swift
-
109elpha-ios/AccountTableViewController.swift
-
3elpha-ios/AuthenticateViewController.swift
-
8elpha-ios/Base.lproj/Main.storyboard
-
39elpha-ios/CellHeightManager.swift
-
63elpha-ios/StatusTableViewController.swift
-
14elpha-ios/StatusView.swift
-
109elpha-ios/TimelineTableViewController.swift
-
5elpha-ios/UITextViewFixed.swift
@ -0,0 +1 @@ |
|||
Subproject commit 16fe62b540f63294cfdfdcd04ebcd9e2c093819c |
@ -0,0 +1,65 @@ |
|||
// |
|||
// 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 loading: Bool = false |
|||
var currentPaginationContext: String = "" |
|||
var cellHeightsDictionary: NSMutableDictionary = [:] |
|||
|
|||
func accountTapped(account: AccountMO) { |
|||
let storyboard = UIStoryboard(name: "Main", bundle: nil) |
|||
|
|||
if let controller = storyboard.instantiateViewController(withIdentifier: "AccountTableViewController") as? AccountTableViewController { |
|||
controller.account = account |
|||
self.navigationController?.pushViewController(controller, animated: true) |
|||
} |
|||
} |
|||
|
|||
func statusTapped(status: StatusMO) { |
|||
let storyboard = UIStoryboard(name: "Main", bundle: nil) |
|||
|
|||
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 attachmentTapped(status: StatusMO, index: Int) { |
|||
let storyboard = UIStoryboard(name: "Main", bundle: nil) |
|||
|
|||
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) |
|||
} |
|||
} |
|||
|
|||
extension AbstractStatusTableViewController: SFSafariViewControllerDelegate { |
|||
func safariViewControllerDidFinish(_ controller: SFSafariViewController) { |
|||
controller.dismiss(animated: true) |
|||
} |
|||
} |
@ -0,0 +1,39 @@ |
|||
// |
|||
// CellHeightManager.swift |
|||
// elpha-ios |
|||
// |
|||
// Created by Dwayne Harris on 11/10/18. |
|||
// Copyright © 2018 Elpha. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
class CellHeightManager { |
|||
static private var cellHeightsDictionary: NSMutableDictionary = [:] |
|||
|
|||
static func set(statusID: String, height: CGFloat) { |
|||
cellHeightsDictionary[statusID] = height |
|||
} |
|||
|
|||
static func set(status: StatusMO?, height: CGFloat) { |
|||
if let id = status?.id { |
|||
set(statusID: id, height: height) |
|||
} |
|||
} |
|||
|
|||
static func get(statusID: String) -> CGFloat { |
|||
if let height = cellHeightsDictionary[statusID] as? CGFloat { |
|||
return height |
|||
} |
|||
|
|||
return UITableView.automaticDimension |
|||
} |
|||
|
|||
static func get(status: StatusMO?) -> CGFloat { |
|||
if let id = status?.id { |
|||
return get(statusID: id) |
|||
} |
|||
|
|||
return UITableView.automaticDimension |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue