diff --git a/Tusker/Screens/Main/MainSidebarMyProfileCollectionViewCell.swift b/Tusker/Screens/Main/MainSidebarMyProfileCollectionViewCell.swift index 0de63d85..8e9d66b0 100644 --- a/Tusker/Screens/Main/MainSidebarMyProfileCollectionViewCell.swift +++ b/Tusker/Screens/Main/MainSidebarMyProfileCollectionViewCell.swift @@ -36,7 +36,7 @@ class MainSidebarMyProfileCollectionViewCell: UICollectionViewListCell { fatalError("init(coder:) has not been implemented") } - func updateUI(item: MainSidebarViewController.Item, account: UserAccountInfo) async { + func updateUI(item: MainSidebarViewController.Item, account: UserAccountInfo) { var config = defaultContentConfiguration() config.text = item.title config.image = UIImage(systemName: item.imageName!) @@ -50,6 +50,12 @@ class MainSidebarMyProfileCollectionViewCell: UICollectionViewListCell { ] } + Task { + await updateAvatar(account: account) + } + } + + private func updateAvatar(account: UserAccountInfo) async { let mastodonController = MastodonController.getForAccount(account) guard let account = try? await mastodonController.getOwnAccount(), let avatar = account.avatar else { diff --git a/Tusker/Screens/Main/MainSidebarViewController.swift b/Tusker/Screens/Main/MainSidebarViewController.swift index 95732706..615457ab 100644 --- a/Tusker/Screens/Main/MainSidebarViewController.swift +++ b/Tusker/Screens/Main/MainSidebarViewController.swift @@ -139,9 +139,7 @@ class MainSidebarViewController: UIViewController { } let myProfileCell = UICollectionView.CellRegistration { [unowned self] cell, indexPath, item in - Task { - await cell.updateUI(item: item, account: self.mastodonController.accountInfo!) - } + cell.updateUI(item: item, account: self.mastodonController.accountInfo!) } let outlineHeaderCell = UICollectionView.CellRegistration { (cell, indexPath, item) in