summaryrefslogtreecommitdiff
path: root/Sora/Views/Settings/Section/SettingsSectionProviderView.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-24 07:52:49 +0000
committerFuwn <[email protected]>2026-03-24 07:52:49 +0000
commitcfaca120dd330653b8746e03ba701def4e3f5216 (patch)
tree4caba0da97cfbd62de57b1f8fb461283694e7c6d /Sora/Views/Settings/Section/SettingsSectionProviderView.swift
parenttest: fix verify with Nimble and simulator boot (diff)
downloadsora-testing-cfaca120dd330653b8746e03ba701def4e3f5216.tar.xz
sora-testing-cfaca120dd330653b8746e03ba701def4e3f5216.zip
Refine settings language and structure
Diffstat (limited to 'Sora/Views/Settings/Section/SettingsSectionProviderView.swift')
-rw-r--r--Sora/Views/Settings/Section/SettingsSectionProviderView.swift72
1 files changed, 41 insertions, 31 deletions
diff --git a/Sora/Views/Settings/Section/SettingsSectionProviderView.swift b/Sora/Views/Settings/Section/SettingsSectionProviderView.swift
index 031840a..b9a7900 100644
--- a/Sora/Views/Settings/Section/SettingsSectionProviderView.swift
+++ b/Sora/Views/Settings/Section/SettingsSectionProviderView.swift
@@ -9,8 +9,8 @@ struct SettingsSectionProviderView: View {
var body: some View {
Form {
- Section(header: Text("Provider Selection")) {
- Picker("Provider", selection: $settings.preferredBooru) {
+ Section("Source") {
+ Picker("Website", selection: $settings.preferredBooru) {
ForEach(BooruProvider.allCases, id: \.self) { type in
Text(type.rawValue).tag(type)
}
@@ -22,24 +22,13 @@ struct SettingsSectionProviderView: View {
}
}
- Section(header: Text("Moebooru Feed")) {
- Toggle("Show Held Posts", isOn: $settings.showHeldMoebooruPosts)
- }
-
- Section(header: Text("User-Agent")) {
- Toggle("Send User-Agent", isOn: $settings.sendBooruUserAgent)
-
- if settings.sendBooruUserAgent {
- TextField("Custom User-Agent", text: $settings.customBooruUserAgent)
- .autocorrectionDisabled(true)
-
- Text("Leave this field empty to use Sora's default User-Agent.")
- .font(.caption)
- .foregroundStyle(.secondary)
+ if BooruProviderFlavor(provider: settings.preferredBooru) == .moebooru {
+ Section("Hidden Posts") {
+ Toggle("Show Hidden Posts", isOn: $settings.showHeldMoebooruPosts)
}
}
- Section(header: Text("API Credentials")) {
+ Section {
SecureField(
"API Key",
text: Binding(
@@ -78,23 +67,40 @@ struct SettingsSectionProviderView: View {
#if os(iOS)
.keyboardType(isDanbooruProvider ? .default : .numberPad)
#endif
+ } header: {
+ Text("Account")
+ } footer: {
+ Text("Add credentials only if your selected source supports them.")
+ }
+
+ Section {
+ Toggle("Send User Agent", isOn: $settings.sendBooruUserAgent)
+
+ if settings.sendBooruUserAgent {
+ TextField("Custom User Agent", text: $settings.customBooruUserAgent)
+ .autocorrectionDisabled(true)
+ }
+ } header: {
+ Text("Advanced")
+ } footer: {
+ Text("Only change these options if a source requires them.")
}
- Section(header: Text("Custom Providers")) {
- Button("Add Custom Provider") {
+ Section {
+ Button("Add Source") {
showingCustomBooruSheet = true
}
.trailingFrame()
if case .custom(let provider) = settings.preferredBooru {
- Button("Remove Custom Provider") {
+ Button("Remove Current Source") {
settings.customProviders.removeAll { $0.id == provider.id }
settings.preferredBooru = .safebooru
}
.disabled(!settings.customProviders.contains { $0.id == provider.id })
}
- Button("Remove All Custom Providers") {
+ Button("Remove All Custom Sources") {
if case .custom = settings.preferredBooru {
settings.preferredBooru = .safebooru
}
@@ -104,23 +110,27 @@ struct SettingsSectionProviderView: View {
}
}
.trailingFrame()
+ } header: {
+ Text("Custom Sources")
+ } footer: {
+ Text("Use custom sources when you want Sora to browse a compatible site.")
}
}
#if os(macOS)
.formStyle(.grouped)
#endif
- .navigationTitle("Provider")
+ .navigationTitle("Source")
#if !os(macOS)
.navigationBarTitleDisplayMode(.large)
#endif
.sheet(isPresented: $showingCustomBooruSheet) {
NavigationStack {
Form {
- Section(header: Text("Provider Details")) {
- TextField("Domain", text: $newDomain)
+ Section("Source Details") {
+ TextField("Website", text: $newDomain)
.autocorrectionDisabled(true)
- Picker("Provider Type", selection: $newFlavor) {
+ Picker("Type", selection: $newFlavor) {
ForEach(BooruProviderFlavor.allCases, id: \.self) { flavor in
Text(flavor.rawValue).tag(flavor)
}
@@ -130,7 +140,7 @@ struct SettingsSectionProviderView: View {
#if os(macOS)
.formStyle(.grouped)
#endif
- .navigationTitle("Add Custom Provider")
+ .navigationTitle("Add Source")
#if !os(macOS)
.navigationBarTitleDisplayMode(.inline)
#endif
@@ -155,7 +165,7 @@ struct SettingsSectionProviderView: View {
}
}
.alert(
- "Invalid Domain",
+ "Invalid Website",
isPresented: Binding(
get: { domainError != nil },
set: { if !$0 { domainError = nil } }
@@ -196,19 +206,19 @@ struct SettingsSectionProviderView: View {
"^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\\.[a-z]{2,}$"
guard NSPredicate(format: "SELF MATCHES %@", domainRegex).evaluate(with: domain) else {
- domainError = "Please enter a valid domain name, such as yande.re."
+ domainError = "Enter a valid website, such as yande.re."
return false
}
guard !domain.contains("://"), !domain.contains("/"), !domain.contains("?") else {
- domainError = "Only enter the domain name—leave out 'http://' or extra details."
+ domainError = "Enter only the website name, without 'http://' or extra details."
return false
}
guard domain.count <= 253 else { // RFC 1035
- domainError = "This domain name is too long. It must be 253 characters or fewer."
+ domainError = "This website name is too long. It must be 253 characters or fewer."
return false
}
@@ -216,7 +226,7 @@ struct SettingsSectionProviderView: View {
let labels = domain.split(separator: ".")
guard labels.allSatisfy({ $0.count <= 63 }) else {
- domainError = "Each section of the domain name must be 63 characters or fewer."
+ domainError = "Each section of the website name must be 63 characters or fewer."
return false
}