Improve settings, sidebars
This commit is contained in:
19
CHDataManagement/Model/Settings/LocalizedPostSettings.swift
Normal file
19
CHDataManagement/Model/Settings/LocalizedPostSettings.swift
Normal file
@ -0,0 +1,19 @@
|
||||
import Foundation
|
||||
|
||||
final class LocalizedPostSettings: ObservableObject {
|
||||
|
||||
@Published
|
||||
var title: String
|
||||
|
||||
@Published
|
||||
var description: String
|
||||
|
||||
@Published
|
||||
var feedUrlPrefix: String
|
||||
|
||||
init(title: String, description: String, feedUrlPrefix: String) {
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.feedUrlPrefix = feedUrlPrefix
|
||||
}
|
||||
}
|
15
CHDataManagement/Model/Settings/LocalizedSettings.swift
Normal file
15
CHDataManagement/Model/Settings/LocalizedSettings.swift
Normal file
@ -0,0 +1,15 @@
|
||||
import Foundation
|
||||
|
||||
final class LocalizedSettings: ObservableObject {
|
||||
|
||||
@Published
|
||||
var navigationBarIconDescription: String
|
||||
|
||||
@Published
|
||||
var posts: LocalizedPostSettings
|
||||
|
||||
init(navigationBarIconDescription: String, posts: LocalizedPostSettings) {
|
||||
self.navigationBarIconDescription = navigationBarIconDescription
|
||||
self.posts = posts
|
||||
}
|
||||
}
|
17
CHDataManagement/Model/Settings/NavigationBarSettings.swift
Normal file
17
CHDataManagement/Model/Settings/NavigationBarSettings.swift
Normal file
@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
final class NavigationBarSettings: ObservableObject {
|
||||
|
||||
/// The path to the main icon in the navigation bar
|
||||
@Published
|
||||
var iconPath: String
|
||||
|
||||
/// The tags to show in the navigation bar
|
||||
@Published
|
||||
var tags: [Tag]
|
||||
|
||||
init(iconPath: String, tags: [Tag]) {
|
||||
self.iconPath = iconPath
|
||||
self.tags = tags
|
||||
}
|
||||
}
|
17
CHDataManagement/Model/Settings/PostSettings.swift
Normal file
17
CHDataManagement/Model/Settings/PostSettings.swift
Normal file
@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
final class PostSettings: ObservableObject {
|
||||
|
||||
/// The number of posts to show in a single page of the news feed
|
||||
@Published
|
||||
var postsPerPage: Int
|
||||
|
||||
/// The maximum width of the main content
|
||||
@Published
|
||||
var contentWidth: CGFloat
|
||||
|
||||
init(postsPerPage: Int, contentWidth: CGFloat) {
|
||||
self.postsPerPage = postsPerPage
|
||||
self.contentWidth = contentWidth
|
||||
}
|
||||
}
|
34
CHDataManagement/Model/Settings/Settings.swift
Normal file
34
CHDataManagement/Model/Settings/Settings.swift
Normal file
@ -0,0 +1,34 @@
|
||||
import Foundation
|
||||
|
||||
final class Settings: ObservableObject {
|
||||
|
||||
@Published
|
||||
var outputDirectoryPath: String
|
||||
|
||||
@Published
|
||||
var navigationBar: NavigationBarSettings
|
||||
|
||||
@Published
|
||||
var posts: PostSettings
|
||||
|
||||
@Published
|
||||
var german: LocalizedSettings
|
||||
|
||||
@Published
|
||||
var english: LocalizedSettings
|
||||
|
||||
init(outputDirectoryPath: String, navigationBar: NavigationBarSettings, posts: PostSettings, german: LocalizedSettings, english: LocalizedSettings) {
|
||||
self.outputDirectoryPath = outputDirectoryPath
|
||||
self.navigationBar = navigationBar
|
||||
self.posts = posts
|
||||
self.german = german
|
||||
self.english = english
|
||||
}
|
||||
|
||||
func localized(in language: ContentLanguage) -> LocalizedSettings {
|
||||
switch language {
|
||||
case .english: return english
|
||||
case .german: return german
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user