언어 설정 화면 추가 및 언어 헤더 적용
설정에서 시스템/한국어/영어/일본어 선택을 지원한다. 선택 시 Accept-Language 헤더와 UI locale을 즉시 반영한다. 언어 변경 후 스플래시를 거쳐 메인으로 소프트 재시작한다.
This commit is contained in:
@@ -43,7 +43,7 @@ class AppState: ObservableObject {
|
||||
@Published var purchasedContentId = 0
|
||||
@Published var purchasedContentOrderType = OrderType.KEEP
|
||||
|
||||
@Published var isChangeAdultContentVisible = false
|
||||
@Published var isRestartApp = false
|
||||
@Published var startTab: HomeViewModel.CurrentTab = .home
|
||||
|
||||
@Published var marketingUtmSource = ""
|
||||
@@ -74,4 +74,13 @@ class AppState: ObservableObject {
|
||||
self.appStep = .main
|
||||
}
|
||||
}
|
||||
|
||||
// 언어 적용 직후 앱을 소프트 재시작(스플래시 -> 메인)하여 전역 UI를 새로고침
|
||||
func softRestart() {
|
||||
isRestartApp = true
|
||||
setAppStep(step: .splash)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
self.setAppStep(step: .main)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ enum AppStep {
|
||||
|
||||
case settings
|
||||
|
||||
case languageSettings
|
||||
|
||||
case notices
|
||||
|
||||
case noticeDetail(notice: NoticeItem)
|
||||
|
||||
@@ -19,9 +19,12 @@ struct SodaLiveApp: App {
|
||||
@ObservedObject var viewModel = AppViewModel()
|
||||
|
||||
@StateObject var canPgPaymentViewModel = CanPgPaymentViewModel()
|
||||
@StateObject private var languageEnvironment = LanguageContainer.environment
|
||||
|
||||
init() {
|
||||
configureImageCache()
|
||||
// 앱 시작 직후, 초기 네트워크 요청도 올바른 언어 헤더를 갖도록 동기 초기화
|
||||
LanguageHeaderProvider.initialize()
|
||||
}
|
||||
|
||||
private func configureImageCache() {
|
||||
@@ -40,6 +43,10 @@ struct SodaLiveApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView(canPgPaymentViewModel: canPgPaymentViewModel)
|
||||
.environment(\.locale, languageEnvironment.locale)
|
||||
.task {
|
||||
await LanguageContainer.service.bootstrap()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)) { _ in
|
||||
CreatorCommunityMediaPlayerManager.shared.pauseContent()
|
||||
// 백그라운드 전환 시 메모리 캐시 정리
|
||||
|
||||
Reference in New Issue
Block a user