feat(live-room): 하트를 길게(2초)간 누르면 표시 되는 왕하트(100캔) 추가, 애니메이션 제외
This commit is contained in:
@@ -11,6 +11,20 @@ struct LiveRoomRightBottomButton: View {
|
||||
|
||||
let imageName: String
|
||||
let onClick: () -> Void
|
||||
let onLongPress: (() -> Void)?
|
||||
let longPressDuration: Double
|
||||
|
||||
init(
|
||||
imageName: String,
|
||||
onClick: @escaping () -> Void,
|
||||
onLongPress: (() -> Void)? = nil,
|
||||
longPressDuration: Double = 2.0
|
||||
) {
|
||||
self.imageName = imageName
|
||||
self.onClick = onClick
|
||||
self.onLongPress = onLongPress
|
||||
self.longPressDuration = longPressDuration
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Image(imageName)
|
||||
@@ -20,6 +34,9 @@ struct LiveRoomRightBottomButton: View {
|
||||
.background(Color.gray52.opacity(0.6))
|
||||
.cornerRadius(10)
|
||||
.onTapGesture { onClick() }
|
||||
.onLongPressGesture(minimumDuration: longPressDuration) {
|
||||
onLongPress?()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +44,8 @@ struct LiveRoomRightBottomButton_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LiveRoomRightBottomButton(
|
||||
imageName: "ic_donation",
|
||||
onClick: {}
|
||||
onClick: {},
|
||||
onLongPress: {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
|
||||
struct LiveRoomLikeHeartRequest: Encodable {
|
||||
let roomId: Int
|
||||
let heartCount: Int
|
||||
let container: String = "ios"
|
||||
}
|
||||
|
||||
@@ -253,7 +253,8 @@ struct LiveRoomViewV2: View {
|
||||
if liveRoomInfo.creatorId != UserDefaults.int(forKey: .userId) {
|
||||
LiveRoomRightBottomButton(
|
||||
imageName: "ic_heart_pink",
|
||||
onClick: { viewModel.likeHeart() }
|
||||
onClick: { viewModel.likeHeart() },
|
||||
onLongPress: { viewModel.likeHeart(messageType: .BIG_HEART_DONATION, heartCount: 100) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user