Fix account name would be blank when DisplayName is empty. (#1169)

This commit is contained in:
Keita Watanabe 2023-03-05 15:24:59 +09:00 committed by GitHub
parent e3ab57ea1c
commit ef7c216d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -99,12 +99,16 @@ public struct AppAccountsSelectorView: View {
if let image = viewModel.roundedAvatar {
Image(uiImage: image)
}
let name = viewModel.account.flatMap { account in
account.displayName?.isEmpty != false ? "@\(account.acct)" : account.displayName
} ?? ""
if let token = viewModel.appAccount.oauthToken,
preferences.getNotificationsCount(for: token) > 0
{
Text("\(viewModel.account?.displayName ?? "") (\(preferences.getNotificationsCount(for: token)))")
Text("\(name) (\(preferences.getNotificationsCount(for: token)))")
} else {
Text("\(viewModel.account?.displayName ?? "")")
Text("\(name)")
}
}
}