mirror of
https://github.com/yattee/yattee.git
synced 2025-04-27 15:30:33 +05:30
Add option to show/hide username in account picker button
This commit is contained in:
parent
f0d1b74e34
commit
9ede4b9b1f
@ -31,6 +31,9 @@ extension Defaults.Keys {
|
||||
.init(section: .searchQuery("Apple Pie Recipes", "", "", ""))
|
||||
])
|
||||
|
||||
#if !os(tvOS)
|
||||
static let accountPickerDisplaysUsername = Key<Bool>("accountPickerDisplaysUsername", default: false)
|
||||
#endif
|
||||
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: true)
|
||||
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
||||
|
||||
|
@ -6,21 +6,29 @@ struct AccountsMenuView: View {
|
||||
|
||||
@Default(.accounts) private var accounts
|
||||
@Default(.instances) private var instances
|
||||
@Default(.accountPickerDisplaysUsername) private var accountPickerDisplaysUsername
|
||||
|
||||
var body: some View {
|
||||
Menu {
|
||||
ForEach(allAccounts, id: \.id) { account in
|
||||
Button(accountButtonTitle(account: account)) {
|
||||
Button {
|
||||
model.setCurrent(account)
|
||||
} label: {
|
||||
HStack {
|
||||
Text(accountButtonTitle(account: account))
|
||||
|
||||
Spacer()
|
||||
|
||||
if model.current == account {
|
||||
Image(systemName: "checkmark")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
if #available(iOS 15.0, macOS 12.0, *) {
|
||||
label
|
||||
.labelStyle(.titleAndIcon)
|
||||
} else {
|
||||
HStack {
|
||||
Image(systemName: "person.crop.circle")
|
||||
HStack {
|
||||
Image(systemName: "person.crop.circle")
|
||||
if accountPickerDisplaysUsername {
|
||||
label
|
||||
.labelStyle(.titleOnly)
|
||||
}
|
||||
|
@ -2,6 +2,9 @@ import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct BrowsingSettings: View {
|
||||
#if !os(tvOS)
|
||||
@Default(.accountPickerDisplaysUsername) private var accountPickerDisplaysUsername
|
||||
#endif
|
||||
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
||||
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
||||
@Default(.visibleSections) private var visibleSections
|
||||
@ -9,6 +12,9 @@ struct BrowsingSettings: View {
|
||||
var body: some View {
|
||||
Group {
|
||||
Section(header: SettingsHeader(text: "Browsing")) {
|
||||
#if !os(tvOS)
|
||||
Toggle("Show username in the account picker button", isOn: $accountPickerDisplaysUsername)
|
||||
#endif
|
||||
Toggle("Show channel name on thumbnail", isOn: $channelOnThumbnail)
|
||||
Toggle("Show video length on thumbnail", isOn: $timeOnThumbnail)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user