mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 01:31:04 +00:00
Fix account name would be blank when DisplayName is empty. (#1169)
This commit is contained in:
parent
e3ab57ea1c
commit
ef7c216d3a
1 changed files with 6 additions and 2 deletions
|
@ -99,12 +99,16 @@ public struct AppAccountsSelectorView: View {
|
||||||
if let image = viewModel.roundedAvatar {
|
if let image = viewModel.roundedAvatar {
|
||||||
Image(uiImage: image)
|
Image(uiImage: image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let name = viewModel.account.flatMap { account in
|
||||||
|
account.displayName?.isEmpty != false ? "@\(account.acct)" : account.displayName
|
||||||
|
} ?? ""
|
||||||
if let token = viewModel.appAccount.oauthToken,
|
if let token = viewModel.appAccount.oauthToken,
|
||||||
preferences.getNotificationsCount(for: token) > 0
|
preferences.getNotificationsCount(for: token) > 0
|
||||||
{
|
{
|
||||||
Text("\(viewModel.account?.displayName ?? "") (\(preferences.getNotificationsCount(for: token)))")
|
Text("\(name) (\(preferences.getNotificationsCount(for: token)))")
|
||||||
} else {
|
} else {
|
||||||
Text("\(viewModel.account?.displayName ?? "")")
|
Text("\(name)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue