feat(live-room): 채팅창 얼리기 기능을 추가한다
채팅 입력 제어와 룸 상태 동기화를 통합해 지연 입장자도 동일 상태를 적용한다.
This commit is contained in:
@@ -46,6 +46,12 @@ struct LiveRoomRouletteDonationChat: LiveRoomChat {
|
||||
|
||||
struct LiveRoomJoinChat: LiveRoomChat {
|
||||
let nickname: String
|
||||
let statusMessage: String?
|
||||
|
||||
var type: LiveRoomChatType = .JOIN
|
||||
|
||||
init(nickname: String, statusMessage: String? = nil) {
|
||||
self.nickname = nickname
|
||||
self.statusMessage = statusMessage
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import Foundation
|
||||
|
||||
struct LiveRoomChatRawMessage: Codable {
|
||||
enum LiveRoomChatRawMessageType: String, Codable {
|
||||
case DONATION, SECRET_DONATION, EDIT_ROOM_INFO, SET_MANAGER, TOGGLE_ROULETTE, ROULETTE_DONATION
|
||||
case DONATION, SECRET_DONATION, EDIT_ROOM_INFO, SET_MANAGER, TOGGLE_ROULETTE, TOGGLE_CHAT_FREEZE, ROULETTE_DONATION
|
||||
case HEART_DONATION, BIG_HEART_DONATION
|
||||
}
|
||||
|
||||
@@ -20,4 +20,5 @@ struct LiveRoomChatRawMessage: Codable {
|
||||
var signatureImageUrl: String? = nil
|
||||
let donationMessage: String?
|
||||
var isActiveRoulette: Bool? = nil
|
||||
var isChatFrozen: Bool? = nil
|
||||
}
|
||||
|
||||
@@ -12,18 +12,27 @@ struct LiveRoomJoinChatItemView: View {
|
||||
let chatMessage: LiveRoomJoinChat
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
Text("'")
|
||||
.appFont(size: 12)
|
||||
.foregroundColor(Color.grayee)
|
||||
|
||||
Text(chatMessage.nickname)
|
||||
.appFont(size: 12, weight: .bold)
|
||||
.foregroundColor(Color.mainYellow)
|
||||
|
||||
Text("'님이 입장하셨습니다.")
|
||||
.appFont(size: 12)
|
||||
.foregroundColor(Color.grayee)
|
||||
Group {
|
||||
if let statusMessage = chatMessage.statusMessage,
|
||||
!statusMessage.isEmpty {
|
||||
Text(statusMessage)
|
||||
.appFont(size: 12)
|
||||
.foregroundColor(Color.grayee)
|
||||
} else {
|
||||
HStack(spacing: 0) {
|
||||
Text("'")
|
||||
.appFont(size: 12)
|
||||
.foregroundColor(Color.grayee)
|
||||
|
||||
Text(chatMessage.nickname)
|
||||
.appFont(size: 12, weight: .bold)
|
||||
.foregroundColor(Color.mainYellow)
|
||||
|
||||
Text("'님이 입장하셨습니다.")
|
||||
.appFont(size: 12)
|
||||
.foregroundColor(Color.grayee)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 6.7)
|
||||
.frame(width: screenSize().width - 86)
|
||||
|
||||
Reference in New Issue
Block a user