채금 기능 추가

This commit is contained in:
Yu Sung
2023-10-11 19:25:12 +09:00
parent 91c43e679f
commit 282ee73de1
8 changed files with 309 additions and 26 deletions

View File

@@ -0,0 +1,85 @@
//
// LiveRoomNoChattingDialogView.swift
// SodaLive
//
// Created by klaus on 2023/10/11.
//
import SwiftUI
import Kingfisher
struct LiveRoomNoChattingDialogView: View {
let nickname: String
let profileUrl: String
let confirmAction: () -> Void
let cancelAction: () -> Void
var body: some View {
ZStack {
Color.black
.opacity(0.5)
.frame(width: screenSize().width, height: screenSize().height)
VStack(spacing: 21) {
Text("채팅금지")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "bbbbbb"))
HStack(spacing: 8) {
KFImage(URL(string: profileUrl))
.resizable()
.frame(width: 26.7, height: 26.7)
Text(nickname)
.font(.custom(Font.medium.rawValue, size: 16.7))
.foregroundColor(Color(hex: "bbbbbb"))
}
Text("3분간 채팅금지를 하겠습니까?")
.font(.custom(Font.medium.rawValue, size: 15))
.foregroundColor(Color(hex: "bbbbbb"))
HStack(spacing: 13.3) {
Text("취소")
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "9970ff"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 80) / 2)
.background(Color(hex: "9970ff").opacity(0.13))
.cornerRadius(8)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(Color(hex: "9970ff"), lineWidth: 1)
)
.onTapGesture { cancelAction() }
Text("확인")
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "ffffff"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 80) / 2)
.background(Color(hex: "9970ff"))
.cornerRadius(8)
.onTapGesture { confirmAction() }
}
}
.padding(.top, 40)
.padding(.bottom, 16.7)
.padding(.horizontal, 16.7)
.background(Color(hex: "222222"))
.cornerRadius(10)
}
}
}
struct LiveRoomNoChattingDialogView_Previews: PreviewProvider {
static var previews: some View {
LiveRoomNoChattingDialogView(
nickname: "닉네임",
profileUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
confirmAction: {},
cancelAction: {}
)
}
}

View File

@@ -74,6 +74,7 @@ struct LiveRoomProfileItemMasterView: View {
struct LiveRoomProfileItemUserView: View {
let isStaff: Bool
let userId: Int
let creatorId: Int
let nickname: String
let profileUrl: String
let role: LiveRoomMemberRole
@@ -82,6 +83,7 @@ struct LiveRoomProfileItemUserView: View {
let onClickInviteSpeaker: (Int) -> Void
let onClickKickOut: (Int) -> Void
let onClickProfile: (Int) -> Void
let onClickNoChatting: (Int, String, String) -> Void
var body: some View {
ZStack {
@@ -145,6 +147,25 @@ struct LiveRoomProfileItemUserView: View {
}
}
if role != .MANAGER && creatorId == UserDefaults.int(forKey: .userId) {
Text("채금")
.font(.custom(Font.medium.rawValue, size: 10))
.foregroundColor(Color(hex: "ffffff"))
.padding(.horizontal, 5.5)
.padding(.vertical, 12)
.background(Color(hex: "9970ff").opacity(0.3))
.cornerRadius(6.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color(hex: "9970ff"), lineWidth: 1)
)
.cornerRadius(6.7)
.padding(.leading, 10)
.onTapGesture {
onClickNoChatting(userId, nickname, profileUrl)
}
}
if role != .MANAGER && isStaff {
Image("ic_kick_out")
.padding(.leading, 10)

View File

@@ -24,7 +24,8 @@ struct LiveRoomProfilesDialogView: View {
roomInfo: GetRoomInfoResponse,
registerNotification: @escaping () -> Void,
unRegisterNotification: @escaping () -> Void,
onClickProfile: @escaping (Int) -> Void
onClickProfile: @escaping (Int) -> Void,
onClickNoChatting: @escaping (Int, String, String) -> Void
) {
self._isShowing = isShowing
self.viewModel = viewModel
@@ -52,13 +53,15 @@ struct LiveRoomProfilesDialogView: View {
LiveRoomProfileItemUserView(
isStaff: isStaff ,
userId: manager.id,
creatorId: roomInfo.creatorId,
nickname: manager.nickname,
profileUrl: manager.profileImage,
role: manager.role,
onClickChangeListener: { _ in },
onClickInviteSpeaker: { _ in },
onClickKickOut: { _ in },
onClickProfile: onClickProfile
onClickProfile: onClickProfile,
onClickNoChatting: { _, _, _ in }
)
)
)
@@ -96,6 +99,7 @@ struct LiveRoomProfilesDialogView: View {
LiveRoomProfileItemUserView(
isStaff: isStaff,
userId: speaker.id,
creatorId: roomInfo.creatorId,
nickname: speaker.nickname,
profileUrl: speaker.profileImage,
role: speaker.role,
@@ -112,7 +116,8 @@ struct LiveRoomProfilesDialogView: View {
viewModel.kickOutId = $0
viewModel.isShowKickOutPopup = true
},
onClickProfile: onClickProfile
onClickProfile: onClickProfile,
onClickNoChatting: onClickNoChatting
)
)
)
@@ -137,6 +142,7 @@ struct LiveRoomProfilesDialogView: View {
LiveRoomProfileItemUserView(
isStaff: isStaff,
userId: listener.id,
creatorId: roomInfo.creatorId,
nickname: listener.nickname,
profileUrl: listener.profileImage,
role: listener.role,
@@ -155,7 +161,8 @@ struct LiveRoomProfilesDialogView: View {
viewModel.kickOutId = $0
viewModel.isShowKickOutPopup = true
},
onClickProfile: onClickProfile
onClickProfile: onClickProfile,
onClickNoChatting: onClickNoChatting
)
)
)

View File

@@ -23,6 +23,7 @@ struct LiveRoomUserProfileDialogView: View {
let onClickInviteSpeaker: (Int) -> Void
let onClickChangeListener: (Int) -> Void
let onClickMenu: (Int, String, Bool) -> Void
let onClickNoChatting: (Int, String, String) -> Void
var body: some View {
ZStack {
@@ -210,6 +211,22 @@ struct LiveRoomUserProfileDialogView: View {
.fixedSize(horizontal: false, vertical: true)
.padding(.top, 21.3)
if let _ = userProfile.isManager {
Text("3분간 채팅금지")
.font(.custom(Font.bold.rawValue, size: 15))
.foregroundColor(Color(hex: "9970ff"))
.frame(maxWidth: .infinity)
.padding(.vertical, 13)
.cornerRadius(8)
.overlay(
RoundedRectangle(cornerRadius: 8)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "9970ff"))
)
.onTapGesture { onClickNoChatting(userProfile.userId, userProfile.nickname, userProfile.profileUrl) }
.padding(.top, 21.3)
}
Text(userProfile.tags)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "9970ff"))