Fix delay before My Profile sidebar item appears on launch
This commit is contained in:
parent
6a2de2be55
commit
46e1205327
|
@ -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 {
|
||||
|
|
|
@ -139,9 +139,7 @@ class MainSidebarViewController: UIViewController {
|
|||
}
|
||||
|
||||
let myProfileCell = UICollectionView.CellRegistration<MainSidebarMyProfileCollectionViewCell, Item> { [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<UICollectionViewListCell, Item> { (cell, indexPath, item) in
|
||||
|
|
Loading…
Reference in New Issue