diff --git a/Segno/Segno/Presentation/View/NicknameCell.swift b/Segno/Segno/Presentation/View/NicknameCell.swift index 953e5e9..4bcd8ae 100644 --- a/Segno/Segno/Presentation/View/NicknameCell.swift +++ b/Segno/Segno/Presentation/View/NicknameCell.swift @@ -34,7 +34,7 @@ final class NicknameCell: UITableViewCell { let label = UILabel() label.text = Metric.nicknameLabelText label.font = .appFont(.surroundAir, size: Metric.textSize) - label.textColor = .appColor(.grey2) + label.textColor = .appColor(.grey3) return label }() diff --git a/Segno/Segno/Presentation/ViewController/SettingsViewController.swift b/Segno/Segno/Presentation/ViewController/SettingsViewController.swift index ef1a8b8..353452f 100644 --- a/Segno/Segno/Presentation/ViewController/SettingsViewController.swift +++ b/Segno/Segno/Presentation/ViewController/SettingsViewController.swift @@ -21,6 +21,12 @@ enum SettingsCellActions: Int { } final class SettingsViewController: UIViewController { + private enum Metric { + static let settingString: String = "설정" + static let darkModeSettingString: String = "다크 모드 설정" + static let cancelMessage: String = "취소" + } + private let disposeBag = DisposeBag() private let viewModel: SettingsViewModel private lazy var tableView: UITableView = { @@ -50,7 +56,7 @@ final class SettingsViewController: UIViewController { } private func setupView() { - title = "설정" + title = Metric.settingString view.backgroundColor = .appColor(.background) } @@ -118,21 +124,38 @@ final class SettingsViewController: UIViewController { guard let action = SettingsCellActions(rawValue: indexPath.row) else { return } switch action { case .darkmode: // 다크 모드 설정 - guard let cell = self?.tableView.cellForRow(at: indexPath) as? SettingsActionSheetCell else { return } - let actionSheet = UIAlertController(title: "다크 모드 설정", message: nil, preferredStyle: .actionSheet) + guard let cell = self?.tableView.cellForRow(at: indexPath) as? SettingsActionSheetCell, + let self = self else { return } + let actionSheet = UIAlertController(title: Metric.darkModeSettingString, message: nil, preferredStyle: .actionSheet) actionSheet.addAction(UIAlertAction(title: DarkMode.system.title, style: .default, handler: { _ in - self?.viewModel.changeDarkMode(to: DarkMode.system.rawValue) - cell.configure(right: DarkMode.system.title) + self.viewModel.changeDarkMode(to: DarkMode.system.rawValue) + .subscribe(onSuccess: { mode in + self.view.window?.overrideUserInterfaceStyle = UIUserInterfaceStyle(rawValue: mode) ?? .unspecified + cell.configure(right: DarkMode.system.title) + }) + .disposed(by: self.disposeBag) })) actionSheet.addAction(UIAlertAction(title: DarkMode.light.title, style: .default, handler: { _ in - self?.viewModel.changeDarkMode(to: DarkMode.light.rawValue) - cell.configure(right: DarkMode.light.title) + self.viewModel.changeDarkMode(to: DarkMode.light.rawValue) + .subscribe(onSuccess: { mode in + self.view.window?.overrideUserInterfaceStyle = UIUserInterfaceStyle(rawValue: mode) ?? .unspecified + cell.configure(right: DarkMode.light.title) + }) + .disposed(by: self.disposeBag) })) actionSheet.addAction(UIAlertAction(title: DarkMode.dark.title, style: .default, handler: { _ in - self?.viewModel.changeDarkMode(to: DarkMode.dark.rawValue) - cell.configure(right: DarkMode.dark.title) + self.viewModel.changeDarkMode(to: DarkMode.dark.rawValue) + .subscribe(onSuccess: { mode in + self.view.window?.overrideUserInterfaceStyle = UIUserInterfaceStyle(rawValue: mode) ?? .unspecified + cell.configure(right: DarkMode.dark.title) + }) + .disposed(by: self.disposeBag) + })) + actionSheet.addAction(UIAlertAction(title: Metric.cancelMessage + , style: .cancel, handler: { _ in + self.dismiss(animated: true) })) - self?.present(actionSheet, animated: true) + self.present(actionSheet, animated: true) default: break }