언어 설정 화면 추가 및 언어 헤더 적용
설정에서 시스템/한국어/영어/일본어 선택을 지원한다. 선택 시 Accept-Language 헤더와 UI locale을 즉시 반영한다. 언어 변경 후 스플래시를 거쳐 메인으로 소프트 재시작한다.
This commit is contained in:
@@ -753,6 +753,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"%@ 님의 시리즈 전체보기" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "View all series by %@"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "%@ さんのシリーズをすべて見る"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"%@ 연재" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
@@ -4049,22 +4065,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"모집완료" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Recruitment closed"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "募集終了"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"모집중" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
@@ -4097,7 +4097,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"모집완료" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Recruitment closed"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "募集終了"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"목소리로 만나는 새로운 세계" : {
|
||||
"extractionState" : "stale",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
@@ -5138,6 +5155,7 @@
|
||||
}
|
||||
},
|
||||
"소다라이브" : {
|
||||
"extractionState" : "stale",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
@@ -5425,6 +5443,38 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"시리즈 전체보기" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "View all series"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "シリーズをすべて見る"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"시스템 기본" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "System default"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "システムのデフォルト"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"시작 시간" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
@@ -5649,6 +5699,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"언어 설정" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Language settings"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "言語設定"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"여성향" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
@@ -7425,6 +7491,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"적용" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Apply"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "適用"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"전체" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
@@ -9600,38 +9682,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"시리즈 전체보기" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "View all series"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "シリーズをすべて見る"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"%@ 님의 시리즈 전체보기" : {
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "View all series by %@"
|
||||
}
|
||||
},
|
||||
"ja" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "%@ さんのシリーズをすべて見る"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version" : "1.1"
|
||||
|
||||
@@ -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()
|
||||
// 백그라운드 전환 시 메모리 캐시 정리
|
||||
|
||||
@@ -18,7 +18,7 @@ struct ContentView: View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
|
||||
if appState.isChangeAdultContentVisible {
|
||||
if appState.isRestartApp {
|
||||
EmptyView()
|
||||
} else {
|
||||
HomeView()
|
||||
@@ -48,6 +48,9 @@ struct ContentView: View {
|
||||
|
||||
case .settings:
|
||||
SettingsView()
|
||||
|
||||
case .languageSettings:
|
||||
LanguageSettingsView()
|
||||
|
||||
case .notices:
|
||||
NoticeListView()
|
||||
|
||||
19
SodaLive/Sources/Extensions/AcceptLanguageDebugLogger.swift
Normal file
19
SodaLive/Sources/Extensions/AcceptLanguageDebugLogger.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// AcceptLanguageDebugLogger.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
#if DEBUG
|
||||
import Foundation
|
||||
import Moya
|
||||
|
||||
/// 디버그용: 각 요청 직전에 Accept-Language 헤더를 콘솔에 출력합니다.
|
||||
struct AcceptLanguageDebugLogger: PluginType {
|
||||
func willSend(_ request: RequestType, target: TargetType) {
|
||||
let header = request.request?.allHTTPHeaderFields?["Accept-Language"] ?? "<nil>"
|
||||
DEBUG_LOG("[Network] Accept-Language: \(header)")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -10,7 +10,15 @@ import Foundation
|
||||
|
||||
extension MoyaProvider {
|
||||
convenience init() {
|
||||
self.init(plugins: [AuthPlugin()])
|
||||
var plugins: [PluginType] = [
|
||||
AuthPlugin(),
|
||||
AcceptLanguagePlugin()
|
||||
]
|
||||
#if DEBUG
|
||||
plugins.append(NetworkLoggerPlugin(configuration: .init(logOptions: [.requestHeaders])))
|
||||
plugins.append(AcceptLanguageDebugLogger())
|
||||
#endif
|
||||
self.init(plugins: plugins)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ final class MyPageViewModel: ObservableObject {
|
||||
} else {
|
||||
UserDefaults.set(ContentType.MALE.rawValue, forKey: .contentPreference)
|
||||
}
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
|
||||
@@ -17,7 +17,7 @@ struct ContentSettingsView: View {
|
||||
|
||||
VStack(spacing: 0) {
|
||||
DetailNavigationBar(title: "콘텐츠 보기 설정") {
|
||||
if AppState.shared.isChangeAdultContentVisible {
|
||||
if AppState.shared.isRestartApp {
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
} else {
|
||||
AppState.shared.back()
|
||||
|
||||
@@ -12,7 +12,7 @@ final class ContentSettingsViewModel: ObservableObject {
|
||||
didSet {
|
||||
if oldValue != isAdultContentVisible {
|
||||
UserDefaults.set(isAdultContentVisible, forKey: .isAdultContentVisible)
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
|
||||
if !isAdultContentVisible {
|
||||
adultContentPreference = .ALL
|
||||
@@ -26,7 +26,7 @@ final class ContentSettingsViewModel: ObservableObject {
|
||||
didSet {
|
||||
if oldValue != adultContentPreference {
|
||||
UserDefaults.set(adultContentPreference.rawValue, forKey: .contentPreference)
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// LanguageOption.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum LanguageOption: String, CaseIterable, Equatable {
|
||||
case system
|
||||
case ko
|
||||
case en
|
||||
case ja
|
||||
|
||||
var displayName: String {
|
||||
switch self {
|
||||
case .system: return String(localized: "시스템 기본")
|
||||
case .ko: return "한국어"
|
||||
case .en: return "English"
|
||||
case .ja: return "日本語"
|
||||
}
|
||||
}
|
||||
|
||||
var headerCode: String? { self == .system ? nil : self.rawValue }
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// LanguageRepository.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol LanguageRepository {
|
||||
func load() async throws -> LanguageOption?
|
||||
func save(_ option: LanguageOption) async throws
|
||||
}
|
||||
|
||||
final class UserDefaultsLanguageRepository: LanguageRepository {
|
||||
private let key = "app.language"
|
||||
|
||||
func load() async throws -> LanguageOption? {
|
||||
try Task.checkCancellation()
|
||||
return await withCheckedContinuation { cont in
|
||||
let value = UserDefaults.standard.string(forKey: key)
|
||||
cont.resume(returning: value.flatMap { LanguageOption(rawValue: $0) })
|
||||
}
|
||||
}
|
||||
|
||||
func save(_ option: LanguageOption) async throws {
|
||||
try Task.checkCancellation()
|
||||
return await withCheckedContinuation { cont in
|
||||
UserDefaults.standard.set(option.rawValue, forKey: key)
|
||||
cont.resume()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// AcceptLanguagePlugin.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Moya
|
||||
|
||||
struct AcceptLanguagePlugin: PluginType {
|
||||
func prepare(_ request: URLRequest, target: TargetType) -> URLRequest {
|
||||
var req = request
|
||||
let code = LanguageHeaderProvider.current
|
||||
req.setValue(code, forHTTPHeaderField: "Accept-Language")
|
||||
return req
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// LanguageEnvironment.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class LanguageEnvironment: ObservableObject {
|
||||
@Published var locale: Locale = .current
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// LanguageService.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum LanguageHeaderProvider {
|
||||
private static let defaultsKey = "app.language"
|
||||
|
||||
// 현재 헤더 코드(ko|en|ja). 앱 시작 시 initialize()로 동기 설정.
|
||||
static var current: String = {
|
||||
// 초기값은 OS 선호 기반으로 계산
|
||||
return mapPreferredToSupported(Locale.preferredLanguages.first)
|
||||
}()
|
||||
|
||||
/// 앱 시작 직후 동기 초기화: 저장된 설정이 있으면 그 값을, 없으면 OS 선호를 사용.
|
||||
static func initialize() {
|
||||
if let raw = UserDefaults.standard.string(forKey: defaultsKey),
|
||||
let option = LanguageOption(rawValue: raw),
|
||||
option != .system {
|
||||
// 명시 선택 값
|
||||
current = option.rawValue
|
||||
return
|
||||
}
|
||||
// 시스템 기본 또는 저장값 없음 → OS 선호 매핑
|
||||
current = mapPreferredToSupported(Locale.preferredLanguages.first)
|
||||
}
|
||||
|
||||
private static func mapPreferredToSupported(_ tag: String?) -> String {
|
||||
guard let tag = tag else { return "en" }
|
||||
if tag.hasPrefix("ko") { return "ko" }
|
||||
if tag.hasPrefix("ja") { return "ja" }
|
||||
return "en"
|
||||
}
|
||||
}
|
||||
|
||||
actor LanguageService {
|
||||
private let repository: LanguageRepository
|
||||
private let environment: LanguageEnvironment
|
||||
|
||||
init(repository: LanguageRepository, environment: LanguageEnvironment) {
|
||||
self.repository = repository
|
||||
self.environment = environment
|
||||
}
|
||||
|
||||
func bootstrap() async {
|
||||
let saved = (try? await repository.load()) ?? .system
|
||||
await applyLanguage(saved)
|
||||
}
|
||||
|
||||
func applyLanguage(_ option: LanguageOption) async {
|
||||
do { try await repository.save(option) } catch { DEBUG_LOG("[Language] save failed: \(error)") }
|
||||
let locale = resolveLocale(option)
|
||||
let header = resolveHeader(option, locale: locale)
|
||||
LanguageHeaderProvider.current = header
|
||||
await MainActor.run { [weak environment] in
|
||||
environment?.locale = locale
|
||||
}
|
||||
DEBUG_LOG("[Language] changed to option=\(option.rawValue) locale=\(locale.identifier) header=\(header)")
|
||||
}
|
||||
|
||||
func currentLocale() async -> Locale {
|
||||
await MainActor.run { environment.locale }
|
||||
}
|
||||
|
||||
func currentLanguageCodeForHeader() async -> String { LanguageHeaderProvider.current }
|
||||
|
||||
// MARK: - Private
|
||||
private func resolveLocale(_ option: LanguageOption) -> Locale {
|
||||
switch option {
|
||||
case .system:
|
||||
guard let first = Locale.preferredLanguages.first else { return Locale(identifier: "en_US") }
|
||||
return mapToSupported(first)
|
||||
case .ko: return Locale(identifier: "ko_KR")
|
||||
case .en: return Locale(identifier: "en_US")
|
||||
case .ja: return Locale(identifier: "ja_JP")
|
||||
}
|
||||
}
|
||||
|
||||
private func resolveHeader(_ option: LanguageOption, locale: Locale) -> String {
|
||||
switch option {
|
||||
case .system:
|
||||
let id = locale.identifier
|
||||
if id.hasPrefix("ko") { return "ko" }
|
||||
if id.hasPrefix("ja") { return "ja" }
|
||||
return "en"
|
||||
case .ko: return "ko"
|
||||
case .en: return "en"
|
||||
case .ja: return "ja"
|
||||
}
|
||||
}
|
||||
|
||||
private func mapToSupported(_ tag: String) -> Locale {
|
||||
if tag.hasPrefix("ko") { return .init(identifier: "ko_KR") }
|
||||
if tag.hasPrefix("ja") { return .init(identifier: "ja_JP") }
|
||||
return .init(identifier: "en_US")
|
||||
}
|
||||
}
|
||||
|
||||
// Composition root for language feature
|
||||
enum LanguageContainer {
|
||||
static let environment = LanguageEnvironment()
|
||||
static let repository: LanguageRepository = UserDefaultsLanguageRepository()
|
||||
static let service = LanguageService(repository: repository, environment: environment)
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// LanguageSettingsViewModel.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class LanguageSettingsViewModel: ObservableObject {
|
||||
// 저장된(현재 적용된) 언어
|
||||
@Published var selected: LanguageOption = .system
|
||||
// 사용자가 화면에서 선택 중인 언어(적용 버튼 누르기 전 임시 상태)
|
||||
@Published var pending: LanguageOption = .system
|
||||
|
||||
private let service: LanguageService
|
||||
|
||||
init(service: LanguageService = LanguageContainer.service) {
|
||||
self.service = service
|
||||
}
|
||||
|
||||
func onAppear() {
|
||||
Task { await loadCurrent() }
|
||||
}
|
||||
|
||||
private func loadCurrent() async {
|
||||
let locale = await service.currentLocale()
|
||||
let option = map(locale: locale)
|
||||
await MainActor.run {
|
||||
self.selected = option
|
||||
self.pending = option
|
||||
}
|
||||
}
|
||||
|
||||
func select(_ option: LanguageOption) {
|
||||
// 즉시 저장/적용하지 않고, 사용자가 '적용' 버튼을 누를 때까지 대기
|
||||
self.pending = option
|
||||
}
|
||||
|
||||
/// 선택한 언어를 저장/적용하고, 앱을 소프트 재시작하여 즉시 반영
|
||||
func applyAndRestart() async {
|
||||
let toApply = pending
|
||||
await service.applyLanguage(toApply)
|
||||
await MainActor.run {
|
||||
self.selected = toApply
|
||||
// 앱 소프트 재시작(스플래시 -> 메인)
|
||||
AppState.shared.softRestart()
|
||||
}
|
||||
}
|
||||
|
||||
private func map(locale: Locale) -> LanguageOption {
|
||||
let id = locale.identifier
|
||||
if id.hasPrefix("ko") { return .ko }
|
||||
if id.hasPrefix("ja") { return .ja }
|
||||
if id.hasPrefix("en") { return .en }
|
||||
return .system
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// LanguageSettingsView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by Junie (AI) on 2025/12/16.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LanguageSettingsView: View {
|
||||
@StateObject private var viewModel = LanguageSettingsViewModel()
|
||||
|
||||
var body: some View {
|
||||
let cardWidth = screenSize().width - 26.7
|
||||
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 0) {
|
||||
DetailNavigationBar(title: String(localized: "언어 설정"))
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack(spacing: 0) {
|
||||
// List를 ScrollView 안에 두면 렌더링 이슈가 발생할 수 있어
|
||||
// 기본 체크마크(SF Symbols)로 커스텀 라디오 UI를 구성합니다.
|
||||
VStack(spacing: 0) {
|
||||
ForEach(Array(LanguageOption.allCases.enumerated()), id: \.offset) { idx, option in
|
||||
HStack(spacing: 0) {
|
||||
Text(option.displayName)
|
||||
.font(.custom(Font.preRegular.rawValue, size: 16))
|
||||
.foregroundColor(Color.grayee)
|
||||
Spacer()
|
||||
if viewModel.pending == option {
|
||||
Image(systemName: "checkmark")
|
||||
.font(.system(size: 16, weight: .semibold))
|
||||
.foregroundColor(Color.white)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 16.7)
|
||||
.frame(height: 50)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture { viewModel.select(option) }
|
||||
|
||||
if idx < LanguageOption.allCases.count - 1 {
|
||||
Rectangle()
|
||||
.frame(height: 0.3)
|
||||
.foregroundColor(Color.gray90)
|
||||
.padding(.leading, 16.7)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: cardWidth)
|
||||
.background(Color.gray22)
|
||||
.cornerRadius(6.7)
|
||||
.padding(.top, 26.7)
|
||||
|
||||
// 적용 버튼
|
||||
Button(action: {
|
||||
Task { await viewModel.applyAndRestart() }
|
||||
}) {
|
||||
Text(String(localized: "적용"))
|
||||
.font(.custom(Font.preBold.rawValue, size: 16))
|
||||
.frame(width: cardWidth, height: 50)
|
||||
.background(Color.button)
|
||||
.cornerRadius(6.7)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 26.7)
|
||||
}
|
||||
}
|
||||
}
|
||||
.task { viewModel.onAppear() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,28 @@ struct SettingsView: View {
|
||||
AppState.shared.setAppStep(step: .notificationSettings)
|
||||
}
|
||||
|
||||
Rectangle()
|
||||
.frame(width: cardWidth - 26.7, height: 0.3)
|
||||
.foregroundColor(Color.gray90)
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Text("언어 설정")
|
||||
.font(.custom(Font.bold.rawValue, size: 14.7))
|
||||
.foregroundColor(Color.grayee)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("ic_forward")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
.padding(.horizontal, 3.3)
|
||||
.frame(width: cardWidth - 26.7, height: 50)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .languageSettings)
|
||||
}
|
||||
|
||||
if UserDefaults.bool(forKey: .auth) {
|
||||
Rectangle()
|
||||
.frame(width: cardWidth - 26.7, height: 0.3)
|
||||
@@ -205,7 +227,7 @@ struct SettingsView: View {
|
||||
UserDefaults.reset()
|
||||
recentContentViewModel.truncate()
|
||||
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
}
|
||||
},
|
||||
@@ -227,7 +249,7 @@ struct SettingsView: View {
|
||||
viewModel.logoutAllDevice {
|
||||
self.isShowLogoutAllDeviceDialog = false
|
||||
UserDefaults.reset()
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@ final class SignOutViewModel: ObservableObject {
|
||||
|
||||
if decoded.success {
|
||||
UserDefaults.reset()
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
|
||||
@@ -64,7 +64,7 @@ struct SplashView: View {
|
||||
}
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
AppState.shared.isChangeAdultContentVisible = false
|
||||
AppState.shared.isRestartApp = false
|
||||
}
|
||||
fetchLastestVersion()
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ final class LoginViewModel: ObservableObject {
|
||||
UserDefaults.set(data.email, forKey: .email)
|
||||
UserDefaults.set(data.token, forKey: .token)
|
||||
self.appViewModel.fetchAndUpdateIdfa()
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
|
||||
@@ -61,7 +61,7 @@ final class SignUpViewModel: ObservableObject {
|
||||
UserDefaults.set(data.email, forKey: .email)
|
||||
UserDefaults.set(data.token, forKey: .token)
|
||||
self.appViewModel.fetchAndUpdateIdfa()
|
||||
AppState.shared.isChangeAdultContentVisible = true
|
||||
AppState.shared.isRestartApp = true
|
||||
AppState.shared.setAppStep(step: .splash)
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
|
||||
Reference in New Issue
Block a user