시그니처 ON/OFF 버튼 추가

This commit is contained in:
Yu Sung 2024-05-02 14:45:54 +09:00
parent 3d625a4fa0
commit 86f0d466fa
4 changed files with 45 additions and 4 deletions

View File

@ -119,6 +119,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
@Published var noticeViewHeight: CGFloat = UIFont.systemFontSize @Published var noticeViewHeight: CGFloat = UIFont.systemFontSize
@Published var isBgOn = true @Published var isBgOn = true
@Published var isSignatureOn = true
@Published var donationStatus: GetLiveRoomDonationStatusResponse? @Published var donationStatus: GetLiveRoomDonationStatusResponse?
@Published private(set) var offset: CGFloat = 0 @Published private(set) var offset: CGFloat = 0

View File

@ -15,6 +15,7 @@ struct LiveRoomInfoGuestView: View {
let isOnBg: Bool let isOnBg: Bool
let isOnNotice: Bool let isOnNotice: Bool
let isOnMenuPan: Bool let isOnMenuPan: Bool
let isOnSignature: Bool
let isShowMenuPanButton: Bool let isShowMenuPanButton: Bool
let creatorId: Int let creatorId: Int
@ -36,6 +37,7 @@ struct LiveRoomInfoGuestView: View {
let onClickMenuPan: () -> Void let onClickMenuPan: () -> Void
let onClickTotalDonation: () -> Void let onClickTotalDonation: () -> Void
let onClickChangeListener: () -> Void let onClickChangeListener: () -> Void
let onClickToggleSignature: () -> Void
var body: some View { var body: some View {
ZStack { ZStack {
@ -61,6 +63,18 @@ struct LiveRoomInfoGuestView: View {
) { onClickChangeListener() } ) { onClickChangeListener() }
} }
LiveRoomOverlayStrokeTextToggleButton(
isOn: isOnSignature,
onText: "시그니처 ON",
onTextColor: Color.button,
onStrokeColor: Color.button,
offText: "시그니처 OFF",
offTextColor: Color.graybb,
offStrokeColor: Color.graybb,
strokeWidth: 1,
strokeCornerRadius: 5.3
) { onClickToggleSignature() }
LiveRoomOverlayStrokeTextToggleButton( LiveRoomOverlayStrokeTextToggleButton(
isOn: isOnBg, isOn: isOnBg,
onText: "배경 ON", onText: "배경 ON",
@ -181,6 +195,7 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider {
isOnBg: true, isOnBg: true,
isOnNotice: false, isOnNotice: false,
isOnMenuPan: false, isOnMenuPan: false,
isOnSignature: false,
isShowMenuPanButton: false, isShowMenuPanButton: false,
creatorId: 1, creatorId: 1,
creatorNickname: "도화", creatorNickname: "도화",
@ -217,7 +232,8 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider {
onClickNotice: {}, onClickNotice: {},
onClickMenuPan: {}, onClickMenuPan: {},
onClickTotalDonation: {}, onClickTotalDonation: {},
onClickChangeListener: {} onClickChangeListener: {},
onClickToggleSignature: {}
) )
} }
} }

View File

@ -17,6 +17,7 @@ struct LiveRoomInfoHostView: View {
let isOnBg: Bool let isOnBg: Bool
let isOnNotice: Bool let isOnNotice: Bool
let isOnMenuPan: Bool let isOnMenuPan: Bool
let isOnSignature: Bool
let isShowMenuPanButton: Bool let isShowMenuPanButton: Bool
let creatorId: Int let creatorId: Int
@ -37,6 +38,7 @@ struct LiveRoomInfoHostView: View {
let onClickMenuPan: () -> Void let onClickMenuPan: () -> Void
let onClickTotalDonation: () -> Void let onClickTotalDonation: () -> Void
let onClickParticipants: () -> Void let onClickParticipants: () -> Void
let onClickToggleSignature: () -> Void
var body: some View { var body: some View {
ZStack { ZStack {
@ -52,6 +54,18 @@ struct LiveRoomInfoHostView: View {
Spacer() Spacer()
LiveRoomOverlayStrokeTextToggleButton(
isOn: isOnSignature,
onText: "시그니처 ON",
onTextColor: Color.button,
onStrokeColor: Color.button,
offText: "시그니처 OFF",
offTextColor: Color.graybb,
offStrokeColor: Color.graybb,
strokeWidth: 1,
strokeCornerRadius: 5.3
) { onClickToggleSignature() }
LiveRoomOverlayStrokeTextToggleButton( LiveRoomOverlayStrokeTextToggleButton(
isOn: isOnBg, isOn: isOnBg,
onText: "배경 ON", onText: "배경 ON",
@ -197,6 +211,7 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider {
isOnBg: true, isOnBg: true,
isOnNotice: true, isOnNotice: true,
isOnMenuPan: false, isOnMenuPan: false,
isOnSignature: false,
isShowMenuPanButton: false, isShowMenuPanButton: false,
creatorId: 1, creatorId: 1,
creatorNickname: "도화", creatorNickname: "도화",
@ -232,7 +247,8 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider {
onClickNotice: {}, onClickNotice: {},
onClickMenuPan: {}, onClickMenuPan: {},
onClickTotalDonation: {}, onClickTotalDonation: {},
onClickParticipants: {} onClickParticipants: {},
onClickToggleSignature: {}
) )
} }
} }

View File

@ -30,6 +30,7 @@ struct LiveRoomViewV2: View {
isOnBg: viewModel.isBgOn, isOnBg: viewModel.isBgOn,
isOnNotice: viewModel.isShowNotice, isOnNotice: viewModel.isShowNotice,
isOnMenuPan: viewModel.isShowMenuPan, isOnMenuPan: viewModel.isShowMenuPan,
isOnSignature: viewModel.isSignatureOn,
isShowMenuPanButton: !liveRoomInfo.menuPan.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, isShowMenuPanButton: !liveRoomInfo.menuPan.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty,
creatorId: liveRoomInfo.creatorId, creatorId: liveRoomInfo.creatorId,
creatorNickname: liveRoomInfo.creatorNickname, creatorNickname: liveRoomInfo.creatorNickname,
@ -66,6 +67,9 @@ struct LiveRoomViewV2: View {
}, },
onClickParticipants: { onClickParticipants: {
viewModel.isShowProfileList = true viewModel.isShowProfileList = true
},
onClickToggleSignature: {
viewModel.isSignatureOn.toggle()
} }
) )
} else { } else {
@ -75,6 +79,7 @@ struct LiveRoomViewV2: View {
isOnBg: viewModel.isBgOn, isOnBg: viewModel.isBgOn,
isOnNotice: viewModel.isShowNotice, isOnNotice: viewModel.isShowNotice,
isOnMenuPan: viewModel.isShowMenuPan, isOnMenuPan: viewModel.isShowMenuPan,
isOnSignature: viewModel.isSignatureOn,
isShowMenuPanButton: !liveRoomInfo.menuPan.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty, isShowMenuPanButton: !liveRoomInfo.menuPan.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty,
creatorId: liveRoomInfo.creatorId, creatorId: liveRoomInfo.creatorId,
creatorNickname: liveRoomInfo.creatorNickname, creatorNickname: liveRoomInfo.creatorNickname,
@ -116,6 +121,9 @@ struct LiveRoomViewV2: View {
}, },
onClickChangeListener: { onClickChangeListener: {
viewModel.setListener() viewModel.setListener()
},
onClickToggleSignature: {
viewModel.isSignatureOn.toggle()
} }
) )
} }
@ -258,7 +266,7 @@ struct LiveRoomViewV2: View {
}.padding(.bottom, 70) }.padding(.bottom, 70)
} }
if viewModel.signatureImageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 { if viewModel.isSignatureOn && viewModel.signatureImageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 {
VStack { VStack {
Spacer() Spacer()
@ -273,7 +281,7 @@ struct LiveRoomViewV2: View {
} }
} }
if let signature = viewModel.signature { if let signature = viewModel.signature, viewModel.isSignatureOn {
VStack { VStack {
Spacer() Spacer()