as the commits say (#57)
Some checks are pending
Build and Release IPA / Build IPA (push) Waiting to run

![image](https://github.com/user-attachments/assets/d48db758-df04-454d-a1b7-185070433d14)
This commit is contained in:
cranci 2025-03-22 15:21:20 +01:00 committed by GitHub
commit 63d093b47c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 36 deletions

View file

@ -42,10 +42,13 @@ struct MusicProgressSlider<T: BinaryFloatingPoint>: View {
}
HStack {
Text(value.asTimeString(style: .positional, showHours: true))
// Determine if we should show hours based on the total duration.
let shouldShowHours = inRange.upperBound >= 3600
Text(value.asTimeString(style: .positional, showHours: shouldShowHours))
Spacer(minLength: 0)
Text("-" + (inRange.upperBound - value).asTimeString(style: .positional, showHours: true))
Text("-" + (inRange.upperBound - value).asTimeString(style: .positional, showHours: shouldShowHours))
}
.font(.system(size: 12))
.foregroundColor(isActive ? fillColor : emptyColor)
}

View file

@ -144,9 +144,9 @@ class CustomMediaPlayerViewController: UIViewController {
addInvisibleControlOverlays()
setupSubtitleLabel()
setupDismissButton()
setupMenuButton()
setupSpeedButton()
setupQualityButton()
setupSpeedButton()
setupMenuButton()
setupSkip85Button()
setupWatchNextButton()
addTimeObserver()
@ -527,20 +527,20 @@ class CustomMediaPlayerViewController: UIViewController {
menuButton = UIButton(type: .system)
menuButton.setImage(UIImage(systemName: "text.bubble"), for: .normal)
menuButton.tintColor = .white
if let subtitlesURL = subtitlesURL, !subtitlesURL.isEmpty {
menuButton.showsMenuAsPrimaryAction = true
menuButton.menu = buildOptionsMenu()
} else {
menuButton.isHidden = true
}
controlsContainerView.addSubview(menuButton)
menuButton.translatesAutoresizingMaskIntoConstraints = false
guard let sliderView = sliderHostingController?.view else { return }
NSLayoutConstraint.activate([
menuButton.bottomAnchor.constraint(equalTo: sliderView.topAnchor),
menuButton.trailingAnchor.constraint(equalTo: sliderView.trailingAnchor),
menuButton.topAnchor.constraint(equalTo: controlsContainerView.topAnchor, constant: 20),
menuButton.trailingAnchor.constraint(equalTo: speedButton.leadingAnchor, constant: -20),
menuButton.widthAnchor.constraint(equalToConstant: 40),
menuButton.heightAnchor.constraint(equalToConstant: 40)
])
@ -550,30 +550,19 @@ class CustomMediaPlayerViewController: UIViewController {
speedButton = UIButton(type: .system)
speedButton.setImage(UIImage(systemName: "speedometer"), for: .normal)
speedButton.tintColor = .white
speedButton.showsMenuAsPrimaryAction = true
speedButton.menu = speedChangerMenu()
controlsContainerView.addSubview(speedButton)
speedButton.translatesAutoresizingMaskIntoConstraints = false
guard let sliderView = sliderHostingController?.view else { return }
if menuButton.isHidden {
NSLayoutConstraint.activate([
speedButton.bottomAnchor.constraint(equalTo: controlsContainerView.bottomAnchor, constant: -50),
speedButton.trailingAnchor.constraint(equalTo: sliderView.trailingAnchor),
speedButton.widthAnchor.constraint(equalToConstant: 40),
speedButton.heightAnchor.constraint(equalToConstant: 40)
])
} else {
NSLayoutConstraint.activate([
speedButton.bottomAnchor.constraint(equalTo: controlsContainerView.bottomAnchor, constant: -50),
speedButton.trailingAnchor.constraint(equalTo: menuButton.leadingAnchor),
speedButton.widthAnchor.constraint(equalToConstant: 40),
speedButton.heightAnchor.constraint(equalToConstant: 40)
])
}
NSLayoutConstraint.activate([
// Middle
speedButton.topAnchor.constraint(equalTo: controlsContainerView.topAnchor, constant: 20),
speedButton.trailingAnchor.constraint(equalTo: qualityButton.leadingAnchor, constant: -20),
speedButton.widthAnchor.constraint(equalToConstant: 40),
speedButton.heightAnchor.constraint(equalToConstant: 40)
])
}
func setupWatchNextButton() {
@ -599,8 +588,8 @@ class CustomMediaPlayerViewController: UIViewController {
]
watchNextButtonControlsConstraints = [
watchNextButton.trailingAnchor.constraint(equalTo: qualityButton.leadingAnchor),
watchNextButton.bottomAnchor.constraint(equalTo: skip85Button.bottomAnchor),
watchNextButton.trailingAnchor.constraint(equalTo: sliderHostingController!.view.trailingAnchor),
watchNextButton.bottomAnchor.constraint(equalTo: sliderHostingController!.view.topAnchor, constant: -5),
watchNextButton.heightAnchor.constraint(equalToConstant: 50),
watchNextButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 120)
]
@ -637,17 +626,18 @@ class CustomMediaPlayerViewController: UIViewController {
qualityButton.showsMenuAsPrimaryAction = true
qualityButton.menu = qualitySelectionMenu()
qualityButton.isHidden = true
controlsContainerView.addSubview(qualityButton)
qualityButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
qualityButton.bottomAnchor.constraint(equalTo: controlsContainerView.bottomAnchor, constant: -50),
qualityButton.trailingAnchor.constraint(equalTo: speedButton.leadingAnchor),
qualityButton.topAnchor.constraint(equalTo: controlsContainerView.topAnchor, constant: 20),
qualityButton.trailingAnchor.constraint(equalTo: controlsContainerView.trailingAnchor, constant: -20),
qualityButton.widthAnchor.constraint(equalToConstant: 40),
qualityButton.heightAnchor.constraint(equalToConstant: 40)
])
}
func updateSubtitleLabelAppearance() {
subtitleLabel.font = UIFont.systemFont(ofSize: CGFloat(subtitleFontSize))

View file

@ -58,7 +58,7 @@ struct SettingsViewPlayer: View {
}
}
}
Section(header: Text("Skip Settings")) {
Section(header: Text("Skip Settings"), footer : Text("Double tapping the screen on it's sides will skip with the short tap setting.")) {
HStack {
Text("Tap Skip:")
Spacer()