시그니처 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 isBgOn = true
@Published var isSignatureOn = true
@Published var donationStatus: GetLiveRoomDonationStatusResponse?
@Published private(set) var offset: CGFloat = 0

View File

@ -15,6 +15,7 @@ struct LiveRoomInfoGuestView: View {
let isOnBg: Bool
let isOnNotice: Bool
let isOnMenuPan: Bool
let isOnSignature: Bool
let isShowMenuPanButton: Bool
let creatorId: Int
@ -36,6 +37,7 @@ struct LiveRoomInfoGuestView: View {
let onClickMenuPan: () -> Void
let onClickTotalDonation: () -> Void
let onClickChangeListener: () -> Void
let onClickToggleSignature: () -> Void
var body: some View {
ZStack {
@ -61,6 +63,18 @@ struct LiveRoomInfoGuestView: View {
) { 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(
isOn: isOnBg,
onText: "배경 ON",
@ -181,6 +195,7 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider {
isOnBg: true,
isOnNotice: false,
isOnMenuPan: false,
isOnSignature: false,
isShowMenuPanButton: false,
creatorId: 1,
creatorNickname: "도화",
@ -217,7 +232,8 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider {
onClickNotice: {},
onClickMenuPan: {},
onClickTotalDonation: {},
onClickChangeListener: {}
onClickChangeListener: {},
onClickToggleSignature: {}
)
}
}

View File

@ -17,6 +17,7 @@ struct LiveRoomInfoHostView: View {
let isOnBg: Bool
let isOnNotice: Bool
let isOnMenuPan: Bool
let isOnSignature: Bool
let isShowMenuPanButton: Bool
let creatorId: Int
@ -37,6 +38,7 @@ struct LiveRoomInfoHostView: View {
let onClickMenuPan: () -> Void
let onClickTotalDonation: () -> Void
let onClickParticipants: () -> Void
let onClickToggleSignature: () -> Void
var body: some View {
ZStack {
@ -52,6 +54,18 @@ struct LiveRoomInfoHostView: View {
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(
isOn: isOnBg,
onText: "배경 ON",
@ -197,6 +211,7 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider {
isOnBg: true,
isOnNotice: true,
isOnMenuPan: false,
isOnSignature: false,
isShowMenuPanButton: false,
creatorId: 1,
creatorNickname: "도화",
@ -232,7 +247,8 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider {
onClickNotice: {},
onClickMenuPan: {},
onClickTotalDonation: {},
onClickParticipants: {}
onClickParticipants: {},
onClickToggleSignature: {}
)
}
}

View File

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