@@ -13,6 +13,7 @@ protocol SettingsVMProtocol {
1313
1414 func changeLanguage( to language: AppLanguage )
1515 func changeTheme( to theme: AppTheme )
16+ func changeDarkThemeBackgroundColor( to color: AppDarkThemeBackgroundColor )
1617}
1718
1819final class SettingsVM : SettingsVMProtocol {
@@ -39,6 +40,13 @@ final class SettingsVM: SettingsVMProtocol {
3940 }
4041 }
4142
43+ private var currentAppDarkThemeBackgroundColor : String {
44+ switch settingsService. getAppBackgroundColor ( ) {
45+ case . dark: return R . string. localizable. backgroundDark ( )
46+ case . black: return R . string. localizable. backgroundBlack ( )
47+ }
48+ }
49+
4250 private let version = Bundle . main. infoDictionary ? [ " CFBundleShortVersionString " ] as? String ?? " 0 "
4351 private let build = Bundle . main. infoDictionary ? [ " CFBundleVersion " ] as? String ?? " 0 "
4452
@@ -52,7 +60,10 @@ final class SettingsVM: SettingsVMProtocol {
5260 MenuSection ( title: R . string. localizable. appearance ( ) , options: [
5361 . descriptionCell( model: DescriptionOption ( title: R . string. localizable. theme ( ) ,
5462 description: currentTheme,
55- handler: changeTheme) )
63+ handler: changeTheme) ) ,
64+ . descriptionCell( model: DescriptionOption ( title: R . string. localizable. backgroundNight ( ) ,
65+ description: currentAppDarkThemeBackgroundColor,
66+ handler: changeDarkThemeBackgroundColor) )
5667 ] ) ,
5768
5869 //MenuSection(title: "Просмотр тем", options: []),
@@ -97,6 +108,17 @@ final class SettingsVM: SettingsVMProtocol {
97108 view? . reloadData ( )
98109 }
99110
111+ func changeDarkThemeBackgroundColor( to color: AppDarkThemeBackgroundColor ) {
112+ settingsService. setAppBackgroundColor ( to: color)
113+
114+ let model = DescriptionOption ( title: R . string. localizable. backgroundNight ( ) ,
115+ description: currentAppDarkThemeBackgroundColor,
116+ handler: changeDarkThemeBackgroundColor)
117+ sections [ 1 ] . options [ 1 ] = . descriptionCell( model: model)
118+
119+ view? . reloadData ( )
120+ }
121+
100122 // MARK: - Private Actions
101123
102124 private func changeLanguage( ) {
@@ -107,6 +129,10 @@ final class SettingsVM: SettingsVMProtocol {
107129 view? . showChangeThemeSheet ( )
108130 }
109131
132+ private func changeDarkThemeBackgroundColor( ) {
133+ view? . showChangeDarkThemeBackgroundColorSheet ( )
134+ }
135+
110136 private func showDefaultError( ) {
111137 view? . showDefaultError ( )
112138 }
0 commit comments