Fix instance public timelines not loading

This commit is contained in:
Shadowfacts 2020-01-05 19:39:37 -05:00
parent 2bdcb9b7f8
commit e3be424f5a
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
7 changed files with 20 additions and 11 deletions

View File

@ -54,6 +54,15 @@ class InstanceTimelineViewController: TimelineTableViewController {
toggleSaveButton.title = toggleSaveButtonTitle
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAt: indexPath) as! TimelineStatusTableViewCell
cell.delegate = nil
cell.overrideMastodonController = mastodonController
return cell
}
// MARK: - Table view delegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

View File

@ -58,7 +58,6 @@ class TimelineTableViewController: EnhancedTableViewController {
tableView.prefetchDataSource = self
guard mastodonController.accessToken != nil else { return }
loadInitialStatuses()
}

View File

@ -11,7 +11,7 @@ import UIKit
class AccountTableViewCell: UITableViewCell {
var delegate: TuskerNavigationDelegate?
var mastodonController: MastodonController? { delegate?.apiController }
var mastodonController: MastodonController! { delegate?.apiController }
@IBOutlet weak var avatarImageView: UIImageView!
@IBOutlet weak var displayNameLabel: UILabel!

View File

@ -12,7 +12,7 @@ import Pachyderm
class FollowNotificationGroupTableViewCell: UITableViewCell {
var delegate: TuskerNavigationDelegate?
var mastodonController: MastodonController? { delegate?.apiController }
var mastodonController: MastodonController! { delegate?.apiController }
@IBOutlet weak var avatarStackView: UIStackView!
@IBOutlet weak var timestampLabel: UILabel!

View File

@ -12,7 +12,7 @@ import Pachyderm
class FollowRequestNotificationTableViewCell: UITableViewCell {
var delegate: TuskerNavigationDelegate?
var mastodonController: MastodonController? { delegate?.apiController }
var mastodonController: MastodonController! { delegate?.apiController }
@IBOutlet weak var stackView: UIStackView!
@IBOutlet weak var avatarImageView: UIImageView!
@ -90,7 +90,7 @@ class FollowRequestNotificationTableViewCell: UITableViewCell {
@IBAction func rejectButtonPressed() {
let request = Account.rejectFollowRequest(account)
mastodonController!.run(request) { (response) in
mastodonController.run(request) { (response) in
guard case let .success(relationship, _) = response else { fatalError() }
MastodonCache.add(relationship: relationship)
DispatchQueue.main.async {
@ -107,7 +107,7 @@ class FollowRequestNotificationTableViewCell: UITableViewCell {
@IBAction func acceptButtonPressed() {
let request = Account.authorizeFollowRequest(account)
mastodonController!.run(request) { (response) in
mastodonController.run(request) { (response) in
guard case let .success(relationship, _) = response else { fatalError() }
MastodonCache.add(relationship: relationship)
DispatchQueue.main.async {

View File

@ -16,7 +16,7 @@ protocol ProfileHeaderTableViewCellDelegate: TuskerNavigationDelegate {
class ProfileHeaderTableViewCell: UITableViewCell {
var delegate: ProfileHeaderTableViewCellDelegate?
var mastodonController: MastodonController? { delegate?.apiController }
var mastodonController: MastodonController! { delegate?.apiController }
@IBOutlet weak var headerImageView: UIImageView!
@IBOutlet weak var avatarContainerView: UIView!
@ -83,7 +83,7 @@ class ProfileHeaderTableViewCell: UITableViewCell {
noteLabel.setTextFromHtml(account.note)
noteLabel.setEmojis(account.emojis)
if accountID != mastodonController!.account.id {
if accountID != mastodonController.account.id {
// don't show relationship label for the user's own account
if let relationship = MastodonCache.relationship(for: accountID) {
followsYouLabel.isHidden = !relationship.followedBy

View File

@ -21,7 +21,8 @@ class BaseStatusTableViewCell: UITableViewCell {
contentLabel.navigationDelegate = delegate
}
}
var mastodonController: MastodonController? { delegate?.apiController }
var overrideMastodonController: MastodonController?
var mastodonController: MastodonController! { overrideMastodonController ?? delegate?.apiController }
@IBOutlet weak var avatarImageView: UIImageView!
@IBOutlet weak var displayNameLabel: UILabel!
@ -249,7 +250,7 @@ class BaseStatusTableViewCell: UITableViewCell {
let realStatus: Status = status.reblog ?? status
let request = (favorited ? Status.favourite : Status.unfavourite)(realStatus)
mastodonController!.run(request) { response in
mastodonController.run(request) { response in
DispatchQueue.main.async {
if case let .success(newStatus, _) = response {
self.favorited = newStatus.favourited ?? false
@ -274,7 +275,7 @@ class BaseStatusTableViewCell: UITableViewCell {
let realStatus: Status = status.reblog ?? status
let request = (reblogged ? Status.reblog : Status.unreblog)(realStatus)
mastodonController!.run(request) { response in
mastodonController.run(request) { response in
DispatchQueue.main.async {
if case let .success(newStatus, _) = response {
self.reblogged = newStatus.reblogged ?? false