Minor tvOS fixes

This commit is contained in:
Arkadiusz Fal
2021-10-22 17:00:09 +02:00
parent 0e54cbcad0
commit bc065e282a
6 changed files with 25 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ struct AccountSelectionView: View {
var body: some View {
Section(header: Text(showHeader ? "Current Account" : "")) {
Button(accountButtonTitle(account: accountsModel.current)) {
Button(accountButtonTitle(account: accountsModel.current, long: true)) {
if let account = nextAccount {
accountsModel.setCurrent(account)
}
@@ -40,11 +40,13 @@ struct AccountSelectionView: View {
allAccounts.next(after: accountsModel.current)
}
func accountButtonTitle(account: Account! = nil) -> String {
func accountButtonTitle(account: Account! = nil, long: Bool = false) -> String {
guard account != nil else {
return "Not selected"
}
return instances.count > 1 ? "\(account.description)\(account.instance.shortDescription)" : account.description
let instanceDescription = long ? account.instance.longDescription : account.instance.description
return instances.count > 1 ? "\(account.description)\(instanceDescription)" : account.description
}
}