- 룰렛 돌리기 API 연동

- 룰렛 돌린 결과 전송
This commit is contained in:
Yu Sung
2023-12-07 04:29:03 +09:00
parent 5682adf967
commit 0af16ac000
8 changed files with 333 additions and 3 deletions

View File

@@ -8,7 +8,7 @@
import Foundation
enum LiveRoomChatType: String {
case CHAT, DONATION, JOIN
case CHAT, DONATION, JOIN, ROULETTE_DONATION
}
protocol LiveRoomChat {
@@ -35,6 +35,14 @@ struct LiveRoomDonationChat: LiveRoomChat {
var type: LiveRoomChatType = .DONATION
}
struct LiveRoomRouletteDonationChat: LiveRoomChat {
let profileUrl: String
let nickname: String
let rouletteResult: String
var type: LiveRoomChatType = .ROULETTE_DONATION
}
struct LiveRoomJoinChat: LiveRoomChat {
let nickname: String

View File

@@ -9,7 +9,7 @@ import Foundation
struct LiveRoomChatRawMessage: Codable {
enum LiveRoomChatRawMessageType: String, Codable {
case DONATION, EDIT_ROOM_INFO, SET_MANAGER, TOGGLE_ROULETTE
case DONATION, EDIT_ROOM_INFO, SET_MANAGER, TOGGLE_ROULETTE, ROULETTE_DONATION
}
let type: LiveRoomChatRawMessageType

View File

@@ -0,0 +1,64 @@
//
// LiveRoomRouletteDonationChatItemView.swift
// SodaLive
//
// Created by klaus on 2023/12/07.
//
import SwiftUI
import Kingfisher
struct LiveRoomRouletteDonationChatItemView: View {
let chatMessage: LiveRoomRouletteDonationChat
var body: some View {
HStack(spacing: 13.3) {
ZStack(alignment: .bottomTrailing) {
KFImage(URL(string: chatMessage.profileUrl))
.resizable()
.scaledToFill()
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipped()
.cornerRadius(23.3)
Image("ic_roulette")
.resizable()
.frame(width: 20, height: 20)
}
VStack(alignment: .leading, spacing: 6.7) {
HStack(spacing: 0) {
Text(chatMessage.nickname)
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(.white)
Text("님의 룰렛 결과?")
.font(.custom(Font.light.rawValue, size: 12))
.foregroundColor(.white)
}
HStack(spacing: 0) {
Text("[\(chatMessage.rouletteResult)]")
.font(.custom(Font.medium.rawValue, size: 13))
.foregroundColor(Color(hex: "ffe500"))
Text(" 당첨!")
.font(.custom(Font.medium.rawValue, size: 13))
.foregroundColor(.white)
}
}
}
.padding(13)
.frame(width: screenSize().width - 86, alignment: .leading)
.background(Color(hex: "c25264"))
.cornerRadius(10)
.padding(.leading, 20)
}
}
struct LiveRoomRouletteDonationChatItemView_Previews: PreviewProvider {
static var previews: some View {
LiveRoomRouletteDonationChatItemView(chatMessage: LiveRoomRouletteDonationChat(profileUrl: "", nickname: "유저일", rouletteResult: "옵션1"))
}
}