feat(live-room): 하트를 길게(2초)간 누르면 표시 되는 왕하트(100캔) 추가, 애니메이션 제외

This commit is contained in:
Yu Sung
2025-11-05 12:20:01 +09:00
parent d8c27ae225
commit 0a59c6f575
6 changed files with 46 additions and 11 deletions

View File

@@ -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: {}
)
}
}