Make minor cleanups.
This commit is contained in:
parent
d3593683df
commit
8c0c8db824
|
@ -20,13 +20,10 @@ final class AppDefaults {
|
||||||
static let shared = AppDefaults()
|
static let shared = AppDefaults()
|
||||||
|
|
||||||
private struct Key {
|
private struct Key {
|
||||||
|
|
||||||
static let firstRunDate = "firstRunDate"
|
static let firstRunDate = "firstRunDate"
|
||||||
|
|
||||||
static let sidebarFontSize = "sidebarFontSize"
|
static let sidebarFontSize = "sidebarFontSize"
|
||||||
static let timelineFontSize = "timelineFontSize"
|
static let timelineFontSize = "timelineFontSize"
|
||||||
static let detailFontSize = "detailFontSize"
|
static let detailFontSize = "detailFontSize"
|
||||||
|
|
||||||
static let openInBrowserInBackground = "openInBrowserInBackground"
|
static let openInBrowserInBackground = "openInBrowserInBackground"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ private let nnwStyleSuffix = ".nnwstyle"
|
||||||
private let cssStyleSuffix = ".css"
|
private let cssStyleSuffix = ".css"
|
||||||
private let styleSuffixes = [styleSuffix, nnwStyleSuffix, cssStyleSuffix];
|
private let styleSuffixes = [styleSuffix, nnwStyleSuffix, cssStyleSuffix];
|
||||||
|
|
||||||
public final class ArticleStylesManager {
|
final class ArticleStylesManager {
|
||||||
|
|
||||||
static let sharedInstance = ArticleStylesManager()
|
static let shared = ArticleStylesManager()
|
||||||
private let folderPath = RSDataSubfolder(nil, stylesFolderName)!
|
private let folderPath = RSDataSubfolder(nil, stylesFolderName)!
|
||||||
|
|
||||||
var currentStyleName: String {
|
var currentStyleName: String {
|
||||||
|
|
|
@ -14,8 +14,7 @@ import RSWeb
|
||||||
func openInBrowser(_ urlString: String) {
|
func openInBrowser(_ urlString: String) {
|
||||||
|
|
||||||
// Opens according to prefs.
|
// Opens according to prefs.
|
||||||
let openInBackground = UserDefaults.standard.bool(forKey: OpenInBrowserInBackgroundKey)
|
openInBrowser(urlString, inBackground: AppDefaults.shared.openInBrowserInBackground)
|
||||||
openInBrowser(urlString, inBackground: openInBackground)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func openInBrowser(_ urlString: String, inBackground: Bool) {
|
func openInBrowser(_ urlString: String, inBackground: Bool) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ class DetailViewController: NSViewController, WKNavigationDelegate, WKUIDelegate
|
||||||
private func reloadHTML() {
|
private func reloadHTML() {
|
||||||
|
|
||||||
if let article = article {
|
if let article = article {
|
||||||
let articleRenderer = ArticleRenderer(article: article, style: ArticleStylesManager.sharedInstance.currentStyle)
|
let articleRenderer = ArticleRenderer(article: article, style: ArticleStylesManager.shared.currentStyle)
|
||||||
webview.loadHTMLString(articleRenderer.html, baseURL: articleRenderer.baseURL)
|
webview.loadHTMLString(articleRenderer.html, baseURL: articleRenderer.baseURL)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue