Add theme and justify-text to reader settings

This commit is contained in:
Jackson Harper 2023-05-31 13:50:42 +08:00
parent bf799a6534
commit 94099281ae
3 changed files with 16 additions and 3 deletions

View file

@ -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")

View file

@ -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";

View file

@ -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
}
}