fix(calls): accepting from the ring window brings Teams to the front
- Accept and Video in the incoming-call window raise the main window before the call starts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -1144,6 +1144,11 @@ impl NotificationCenter {
1144
1144
}
1145
1145
}
1146
1146
1147
pub fn accept_ring(&mut self, ring_id: u64, mode: calling::AcceptMode, cx: &mut Context<Self>) {
1148
self.raise_main_window(cx);
1149
self.app.update(cx, |state, cx| state.accept_ring(ring_id, mode, cx));
1150
}
1151
1147
1152
fn raise_main_window(&mut self, cx: &mut Context<Self>) {
1148
1153
if let Some(native) = self.main_native {
1149
1154
platform::restore_and_raise(native);
@@ -1144,6 +1144,11 @@ impl NotificationCenter {1144
}1144
}1145
}1145
}1146
1146
1147
pub fn accept_ring(&mut self, ring_id: u64, mode: calling::AcceptMode, cx: &mut Context<Self>) {1148
self.raise_main_window(cx);1149
self.app.update(cx, |state, cx| state.accept_ring(ring_id, mode, cx));1150
}1151
1147
fn raise_main_window(&mut self, cx: &mut Context<Self>) {1152
fn raise_main_window(&mut self, cx: &mut Context<Self>) {1148
if let Some(native) = self.main_native {1153
if let Some(native) = self.main_native {1149
platform::restore_and_raise(native);1154
platform::restore_and_raise(native);@@ -31,6 +31,7 @@ fn card_radius(window_transparent: bool) -> f32 {
31
31
32
32
pub struct RingView {
33
33
app: Entity<AppState>,
34
center: Entity<NotificationCenter>,
34
35
ring_id: u64,
35
36
_subscription: Subscription,
36
37
}
@@ -41,6 +42,7 @@ impl RingView {
41
42
let subscription = cx.observe(&app, |_, _, cx| cx.notify());
42
43
RingView {
43
44
app,
45
center,
44
46
ring_id,
45
47
_subscription: subscription,
46
48
}
@@ -100,7 +102,7 @@ impl Render for RingView {
100
102
let avatar = caller_avatar(state, &entry);
101
103
let ring_id = self.ring_id;
102
104
let decline_app = self.app.clone();
103
let accept_app = self.app.clone();
105
let accept_center = self.center.clone();
104
106
let decline = answer_button("ring-decline", "Decline", IconName::PhoneOff, theme::red(), theme::white())
105
107
.on_click(move |_, _, cx| {
106
108
cx.stop_propagation();
@@ -115,11 +117,9 @@ impl Render for RingView {
115
117
)
116
118
.on_click(move |_, _, cx| {
117
119
cx.stop_propagation();
118
accept_app.update(cx, |state, cx| {
119
state.accept_ring(ring_id, AcceptMode::Audio, cx)
120
});
120
accept_center.update(cx, |center, cx| center.accept_ring(ring_id, AcceptMode::Audio, cx));
121
121
});
122
let video_app = self.app.clone();
122
let video_center = self.center.clone();
123
123
let accept_video = entry.ring.video.then(|| {
124
124
answer_button(
125
125
"ring-accept-video",
@@ -130,9 +130,7 @@ impl Render for RingView {
130
130
)
131
131
.on_click(move |_, _, cx| {
132
132
cx.stop_propagation();
133
video_app.update(cx, |state, cx| {
134
state.accept_ring(ring_id, AcceptMode::Video, cx)
135
});
133
video_center.update(cx, |center, cx| center.accept_ring(ring_id, AcceptMode::Video, cx));
136
134
})
137
135
});
138
136
div()
@@ -31,6 +31,7 @@ fn card_radius(window_transparent: bool) -> f32 {31
31
32
pub struct RingView {32
pub struct RingView {33
app: Entity<AppState>,33
app: Entity<AppState>,34
center: Entity<NotificationCenter>,34
ring_id: u64,35
ring_id: u64,35
_subscription: Subscription,36
_subscription: Subscription,36
}37
}@@ -41,6 +42,7 @@ impl RingView {41
let subscription = cx.observe(&app, |_, _, cx| cx.notify());42
let subscription = cx.observe(&app, |_, _, cx| cx.notify());42
RingView {43
RingView {43
app,44
app,45
center,44
ring_id,46
ring_id,45
_subscription: subscription,47
_subscription: subscription,46
}48
}@@ -100,7 +102,7 @@ impl Render for RingView {100
let avatar = caller_avatar(state, &entry);102
let avatar = caller_avatar(state, &entry);101
let ring_id = self.ring_id;103
let ring_id = self.ring_id;102
let decline_app = self.app.clone();104
let decline_app = self.app.clone();103
let accept_app = self.app.clone();105
let accept_center = self.center.clone();104
let decline = answer_button("ring-decline", "Decline", IconName::PhoneOff, theme::red(), theme::white())106
let decline = answer_button("ring-decline", "Decline", IconName::PhoneOff, theme::red(), theme::white())105
.on_click(move |_, _, cx| {107
.on_click(move |_, _, cx| {106
cx.stop_propagation();108
cx.stop_propagation();@@ -115,11 +117,9 @@ impl Render for RingView {115
)117
)116
.on_click(move |_, _, cx| {118
.on_click(move |_, _, cx| {117
cx.stop_propagation();119
cx.stop_propagation();118
accept_app.update(cx, |state, cx| {120
accept_center.update(cx, |center, cx| center.accept_ring(ring_id, AcceptMode::Audio, cx));119
state.accept_ring(ring_id, AcceptMode::Audio, cx)120
});121
});121
});122
let video_app = self.app.clone();122
let video_center = self.center.clone();123
let accept_video = entry.ring.video.then(|| {123
let accept_video = entry.ring.video.then(|| {124
answer_button(124
answer_button(125
"ring-accept-video",125
"ring-accept-video",@@ -130,9 +130,7 @@ impl Render for RingView {130
)130
)131
.on_click(move |_, _, cx| {131
.on_click(move |_, _, cx| {132
cx.stop_propagation();132
cx.stop_propagation();133
video_app.update(cx, |state, cx| {133
video_center.update(cx, |center, cx| center.accept_ring(ring_id, AcceptMode::Video, cx));134
state.accept_ring(ring_id, AcceptMode::Video, cx)135
});136
})134
})137
});135
});138
div()136
div()