iOS: wire prev/next chapter buttons and add prefetch indicator

- Full player prev/next buttons now dismiss the player before navigating (allows user to see chapter change)
- Added amber loading indicator on next chapter button when prefetching audio (both mini and full player)
- Indicator appears as small ProgressView in bottom-right corner of forward button
This commit is contained in:
Admin
2026-03-08 13:39:38 +05:00
parent 4df287ace4
commit c35f099f50

View File

@@ -78,9 +78,26 @@ struct MiniPlayerView: View {
)
}
} label: {
ZStack {
Image(systemName: "forward.end.fill")
.font(.system(size: 24, weight: .semibold))
.foregroundStyle(.white)
// Show small loading indicator if next chapter is being prefetched
if audioPlayer.nextPrefetchStatus == .prefetching {
VStack {
Spacer()
HStack {
Spacer()
ProgressView()
.scaleEffect(0.5)
.tint(.amber)
.padding(2)
.background(Circle().fill(.black.opacity(0.6)))
}
}
}
}
.frame(width: 44, height: 44)
.contentShape(Rectangle())
}
@@ -395,6 +412,7 @@ struct FullPlayerView: View {
// previous chapter
Button {
if let prev = audioPlayer.prevChapter {
onDismiss()
NotificationCenter.default.post(
name: .skipToPrevChapter,
object: nil,
@@ -433,6 +451,7 @@ struct FullPlayerView: View {
// next chapter
Button {
if let next = audioPlayer.nextChapter {
onDismiss()
NotificationCenter.default.post(
name: .skipToNextChapter,
object: nil,
@@ -440,9 +459,26 @@ struct FullPlayerView: View {
)
}
} label: {
ZStack {
Image(systemName: "forward.end.fill")
.font(.system(size: 32, weight: .regular))
.foregroundStyle(.white.opacity(0.9))
// Show small loading indicator if next chapter is being prefetched
if audioPlayer.nextPrefetchStatus == .prefetching {
VStack {
Spacer()
HStack {
Spacer()
ProgressView()
.scaleEffect(0.6)
.tint(.amber)
.padding(4)
.background(Circle().fill(.black.opacity(0.6)))
}
}
}
}
.frame(maxWidth: .infinity)
}
.buttonStyle(.plain)