diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index c110a7842..bf5fb09fb 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -864,6 +864,7 @@ DFD406F7291FB1A600C02962 /* SafariView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406F6291FB1A600C02962 /* SafariView.swift */; }; DFD406FA291FB5E400C02962 /* SettingsRows.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406F9291FB5E400C02962 /* SettingsRows.swift */; }; DFD406FC291FB63B00C02962 /* SettingsHelpSheets.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406FB291FB63B00C02962 /* SettingsHelpSheets.swift */; }; + DFD406FF291FDC0C00C02962 /* AppearanceManagementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406FE291FDC0C00C02962 /* AppearanceManagementView.swift */; }; DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; DFFC199827A0D0D7004B7AEF /* NotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFFC199727A0D0D7004B7AEF /* NotificationsViewController.swift */; }; DFFC199A27A0D32A004B7AEF /* NotificationsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFFC199927A0D32A004B7AEF /* NotificationsTableViewCell.swift */; }; @@ -1609,6 +1610,7 @@ DFD406F6291FB1A600C02962 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = ""; }; DFD406F9291FB5E400C02962 /* SettingsRows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsRows.swift; sourceTree = ""; }; DFD406FB291FB63B00C02962 /* SettingsHelpSheets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsHelpSheets.swift; sourceTree = ""; }; + DFD406FE291FDC0C00C02962 /* AppearanceManagementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceManagementView.swift; sourceTree = ""; }; DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = ""; }; DFFC199727A0D0D7004B7AEF /* NotificationsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsViewController.swift; sourceTree = ""; }; DFFC199927A0D32A004B7AEF /* NotificationsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsTableViewCell.swift; sourceTree = ""; }; @@ -2009,6 +2011,7 @@ 519ED47924482AEB007F8E94 /* EnableExtensionPointViewController.swift */, 51A16990235E10D600EB091F /* Settings.storyboard */, DFD406F8291FB5D500C02962 /* Settings View */, + DFD406FD291FDBD900C02962 /* Appearance View */, 516A09382360A2AE00EAE89B /* SettingsComboTableViewCell.swift */, 516A091D23609A3600EAE89B /* SettingsComboTableViewCell.xib */, 516A093A2360A4A000EAE89B /* SettingsTableViewCell.xib */, @@ -2902,6 +2905,14 @@ path = "Settings View"; sourceTree = ""; }; + DFD406FD291FDBD900C02962 /* Appearance View */ = { + isa = PBXGroup; + children = ( + DFD406FE291FDC0C00C02962 /* AppearanceManagementView.swift */, + ); + path = "Appearance View"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -4058,6 +4069,7 @@ B2B80778239C4C7000F191E0 /* RSImage-AppIcons.swift in Sources */, 518ED21D23D0F26000E0A862 /* UIViewController-Extensions.swift in Sources */, DFFC199827A0D0D7004B7AEF /* NotificationsViewController.swift in Sources */, + DFD406FF291FDC0C00C02962 /* AppearanceManagementView.swift in Sources */, 51A9A5F52380F6A60033AADF /* ModalNavigationController.swift in Sources */, 51EAED96231363EF00A9EEE3 /* NonIntrinsicButton.swift in Sources */, 51C4527B2265091600C03939 /* MasterUnreadIndicatorView.swift in Sources */, diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/Contents.json b/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/Contents.json new file mode 100644 index 000000000..11a2b61ec --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "app.appearance.automatic.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "app.appearance.automatic 1.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/app.appearance.automatic 1.png b/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/app.appearance.automatic 1.png new file mode 100644 index 000000000..67bc3e466 Binary files /dev/null and b/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/app.appearance.automatic 1.png differ diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/app.appearance.automatic.png b/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/app.appearance.automatic.png new file mode 100644 index 000000000..67bc3e466 Binary files /dev/null and b/iOS/Resources/Assets.xcassets/Settings/app.appearance.automatic.imageset/app.appearance.automatic.png differ diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/Contents.json b/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/Contents.json new file mode 100644 index 000000000..ed84c97cb --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "app.appearance.dark.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "app.appearance.dark 1.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/app.appearance.dark 1.png b/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/app.appearance.dark 1.png new file mode 100644 index 000000000..b3da0a6e7 Binary files /dev/null and b/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/app.appearance.dark 1.png differ diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/app.appearance.dark.png b/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/app.appearance.dark.png new file mode 100644 index 000000000..b3da0a6e7 Binary files /dev/null and b/iOS/Resources/Assets.xcassets/Settings/app.appearance.dark.imageset/app.appearance.dark.png differ diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/Contents.json b/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/Contents.json new file mode 100644 index 000000000..3050a7534 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "app.appearance.light.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "app.appearance.light 1.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/app.appearance.light 1.png b/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/app.appearance.light 1.png new file mode 100644 index 000000000..d777687ff Binary files /dev/null and b/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/app.appearance.light 1.png differ diff --git a/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/app.appearance.light.png b/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/app.appearance.light.png new file mode 100644 index 000000000..d777687ff Binary files /dev/null and b/iOS/Resources/Assets.xcassets/Settings/app.appearance.light.imageset/app.appearance.light.png differ diff --git a/iOS/Settings/Appearance View/AppearanceManagementView.swift b/iOS/Settings/Appearance View/AppearanceManagementView.swift new file mode 100644 index 000000000..7834d436d --- /dev/null +++ b/iOS/Settings/Appearance View/AppearanceManagementView.swift @@ -0,0 +1,108 @@ +// +// AppearanceManagementView.swift +// NetNewsWire-iOS +// +// Created by Stuart Breckenridge on 12/11/2022. +// Copyright © 2022 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct AppearanceManagementView: View { + + @StateObject private var appDefaults = AppDefaults.shared + + var body: some View { + List { + Section("Application Appearance") { + HStack { + appLightButton() + Spacer() + appDarkButton() + Spacer() + appAutomaticButton() + } + .listRowBackground(Color.clear) + } + + Section("Timeline Appearance") { + SettingsViewRows.SortOldestToNewest($appDefaults.timelineSortDirectionBool) + SettingsViewRows.GroupByFeed($appDefaults.timelineGroupByFeed) + SettingsViewRows.RefreshToClearReadArticles($appDefaults.refreshClearsReadArticles) + } + + Section("Article Appearance") { + SettingsViewRows.ThemeSelection + SettingsViewRows.ConfirmMarkAllAsRead($appDefaults.confirmMarkAllAsRead) + SettingsViewRows.OpenLinksInNetNewsWire($appDefaults.useSystemBrowser) + SettingsViewRows.EnableFullScreenArticles($appDefaults.articleFullscreenEnabled) + } + } + .navigationTitle(Text("Appearance")) + .tint(Color(uiColor: AppAssets.primaryAccentColor)) + } + + func appLightButton() -> some View { + VStack(spacing: 4) { + Image("app.appearance.light") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 40.0, height: 40.0) + Text("Always Light") + .font(.subheadline) + if AppDefaults.userInterfaceColorPalette == .light { + Image(systemName: "checkmark.circle.fill") + .foregroundColor(Color(uiColor: AppAssets.primaryAccentColor)) + } else { + Image(systemName: "circle") + } + }.onTapGesture { + AppDefaults.userInterfaceColorPalette = .light + } + } + + func appDarkButton() -> some View { + VStack(spacing: 4) { + Image("app.appearance.dark") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 40.0, height: 40.0) + Text("Always Dark") + .font(.subheadline) + if AppDefaults.userInterfaceColorPalette == .dark { + Image(systemName: "checkmark.circle.fill") + .foregroundColor(Color(uiColor: AppAssets.primaryAccentColor)) + } else { + Image(systemName: "circle") + } + }.onTapGesture { + AppDefaults.userInterfaceColorPalette = .dark + } + } + + func appAutomaticButton() -> some View { + VStack(spacing: 4) { + Image("app.appearance.automatic") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 40.0, height: 40.0) + Text("Use System") + .font(.subheadline) + if AppDefaults.userInterfaceColorPalette == .automatic { + Image(systemName: "checkmark.circle.fill") + .foregroundColor(Color(uiColor: AppAssets.primaryAccentColor)) + } else { + Image(systemName: "circle") + } + }.onTapGesture { + AppDefaults.userInterfaceColorPalette = .automatic + } + } + +} + +struct AppearanceManagementView_Previews: PreviewProvider { + static var previews: some View { + AppearanceManagementView() + } +} diff --git a/iOS/Settings/Settings View/SettingsRows.swift b/iOS/Settings/Settings View/SettingsRows.swift index 48ccb344a..f795f7937 100644 --- a/iOS/Settings/Settings View/SettingsRows.swift +++ b/iOS/Settings/Settings View/SettingsRows.swift @@ -179,13 +179,12 @@ struct SettingsViewRows { static var ThemeSelection: some View { NavigationLink(destination: ArticleThemesViewControllerRepresentable().edgesIgnoringSafeArea(.all)) { - Label { - Text("Article Themes") - } icon: { - Image(systemName: "textformat") - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 25.0, height: 25.0) + HStack { + Text("Article Theme") + Spacer() + Text(ArticleThemesManager.shared.currentTheme.name) + .font(.callout) + .foregroundColor(.secondary) } } } @@ -212,7 +211,7 @@ struct SettingsViewRows { /// This row, when tapped, will push the New Article Notifications /// screen in to view. static var ConfigureAppearance: some View { - NavigationLink(destination: NotificationsViewControllerRepresentable().edgesIgnoringSafeArea(.all)) { + NavigationLink(destination: AppearanceManagementView()) { Label { Text("Appearance") } icon: { diff --git a/iOS/Settings/Settings View/SettingsView.swift b/iOS/Settings/Settings View/SettingsView.swift index 83f116da6..588da7b5f 100644 --- a/iOS/Settings/Settings View/SettingsView.swift +++ b/iOS/Settings/Settings View/SettingsView.swift @@ -32,8 +32,8 @@ struct SettingsView: View { } Section(footer: Text("Configure the look and feel of NetNewsWire.")) { - SettingsViewRows.ConfigureNewArticleNotifications SettingsViewRows.ConfigureAppearance + SettingsViewRows.ConfigureNewArticleNotifications }