mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Don't use user but account on Sidebar on iPad (IOS-192)
This commit is contained in:
parent
a2c03bd6d1
commit
c152c7b3c7
@ -70,17 +70,18 @@ extension SidebarViewModel {
|
|||||||
secondaryCollectionView: UICollectionView
|
secondaryCollectionView: UICollectionView
|
||||||
) {
|
) {
|
||||||
let tabCellRegistration = UICollectionView.CellRegistration<SidebarListCollectionViewCell, MainTabBarController.Tab> { [weak self] cell, indexPath, item in
|
let tabCellRegistration = UICollectionView.CellRegistration<SidebarListCollectionViewCell, MainTabBarController.Tab> { [weak self] cell, indexPath, item in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
let imageURL: URL? = {
|
let imageURL: URL?
|
||||||
switch item {
|
switch item {
|
||||||
case .me:
|
case .me:
|
||||||
let user = self.authContext?.mastodonAuthenticationBox.authentication.user(in: self.context.managedObjectContext)
|
let account = self.authContext?.mastodonAuthenticationBox.authentication.account()
|
||||||
return user?.avatarImageURL()
|
imageURL = account?.avatarImageURL()
|
||||||
default:
|
case .home, .search, .compose, .notifications:
|
||||||
return nil
|
// no custom avatar for other tabs
|
||||||
|
imageURL = nil
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
cell.item = SidebarListContentView.Item(
|
cell.item = SidebarListContentView.Item(
|
||||||
isActive: false,
|
isActive: false,
|
||||||
accessoryImage: item == .me ? self.chevronImage : nil,
|
accessoryImage: item == .me ? self.chevronImage : nil,
|
||||||
@ -132,10 +133,11 @@ extension SidebarViewModel {
|
|||||||
}
|
}
|
||||||
.store(in: &cell.disposeBag)
|
.store(in: &cell.disposeBag)
|
||||||
case .me:
|
case .me:
|
||||||
guard let user = self.authContext?.mastodonAuthenticationBox.authentication.user(in: self.context.managedObjectContext) else { return }
|
guard let account = self.authContext?.mastodonAuthenticationBox.authentication.account() else { return }
|
||||||
let currentUserDisplayName = user.displayNameWithFallback
|
|
||||||
|
let currentUserDisplayName = account.displayNameWithFallback
|
||||||
cell.accessibilityHint = L10n.Scene.AccountList.tabBarHint(currentUserDisplayName)
|
cell.accessibilityHint = L10n.Scene.AccountList.tabBarHint(currentUserDisplayName)
|
||||||
default:
|
case .compose, .home, .search:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user