라이브 룰렛

- 룰렛 설정 아이콘 추가
- 룰렛 돌리기 아이콘 추가
This commit is contained in:
Yu Sung 2023-12-05 12:48:50 +09:00
parent 4de4f997e6
commit 9622e9b55d
7 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_roulette.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_roulette_settings.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -24,6 +24,7 @@ struct GetRoomInfoResponse: Decodable {
let listenerList: [LiveRoomMember]
let managerList: [LiveRoomMember]
let donationRankingTop3UserIds: [Int]
let isActiveRoulette: Bool
let isPrivateRoom: Bool
let password: String?
}

View File

@ -307,6 +307,26 @@ struct LiveRoomView: View {
}
VStack(spacing: 13.3) {
if let liveRoomInfo = viewModel.liveRoomInfo {
if liveRoomInfo.creatorId == UserDefaults.int(forKey: .userId) {
Image("ic_roulette_settings")
.resizable()
.frame(width: 26.7, height: 26.7)
.padding(11)
.background(Color(hex: "525252").opacity(0.6))
.cornerRadius(10)
.padding(.bottom, 13.3)
} else if liveRoomInfo.creatorId != UserDefaults.int(forKey: .userId) && viewModel.isActiveRoulette {
Image("ic_roulette")
.resizable()
.frame(width: 26.7, height: 26.7)
.padding(11)
.background(Color(hex: "525252").opacity(0.6))
.cornerRadius(10)
.padding(.bottom, 13.3)
}
}
if viewModel.role == .SPEAKER {
Image(viewModel.isMute ? "ic_mic_off" : "ic_mic_on")
.resizable()

View File

@ -132,6 +132,8 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
@Published var isNoChatting = false
@Published var remainingNoChattingTime = 0
@Published var isActiveRoulette = false
var timer: DispatchSourceTimer?
func setOriginOffset(_ offset: CGFloat) {
@ -243,6 +245,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
if let data = decoded.data, decoded.success {
self.liveRoomInfo = data
self.isActiveRoulette = data.isActiveRoulette
self.isLoading = true
self.agora.joinChannel(
roomInfo: data,