Fix stautses on My Profile not appearing until scroll
This commit is contained in:
parent
5d9f4b8ea8
commit
80b3585b71
|
@ -38,6 +38,8 @@ class ProfileViewController: UIPageViewController {
|
|||
|
||||
private var headerView: ProfileHeaderView!
|
||||
|
||||
private var hasAppeared = false
|
||||
|
||||
init(accountID: String?, mastodonController: MastodonController) {
|
||||
self.accountID = accountID
|
||||
self.mastodonController = mastodonController
|
||||
|
@ -95,6 +97,12 @@ class ProfileViewController: UIPageViewController {
|
|||
loadAccount()
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
hasAppeared = true
|
||||
}
|
||||
|
||||
private func loadAccount() {
|
||||
guard let accountID = accountID else { return }
|
||||
if mastodonController.persistentContainer.account(for: accountID) != nil {
|
||||
|
@ -122,8 +130,14 @@ class ProfileViewController: UIPageViewController {
|
|||
// Optionally invoke updateUI on headerView because viewDidLoad may not have been called yet
|
||||
headerView?.updateUI(for: accountID)
|
||||
navigationItem.title = account.displayNameWithoutCustomEmoji
|
||||
pageControllers.forEach {
|
||||
$0.updateUI(account: account)
|
||||
|
||||
// Only call updateUI on the individual page controllers if the account is loaded after the profile VC has appeared on screen.
|
||||
// Otherwise, fi the page view controllers do something with the table view before they appear, the table view doesn't load
|
||||
// its cells until the user begins to scroll.
|
||||
if hasAppeared {
|
||||
pageControllers.forEach {
|
||||
$0.updateUI(account: account)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue