mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Named the theme tuple for clarity
This commit is contained in:
@@ -140,11 +140,10 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging, Observable
|
||||
} catch {
|
||||
logger.error("\(error.localizedDescription)")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func themesByDeveloper() -> ([ArticleTheme], [ArticleTheme]) {
|
||||
func themesByDeveloper() -> (builtIn: [ArticleTheme], other: [ArticleTheme]) {
|
||||
let installedProvidedThemes = themeNames.map({ try? articleThemeWithThemeName($0) }).compactMap({ $0 }).filter({ $0.isAppTheme }).sorted(by: { $0.name < $1.name }).filter({ $0.name != AppDefaults.defaultThemeName })
|
||||
|
||||
let installedOtherThemes = themeNames.map({ try? articleThemeWithThemeName($0) }).compactMap({ $0 }).filter({ !$0.isAppTheme }).sorted(by: { $0.name < $1.name })
|
||||
@@ -173,7 +172,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging, Observable
|
||||
|
||||
let installedThemes = ArticleThemesManager.shared.themesByDeveloper()
|
||||
|
||||
for theme in installedThemes.0 {
|
||||
for theme in installedThemes.builtIn {
|
||||
let item = NSMenuItem()
|
||||
item.title = theme.name
|
||||
item.action = #selector(updateThemeSelection(_:))
|
||||
@@ -189,7 +188,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Logging, Observable
|
||||
thirdPartyHeading.isEnabled = false
|
||||
menu.addItem(thirdPartyHeading)
|
||||
|
||||
for theme in installedThemes.1 {
|
||||
for theme in installedThemes.other {
|
||||
let item = NSMenuItem()
|
||||
item.title = theme.name
|
||||
item.action = #selector(updateThemeSelection(_:))
|
||||
|
||||
@@ -21,13 +21,13 @@ struct ArticleThemeManagerView: View {
|
||||
Form {
|
||||
Section(header: Text("Built-in Themes", comment: "Section header for installed themes"), footer: Text("These themes cannot be deleted.", comment: "Section footer for installed themes.")) {
|
||||
articleThemeRow(try! themeManager.articleThemeWithThemeName(AppDefaults.defaultThemeName))
|
||||
ForEach(0..<themeManager.themesByDeveloper().0.count, id: \.self) { i in
|
||||
ForEach(0..<themeManager.themesByDeveloper().builtIn.count, id: \.self) { i in
|
||||
articleThemeRow(themeManager.themesByDeveloper().0[i])
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: Text("Other Themes", comment: "Section header for third party themes")) {
|
||||
ForEach(0..<themeManager.themesByDeveloper().1.count, id: \.self) { i in
|
||||
ForEach(0..<themeManager.themesByDeveloper().other.count, id: \.self) { i in
|
||||
articleThemeRow(themeManager.themesByDeveloper().1[i])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user