diff options
| author | Fuwn <[email protected]> | 2025-02-20 02:40:26 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-20 02:40:26 -0800 |
| commit | 0538ecfabde1883b71971cf0ce62a4d14ff072cd (patch) | |
| tree | 029f6d9cb58da3ce338e862f4d43104e36cacb54 | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-0538ecfabde1883b71971cf0ce62a4d14ff072cd.tar.xz sora-testing-0538ecfabde1883b71971cf0ce62a4d14ff072cd.zip | |
feat: Development commit
| -rw-r--r-- | Sora/Data/Settings.swift | 2 | ||||
| -rw-r--r-- | Sora/SoraApp.swift | 3 | ||||
| -rw-r--r-- | Sora/Views/Post/PostGridView.swift | 3 | ||||
| -rw-r--r-- | Sora/Views/Post/PostView.swift | 1 | ||||
| -rw-r--r-- | Sora/Views/Settings/SettingsAttributionsView.swift | 1 | ||||
| -rw-r--r-- | Sora/Views/Settings/SettingsDetailsView.swift | 26 | ||||
| -rw-r--r-- | Sora/Views/Settings/SettingsSearchView.swift | 15 | ||||
| -rw-r--r-- | Sora/Views/Settings/SettingsThumbnailsView.swift | 63 | ||||
| -rw-r--r-- | Sora/Views/SettingsView.swift | 30 | ||||
| -rw-r--r-- | Sora/Views/SettingsViewMacOS.swift | 32 |
10 files changed, 31 insertions, 145 deletions
diff --git a/Sora/Data/Settings.swift b/Sora/Data/Settings.swift index 4d5a030..43b2a56 100644 --- a/Sora/Data/Settings.swift +++ b/Sora/Data/Settings.swift @@ -9,6 +9,6 @@ class Settings: ObservableObject { @AppStorage("thumbnailType") var thumbnailType: PostFileType = .preview @AppStorage("searchSuggestions") var searchSuggestions: Bool = false @AppStorage("columns") var columns: Int = 2 - @AppStorage("blurNSFWThumbnails") var blurNSFWThumbnails: Bool = false + @AppStorage("blurNSFWThumbnails") var blurNSFWThumbnails: Bool = true @AppStorage("showNSFWPosts") var showNSFWPosts: Bool = false } diff --git a/Sora/SoraApp.swift b/Sora/SoraApp.swift index ad1f8cf..a080c4c 100644 --- a/Sora/SoraApp.swift +++ b/Sora/SoraApp.swift @@ -12,10 +12,9 @@ struct SoraApp: App { #if os(macOS) SwiftUI.Settings { - SettingsViewMacOS() + SettingsView() .environmentObject(settings) } - .defaultSize(width: 400, height: 400) #endif } } diff --git a/Sora/Views/Post/PostGridView.swift b/Sora/Views/Post/PostGridView.swift index 0a1c37b..40d8132 100644 --- a/Sora/Views/Post/PostGridView.swift +++ b/Sora/Views/Post/PostGridView.swift @@ -78,9 +78,6 @@ struct PostGridView: View { .refreshable { await manager.fetchPosts(page: 1, tags: manager.tags, replace: true) } - #if os(iOS) - .navigationBarTitleDisplayMode(.inline) - #endif } } } diff --git a/Sora/Views/Post/PostView.swift b/Sora/Views/Post/PostView.swift index 111d77e..9c25552 100644 --- a/Sora/Views/Post/PostView.swift +++ b/Sora/Views/Post/PostView.swift @@ -32,6 +32,7 @@ struct PostView: View { } } .blur(radius: settings.blurNSFWThumbnails ? post.rating != "s" ? 10 : 0 : 0) + .animation(.default, value: settings.blurNSFWThumbnails) } placeholder: { ProgressView() .padding() diff --git a/Sora/Views/Settings/SettingsAttributionsView.swift b/Sora/Views/Settings/SettingsAttributionsView.swift index 1194880..28481fd 100644 --- a/Sora/Views/Settings/SettingsAttributionsView.swift +++ b/Sora/Views/Settings/SettingsAttributionsView.swift @@ -3,7 +3,6 @@ import SwiftUI struct SettingsAttributionsView: View { var body: some View { Text("Rabbit SVG created by Kim Sun Young") - .font(.caption) .fontWeight(.light) .foregroundColor(.secondary) } diff --git a/Sora/Views/Settings/SettingsDetailsView.swift b/Sora/Views/Settings/SettingsDetailsView.swift index 29b9e76..4ac784c 100644 --- a/Sora/Views/Settings/SettingsDetailsView.swift +++ b/Sora/Views/Settings/SettingsDetailsView.swift @@ -4,28 +4,10 @@ struct SettingsDetailsView: View { @EnvironmentObject var settings: Settings var body: some View { - #if os(macOS) - Text("Details") - .font(.headline) - - HStack { - Text("Detail View Type") - - Spacer() - - Picker("", selection: $settings.detailViewType) { - ForEach(PostFileType.allCases, id: \.self) { type in - Text(type.rawValue.capitalized).tag(type) - } - } - .frame(width: 150) - } - #else - Picker("Detail View Type", selection: $settings.detailViewType) { - ForEach(PostFileType.allCases, id: \.self) { type in - Text(type.rawValue.capitalized).tag(type) - } + Picker("Detail View Type", selection: $settings.detailViewType) { + ForEach(PostFileType.allCases, id: \.self) { type in + Text(type.rawValue.capitalized).tag(type) } - #endif + } } } diff --git a/Sora/Views/Settings/SettingsSearchView.swift b/Sora/Views/Settings/SettingsSearchView.swift index c1f1baa..1052abf 100644 --- a/Sora/Views/Settings/SettingsSearchView.swift +++ b/Sora/Views/Settings/SettingsSearchView.swift @@ -4,19 +4,6 @@ struct SettingsSearchView: View { @EnvironmentObject var settings: Settings var body: some View { - #if os(macOS) - Text("Search") - .font(.headline) - - HStack { - Text("Suggest Search Tags") - - Spacer() - - Toggle("", isOn: $settings.searchSuggestions) - } - #else - Toggle("Suggest Search Tags", isOn: $settings.searchSuggestions) - #endif + Toggle("Suggest Search Tags", isOn: $settings.searchSuggestions) } } diff --git a/Sora/Views/Settings/SettingsThumbnailsView.swift b/Sora/Views/Settings/SettingsThumbnailsView.swift index 39ba951..1f70da6 100644 --- a/Sora/Views/Settings/SettingsThumbnailsView.swift +++ b/Sora/Views/Settings/SettingsThumbnailsView.swift @@ -4,73 +4,28 @@ struct SettingsThumbnailsView: View { @EnvironmentObject var settings: Settings var body: some View { - #if os(macOS) - Text("Thumbnails") - .font(.headline) - - HStack { - Text("Thumbnail Type") - - Spacer() - - Picker("", selection: $settings.thumbnailType) { - ForEach(PostFileType.allCases, id: \.self) { type in - Text(type.rawValue.capitalized).tag(type) - } - } - .frame(width: 150) + Picker("Thumbnail Type", selection: $settings.thumbnailType) { + ForEach(PostFileType.allCases, id: \.self) { type in + Text(type.rawValue.capitalized).tag(type) } - #else - Picker("Thumbnail Type", selection: $settings.thumbnailType) { - ForEach(PostFileType.allCases, id: \.self) { type in - Text(type.rawValue.capitalized).tag(type) - } - } - #endif + } #if os(macOS) - HStack { - Text("Thumbnail Columns") - - Spacer() - - Picker("", selection: $settings.columns) { - ForEach(1 ... 10, id: \.self) { i in Text("\(i)") } - } - .frame(width: 75) + Picker("Thumbnail Columns", selection: $settings.columns) { + ForEach(1 ... 10, id: \.self) { i in Text("\(i)") } } #else Stepper( - "Thumbnail Columns (\(settings.columns))", + "Thumbnail Columns: \(settings.columns)", value: $settings.columns, in: 1 ... 10 ) #endif - #if os(macOS) - HStack { - Text("Show NSFW Posts") - - Spacer() - - Toggle("", isOn: $settings.showNSFWPosts) - } - #else - Toggle("Show NSFW Posts", isOn: $settings.showNSFWPosts) - #endif + Toggle("Show NSFW Posts", isOn: $settings.showNSFWPosts) if settings.showNSFWPosts { - #if os(macOS) - HStack { - Text("Blur NSFW Thumbnails") - - Spacer() - - Toggle("", isOn: $settings.blurNSFWThumbnails) - } - #else - Toggle("Blur NSFW Thumbnails", isOn: $settings.blurNSFWThumbnails) - #endif + Toggle("Blur NSFW Thumbnails", isOn: $settings.blurNSFWThumbnails) } } } diff --git a/Sora/Views/SettingsView.swift b/Sora/Views/SettingsView.swift index 59685a5..668d31f 100644 --- a/Sora/Views/SettingsView.swift +++ b/Sora/Views/SettingsView.swift @@ -2,29 +2,27 @@ import SwiftUI struct SettingsView: View { var body: some View { - NavigationStack { - Form { - Section(header: Text("Thumbnails")) { - SettingsThumbnailsView() - } + Form { + Section(header: Text("Thumbnails")) { + SettingsThumbnailsView() + } - Section(header: Text("Details")) { - SettingsDetailsView() - } + Section(header: Text("Details")) { + SettingsDetailsView() + } - Section(header: Text("Search")) { - SettingsSearchView() - } + Section(header: Text("Search")) { + SettingsSearchView() + } - Section(header: Text("Attributions")) { - SettingsAttributionsView() - } + Section(header: Text("Attributions")) { + SettingsAttributionsView() } } - .navigationTitle("Settings") #if os(macOS) - .padding() + .formStyle(.grouped) #endif + .navigationTitle("Settings") } } diff --git a/Sora/Views/SettingsViewMacOS.swift b/Sora/Views/SettingsViewMacOS.swift deleted file mode 100644 index 57d640c..0000000 --- a/Sora/Views/SettingsViewMacOS.swift +++ /dev/null @@ -1,32 +0,0 @@ -import SwiftUI - -struct SettingsViewMacOS: View { - var body: some View { - NavigationStack { - VStack(alignment: .leading) { - SettingsThumbnailsView() - - Spacer() - .frame(height: 25) - - SettingsDetailsView() - - Spacer() - .frame(height: 25) - - SettingsSearchView() - - Spacer() - .frame(height: 25) - - SettingsAttributionsView() - } - .padding() - } - } -} - -#Preview { - SettingsViewMacOS() - .environmentObject(Settings()) -} |