From 08086f1b1836b4f68809d08a190fb36c84ef0ff4 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 20 Jan 2020 15:25:23 -0500 Subject: [PATCH] Fix compose reply view missing MastodonController instance --- Tusker/Screens/Compose/ComposeViewController.swift | 1 + .../Views/Compose Status Reply/ComposeStatusReplyView.swift | 3 +++ Tusker/Views/ContentTextView.swift | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Compose/ComposeViewController.swift b/Tusker/Screens/Compose/ComposeViewController.swift index d0abd874da..7efb15cc2e 100644 --- a/Tusker/Screens/Compose/ComposeViewController.swift +++ b/Tusker/Screens/Compose/ComposeViewController.swift @@ -193,6 +193,7 @@ class ComposeViewController: UIViewController { } let replyView = ComposeStatusReplyView.create() + replyView.mastodonController = mastodonController replyView.updateUI(for: inReplyTo) stackView.insertArrangedSubview(replyView, at: 0) diff --git a/Tusker/Views/Compose Status Reply/ComposeStatusReplyView.swift b/Tusker/Views/Compose Status Reply/ComposeStatusReplyView.swift index 1242ae4b33..12f24cd5bc 100644 --- a/Tusker/Views/Compose Status Reply/ComposeStatusReplyView.swift +++ b/Tusker/Views/Compose Status Reply/ComposeStatusReplyView.swift @@ -10,6 +10,8 @@ import UIKit import Pachyderm class ComposeStatusReplyView: UIView { + + weak var mastodonController: MastodonController? @IBOutlet weak var avatarImageView: UIImageView! @IBOutlet weak var displayNameLabel: UILabel! @@ -34,6 +36,7 @@ class ComposeStatusReplyView: UIView { func updateUI(for status: Status) { displayNameLabel.text = status.account.realDisplayName usernameLabel.text = "@\(status.account.acct)" + statusContentTextView.overrideMastodonController = mastodonController statusContentTextView.statusID = status.id ImageCache.avatars.get(status.account.avatar) { (data) in diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index b36076dc30..3cd7a4eddc 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -16,8 +16,9 @@ private let emojiRegex = try! NSRegularExpression(pattern: ":(\\w+):", options: class ContentTextView: LinkTextView { weak var navigationDelegate: TuskerNavigationDelegate? - var mastodonController: MastodonController? { navigationDelegate?.apiController } - + weak var overrideMastodonController: MastodonController? + var mastodonController: MastodonController? { overrideMastodonController ?? navigationDelegate?.apiController } + var defaultFont: UIFont = .systemFont(ofSize: 17) var defaultColor: UIColor = .label