-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
다크모드 기능 구현 #161
Merged
+98
−38
Merged
다크모드 기능 구현 #161
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
57becae
#41 #42 fix: LocalUtilityRepository의 UserDefaults 관련 메소드의 코드 간략화
LEEYOONJONG 2077c50
#15 feat: 다크모드 색상 변경
LEEYOONJONG 210a373
#126 refactor: 다크모드 화면 설정을 ViewController에서 하기 위해 유즈케이스 메서드의 리턴타입을 Si…
LEEYOONJONG 34f46b0
#157 feat: 다크모드 화면 구성
LEEYOONJONG 64c1ac3
#159 #160 feat: 다크모드 로직을 DarkModeManager로 이동
LEEYOONJONG f4bdf8f
#160 feat: 저장된 다크모드 설정 값을 기반으로 뷰 설정
LEEYOONJONG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// DarkModeManager.swift | ||
// Segno | ||
// | ||
// Created by YOONJONG on 2022/12/06. | ||
// | ||
|
||
import UIKit | ||
|
||
import RxSwift | ||
|
||
class DarkModeManager { | ||
static let shared = DarkModeManager() | ||
|
||
let repository: LocalUtilityRepository | ||
|
||
private init() { | ||
self.repository = LocalUtilityRepositoryImpl() | ||
} | ||
|
||
func getDarkMode() -> Int { | ||
if let mode = repository.getUserDefaultsObject(forKey: .darkmode) as? Int { | ||
debugPrint("SettingsUseCase - getDarkMode : 키가 있습니다 - \(mode)") | ||
return mode | ||
} else { | ||
repository.setUserDefaults(DarkMode.system.rawValue, forKey: .darkmode) | ||
debugPrint("SettingsUseCase - getDarkMode : 키가 없어 \(DarkMode.system.rawValue) 로 설정합니다.") | ||
return DarkMode.system.rawValue | ||
} | ||
} | ||
|
||
func changeDarkMode(to mode: Int) { | ||
repository.setUserDefaults(mode, forKey: .darkmode) | ||
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, | ||
let window = windowScene.windows.first else { return } | ||
|
||
window.overrideUserInterfaceStyle = UIUserInterfaceStyle(rawValue: mode) ?? .unspecified | ||
debugPrint("SettingsUseCase - changeDarkMode : \(mode)로 설정") | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분을 Implment를 직접 가져오기보다는 우리가 해 왔던 동적인 스타일로 바꾸면 좋을 것 같다~ 라고 생각했는데, 어차피 private init이라 밖에서 불러올 일이 없는 이니셜라이저겠군요.