Merge pull request #21: feat(macos): screen share via ScreenCaptureKit system dialog
@@ -8,7 +8,7 @@ use calling::{
8
8
AttendeeLimits, CallCommand, CallState, CallUpdate, CameraDevice, CaptionEntry, CaptionState,
9
9
ContentShare, DeviceChoice, DeviceLists, EndKind, EndReason, HoldState, MeetingCapability,
10
10
MeetingRole, MeetingTarget, Progress, Reaction, Replacement, RosterEntry, ShareKind,
11
ShareSource, SpeakingDetector, StatsSample, VideoHub, VideoWant,
11
SharePicker, ShareSource, SpeakingDetector, StatsSample, VideoHub, VideoWant,
12
12
};
13
13
use teams_core::RecordingPolicy;
14
14
use tokio::sync::mpsc::UnboundedSender;
@@ -299,6 +299,8 @@ pub struct CallModel {
299
299
pub cameras: Vec<CameraDevice>,
300
300
pub camera: DeviceChoice,
301
301
pub local_share: Option<String>,
302
pub share_picker: SharePicker,
303
pub share_kind: Option<ShareKind>,
302
304
pub share_sources: Vec<ShareSource>,
303
305
pub share_thumbnails: Vec<(ShareSource, Arc<gpui_kit::RenderImage>)>,
304
306
pub last_sample: Option<StatsSample>,
@@ -369,6 +371,8 @@ impl CallModel {
369
371
cameras: Vec::new(),
370
372
camera: DeviceChoice::SystemDefault,
371
373
local_share: None,
374
share_picker: SharePicker::List,
375
share_kind: None,
372
376
share_sources: Vec::new(),
373
377
share_thumbnails: Vec::new(),
374
378
last_sample: None,
@@ -508,6 +512,8 @@ impl CallModel {
508
512
}
509
513
self.local_share = label;
510
514
}
515
CallUpdate::SharePicker(picker) => self.share_picker = picker,
516
CallUpdate::ShareKind(kind) => self.share_kind = kind,
511
517
CallUpdate::ShareSources(sources) => {
512
518
self.share_thumbnails
513
519
.retain(|(source, _)| sources.contains(source));
@@ -1207,7 +1213,11 @@ impl CallModel {
1207
1213
}
1208
1214
1209
1215
pub fn can_share(&self) -> bool {
1210
!self.share_sources.is_empty() && self.is_live()
1216
self.is_live() && (self.uses_portal_picker() || !self.share_sources.is_empty())
1217
}
1218
1219
pub fn uses_portal_picker(&self) -> bool {
1220
self.share_picker == SharePicker::Portal
1211
1221
}
1212
1222
1213
1223
pub fn is_live(&self) -> bool {
@@ -1968,6 +1978,16 @@ mod tests {
1968
1978
assert!(!model.share_sound);
1969
1979
}
1970
1980
1981
#[test]
1982
fn portal_share_works_without_a_source_list() {
1983
let mut model = connected_model();
1984
assert!(model.share_sources.is_empty());
1985
assert!(!model.can_share());
1986
model.apply(CallUpdate::SharePicker(SharePicker::Portal));
1987
assert!(model.uses_portal_picker());
1988
assert!(model.can_share());
1989
}
1990
1971
1991
#[test]
1972
1992
fn lobby_guests_are_listed_for_organizers_who_may_admit() {
1973
1993
let mut model = meeting_with_me();
@@ -8,7 +8,7 @@ use calling::{8
AttendeeLimits, CallCommand, CallState, CallUpdate, CameraDevice, CaptionEntry, CaptionState,8
AttendeeLimits, CallCommand, CallState, CallUpdate, CameraDevice, CaptionEntry, CaptionState,9
ContentShare, DeviceChoice, DeviceLists, EndKind, EndReason, HoldState, MeetingCapability,9
ContentShare, DeviceChoice, DeviceLists, EndKind, EndReason, HoldState, MeetingCapability,10
MeetingRole, MeetingTarget, Progress, Reaction, Replacement, RosterEntry, ShareKind,10
MeetingRole, MeetingTarget, Progress, Reaction, Replacement, RosterEntry, ShareKind,11
ShareSource, SpeakingDetector, StatsSample, VideoHub, VideoWant,11
SharePicker, ShareSource, SpeakingDetector, StatsSample, VideoHub, VideoWant,12
};12
};13
use teams_core::RecordingPolicy;13
use teams_core::RecordingPolicy;14
use tokio::sync::mpsc::UnboundedSender;14
use tokio::sync::mpsc::UnboundedSender;@@ -299,6 +299,8 @@ pub struct CallModel {299
pub cameras: Vec<CameraDevice>,299
pub cameras: Vec<CameraDevice>,300
pub camera: DeviceChoice,300
pub camera: DeviceChoice,301
pub local_share: Option<String>,301
pub local_share: Option<String>,302
pub share_picker: SharePicker,303
pub share_kind: Option<ShareKind>,302
pub share_sources: Vec<ShareSource>,304
pub share_sources: Vec<ShareSource>,303
pub share_thumbnails: Vec<(ShareSource, Arc<gpui_kit::RenderImage>)>,305
pub share_thumbnails: Vec<(ShareSource, Arc<gpui_kit::RenderImage>)>,304
pub last_sample: Option<StatsSample>,306
pub last_sample: Option<StatsSample>,@@ -369,6 +371,8 @@ impl CallModel {369
cameras: Vec::new(),371
cameras: Vec::new(),370
camera: DeviceChoice::SystemDefault,372
camera: DeviceChoice::SystemDefault,371
local_share: None,373
local_share: None,374
share_picker: SharePicker::List,375
share_kind: None,372
share_sources: Vec::new(),376
share_sources: Vec::new(),373
share_thumbnails: Vec::new(),377
share_thumbnails: Vec::new(),374
last_sample: None,378
last_sample: None,@@ -508,6 +512,8 @@ impl CallModel {508
}512
}509
self.local_share = label;513
self.local_share = label;510
}514
}515
CallUpdate::SharePicker(picker) => self.share_picker = picker,516
CallUpdate::ShareKind(kind) => self.share_kind = kind,511
CallUpdate::ShareSources(sources) => {517
CallUpdate::ShareSources(sources) => {512
self.share_thumbnails518
self.share_thumbnails513
.retain(|(source, _)| sources.contains(source));519
.retain(|(source, _)| sources.contains(source));@@ -1207,7 +1213,11 @@ impl CallModel {1207
}1213
}1208
1214
1209
pub fn can_share(&self) -> bool {1215
pub fn can_share(&self) -> bool {1210
!self.share_sources.is_empty() && self.is_live()1216
self.is_live() && (self.uses_portal_picker() || !self.share_sources.is_empty())1217
}1218
1219
pub fn uses_portal_picker(&self) -> bool {1220
self.share_picker == SharePicker::Portal1211
}1221
}1212
1222
1213
pub fn is_live(&self) -> bool {1223
pub fn is_live(&self) -> bool {@@ -1968,6 +1978,16 @@ mod tests {1968
assert!(!model.share_sound);1978
assert!(!model.share_sound);1969
}1979
}1970
1980
1981
#[test]1982
fn portal_share_works_without_a_source_list() {1983
let mut model = connected_model();1984
assert!(model.share_sources.is_empty());1985
assert!(!model.can_share());1986
model.apply(CallUpdate::SharePicker(SharePicker::Portal));1987
assert!(model.uses_portal_picker());1988
assert!(model.can_share());1989
}1990
1971
#[test]1991
#[test]1972
fn lobby_guests_are_listed_for_organizers_who_may_admit() {1992
fn lobby_guests_are_listed_for_organizers_who_may_admit() {1973
let mut model = meeting_with_me();1993
let mut model = meeting_with_me();