mirror of
https://github.com/yattee/yattee.git
synced 2026-02-20 01:39:46 +00:00
Fix lock screen always showing 10s seek regardless of system controls setting
This commit is contained in:
@@ -274,10 +274,19 @@ final class NowPlayingService {
|
|||||||
|
|
||||||
/// Configures remote commands based on current settings.
|
/// Configures remote commands based on current settings.
|
||||||
/// Call this method when settings change to reconfigure the commands.
|
/// Call this method when settings change to reconfigure the commands.
|
||||||
func configureRemoteCommands() {
|
func configureRemoteCommands(
|
||||||
|
mode: SystemControlsMode? = nil,
|
||||||
|
duration: SystemControlsSeekDuration? = nil
|
||||||
|
) {
|
||||||
// Remove existing targets to prevent duplicate handlers
|
// Remove existing targets to prevent duplicate handlers
|
||||||
removeAllTargets()
|
removeAllTargets()
|
||||||
|
|
||||||
|
// If explicit values provided, use them directly (bypasses debounce)
|
||||||
|
if let mode, let duration {
|
||||||
|
configureRemoteCommandsWithSettings(mode: mode, duration: duration)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Read settings from active preset's cached global settings
|
// Read settings from active preset's cached global settings
|
||||||
if let layoutService = playerControlsLayoutService {
|
if let layoutService = playerControlsLayoutService {
|
||||||
Task {
|
Task {
|
||||||
|
|||||||
@@ -2062,8 +2062,11 @@ final class PlayerService {
|
|||||||
|
|
||||||
/// Reconfigures system control buttons (Control Center, Lock Screen) based on current settings.
|
/// Reconfigures system control buttons (Control Center, Lock Screen) based on current settings.
|
||||||
/// Call this when system controls settings change.
|
/// Call this when system controls settings change.
|
||||||
func reconfigureSystemControls() {
|
func reconfigureSystemControls(
|
||||||
nowPlayingService.configureRemoteCommands()
|
mode: SystemControlsMode? = nil,
|
||||||
|
duration: SystemControlsSeekDuration? = nil
|
||||||
|
) {
|
||||||
|
nowPlayingService.configureRemoteCommands(mode: mode, duration: duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Observer for preset changes to reconfigure system controls.
|
/// Observer for preset changes to reconfigure system controls.
|
||||||
@@ -2074,6 +2077,9 @@ final class PlayerService {
|
|||||||
self.playerControlsLayoutService = service
|
self.playerControlsLayoutService = service
|
||||||
nowPlayingService.playerControlsLayoutService = service
|
nowPlayingService.playerControlsLayoutService = service
|
||||||
|
|
||||||
|
// Reconfigure with the actual saved settings now that layout service is available
|
||||||
|
nowPlayingService.configureRemoteCommands()
|
||||||
|
|
||||||
// Observe preset changes to reconfigure system controls
|
// Observe preset changes to reconfigure system controls
|
||||||
presetChangeObserver = NotificationCenter.default.addObserver(
|
presetChangeObserver = NotificationCenter.default.addObserver(
|
||||||
forName: .playerControlsActivePresetDidChange,
|
forName: .playerControlsActivePresetDidChange,
|
||||||
|
|||||||
@@ -519,7 +519,10 @@ private struct SystemControlsSection: View {
|
|||||||
.onChange(of: systemControlsMode) { _, newMode in
|
.onChange(of: systemControlsMode) { _, newMode in
|
||||||
guard newMode != viewModel.systemControlsMode else { return }
|
guard newMode != viewModel.systemControlsMode else { return }
|
||||||
viewModel.updateSystemControlsModeSync(newMode)
|
viewModel.updateSystemControlsModeSync(newMode)
|
||||||
appEnvironment?.playerService.reconfigureSystemControls()
|
appEnvironment?.playerService.reconfigureSystemControls(
|
||||||
|
mode: newMode,
|
||||||
|
duration: viewModel.systemControlsSeekDuration
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if systemControlsMode == .seek {
|
if systemControlsMode == .seek {
|
||||||
@@ -535,7 +538,10 @@ private struct SystemControlsSection: View {
|
|||||||
.onChange(of: systemControlsSeekDuration) { _, newDuration in
|
.onChange(of: systemControlsSeekDuration) { _, newDuration in
|
||||||
guard newDuration != viewModel.systemControlsSeekDuration else { return }
|
guard newDuration != viewModel.systemControlsSeekDuration else { return }
|
||||||
viewModel.updateSystemControlsSeekDurationSync(newDuration)
|
viewModel.updateSystemControlsSeekDurationSync(newDuration)
|
||||||
appEnvironment?.playerService.reconfigureSystemControls()
|
appEnvironment?.playerService.reconfigureSystemControls(
|
||||||
|
mode: viewModel.systemControlsMode,
|
||||||
|
duration: newDuration
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} header: {
|
} header: {
|
||||||
|
|||||||
Reference in New Issue
Block a user