Files
yattee/Shared/Navigation/AccountViewButton.swift
Arkadiusz Fal be4e1adb9b Fix all SwiftLint violations across codebase
Resolves 130+ violations including deployment target checks, code style issues, and formatting inconsistencies. Adds SwiftLint disable comments for compiler-required availability checks while maintaining deployment target compliance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 18:14:35 +01:00

48 lines
1.4 KiB
Swift

import Defaults
import SwiftUI
struct AccountViewButton: View {
@ObservedObject private var model = AccountsModel.shared
private var navigation = NavigationModel.shared
@Default(.instances) private var instances
@Default(.accountPickerDisplaysUsername) private var accountPickerDisplaysUsername
@ViewBuilder var body: some View {
if !instances.isEmpty {
Button {
navigation.presentingAccounts = true
} label: {
HStack(spacing: 6) {
if !accountPickerDisplaysUsername || !(model.current?.isPublic ?? true) {
if let name = model.current?.app?.rawValue.capitalized {
Image(name)
.resizable()
.frame(width: accountImageSize, height: accountImageSize)
} else {
Image(systemName: "globe")
}
}
if accountPickerDisplaysUsername {
label
}
}
}
.transaction { t in t.animation = .none }
}
}
private var accountImageSize: Double {
#if os(macOS)
20
#else
30
#endif
}
private var label: some View {
Text(model.current?.description ?? "Select Account")
}
}