diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index 91de47635..e681e7b01 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -243,7 +243,6 @@ final class AppDefaults: ObservableObject { } set { AppDefaults.setInt(for: Key.timelineNumberOfLines, newValue) - AppDefaults.shared.objectWillChange.send() } } @@ -254,7 +253,6 @@ final class AppDefaults: ObservableObject { } set { AppDefaults.store.set(newValue.rawValue, forKey: Key.timelineIconDimension) - AppDefaults.shared.objectWillChange.send() } } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index ce3ceed7d..a749e8e23 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1130,13 +1130,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, Logging { } func showSettings(scrollToArticlesSection: Bool = false) { -// let settingsNavController = UIStoryboard.settings.instantiateInitialViewController() as! UINavigationController -// let settingsViewController = settingsNavController.topViewController as! SettingsViewController -// settingsViewController.scrollToArticlesSection = scrollToArticlesSection -// settingsNavController.modalPresentationStyle = .formSheet -// settingsViewController.presentingParentController = rootSplitViewController -// rootSplitViewController.present(settingsNavController, animated: true) - let hostedSettings = UIHostingController(rootView: SettingsView()) + var s = scrollToArticlesSection + let hostedSettings = UIHostingController(rootView: SettingsView(isConfigureAppearanceShown: Binding(get: { s }, set: { s = $0 }))) rootSplitViewController.present(hostedSettings, animated: true) } diff --git a/iOS/Settings/ArticleThemesTableViewController.swift b/iOS/Settings/ArticleThemesTableViewController.swift index 1fcf94b9e..85bd60806 100644 --- a/iOS/Settings/ArticleThemesTableViewController.swift +++ b/iOS/Settings/ArticleThemesTableViewController.swift @@ -12,7 +12,7 @@ import RSCore import UIKit import SwiftUI -struct ArticleThemesViewControllerRepresentable: UIViewControllerRepresentable { +struct ArticleThemesWrapper: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> ArticleThemesTableViewController { let storyboard = UIStoryboard(name: "Settings", bundle: .main) let controller = storyboard.instantiateViewController(withIdentifier: "ArticleThemesTableViewController") as! ArticleThemesTableViewController diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index a8cf0758a..2718d31a0 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -933,7 +933,7 @@ - + @@ -1079,10 +1079,10 @@ - + - + @@ -1093,7 +1093,7 @@ - + diff --git a/iOS/Settings/TimelineCustomizerViewController.swift b/iOS/Settings/TimelineCustomizerViewController.swift index f9d15bb9a..8b0f796de 100644 --- a/iOS/Settings/TimelineCustomizerViewController.swift +++ b/iOS/Settings/TimelineCustomizerViewController.swift @@ -7,6 +7,22 @@ // import UIKit +import SwiftUI +import RSCore + +struct TimelineCustomizerWrapper: UIViewControllerRepresentable { + public func makeUIViewController(context: Context) -> TimelineCustomizerViewController { + let controller = UIStoryboard.settings.instantiateController(ofType: TimelineCustomizerViewController.self) + return controller + } + + public func updateUIViewController(_ uiViewController: TimelineCustomizerViewController, context: Context) { + // + } + + public typealias UIViewControllerType = TimelineCustomizerViewController +} + class TimelineCustomizerViewController: UIViewController { diff --git a/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift b/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift index 365db386a..432dff6cd 100644 --- a/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift +++ b/iOS/Settings/Views/Appearance/DisplayAndBehaviorsView.swift @@ -23,6 +23,7 @@ struct DisplayAndBehaviorsView: View { SettingsViewRows.SortOldestToNewest($appDefaults.timelineSortDirectionBool) SettingsViewRows.GroupByFeed($appDefaults.timelineGroupByFeed) SettingsViewRows.RefreshToClearReadArticles($appDefaults.refreshClearsReadArticles) + SettingsViewRows.TimelineLayout } Section("Article") { diff --git a/iOS/Settings/Views/General/SettingsRows.swift b/iOS/Settings/Views/General/SettingsRows.swift index 80465b5e9..25aa083f0 100644 --- a/iOS/Settings/Views/General/SettingsRows.swift +++ b/iOS/Settings/Views/General/SettingsRows.swift @@ -144,22 +144,15 @@ struct SettingsViewRows { /// This row, when tapped, will push the the Timeline Layout screen /// in to view. static var TimelineLayout: some View { - NavigationLink(destination: NotificationsViewControllerRepresentable()) { - Label { - Text("Timeline Layout") - } icon: { - Image(systemName: "slider.vertical.3") - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 25.0, height: 25.0) - } + NavigationLink(destination: TimelineCustomizerWrapper().edgesIgnoringSafeArea(.all).navigationTitle(Text("Timeline Layout"))) { + Text("Timeline Layout") } } /// This row, when tapped, will push the the Theme Selector screen /// in to view. static var ThemeSelection: some View { - NavigationLink(destination: ArticleThemesViewControllerRepresentable().edgesIgnoringSafeArea(.all)) { + NavigationLink(destination: ArticleThemesWrapper().edgesIgnoringSafeArea(.all)) { HStack { Text("Article Theme") Spacer() @@ -192,8 +185,8 @@ struct SettingsViewRows { /// This row, when tapped, will push the New Article Notifications /// screen in to view. - static var ConfigureAppearance: some View { - NavigationLink(destination: DisplayAndBehaviorsView()) { + static func ConfigureAppearance(_ isShown: Binding) -> some View { + NavigationLink(destination: DisplayAndBehaviorsView(), isActive: isShown) { Label { Text("Display & Behaviors") } icon: { diff --git a/iOS/Settings/Views/General/SettingsView.swift b/iOS/Settings/Views/General/SettingsView.swift index b2c445e53..aee75dbbc 100644 --- a/iOS/Settings/Views/General/SettingsView.swift +++ b/iOS/Settings/Views/General/SettingsView.swift @@ -15,6 +15,8 @@ struct SettingsView: View { @StateObject private var appDefaults = AppDefaults.shared @StateObject private var viewModel = SettingsViewModel() + + @Binding var isConfigureAppearanceShown: Bool var body: some View { NavigationView { @@ -34,7 +36,7 @@ struct SettingsView: View { // Appearance Section(header: Text("Appearance"), footer: Text("Manage the look, feel, and behavior of NetNewsWire.")) { - SettingsViewRows.ConfigureAppearance + SettingsViewRows.ConfigureAppearance($isConfigureAppearanceShown) if viewModel.notificationPermissions == .authorized { SettingsViewRows.ConfigureNewArticleNotifications } @@ -49,6 +51,7 @@ struct SettingsView: View { } } .tint(Color(uiColor: AppAssets.primaryAccentColor)) + .navigationViewStyle(.stack) .listStyle(.insetGrouped) .navigationTitle(Text("Settings")) .navigationBarTitleDisplayMode(.inline) diff --git a/iOS/Settings/Views/New Article Notifications/NewArticleNotificationsView.swift b/iOS/Settings/Views/New Article Notifications/NewArticleNotificationsView.swift index 05eb74fb1..9599222cb 100644 --- a/iOS/Settings/Views/New Article Notifications/NewArticleNotificationsView.swift +++ b/iOS/Settings/Views/New Article Notifications/NewArticleNotificationsView.swift @@ -50,7 +50,6 @@ struct NewArticleNotificationsView: View { get: { webfeed.isNotifyAboutNewArticles ?? false }, set: { webfeed.isNotifyAboutNewArticles = $0 })) } - } }