experiment(BookmarkRow): add sensoryFeedback haptic on podcast trigger button

This commit is contained in:
Krishna Kumar
2026-05-23 00:47:40 -05:00
parent ab72611d7b
commit ea8a425c21

View File

@@ -5,6 +5,8 @@ struct BookmarkRow: View {
var readingProgress: Double = 0 var readingProgress: Double = 0
var onPodcast: (() -> Void)? = nil var onPodcast: (() -> Void)? = nil
@State private var podcastTapCount = 0
var body: some View { var body: some View {
VStack(alignment: .leading, spacing: 6) { VStack(alignment: .leading, spacing: 6) {
HStack(alignment: .top, spacing: 11) { HStack(alignment: .top, spacing: 11) {
@@ -34,13 +36,17 @@ struct BookmarkRow: View {
Spacer() Spacer()
if let onPodcast { if let onPodcast {
Button(action: onPodcast) { Button {
podcastTapCount += 1
onPodcast()
} label: {
Image(systemName: podcastCached ? "headphones.circle.fill" : "headphones.circle") Image(systemName: podcastCached ? "headphones.circle.fill" : "headphones.circle")
.font(.system(size: 26)) .font(.system(size: 26))
.foregroundStyle(podcastCached ? .blue : Color(.systemGray3)) .foregroundStyle(podcastCached ? .blue : Color(.systemGray3))
} }
.buttonStyle(.plain) .buttonStyle(.plain)
.padding(.top, 1) .padding(.top, 1)
.sensoryFeedback(.impact(weight: .medium), trigger: podcastTapCount)
} }
} }