screenshare: fix inline per-call quality override being discarded
The Share control's inline quality dropdown sets a session-only `share_quality_selection`, but ToggleScreenShare (which opens the audio picker on the only real path to a share) unconditionally reset it back to the saved config default before ConfirmShareScreen read it. The picker has no quality control of its own, so the user's per-call pick was silently dropped 100% of the time and every share used the persisted default. Drop the reset; add a regression test asserting the override survives picker-open and reaches the confirm. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+41
-1
@@ -1759,7 +1759,11 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
// so the picker can't be reopened during the startup window.
|
||||
state.share_picker_open = true;
|
||||
state.share_audio_selection = None;
|
||||
state.share_quality_selection = state.config.screen_share.quality;
|
||||
// NB: do NOT reset `share_quality_selection` here. It is the
|
||||
// per-call override set by the inline quality dropdown next to
|
||||
// the Share button, and the picker has no quality control of its
|
||||
// own — resetting it would silently discard the user's pick
|
||||
// before `ConfirmShareScreen` reads it.
|
||||
state.share_audio_apps.clear();
|
||||
let _ = state.controller.send(CoreCommand::ListAudioApps);
|
||||
}
|
||||
@@ -9271,6 +9275,42 @@ mod tests {
|
||||
assert!(!state.share_picker_open);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inline_quality_override_survives_opening_the_picker() {
|
||||
// The inline quality dropdown (next to the Share button) sets a
|
||||
// per-call `share_quality_selection`. Opening the audio picker via
|
||||
// ToggleScreenShare must NOT reset it back to the saved config default,
|
||||
// or the override the user just made is silently discarded before
|
||||
// ConfirmShareScreen reads it into StartScreenShare.
|
||||
use crate::config::ShareQuality;
|
||||
let mut state = AppState::default();
|
||||
// Saved default is Auto; the user picks a different per-call quality.
|
||||
assert_eq!(state.config.screen_share.quality, ShareQuality::Auto);
|
||||
let _ = update(
|
||||
&mut state,
|
||||
AppMessage::SelectShareQualityOverride(ShareQuality::High),
|
||||
);
|
||||
assert_eq!(state.share_quality_selection, ShareQuality::High);
|
||||
|
||||
// Clicking Share opens the picker — the override must be preserved.
|
||||
let _ = update(&mut state, AppMessage::ToggleScreenShare);
|
||||
assert!(state.share_picker_open);
|
||||
assert_eq!(
|
||||
state.share_quality_selection,
|
||||
ShareQuality::High,
|
||||
"opening the picker must not clobber the inline per-call override"
|
||||
);
|
||||
|
||||
// Confirming reads that same override into the share start.
|
||||
let _ = update(&mut state, AppMessage::ConfirmShareScreen);
|
||||
assert!(state.share_starting);
|
||||
assert_eq!(
|
||||
state.share_quality_selection,
|
||||
ShareQuality::High,
|
||||
"the override the picker preserved must still be what ConfirmShareScreen sends"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn share_start_failure_clears_in_flight_flag() {
|
||||
// A failed spawn surfaces as UiEvent::Error (not ScreenShareStopped); the
|
||||
|
||||
Reference in New Issue
Block a user