From 94099281ae7260a8b8064f5bba82c2fb09af9865 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 31 May 2023 13:50:42 +0800 Subject: [PATCH] Add theme and justify-text to reader settings --- apple/OmnivoreKit/Sources/Views/LocalText.swift | 2 +- .../Views/Resources/en.lproj/Localizable.strings | 3 ++- apple/Sources/MainApp.swift | 14 +++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apple/OmnivoreKit/Sources/Views/LocalText.swift b/apple/OmnivoreKit/Sources/Views/LocalText.swift index 46219ab36..86ebd4499 100644 --- a/apple/OmnivoreKit/Sources/Views/LocalText.swift +++ b/apple/OmnivoreKit/Sources/Views/LocalText.swift @@ -164,7 +164,7 @@ public enum LocalText { public static let genericLoading = localText(key: "genericLoading") public static let genericFontFamily = localText(key: "genericFontFamily") public static let genericHighContrastText = localText(key: "genericHighContrastText") - public static let enableHighlightOnReleaseText = localText(key: "enableHighlightOnReleaseText") + public static let enableJustifyText = localText(key: "enableJustifyText") public static let genericFont = localText(key: "genericFont") public static let genericHighlight = localText(key: "genericHighlight") public static let labelsGeneric = localText(key: "labelsGeneric") diff --git a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings index 08503bd95..62b25a688 100644 --- a/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings +++ b/apple/OmnivoreKit/Sources/Views/Resources/en.lproj/Localizable.strings @@ -163,7 +163,8 @@ "genericLoading" = "Loading..."; "genericFontFamily" = "Font Family"; "genericHighContrastText" = "High Contrast Text"; -"enableHighlightOnReleaseText" = "Auto Highlight Mode:"; +"enableHighlightOnReleaseText" = "Auto Highlight Mode"; +"enableJustifyText" = "Justify Text"; "genericFont" = "Font"; "genericHighlight" = "Highlight"; "labelsGeneric" = "Labels"; diff --git a/apple/Sources/MainApp.swift b/apple/Sources/MainApp.swift index 43fbf54eb..a5dc0dc0e 100644 --- a/apple/Sources/MainApp.swift +++ b/apple/Sources/MainApp.swift @@ -17,6 +17,9 @@ struct MainApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @AppStorage(UserDefaultKey.preferredWebFont.rawValue) var preferredFont = WebFont.inter.rawValue @AppStorage(UserDefaultKey.prefersHighContrastWebFont.rawValue) var prefersHighContrastText = true + @AppStorage(UserDefaultKey.justifyText.rawValue) var justifyText = false + @AppStorage(UserDefaultKey.themeName.rawValue) var currentThemeName = "System" + #elseif os(iOS) @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate #endif @@ -39,7 +42,9 @@ struct MainApp: App { .commands { MacMenuCommands( preferredFont: $preferredFont, - prefersHighContrastText: $prefersHighContrastText + prefersHighContrastText: $prefersHighContrastText, + justifyText: $justifyText, + currentThemeName: $currentThemeName ) } .onChange(of: preferredFont) { _ in @@ -48,6 +53,13 @@ struct MainApp: App { .onChange(of: prefersHighContrastText) { _ in NSNotification.readerSettingsChanged() } + .onChange(of: justifyText) { _ in + NSNotification.readerSettingsChanged() + } + .onChange(of: currentThemeName) { _ in + NSNotification.readerSettingsChanged() + } + #endif } }