From dfc3a890e7fc072d06046749adbb34993a5b3b26 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 31 May 2023 13:49:31 +0800 Subject: [PATCH] Move to just two panes on mac for now --- .../Sources/App/MacMenuCommands.swift | 21 +++++++++++++++---- .../App/Views/Home/HomeFeedViewMac.swift | 2 ++ .../Sources/App/Views/Home/HomeView.swift | 16 ++++++++++++++ .../App/Views/PrimaryContentView.swift | 7 ------- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift b/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift index 49c18e1c9..8616567d6 100644 --- a/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift +++ b/apple/OmnivoreKit/Sources/App/MacMenuCommands.swift @@ -9,10 +9,11 @@ import Views ) @AppStorage(UserDefaultKey.preferredWebLineSpacing.rawValue) var storedLineSpacing = 150 @AppStorage(UserDefaultKey.preferredWebMaxWidthPercentage.rawValue) var storedMaxWidthPercentage = 100 - @AppStorage(UserDefaultKey.enableHighlightOnRelease.rawValue) var enableHighlightOnRelease = false @Binding var preferredFont: String @Binding var prefersHighContrastText: Bool + @Binding var justifyText: Bool + @Binding var currentThemeName: String public var fontSizeButtons: some View { Group { @@ -85,10 +86,14 @@ import Views public init( preferredFont: Binding, - prefersHighContrastText: Binding + prefersHighContrastText: Binding, + justifyText: Binding, + currentThemeName: Binding ) { self._preferredFont = preferredFont self._prefersHighContrastText = prefersHighContrastText + self._justifyText = justifyText + self._currentThemeName = currentThemeName } public var body: some Commands { @@ -111,14 +116,22 @@ import Views } } + Picker(selection: $currentThemeName, label: Text("Theme")) { + ForEach(Theme.allCases, id: \.self) { theme in + Text(theme.rawValue).tag(theme.rawValue).tag(theme.rawValue) + } + }.onChange(of: currentThemeName) { _ in + NSNotification.readerSettingsChanged() + } + Toggle( isOn: $prefersHighContrastText, label: { Text(LocalText.genericHighContrastText) } ) Toggle( - isOn: $enableHighlightOnRelease, - label: { Text(LocalText.genericHighContrastText) } + isOn: $justifyText, + label: { Text(LocalText.enableJustifyText) } ) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift index 762a89920..b5a38102c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewMac.swift @@ -35,6 +35,8 @@ import Views } } List { + Spacer(minLength: 10) + ForEach(viewModel.items) { item in MacFeedCardNavigationLink( item: item, diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeView.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeView.swift index 6c2c49875..ebc82f97e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeView.swift @@ -1,4 +1,6 @@ import SwiftUI +import Utils +import Views struct HomeView: View { @StateObject private var viewModel = HomeFeedViewModel() @@ -22,6 +24,20 @@ struct HomeView: View { } #elseif os(macOS) HomeFeedView(viewModel: viewModel) + .frame(minWidth: 320) + .toolbar { + ToolbarItem { + Button( + action: { + NSApp.keyWindow?.firstResponder?.tryToPerform( + #selector(NSSplitViewController.toggleSidebar(_:)), with: nil + ) + }, + label: { Label(LocalText.navigationSelectSidebarToggle, systemImage: "sidebar.left") } + ) + } + } + #endif } } diff --git a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift index 376b2c53b..ddd54e1ca 100644 --- a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift @@ -24,14 +24,7 @@ public struct PrimaryContentView: View { #if os(macOS) private var splitView: some View { NavigationView { - // The first column is the sidebar. - PrimaryContentSidebar(categories: categories) - .navigationTitle("Categories") - - // Second column is the Primary Nav Stack PrimaryContentCategory.feed.destinationView - - // Third column is the detail view Text(LocalText.navigationSelectLink) } .accentColor(.appGrayTextContrast)