mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 10:55:03 +00:00
Convert Download settings to macOS-native helpers
This commit is contained in:
@@ -12,7 +12,7 @@ struct DownloadSettingsView: View {
|
|||||||
@Environment(\.appEnvironment) private var appEnvironment
|
@Environment(\.appEnvironment) private var appEnvironment
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
SettingsFormContainer {
|
||||||
if let downloadSettings = appEnvironment?.downloadSettings,
|
if let downloadSettings = appEnvironment?.downloadSettings,
|
||||||
let downloadManager = appEnvironment?.downloadManager {
|
let downloadManager = appEnvironment?.downloadManager {
|
||||||
StorageSection(downloadManager: downloadManager)
|
StorageSection(downloadManager: downloadManager)
|
||||||
@@ -49,7 +49,8 @@ private struct StorageSection: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Section {
|
SettingsFormSection {
|
||||||
|
#if os(iOS)
|
||||||
NavigationLink {
|
NavigationLink {
|
||||||
DownloadsStorageView()
|
DownloadsStorageView()
|
||||||
} label: {
|
} label: {
|
||||||
@@ -60,6 +61,15 @@ private struct StorageSection: View {
|
|||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
SettingsNavigationRow(
|
||||||
|
"settings.downloads.usedStorage",
|
||||||
|
systemImage: "internaldrive",
|
||||||
|
trailing: { Text(formatBytes(storageUsed)) }
|
||||||
|
) {
|
||||||
|
DownloadsStorageView()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +80,7 @@ private struct QualitySection: View {
|
|||||||
@Bindable var downloadSettings: DownloadSettings
|
@Bindable var downloadSettings: DownloadSettings
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Section {
|
SettingsFormSection("settings.downloads.quality.header") {
|
||||||
Picker(
|
Picker(
|
||||||
String(localized: "settings.downloads.preferredQuality"),
|
String(localized: "settings.downloads.preferredQuality"),
|
||||||
selection: $downloadSettings.preferredDownloadQuality
|
selection: $downloadSettings.preferredDownloadQuality
|
||||||
@@ -86,8 +96,6 @@ private struct QualitySection: View {
|
|||||||
isOn: $downloadSettings.includeSubtitlesInAutoDownload
|
isOn: $downloadSettings.includeSubtitlesInAutoDownload
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} header: {
|
|
||||||
Text(String(localized: "settings.downloads.quality.header"))
|
|
||||||
} footer: {
|
} footer: {
|
||||||
if downloadSettings.preferredDownloadQuality == .ask {
|
if downloadSettings.preferredDownloadQuality == .ask {
|
||||||
Text(String(localized: "settings.downloads.quality.ask.footer"))
|
Text(String(localized: "settings.downloads.quality.ask.footer"))
|
||||||
@@ -104,7 +112,7 @@ private struct ConcurrencySection: View {
|
|||||||
@Bindable var downloadSettings: DownloadSettings
|
@Bindable var downloadSettings: DownloadSettings
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Section {
|
SettingsFormSection {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
Stepper(value: $downloadSettings.maxConcurrentDownloads, in: 1...5) {
|
Stepper(value: $downloadSettings.maxConcurrentDownloads, in: 1...5) {
|
||||||
HStack {
|
HStack {
|
||||||
@@ -133,7 +141,7 @@ private struct CellularSection: View {
|
|||||||
let downloadManager: DownloadManager?
|
let downloadManager: DownloadManager?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Section {
|
SettingsFormSection(footer: "settings.downloads.allowCellular.footer") {
|
||||||
Toggle(
|
Toggle(
|
||||||
String(localized: "settings.downloads.allowCellular"),
|
String(localized: "settings.downloads.allowCellular"),
|
||||||
isOn: $downloadSettings.allowCellularDownloads
|
isOn: $downloadSettings.allowCellularDownloads
|
||||||
@@ -141,8 +149,6 @@ private struct CellularSection: View {
|
|||||||
.onChange(of: downloadSettings.allowCellularDownloads) {
|
.onChange(of: downloadSettings.allowCellularDownloads) {
|
||||||
downloadManager?.refreshCellularAccessSetting()
|
downloadManager?.refreshCellularAccessSetting()
|
||||||
}
|
}
|
||||||
} footer: {
|
|
||||||
Text(String(localized: "settings.downloads.allowCellular.footer"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user