Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Fix playback speed + repeat mode buttons in Playlist fullscreen #26260

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions ios/brave-ios/Sources/PlaylistUI/PlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,22 @@ extension PlayerView {
var body: some View {
VStack {
HStack(spacing: 16) {
PlaybackSpeedPicker(playbackSpeed: $model.playbackSpeed)
if #available(iOS 18.0, *) {
// iOS 18 breaks simultaneous gestures on `Menu`, so we'll swap in a the old Button
// instead for those users for the time being...
Button {
model.playbackSpeed.cycle()
} label: {
Label(
Strings.Playlist.accessibilityPlaybackSpeed,
braveSystemImage: model.playbackSpeed.braveSystemName
)
.transition(.opacity.animation(.linear(duration: 0.1)))
.contentShape(.rect)
}
} else {
PlaybackSpeedPicker(playbackSpeed: $model.playbackSpeed)
}
Spacer()
Toggle(isOn: $model.isShuffleEnabled) {
if model.isShuffleEnabled {
Expand All @@ -164,8 +179,39 @@ extension PlayerView {
}
}
.toggleStyle(.button)
RepeatModePicker(repeatMode: $model.repeatMode)
.disabled(model.duration.isIndefinite)
Group {
if #available(iOS 18.0, *) {
// iOS 18 breaks simultaneous gestures on `Menu`, so we'll swap in a the old Button
// instead for those users for the time being...
Button {
model.repeatMode.cycle()
} label: {
Group {
switch model.repeatMode {
case .none:
Label(
Strings.Playlist.accessibilityRepeatModeOff,
braveSystemImage: "leo.loop.off"
)
case .one:
Label(
Strings.Playlist.accessibilityRepeatModeOne,
braveSystemImage: "leo.loop.1"
)
case .all:
Label(
Strings.Playlist.accessibilityRepeatModeAll,
braveSystemImage: "leo.loop.all"
)
}
}
.transition(.opacity.animation(.linear(duration: 0.1)))
}
} else {
RepeatModePicker(repeatMode: $model.repeatMode)
}
}
.disabled(model.duration.isIndefinite)
Button {
Task {
await model.playNextItem()
Expand Down
Loading