mirror of
https://github.com/yattee/yattee.git
synced 2025-04-27 23:40:35 +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", "", "", ""))
|
.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 channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: true)
|
||||||
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
||||||
|
|
||||||
|
@ -6,21 +6,29 @@ struct AccountsMenuView: View {
|
|||||||
|
|
||||||
@Default(.accounts) private var accounts
|
@Default(.accounts) private var accounts
|
||||||
@Default(.instances) private var instances
|
@Default(.instances) private var instances
|
||||||
|
@Default(.accountPickerDisplaysUsername) private var accountPickerDisplaysUsername
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Menu {
|
Menu {
|
||||||
ForEach(allAccounts, id: \.id) { account in
|
ForEach(allAccounts, id: \.id) { account in
|
||||||
Button(accountButtonTitle(account: account)) {
|
Button {
|
||||||
model.setCurrent(account)
|
model.setCurrent(account)
|
||||||
|
} label: {
|
||||||
|
HStack {
|
||||||
|
Text(accountButtonTitle(account: account))
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
if model.current == account {
|
||||||
|
Image(systemName: "checkmark")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
if #available(iOS 15.0, macOS 12.0, *) {
|
HStack {
|
||||||
label
|
Image(systemName: "person.crop.circle")
|
||||||
.labelStyle(.titleAndIcon)
|
if accountPickerDisplaysUsername {
|
||||||
} else {
|
|
||||||
HStack {
|
|
||||||
Image(systemName: "person.crop.circle")
|
|
||||||
label
|
label
|
||||||
.labelStyle(.titleOnly)
|
.labelStyle(.titleOnly)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ import Defaults
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct BrowsingSettings: View {
|
struct BrowsingSettings: View {
|
||||||
|
#if !os(tvOS)
|
||||||
|
@Default(.accountPickerDisplaysUsername) private var accountPickerDisplaysUsername
|
||||||
|
#endif
|
||||||
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
||||||
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
||||||
@Default(.visibleSections) private var visibleSections
|
@Default(.visibleSections) private var visibleSections
|
||||||
@ -9,6 +12,9 @@ struct BrowsingSettings: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
Section(header: SettingsHeader(text: "Browsing")) {
|
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 channel name on thumbnail", isOn: $channelOnThumbnail)
|
||||||
Toggle("Show video length on thumbnail", isOn: $timeOnThumbnail)
|
Toggle("Show video length on thumbnail", isOn: $timeOnThumbnail)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user