라이브 생성 문구를 I18n으로 이동한다

라이브 생성 화면 문구를 다국어 리소스로 통합한다.\n공지 입력 검증을 5자 이상으로 적용한다.
This commit is contained in:
Yu Sung
2025-12-18 15:25:13 +09:00
parent 8efa89d564
commit 982a17bb41
4 changed files with 67 additions and 31 deletions

View File

@@ -161,10 +161,10 @@ struct LiveRoomCreateView: View {
.frame(width: screenSize().width - 26.7, alignment: .leading)
HStack(spacing: 13.3) {
SelectedButtonView(title: "가능", isActive: true, isSelected: viewModel.isAvailableJoinCreator)
SelectedButtonView(title: I18n.CreateLive.joinAllowed, isActive: true, isSelected: viewModel.isAvailableJoinCreator)
.onTapGesture { viewModel.isAvailableJoinCreator = true }
SelectedButtonView(title: "불가능", isActive: true, isSelected: !viewModel.isAvailableJoinCreator)
SelectedButtonView(title: I18n.CreateLive.joinNotAllowed, isActive: true, isSelected: !viewModel.isAvailableJoinCreator)
.onTapGesture { viewModel.isAvailableJoinCreator = false }
}
}
@@ -374,7 +374,7 @@ struct LiveRoomCreateView: View {
TextViewWrapper(
text: $viewModel.content,
placeholder: viewModel.placeholder,
placeholder: I18n.CreateLive.noticePlaceholder,
textColorHex: "eeeeee",
backgroundColorHex: "303030"
)
@@ -394,13 +394,13 @@ struct LiveRoomCreateView: View {
HStack(spacing: 13.3) {
TimeSettingSelectButton(
title: "지금 즉시",
title: I18n.CreateLive.startNow,
timeSettingMode: .NOW,
buttonWidth: (screenSize().width - 40) / 2
)
TimeSettingSelectButton(
title: "예약 설정",
title: I18n.CreateLive.schedule,
timeSettingMode: .RESERVATION,
buttonWidth: (screenSize().width - 40) / 2
)
@@ -587,13 +587,13 @@ struct LiveRoomCreateView: View {
HStack(spacing: 13.3) {
RoomTypeSelectButton(
title: "공개",
title: I18n.CreateLive.publicRoom,
type: .OPEN,
buttonWidth: (screenSize().width - 40) / 2
)
RoomTypeSelectButton(
title: "비공개",
title: I18n.CreateLive.privateRoom,
type: .PRIVATE,
buttonWidth: (screenSize().width - 40) / 2
)
@@ -663,13 +663,13 @@ struct LiveRoomCreateView: View {
HStack(spacing: 13.3) {
AdultSettingSelectButton(
title: "전체 연령",
title: I18n.CreateLive.allAges,
isAdult: false,
buttonWidth: (screenSize().width - 40) / 2
)
AdultSettingSelectButton(
title: "19세 이상",
title: I18n.CreateLive.over19,
isAdult: true,
buttonWidth: (screenSize().width - 40) / 2
)

View File

@@ -107,8 +107,6 @@ final class LiveRoomCreateViewModel: ObservableObject {
var coverImagePath: String? = nil
let placeholder = "라이브 공지를 입력하세요"
func getRecentInfo() {
isLoading = true
@@ -137,7 +135,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
self.coverImagePath = data.coverImagePath
self.numberOfPeople = String(data.numberOfPeople)
self.errorMessage = "최근데이터를 불러왔습니다."
self.errorMessage = I18n.CreateLive.recentDataLoaded
self.isShowPopup = true
self.isShowGetRecentInfoButton = false
}
@@ -146,7 +144,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
if let message = decoded.message {
self.errorMessage = message
} else {
self.errorMessage = "최근데이터를 불러오지 못했습니다.\n다시 시도해 주세요."
self.errorMessage = I18n.CreateLive.recentDataLoadFailed
}
self.isShowPopup = true
@@ -155,7 +153,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
} catch {
print(error)
DispatchQueue.main.async {
self.errorMessage = "최근데이터를 불러오지 못했습니다.\n다시 시도해 주세요."
self.errorMessage = I18n.CreateLive.recentDataLoadFailed
self.isShowPopup = true
}
}
@@ -170,7 +168,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
var request = CreateLiveRoomRequest(
title: title,
content: content.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? content : "",
content: content.trimmingCharacters(in: .whitespacesAndNewlines) != I18n.CreateLive.noticePlaceholder ? content : "",
coverImageUrl: coverImagePath,
tags: tags,
numberOfPeople: Int(numberOfPeople)!,
@@ -231,19 +229,19 @@ final class LiveRoomCreateViewModel: ObservableObject {
if let message = decoded.message {
self.errorMessage = message
} else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
}
self.isShowPopup = true
}
} catch {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
self.isShowPopup = true
}
}
.store(in: &subscription)
} else {
self.errorMessage = "라이브을 만들지 못했습니다.\n다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.CreateLive.createLiveFailedGeneric
self.isShowPopup = true
self.isLoading = false
}
@@ -252,13 +250,13 @@ final class LiveRoomCreateViewModel: ObservableObject {
func selectMenuPreset(selectedMenuPreset: SelectedMenu) {
if menuList.isEmpty && (selectedMenuPreset == .MENU_2 || selectedMenuPreset == .MENU_3) {
errorMessage = "메뉴 1을 먼저 설정하세요"
errorMessage = I18n.MissionMenu.needMenu1First
isShowPopup = true
return
}
if menuList.count == 1 && selectedMenuPreset == .MENU_3 {
errorMessage = "메뉴 1과 메뉴 2를 먼저 설정하세요"
errorMessage = I18n.MissionMenu.needMenu1And2First
isShowPopup = true
return
}
@@ -304,13 +302,13 @@ final class LiveRoomCreateViewModel: ObservableObject {
if let message = decoded.message {
self.errorMessage = message
} else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
}
self.isShowPopup = true
}
} catch {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
self.isShowPopup = true
}
}
@@ -319,32 +317,32 @@ final class LiveRoomCreateViewModel: ObservableObject {
private func validate() -> Bool {
if coverImage == nil && coverImagePath == nil {
self.errorMessage = "커버이미지를 선택해주세요."
self.errorMessage = I18n.CreateLive.selectCoverImage
self.isShowPopup = true
return false
}
if title.trimmingCharacters(in: .whitespaces).isEmpty {
self.errorMessage = "제목을 입력해 주세요."
self.errorMessage = I18n.CreateLive.enterTitle
self.isShowPopup = true
return false
}
let notice = content.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? content : ""
if notice.isEmpty && notice.count < 5 {
self.errorMessage = "공지를 5자 이상 입력해주세요."
let notice = content.trimmingCharacters(in: .whitespacesAndNewlines) != I18n.CreateLive.noticePlaceholder ? content : ""
if notice.isEmpty || notice.count < 5 {
self.errorMessage = I18n.CreateLive.enterNoticeMin5
self.isShowPopup = true
return false
}
guard let numberOfPeople = Int(numberOfPeople), (numberOfPeople >= 3 && numberOfPeople <= 999) else {
self.errorMessage = "인원을 3~999명 사이로 입력해주세요."
self.errorMessage = I18n.CreateLive.enterPeopleRange
self.isShowPopup = true
return false
}
if roomType == .PRIVATE && (password.trimmingCharacters(in: .whitespaces).isEmpty || password.count != 6) {
self.errorMessage = "방 입장 비밀번호 6자리를 입력해 주세요."
self.errorMessage = I18n.CreateLive.enterPassword6
self.isShowPopup = true
return false
}

View File

@@ -79,7 +79,7 @@ struct LiveRoomCreateTagView: View {
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(
selectedTags.contains(tag.tag) ?
Color(hex: "9970ff") :
Color.button :
Color(hex: "bbbbbb")
)
}
@@ -105,7 +105,7 @@ struct LiveRoomCreateTagView: View {
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(width: screenSize().width - 26.7)
.background(Color(hex: "9970ff"))
.background(Color.button)
.cornerRadius(10)
.padding(.bottom, 26.7)
.onTapGesture {