BlueGit

ict rusty-teams

feat(meetings): save reminder snooze and dismiss to the Outlook reminder

- Snooze calls Graph snoozeReminder to the meeting start, corner X calls dismissReminder (occurrence id)
- Reads Graph reminderView every 60 s near a meeting; reminders dismissed or snoozed in Outlook or on another device are not shown and an open toast closes
- Read or write failure keeps the local behaviour and logs a diagnostics line
- No reads in demo, no writes in demo or read-only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-17 · 6 weeks ago

Hash
bff3e0379507d897f9234c4022fd775ea5191cc1
Parent
4e2d5e64
9 files changed +676 −9
ROADMAP.md +1 −1
@@ -194,7 +194,7 @@ Feature parity with the Microsoft Teams desktop client.
194 194 | In a call shown in presence | Done | "In a call", "In a meeting", "Presenting" from Teams activity on profile cards and chat headers; no notification sounds during a native call |
195 195 | Schedule a meeting | Partial | Calls tab "New meeting": title, people chips, date, start, end (next half hour, 30 min), Repeat (does not repeat, daily, weekdays, weekly), details, Teams meeting always on. Graph `POST /me/events` with `isOnlineMeeting` and `teamsForBusiness`, local wall time in the own mailbox time zone (series keep their time across DST, weekday from the local date). Body building unit tested; never run against a real calendar |
196 196 | Answer meeting invitations | Partial | Upcoming rows of invited meetings show Accepted / Tentative / Declined / Respond as a menu with "Send a response" (default on); own meetings say Organizer. Graph `accept`, `tentativelyAccept`, `decline`, falls back to the iCalUId lookup when the Teams id is not a Graph id. Not run against a real invitation |
197 | Meeting start reminder | Partial | Toast 5 min before the start of an Upcoming meeting: title, time, Join, Snooze (back at the start or first join). Corner X dismisses for good. Live state (green dot) from polled live-meeting state. One chime at the start or first join; quiet with sound off and during Do not disturb or a call. Ctrl+Shift+J joins from the latest. Driven by the polled calendar; push event 128 not wired (the realtime layer does not receive it) |
197 | Meeting start reminder | Partial | Toast 5 min before the start of an Upcoming meeting: title, time, Join, Snooze (back at the start or first join). Corner X dismisses for good. Snooze and X are saved to the Outlook reminder (Graph snoozeReminder / dismissReminder, occurrence id); reminders snoozed or dismissed in Outlook or on another device are read from reminderView every 60 s near a meeting and are not shown again. Live state (green dot) from polled live-meeting state. One chime at the start or first join; quiet with sound off and during Do not disturb or a call. Ctrl+Shift+J joins from the latest. Driven by the polled calendar; push event 128 not wired (the realtime layer does not receive it) |
198 198 | Pre-join screen | Partial | Join from Upcoming, chat, Join with ID, link or reminder opens a screen in the chat pane: camera preview, camera and mic switches, background menu, camera, microphone and speaker selects, "Computer audio" or "Don't use audio" (audio off in both directions), Join now, Cancel. Camera, mic and devices remembered. 1:1 calls and Meet now skip it. Checked in the demo only |
199 199 | Narrow windows in a call | Done | Controls that do not fit move into "..." (View, Reactions, Raise hand, People, Chat; mic, camera, share, "..." and Leave always stay). Below 960 px, or when a side panel would leave the call under 720 px, the chat list hides; still too narrow, the panel overlays the call. Layout guard checks 640x480, 1280x800, 1920x1080 |
200 200 | Give and take control | Missing | Protocol known (main-channel data channel, action codes 0-11); needs a second person and a security review |
@@ -194,7 +194,7 @@ Feature parity with the Microsoft Teams desktop client.
194| In a call shown in presence | Done | "In a call", "In a meeting", "Presenting" from Teams activity on profile cards and chat headers; no notification sounds during a native call |
194| In a call shown in presence | Done | "In a call", "In a meeting", "Presenting" from Teams activity on profile cards and chat headers; no notification sounds during a native call |
195| Schedule a meeting | Partial | Calls tab "New meeting": title, people chips, date, start, end (next half hour, 30 min), Repeat (does not repeat, daily, weekdays, weekly), details, Teams meeting always on. Graph `POST /me/events` with `isOnlineMeeting` and `teamsForBusiness`, local wall time in the own mailbox time zone (series keep their time across DST, weekday from the local date). Body building unit tested; never run against a real calendar |
195| Schedule a meeting | Partial | Calls tab "New meeting": title, people chips, date, start, end (next half hour, 30 min), Repeat (does not repeat, daily, weekdays, weekly), details, Teams meeting always on. Graph `POST /me/events` with `isOnlineMeeting` and `teamsForBusiness`, local wall time in the own mailbox time zone (series keep their time across DST, weekday from the local date). Body building unit tested; never run against a real calendar |
196| Answer meeting invitations | Partial | Upcoming rows of invited meetings show Accepted / Tentative / Declined / Respond as a menu with "Send a response" (default on); own meetings say Organizer. Graph `accept`, `tentativelyAccept`, `decline`, falls back to the iCalUId lookup when the Teams id is not a Graph id. Not run against a real invitation |
196| Answer meeting invitations | Partial | Upcoming rows of invited meetings show Accepted / Tentative / Declined / Respond as a menu with "Send a response" (default on); own meetings say Organizer. Graph `accept`, `tentativelyAccept`, `decline`, falls back to the iCalUId lookup when the Teams id is not a Graph id. Not run against a real invitation |
197| Meeting start reminder | Partial | Toast 5 min before the start of an Upcoming meeting: title, time, Join, Snooze (back at the start or first join). Corner X dismisses for good. Live state (green dot) from polled live-meeting state. One chime at the start or first join; quiet with sound off and during Do not disturb or a call. Ctrl+Shift+J joins from the latest. Driven by the polled calendar; push event 128 not wired (the realtime layer does not receive it) |
197| Meeting start reminder | Partial | Toast 5 min before the start of an Upcoming meeting: title, time, Join, Snooze (back at the start or first join). Corner X dismisses for good. Snooze and X are saved to the Outlook reminder (Graph snoozeReminder / dismissReminder, occurrence id); reminders snoozed or dismissed in Outlook or on another device are read from reminderView every 60 s near a meeting and are not shown again. Live state (green dot) from polled live-meeting state. One chime at the start or first join; quiet with sound off and during Do not disturb or a call. Ctrl+Shift+J joins from the latest. Driven by the polled calendar; push event 128 not wired (the realtime layer does not receive it) |
198| Pre-join screen | Partial | Join from Upcoming, chat, Join with ID, link or reminder opens a screen in the chat pane: camera preview, camera and mic switches, background menu, camera, microphone and speaker selects, "Computer audio" or "Don't use audio" (audio off in both directions), Join now, Cancel. Camera, mic and devices remembered. 1:1 calls and Meet now skip it. Checked in the demo only |
198| Pre-join screen | Partial | Join from Upcoming, chat, Join with ID, link or reminder opens a screen in the chat pane: camera preview, camera and mic switches, background menu, camera, microphone and speaker selects, "Computer audio" or "Don't use audio" (audio off in both directions), Join now, Cancel. Camera, mic and devices remembered. 1:1 calls and Meet now skip it. Checked in the demo only |
199| Narrow windows in a call | Done | Controls that do not fit move into "..." (View, Reactions, Raise hand, People, Chat; mic, camera, share, "..." and Leave always stay). Below 960 px, or when a side panel would leave the call under 720 px, the chat list hides; still too narrow, the panel overlays the call. Layout guard checks 640x480, 1280x800, 1920x1080 |
199| Narrow windows in a call | Done | Controls that do not fit move into "..." (View, Reactions, Raise hand, People, Chat; mic, camera, share, "..." and Leave always stay). Below 960 px, or when a side panel would leave the call under 720 px, the chat list hides; still too narrow, the panel overlays the call. Layout guard checks 640x480, 1280x800, 1920x1080 |
200| Give and take control | Missing | Protocol known (main-channel data channel, action codes 0-11); needs a second person and a security review |
200| Give and take control | Missing | Protocol known (main-channel data channel, action codes 0-11); needs a second person and a security review |
crates/app-state/src/call/launcher.rs +40 −0
@@ -225,6 +225,46 @@ impl CallLauncher {
225 225 .map_err(|error| error.to_string())
226 226 }
227 227
228 pub async fn reminder_view(
229 &self,
230 start: chrono::DateTime<chrono::Utc>,
231 end: chrono::DateTime<chrono::Utc>,
232 ) -> Result<Vec<chatsvc::Reminder>, String> {
233 let session = self.engine().ok_or_else(|| NOT_READY.to_owned())?.session();
234 chatsvc::Calendar::new(&session)
235 .reminder_view(start, end)
236 .await
237 .map_err(|error| error.to_string())
238 }
239
240 pub async fn snooze_reminder(
241 &self,
242 event_id: &str,
243 until: chrono::DateTime<chrono::Utc>,
244 ) -> Result<(), String> {
245 let session = self
246 .ready_engine()
247 .await
248 .ok_or_else(|| NOT_READY.to_owned())?
249 .session();
250 chatsvc::Calendar::new(&session)
251 .snooze_reminder(event_id, until)
252 .await
253 .map_err(|error| error.to_string())
254 }
255
256 pub async fn dismiss_reminder(&self, event_id: &str) -> Result<(), String> {
257 let session = self
258 .ready_engine()
259 .await
260 .ok_or_else(|| NOT_READY.to_owned())?
261 .session();
262 chatsvc::Calendar::new(&session)
263 .dismiss_reminder(event_id)
264 .await
265 .map_err(|error| error.to_string())
266 }
267
228 268 pub async fn live_meeting(&self, thread_id: &str) -> Option<LiveMeeting> {
229 269 let session = self.engine()?.session();
230 270 fetch_live_meeting(&session, thread_id).await.ok().flatten()
@@ -225,6 +225,46 @@ impl CallLauncher {
225 .map_err(|error| error.to_string())
225 .map_err(|error| error.to_string())
226 }
226 }
227
227
228 pub async fn reminder_view(
229 &self,
230 start: chrono::DateTime<chrono::Utc>,
231 end: chrono::DateTime<chrono::Utc>,
232 ) -> Result<Vec<chatsvc::Reminder>, String> {
233 let session = self.engine().ok_or_else(|| NOT_READY.to_owned())?.session();
234 chatsvc::Calendar::new(&session)
235 .reminder_view(start, end)
236 .await
237 .map_err(|error| error.to_string())
238 }
239
240 pub async fn snooze_reminder(
241 &self,
242 event_id: &str,
243 until: chrono::DateTime<chrono::Utc>,
244 ) -> Result<(), String> {
245 let session = self
246 .ready_engine()
247 .await
248 .ok_or_else(|| NOT_READY.to_owned())?
249 .session();
250 chatsvc::Calendar::new(&session)
251 .snooze_reminder(event_id, until)
252 .await
253 .map_err(|error| error.to_string())
254 }
255
256 pub async fn dismiss_reminder(&self, event_id: &str) -> Result<(), String> {
257 let session = self
258 .ready_engine()
259 .await
260 .ok_or_else(|| NOT_READY.to_owned())?
261 .session();
262 chatsvc::Calendar::new(&session)
263 .dismiss_reminder(event_id)
264 .await
265 .map_err(|error| error.to_string())
266 }
267
228 pub async fn live_meeting(&self, thread_id: &str) -> Option<LiveMeeting> {
268 pub async fn live_meeting(&self, thread_id: &str) -> Option<LiveMeeting> {
229 let session = self.engine()?.session();
269 let session = self.engine()?.session();
230 fetch_live_meeting(&session, thread_id).await.ok().flatten()
270 fetch_live_meeting(&session, thread_id).await.ok().flatten()
crates/app-state/src/call/mod.rs +1 −0
@@ -7,6 +7,7 @@ pub mod history;
7 7 pub mod join;
8 8 pub mod launcher;
9 9 pub mod list;
10 pub mod outlook_reminders;
10 11 pub mod overlay_layout;
11 12 pub mod people_actions;
12 13 pub mod prejoin;
@@ -7,6 +7,7 @@ pub mod history;
7pub mod join;
7pub mod join;
8pub mod launcher;
8pub mod launcher;
9pub mod list;
9pub mod list;
10pub mod outlook_reminders;
10pub mod overlay_layout;
11pub mod overlay_layout;
11pub mod people_actions;
12pub mod people_actions;
12pub mod prejoin;
13pub mod prejoin;
crates/app-state/src/call/outlook_reminders.rs added +270 −0
@@ -0,0 +1,270 @@
1 use std::collections::HashMap;
2
3 use chatsvc::{CalendarEvent, Reminder};
4 use chrono::{DateTime, Duration, Utc};
5 use gpui_kit::Context;
6
7 use super::reminder::{GRACE_MINUTES, LEAD_MINUTES, is_eligible};
8 use crate::app_state::AppState;
9 use crate::runtime;
10
11 const POLL_SECONDS: i64 = 60;
12 const WATCH_BEFORE_LEAD_MINUTES: i64 = 1;
13 const RANGE_HOURS: i64 = 1;
14
15 #[derive(Debug, Clone, PartialEq, Eq)]
16 struct KnownReminders {
17 start: DateTime<Utc>,
18 end: DateTime<Utc>,
19 fire_times: HashMap<String, DateTime<Utc>>,
20 }
21
22 #[derive(Debug, Default)]
23 pub struct OutlookReminders {
24 known: Option<KnownReminders>,
25 last_poll: Option<DateTime<Utc>>,
26 polling: bool,
27 }
28
29 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
30 pub enum ReminderWrite {
31 Snooze(DateTime<Utc>),
32 Dismiss,
33 }
34
35 fn watched(event: &CalendarEvent, now: DateTime<Utc>) -> bool {
36 let watch_from = event.start - Duration::minutes(LEAD_MINUTES + WATCH_BEFORE_LEAD_MINUTES);
37 let watch_until = event
38 .end
39 .min(event.start + Duration::minutes(GRACE_MINUTES));
40 is_eligible(event) && now >= watch_from && now < watch_until
41 }
42
43 impl OutlookReminders {
44 pub fn poll_range(
45 &mut self,
46 events: &[CalendarEvent],
47 now: DateTime<Utc>,
48 ) -> Option<(DateTime<Utc>, DateTime<Utc>)> {
49 let due = !self.polling
50 && self
51 .last_poll
52 .is_none_or(|last| now - last >= Duration::seconds(POLL_SECONDS));
53 if !due || !events.iter().any(|event| watched(event, now)) {
54 return None;
55 }
56 self.polling = true;
57 self.last_poll = Some(now);
58 Some((
59 now - Duration::hours(RANGE_HOURS),
60 now + Duration::hours(RANGE_HOURS),
61 ))
62 }
63
64 pub fn apply(
65 &mut self,
66 start: DateTime<Utc>,
67 end: DateTime<Utc>,
68 fetched: Result<Vec<Reminder>, String>,
69 ) {
70 self.polling = false;
71 self.known = fetched.ok().map(|reminders| KnownReminders {
72 start,
73 end,
74 fire_times: reminders
75 .into_iter()
76 .map(|reminder| (reminder.event_id, reminder.fire_time))
77 .collect(),
78 });
79 }
80
81 pub fn allows(&self, event: &CalendarEvent, now: DateTime<Utc>) -> bool {
82 let Some(known) = &self.known else {
83 return true;
84 };
85 if event.start < known.start || event.start >= known.end {
86 return true;
87 }
88 known
89 .fire_times
90 .get(&event.object_id)
91 .is_some_and(|fire_time| now >= *fire_time)
92 }
93
94 pub fn note(&mut self, event_id: &str, write: ReminderWrite) {
95 let Some(known) = self.known.as_mut() else {
96 return;
97 };
98 match write {
99 ReminderWrite::Snooze(until) => {
100 known.fire_times.insert(event_id.to_owned(), until);
101 }
102 ReminderWrite::Dismiss => {
103 known.fire_times.remove(event_id);
104 }
105 }
106 }
107 }
108
109 impl AppState {
110 pub(super) fn poll_outlook_reminders(&mut self, now: DateTime<Utc>, cx: &mut Context<Self>) {
111 if self.mode.demo {
112 return;
113 }
114 let Some(launcher) = self.call_launcher.clone() else {
115 return;
116 };
117 let Some((start, end)) = self
118 .meeting_toasts
119 .outlook_mut()
120 .poll_range(&self.calendar_events, now)
121 else {
122 return;
123 };
124 let fetched = runtime::spawn(async move { launcher.reminder_view(start, end).await });
125 cx.spawn(async move |this, cx| {
126 let fetched = fetched
127 .await
128 .unwrap_or_else(|_| Err("reminder fetch was dropped".to_owned()));
129 if let Err(error) = &fetched {
130 crate::diagnostics::record(format!(
131 "calendar: Outlook reminders not read: {error}"
132 ));
133 }
134 this.update(cx, |state, _| {
135 state
136 .meeting_toasts
137 .outlook_mut()
138 .apply(start, end, fetched);
139 })
140 .ok();
141 })
142 .detach();
143 }
144
145 pub(super) fn write_outlook_reminder(&mut self, event_id: String, write: ReminderWrite) {
146 if self.mode.demo || self.mode.read_only {
147 return;
148 }
149 let Some(launcher) = self.call_launcher.clone() else {
150 return;
151 };
152 self.meeting_toasts.outlook_mut().note(&event_id, write);
153 runtime::handle().spawn(async move {
154 let written = match write {
155 ReminderWrite::Snooze(until) => launcher.snooze_reminder(&event_id, until).await,
156 ReminderWrite::Dismiss => launcher.dismiss_reminder(&event_id).await,
157 };
158 if let Err(error) = written {
159 crate::diagnostics::record(format!(
160 "calendar: Outlook reminder {write:?} not saved: {error}"
161 ));
162 }
163 });
164 }
165 }
166
167 #[cfg(test)]
168 mod tests {
169 use chatsvc::ResponseType;
170 use chrono::TimeZone;
171
172 use super::*;
173
174 fn at(hour: u32, minute: u32) -> DateTime<Utc> {
175 Utc.with_ymd_and_hms(2026, 10, 19, hour, minute, 0).unwrap()
176 }
177
178 fn event(id: &str) -> CalendarEvent {
179 CalendarEvent {
180 object_id: id.into(),
181 subject: "Daily Standup".into(),
182 start: at(9, 45),
183 end: at(10, 0),
184 all_day: false,
185 cancelled: false,
186 online: true,
187 join_url: Some("https://teams.microsoft.com/l/meetup-join/x".into()),
188 thread_id: None,
189 organizer_name: None,
190 organizer_address: None,
191 ical_uid: None,
192 response: ResponseType::Accepted,
193 }
194 }
195
196 fn reminder(event_id: &str, fire_time: DateTime<Utc>) -> Reminder {
197 Reminder {
198 event_id: event_id.into(),
199 fire_time,
200 }
201 }
202
203 fn known(reminders: Vec<Reminder>, now: DateTime<Utc>) -> OutlookReminders {
204 let mut outlook = OutlookReminders::default();
205 let (start, end) = outlook.poll_range(&[event("a")], now).unwrap();
206 outlook.apply(start, end, Ok(reminders));
207 outlook
208 }
209
210 #[test]
211 fn polls_only_near_a_meeting_and_once_a_minute() {
212 let events = [event("a")];
213 let mut outlook = OutlookReminders::default();
214 assert_eq!(outlook.poll_range(&events, at(9, 38)), None);
215 let range = outlook.poll_range(&events, at(9, 39)).unwrap();
216 assert_eq!(range, (at(8, 39), at(10, 39)));
217 assert_eq!(outlook.poll_range(&events, at(9, 41)), None);
218 outlook.apply(range.0, range.1, Ok(Vec::new()));
219 assert_eq!(
220 outlook.poll_range(&events, at(9, 39) + Duration::seconds(59)),
221 None
222 );
223 assert!(outlook.poll_range(&events, at(9, 40)).is_some());
224 let mut later = OutlookReminders::default();
225 assert_eq!(later.poll_range(&events, at(9, 50)), None);
226 }
227
228 #[test]
229 fn unknown_state_keeps_the_local_behaviour() {
230 let mut outlook = OutlookReminders::default();
231 assert!(outlook.allows(&event("a"), at(9, 40)));
232 let (start, end) = outlook.poll_range(&[event("a")], at(9, 39)).unwrap();
233 outlook.apply(start, end, Err("offline".into()));
234 assert!(outlook.allows(&event("a"), at(9, 40)));
235 }
236
237 #[test]
238 fn a_reminder_missing_in_outlook_was_dismissed_there() {
239 let outlook = known(vec![reminder("b", at(9, 30))], at(9, 39));
240 assert!(!outlook.allows(&event("a"), at(9, 40)));
241 assert!(outlook.allows(&event("b"), at(9, 40)));
242 }
243
244 #[test]
245 fn a_reminder_snoozed_in_outlook_waits_for_its_fire_time() {
246 let outlook = known(vec![reminder("a", at(9, 43))], at(9, 39));
247 assert!(!outlook.allows(&event("a"), at(9, 42)));
248 assert!(outlook.allows(&event("a"), at(9, 43)));
249 }
250
251 #[test]
252 fn events_outside_the_read_range_are_not_judged() {
253 let outlook = known(Vec::new(), at(9, 39));
254 let tomorrow = CalendarEvent {
255 start: at(9, 45) + Duration::days(1),
256 ..event("a")
257 };
258 assert!(outlook.allows(&tomorrow, at(9, 40)));
259 }
260
261 #[test]
262 fn own_writes_update_the_known_state_at_once() {
263 let mut outlook = known(vec![reminder("a", at(9, 30))], at(9, 39));
264 outlook.note("a", ReminderWrite::Snooze(at(9, 45)));
265 assert!(!outlook.allows(&event("a"), at(9, 44)));
266 assert!(outlook.allows(&event("a"), at(9, 45)));
267 outlook.note("a", ReminderWrite::Dismiss);
268 assert!(!outlook.allows(&event("a"), at(9, 46)));
269 }
270 }
@@ -0,0 +1,270 @@
1use std::collections::HashMap;
2
3use chatsvc::{CalendarEvent, Reminder};
4use chrono::{DateTime, Duration, Utc};
5use gpui_kit::Context;
6
7use super::reminder::{GRACE_MINUTES, LEAD_MINUTES, is_eligible};
8use crate::app_state::AppState;
9use crate::runtime;
10
11const POLL_SECONDS: i64 = 60;
12const WATCH_BEFORE_LEAD_MINUTES: i64 = 1;
13const RANGE_HOURS: i64 = 1;
14
15#[derive(Debug, Clone, PartialEq, Eq)]
16struct KnownReminders {
17 start: DateTime<Utc>,
18 end: DateTime<Utc>,
19 fire_times: HashMap<String, DateTime<Utc>>,
20}
21
22#[derive(Debug, Default)]
23pub struct OutlookReminders {
24 known: Option<KnownReminders>,
25 last_poll: Option<DateTime<Utc>>,
26 polling: bool,
27}
28
29#[derive(Debug, Clone, Copy, PartialEq, Eq)]
30pub enum ReminderWrite {
31 Snooze(DateTime<Utc>),
32 Dismiss,
33}
34
35fn watched(event: &CalendarEvent, now: DateTime<Utc>) -> bool {
36 let watch_from = event.start - Duration::minutes(LEAD_MINUTES + WATCH_BEFORE_LEAD_MINUTES);
37 let watch_until = event
38 .end
39 .min(event.start + Duration::minutes(GRACE_MINUTES));
40 is_eligible(event) && now >= watch_from && now < watch_until
41}
42
43impl OutlookReminders {
44 pub fn poll_range(
45 &mut self,
46 events: &[CalendarEvent],
47 now: DateTime<Utc>,
48 ) -> Option<(DateTime<Utc>, DateTime<Utc>)> {
49 let due = !self.polling
50 && self
51 .last_poll
52 .is_none_or(|last| now - last >= Duration::seconds(POLL_SECONDS));
53 if !due || !events.iter().any(|event| watched(event, now)) {
54 return None;
55 }
56 self.polling = true;
57 self.last_poll = Some(now);
58 Some((
59 now - Duration::hours(RANGE_HOURS),
60 now + Duration::hours(RANGE_HOURS),
61 ))
62 }
63
64 pub fn apply(
65 &mut self,
66 start: DateTime<Utc>,
67 end: DateTime<Utc>,
68 fetched: Result<Vec<Reminder>, String>,
69 ) {
70 self.polling = false;
71 self.known = fetched.ok().map(|reminders| KnownReminders {
72 start,
73 end,
74 fire_times: reminders
75 .into_iter()
76 .map(|reminder| (reminder.event_id, reminder.fire_time))
77 .collect(),
78 });
79 }
80
81 pub fn allows(&self, event: &CalendarEvent, now: DateTime<Utc>) -> bool {
82 let Some(known) = &self.known else {
83 return true;
84 };
85 if event.start < known.start || event.start >= known.end {
86 return true;
87 }
88 known
89 .fire_times
90 .get(&event.object_id)
91 .is_some_and(|fire_time| now >= *fire_time)
92 }
93
94 pub fn note(&mut self, event_id: &str, write: ReminderWrite) {
95 let Some(known) = self.known.as_mut() else {
96 return;
97 };
98 match write {
99 ReminderWrite::Snooze(until) => {
100 known.fire_times.insert(event_id.to_owned(), until);
101 }
102 ReminderWrite::Dismiss => {
103 known.fire_times.remove(event_id);
104 }
105 }
106 }
107}
108
109impl AppState {
110 pub(super) fn poll_outlook_reminders(&mut self, now: DateTime<Utc>, cx: &mut Context<Self>) {
111 if self.mode.demo {
112 return;
113 }
114 let Some(launcher) = self.call_launcher.clone() else {
115 return;
116 };
117 let Some((start, end)) = self
118 .meeting_toasts
119 .outlook_mut()
120 .poll_range(&self.calendar_events, now)
121 else {
122 return;
123 };
124 let fetched = runtime::spawn(async move { launcher.reminder_view(start, end).await });
125 cx.spawn(async move |this, cx| {
126 let fetched = fetched
127 .await
128 .unwrap_or_else(|_| Err("reminder fetch was dropped".to_owned()));
129 if let Err(error) = &fetched {
130 crate::diagnostics::record(format!(
131 "calendar: Outlook reminders not read: {error}"
132 ));
133 }
134 this.update(cx, |state, _| {
135 state
136 .meeting_toasts
137 .outlook_mut()
138 .apply(start, end, fetched);
139 })
140 .ok();
141 })
142 .detach();
143 }
144
145 pub(super) fn write_outlook_reminder(&mut self, event_id: String, write: ReminderWrite) {
146 if self.mode.demo || self.mode.read_only {
147 return;
148 }
149 let Some(launcher) = self.call_launcher.clone() else {
150 return;
151 };
152 self.meeting_toasts.outlook_mut().note(&event_id, write);
153 runtime::handle().spawn(async move {
154 let written = match write {
155 ReminderWrite::Snooze(until) => launcher.snooze_reminder(&event_id, until).await,
156 ReminderWrite::Dismiss => launcher.dismiss_reminder(&event_id).await,
157 };
158 if let Err(error) = written {
159 crate::diagnostics::record(format!(
160 "calendar: Outlook reminder {write:?} not saved: {error}"
161 ));
162 }
163 });
164 }
165}
166
167#[cfg(test)]
168mod tests {
169 use chatsvc::ResponseType;
170 use chrono::TimeZone;
171
172 use super::*;
173
174 fn at(hour: u32, minute: u32) -> DateTime<Utc> {
175 Utc.with_ymd_and_hms(2026, 10, 19, hour, minute, 0).unwrap()
176 }
177
178 fn event(id: &str) -> CalendarEvent {
179 CalendarEvent {
180 object_id: id.into(),
181 subject: "Daily Standup".into(),
182 start: at(9, 45),
183 end: at(10, 0),
184 all_day: false,
185 cancelled: false,
186 online: true,
187 join_url: Some("https://teams.microsoft.com/l/meetup-join/x".into()),
188 thread_id: None,
189 organizer_name: None,
190 organizer_address: None,
191 ical_uid: None,
192 response: ResponseType::Accepted,
193 }
194 }
195
196 fn reminder(event_id: &str, fire_time: DateTime<Utc>) -> Reminder {
197 Reminder {
198 event_id: event_id.into(),
199 fire_time,
200 }
201 }
202
203 fn known(reminders: Vec<Reminder>, now: DateTime<Utc>) -> OutlookReminders {
204 let mut outlook = OutlookReminders::default();
205 let (start, end) = outlook.poll_range(&[event("a")], now).unwrap();
206 outlook.apply(start, end, Ok(reminders));
207 outlook
208 }
209
210 #[test]
211 fn polls_only_near_a_meeting_and_once_a_minute() {
212 let events = [event("a")];
213 let mut outlook = OutlookReminders::default();
214 assert_eq!(outlook.poll_range(&events, at(9, 38)), None);
215 let range = outlook.poll_range(&events, at(9, 39)).unwrap();
216 assert_eq!(range, (at(8, 39), at(10, 39)));
217 assert_eq!(outlook.poll_range(&events, at(9, 41)), None);
218 outlook.apply(range.0, range.1, Ok(Vec::new()));
219 assert_eq!(
220 outlook.poll_range(&events, at(9, 39) + Duration::seconds(59)),
221 None
222 );
223 assert!(outlook.poll_range(&events, at(9, 40)).is_some());
224 let mut later = OutlookReminders::default();
225 assert_eq!(later.poll_range(&events, at(9, 50)), None);
226 }
227
228 #[test]
229 fn unknown_state_keeps_the_local_behaviour() {
230 let mut outlook = OutlookReminders::default();
231 assert!(outlook.allows(&event("a"), at(9, 40)));
232 let (start, end) = outlook.poll_range(&[event("a")], at(9, 39)).unwrap();
233 outlook.apply(start, end, Err("offline".into()));
234 assert!(outlook.allows(&event("a"), at(9, 40)));
235 }
236
237 #[test]
238 fn a_reminder_missing_in_outlook_was_dismissed_there() {
239 let outlook = known(vec![reminder("b", at(9, 30))], at(9, 39));
240 assert!(!outlook.allows(&event("a"), at(9, 40)));
241 assert!(outlook.allows(&event("b"), at(9, 40)));
242 }
243
244 #[test]
245 fn a_reminder_snoozed_in_outlook_waits_for_its_fire_time() {
246 let outlook = known(vec![reminder("a", at(9, 43))], at(9, 39));
247 assert!(!outlook.allows(&event("a"), at(9, 42)));
248 assert!(outlook.allows(&event("a"), at(9, 43)));
249 }
250
251 #[test]
252 fn events_outside_the_read_range_are_not_judged() {
253 let outlook = known(Vec::new(), at(9, 39));
254 let tomorrow = CalendarEvent {
255 start: at(9, 45) + Duration::days(1),
256 ..event("a")
257 };
258 assert!(outlook.allows(&tomorrow, at(9, 40)));
259 }
260
261 #[test]
262 fn own_writes_update_the_known_state_at_once() {
263 let mut outlook = known(vec![reminder("a", at(9, 30))], at(9, 39));
264 outlook.note("a", ReminderWrite::Snooze(at(9, 45)));
265 assert!(!outlook.allows(&event("a"), at(9, 44)));
266 assert!(outlook.allows(&event("a"), at(9, 45)));
267 outlook.note("a", ReminderWrite::Dismiss);
268 assert!(!outlook.allows(&event("a"), at(9, 46)));
269 }
270}
crates/app-state/src/call/reminder.rs +87 −6
@@ -4,6 +4,7 @@ use chatsvc::{CalendarEvent, ResponseType};
4 4 use chrono::{DateTime, Duration, FixedOffset, Utc};
5 5 use gpui_kit::Context;
6 6
7 use super::outlook_reminders::{OutlookReminders, ReminderWrite};
7 8 use crate::app_state::{AppEvent, AppState};
8 9
9 10 pub const LEAD_MINUTES: i64 = 5;
@@ -22,6 +23,7 @@ pub enum ReminderPhase {
22 23 pub struct MeetingToast {
23 24 pub id: u64,
24 25 pub event_key: String,
26 pub event_id: String,
25 27 pub phase: ReminderPhase,
26 28 pub subject: String,
27 29 pub start: DateTime<Utc>,
@@ -32,13 +34,16 @@ fn event_key(event: &CalendarEvent) -> String {
32 34 format!("{}@{}", event.object_id, event.start.timestamp())
33 35 }
34 36
35 pub fn phase_at(event: &CalendarEvent, now: DateTime<Utc>, live: bool) -> Option<ReminderPhase> {
36 let eligible = event.online
37 pub(super) fn is_eligible(event: &CalendarEvent) -> bool {
38 event.online
37 39 && !event.cancelled
38 40 && !event.all_day
39 41 && event.join_url.is_some()
40 && event.response != ResponseType::Declined;
41 if !eligible {
42 && event.response != ResponseType::Declined
43 }
44
45 pub fn phase_at(event: &CalendarEvent, now: DateTime<Utc>, live: bool) -> Option<ReminderPhase> {
46 if !is_eligible(event) {
42 47 return None;
43 48 }
44 49 let opens = event.start - Duration::minutes(LEAD_MINUTES);
@@ -93,6 +98,7 @@ pub struct MeetingToasts {
93 98 next_id: u64,
94 99 last_check: Option<DateTime<Utc>>,
95 100 last_live_poll: Option<DateTime<Utc>>,
101 outlook: OutlookReminders,
96 102 }
97 103
98 104 impl MeetingToasts {
@@ -112,6 +118,10 @@ impl MeetingToasts {
112 118 self.entries.is_empty()
113 119 }
114 120
121 pub fn outlook_mut(&mut self) -> &mut OutlookReminders {
122 &mut self.outlook
123 }
124
115 125 pub fn dismiss(&mut self, id: u64) -> Option<MeetingToast> {
116 126 let index = self.entries.iter().position(|toast| toast.id == id)?;
117 127 let toast = self.entries.remove(index);
@@ -166,9 +176,11 @@ impl MeetingToasts {
166 176 ) -> ReminderUpdate {
167 177 self.last_check = Some(now);
168 178 let before = self.entries.clone();
179 let outlook = &self.outlook;
169 180 self.entries.retain(|toast| {
170 181 events.iter().any(|event| {
171 182 event_key(event) == toast.event_key
183 && outlook.allows(event, now)
172 184 && phase_at(event, now, is_live(event, live_threads)).is_some()
173 185 })
174 186 });
@@ -186,6 +198,10 @@ impl MeetingToasts {
186 198 if self.dismissed.contains(&key) {
187 199 continue;
188 200 }
201 if !self.outlook.allows(event, now) {
202 self.fired.retain(|(fired_key, _)| *fired_key != key);
203 continue;
204 }
189 205 let chime_due = phase != ReminderPhase::Soon && !self.chimed.contains(&key);
190 206 if let Some(existing) = self.entries.iter_mut().find(|toast| toast.event_key == key) {
191 207 existing.phase = phase;
@@ -224,6 +240,7 @@ impl MeetingToasts {
224 240 self.entries.push(MeetingToast {
225 241 id: self.next_id,
226 242 event_key: key,
243 event_id: event.object_id.clone(),
227 244 phase,
228 245 subject,
229 246 start: event.start,
@@ -240,6 +257,7 @@ impl MeetingToasts {
240 257 impl AppState {
241 258 pub fn tick_meeting_reminders(&mut self, show: bool, cx: &mut Context<Self>) {
242 259 let now = Utc::now();
260 self.poll_outlook_reminders(now, cx);
243 261 let in_call = self.call.is_some();
244 262 let show = show && !in_call && !self.mode.read_only;
245 263 for thread_id in self
@@ -284,14 +302,16 @@ impl AppState {
284 302 }
285 303
286 304 pub fn snooze_meeting_toast(&mut self, id: u64, cx: &mut Context<Self>) {
287 if self.meeting_toasts.snooze(id).is_some() {
305 if let Some(toast) = self.meeting_toasts.snooze(id) {
306 self.write_outlook_reminder(toast.event_id, ReminderWrite::Snooze(toast.start));
288 307 cx.emit(AppEvent::MeetingReminder);
289 308 cx.notify();
290 309 }
291 310 }
292 311
293 312 pub fn dismiss_meeting_toast(&mut self, id: u64, cx: &mut Context<Self>) {
294 if self.meeting_toasts.dismiss(id).is_some() {
313 if let Some(toast) = self.meeting_toasts.dismiss(id) {
314 self.write_outlook_reminder(toast.event_id, ReminderWrite::Dismiss);
295 315 cx.emit(AppEvent::MeetingReminder);
296 316 cx.notify();
297 317 }
@@ -613,6 +633,7 @@ mod tests {
613 633 let toast = |phase| MeetingToast {
614 634 id: 1,
615 635 event_key: "a".into(),
636 event_id: "a".into(),
616 637 phase,
617 638 subject: "Planning".into(),
618 639 start: at(9, 0, 0),
@@ -653,6 +674,66 @@ mod tests {
653 674 assert!(!toasts.clear());
654 675 }
655 676
677 fn outlook_state(
678 toasts: &mut MeetingToasts,
679 now: DateTime<Utc>,
680 fire_times: &[(&str, DateTime<Utc>)],
681 ) {
682 let outlook = toasts.outlook_mut();
683 let (start, end) = outlook.poll_range(&[event("a")], now).unwrap();
684 let reminders = fire_times
685 .iter()
686 .map(|(event_id, fire_time)| chatsvc::Reminder {
687 event_id: (*event_id).into(),
688 fire_time: *fire_time,
689 })
690 .collect();
691 outlook.apply(start, end, Ok(reminders));
692 }
693
694 #[test]
695 fn a_reminder_dismissed_in_outlook_is_not_shown_and_closes_an_open_toast() {
696 let events = [event("a"), event("b")];
697 let mut toasts = MeetingToasts::default();
698 outlook_state(&mut toasts, at(8, 54, 0), &[("b", at(8, 45, 0))]);
699 tick(&mut toasts, &events, at(8, 56, 0), true);
700 assert_eq!(toasts.entries().len(), 1);
701 assert_eq!(toasts.entries()[0].event_id, "b");
702 outlook_state(&mut toasts, at(8, 57, 0), &[]);
703 assert!(tick(&mut toasts, &events, at(8, 57, 1), true).changed);
704 assert!(toasts.is_empty());
705 }
706
707 #[test]
708 fn a_reminder_snoozed_in_outlook_comes_back_at_its_fire_time() {
709 let events = [event("a")];
710 let mut toasts = MeetingToasts::default();
711 outlook_state(&mut toasts, at(8, 54, 0), &[("a", at(8, 45, 0))]);
712 tick(&mut toasts, &events, at(8, 56, 0), true);
713 assert_eq!(toasts.entries().len(), 1);
714 outlook_state(&mut toasts, at(8, 57, 0), &[("a", at(8, 59, 0))]);
715 tick(&mut toasts, &events, at(8, 57, 1), true);
716 assert!(toasts.is_empty());
717 tick(&mut toasts, &events, at(8, 58, 59), true);
718 assert!(toasts.is_empty());
719 tick(&mut toasts, &events, at(8, 59, 0), true);
720 assert_eq!(toasts.entries().len(), 1);
721 }
722
723 #[test]
724 fn snooze_and_dismiss_hand_back_the_event_for_the_outlook_write() {
725 let events = [event("a"), event("b")];
726 let mut toasts = MeetingToasts::default();
727 tick(&mut toasts, &events, at(8, 56, 0), true);
728 let snoozed = toasts.snooze(toasts.entries()[0].id).unwrap();
729 assert_eq!(
730 (snoozed.event_id.as_str(), snoozed.start),
731 ("a", at(9, 0, 0))
732 );
733 let dismissed = toasts.dismiss(toasts.entries()[0].id).unwrap();
734 assert_eq!(dismissed.event_id, "b");
735 }
736
656 737 #[test]
657 738 fn checks_run_at_most_once_a_second() {
658 739 let mut toasts = MeetingToasts::default();
@@ -4,6 +4,7 @@ use chatsvc::{CalendarEvent, ResponseType};
4use chrono::{DateTime, Duration, FixedOffset, Utc};
4use chrono::{DateTime, Duration, FixedOffset, Utc};
5use gpui_kit::Context;
5use gpui_kit::Context;
6
6
7use super::outlook_reminders::{OutlookReminders, ReminderWrite};
7use crate::app_state::{AppEvent, AppState};
8use crate::app_state::{AppEvent, AppState};
8
9
9pub const LEAD_MINUTES: i64 = 5;
10pub const LEAD_MINUTES: i64 = 5;
@@ -22,6 +23,7 @@ pub enum ReminderPhase {
22pub struct MeetingToast {
23pub struct MeetingToast {
23 pub id: u64,
24 pub id: u64,
24 pub event_key: String,
25 pub event_key: String,
26 pub event_id: String,
25 pub phase: ReminderPhase,
27 pub phase: ReminderPhase,
26 pub subject: String,
28 pub subject: String,
27 pub start: DateTime<Utc>,
29 pub start: DateTime<Utc>,
@@ -32,13 +34,16 @@ fn event_key(event: &CalendarEvent) -> String {
32 format!("{}@{}", event.object_id, event.start.timestamp())
34 format!("{}@{}", event.object_id, event.start.timestamp())
33}
35}
34
36
35pub fn phase_at(event: &CalendarEvent, now: DateTime<Utc>, live: bool) -> Option<ReminderPhase> {
37pub(super) fn is_eligible(event: &CalendarEvent) -> bool {
36 let eligible = event.online
38 event.online
37 && !event.cancelled
39 && !event.cancelled
38 && !event.all_day
40 && !event.all_day
39 && event.join_url.is_some()
41 && event.join_url.is_some()
40 && event.response != ResponseType::Declined;
42 && event.response != ResponseType::Declined
41 if !eligible {
43}
44
45pub fn phase_at(event: &CalendarEvent, now: DateTime<Utc>, live: bool) -> Option<ReminderPhase> {
46 if !is_eligible(event) {
42 return None;
47 return None;
43 }
48 }
44 let opens = event.start - Duration::minutes(LEAD_MINUTES);
49 let opens = event.start - Duration::minutes(LEAD_MINUTES);
@@ -93,6 +98,7 @@ pub struct MeetingToasts {
93 next_id: u64,
98 next_id: u64,
94 last_check: Option<DateTime<Utc>>,
99 last_check: Option<DateTime<Utc>>,
95 last_live_poll: Option<DateTime<Utc>>,
100 last_live_poll: Option<DateTime<Utc>>,
101 outlook: OutlookReminders,
96}
102}
97
103
98impl MeetingToasts {
104impl MeetingToasts {
@@ -112,6 +118,10 @@ impl MeetingToasts {
112 self.entries.is_empty()
118 self.entries.is_empty()
113 }
119 }
114
120
121 pub fn outlook_mut(&mut self) -> &mut OutlookReminders {
122 &mut self.outlook
123 }
124
115 pub fn dismiss(&mut self, id: u64) -> Option<MeetingToast> {
125 pub fn dismiss(&mut self, id: u64) -> Option<MeetingToast> {
116 let index = self.entries.iter().position(|toast| toast.id == id)?;
126 let index = self.entries.iter().position(|toast| toast.id == id)?;
117 let toast = self.entries.remove(index);
127 let toast = self.entries.remove(index);
@@ -166,9 +176,11 @@ impl MeetingToasts {
166 ) -> ReminderUpdate {
176 ) -> ReminderUpdate {
167 self.last_check = Some(now);
177 self.last_check = Some(now);
168 let before = self.entries.clone();
178 let before = self.entries.clone();
179 let outlook = &self.outlook;
169 self.entries.retain(|toast| {
180 self.entries.retain(|toast| {
170 events.iter().any(|event| {
181 events.iter().any(|event| {
171 event_key(event) == toast.event_key
182 event_key(event) == toast.event_key
183 && outlook.allows(event, now)
172 && phase_at(event, now, is_live(event, live_threads)).is_some()
184 && phase_at(event, now, is_live(event, live_threads)).is_some()
173 })
185 })
174 });
186 });
@@ -186,6 +198,10 @@ impl MeetingToasts {
186 if self.dismissed.contains(&key) {
198 if self.dismissed.contains(&key) {
187 continue;
199 continue;
188 }
200 }
201 if !self.outlook.allows(event, now) {
202 self.fired.retain(|(fired_key, _)| *fired_key != key);
203 continue;
204 }
189 let chime_due = phase != ReminderPhase::Soon && !self.chimed.contains(&key);
205 let chime_due = phase != ReminderPhase::Soon && !self.chimed.contains(&key);
190 if let Some(existing) = self.entries.iter_mut().find(|toast| toast.event_key == key) {
206 if let Some(existing) = self.entries.iter_mut().find(|toast| toast.event_key == key) {
191 existing.phase = phase;
207 existing.phase = phase;
@@ -224,6 +240,7 @@ impl MeetingToasts {
224 self.entries.push(MeetingToast {
240 self.entries.push(MeetingToast {
225 id: self.next_id,
241 id: self.next_id,
226 event_key: key,
242 event_key: key,
243 event_id: event.object_id.clone(),
227 phase,
244 phase,
228 subject,
245 subject,
229 start: event.start,
246 start: event.start,
@@ -240,6 +257,7 @@ impl MeetingToasts {
240impl AppState {
257impl AppState {
241 pub fn tick_meeting_reminders(&mut self, show: bool, cx: &mut Context<Self>) {
258 pub fn tick_meeting_reminders(&mut self, show: bool, cx: &mut Context<Self>) {
242 let now = Utc::now();
259 let now = Utc::now();
260 self.poll_outlook_reminders(now, cx);
243 let in_call = self.call.is_some();
261 let in_call = self.call.is_some();
244 let show = show && !in_call && !self.mode.read_only;
262 let show = show && !in_call && !self.mode.read_only;
245 for thread_id in self
263 for thread_id in self
@@ -284,14 +302,16 @@ impl AppState {
284 }
302 }
285
303
286 pub fn snooze_meeting_toast(&mut self, id: u64, cx: &mut Context<Self>) {
304 pub fn snooze_meeting_toast(&mut self, id: u64, cx: &mut Context<Self>) {
287 if self.meeting_toasts.snooze(id).is_some() {
305 if let Some(toast) = self.meeting_toasts.snooze(id) {
306 self.write_outlook_reminder(toast.event_id, ReminderWrite::Snooze(toast.start));
288 cx.emit(AppEvent::MeetingReminder);
307 cx.emit(AppEvent::MeetingReminder);
289 cx.notify();
308 cx.notify();
290 }
309 }
291 }
310 }
292
311
293 pub fn dismiss_meeting_toast(&mut self, id: u64, cx: &mut Context<Self>) {
312 pub fn dismiss_meeting_toast(&mut self, id: u64, cx: &mut Context<Self>) {
294 if self.meeting_toasts.dismiss(id).is_some() {
313 if let Some(toast) = self.meeting_toasts.dismiss(id) {
314 self.write_outlook_reminder(toast.event_id, ReminderWrite::Dismiss);
295 cx.emit(AppEvent::MeetingReminder);
315 cx.emit(AppEvent::MeetingReminder);
296 cx.notify();
316 cx.notify();
297 }
317 }
@@ -613,6 +633,7 @@ mod tests {
613 let toast = |phase| MeetingToast {
633 let toast = |phase| MeetingToast {
614 id: 1,
634 id: 1,
615 event_key: "a".into(),
635 event_key: "a".into(),
636 event_id: "a".into(),
616 phase,
637 phase,
617 subject: "Planning".into(),
638 subject: "Planning".into(),
618 start: at(9, 0, 0),
639 start: at(9, 0, 0),
@@ -653,6 +674,66 @@ mod tests {
653 assert!(!toasts.clear());
674 assert!(!toasts.clear());
654 }
675 }
655
676
677 fn outlook_state(
678 toasts: &mut MeetingToasts,
679 now: DateTime<Utc>,
680 fire_times: &[(&str, DateTime<Utc>)],
681 ) {
682 let outlook = toasts.outlook_mut();
683 let (start, end) = outlook.poll_range(&[event("a")], now).unwrap();
684 let reminders = fire_times
685 .iter()
686 .map(|(event_id, fire_time)| chatsvc::Reminder {
687 event_id: (*event_id).into(),
688 fire_time: *fire_time,
689 })
690 .collect();
691 outlook.apply(start, end, Ok(reminders));
692 }
693
694 #[test]
695 fn a_reminder_dismissed_in_outlook_is_not_shown_and_closes_an_open_toast() {
696 let events = [event("a"), event("b")];
697 let mut toasts = MeetingToasts::default();
698 outlook_state(&mut toasts, at(8, 54, 0), &[("b", at(8, 45, 0))]);
699 tick(&mut toasts, &events, at(8, 56, 0), true);
700 assert_eq!(toasts.entries().len(), 1);
701 assert_eq!(toasts.entries()[0].event_id, "b");
702 outlook_state(&mut toasts, at(8, 57, 0), &[]);
703 assert!(tick(&mut toasts, &events, at(8, 57, 1), true).changed);
704 assert!(toasts.is_empty());
705 }
706
707 #[test]
708 fn a_reminder_snoozed_in_outlook_comes_back_at_its_fire_time() {
709 let events = [event("a")];
710 let mut toasts = MeetingToasts::default();
711 outlook_state(&mut toasts, at(8, 54, 0), &[("a", at(8, 45, 0))]);
712 tick(&mut toasts, &events, at(8, 56, 0), true);
713 assert_eq!(toasts.entries().len(), 1);
714 outlook_state(&mut toasts, at(8, 57, 0), &[("a", at(8, 59, 0))]);
715 tick(&mut toasts, &events, at(8, 57, 1), true);
716 assert!(toasts.is_empty());
717 tick(&mut toasts, &events, at(8, 58, 59), true);
718 assert!(toasts.is_empty());
719 tick(&mut toasts, &events, at(8, 59, 0), true);
720 assert_eq!(toasts.entries().len(), 1);
721 }
722
723 #[test]
724 fn snooze_and_dismiss_hand_back_the_event_for_the_outlook_write() {
725 let events = [event("a"), event("b")];
726 let mut toasts = MeetingToasts::default();
727 tick(&mut toasts, &events, at(8, 56, 0), true);
728 let snoozed = toasts.snooze(toasts.entries()[0].id).unwrap();
729 assert_eq!(
730 (snoozed.event_id.as_str(), snoozed.start),
731 ("a", at(9, 0, 0))
732 );
733 let dismissed = toasts.dismiss(toasts.entries()[0].id).unwrap();
734 assert_eq!(dismissed.event_id, "b");
735 }
736
656 #[test]
737 #[test]
657 fn checks_run_at_most_once_a_second() {
738 fn checks_run_at_most_once_a_second() {
658 let mut toasts = MeetingToasts::default();
739 let mut toasts = MeetingToasts::default();
crates/chatsvc/src/calendar.rs +2 −0
@@ -5,8 +5,10 @@ use session::{ApiResponse, Method, Request, Session};
5 5 use crate::cards::{CardTransport, DEFAULT_MT_REGION, SessionCardTransport, spaces_scope};
6 6 use crate::error::{Error, Result};
7 7
8 mod reminders;
8 9 mod schedule;
9 10
11 pub use reminders::{Reminder, parse_reminders};
10 12 pub use schedule::{
11 13 Attendee, CreatedEvent, NewEvent, Repeat, Reply, new_event_body, parse_created_event,
12 14 };
@@ -5,8 +5,10 @@ use session::{ApiResponse, Method, Request, Session};
5use crate::cards::{CardTransport, DEFAULT_MT_REGION, SessionCardTransport, spaces_scope};
5use crate::cards::{CardTransport, DEFAULT_MT_REGION, SessionCardTransport, spaces_scope};
6use crate::error::{Error, Result};
6use crate::error::{Error, Result};
7
7
8mod reminders;
8mod schedule;
9mod schedule;
9
10
11pub use reminders::{Reminder, parse_reminders};
10pub use schedule::{
12pub use schedule::{
11 Attendee, CreatedEvent, NewEvent, Repeat, Reply, new_event_body, parse_created_event,
13 Attendee, CreatedEvent, NewEvent, Repeat, Reply, new_event_body, parse_created_event,
12};
14};
crates/chatsvc/src/calendar/reminders.rs added +273 −0
@@ -0,0 +1,273 @@
1 use chrono::{DateTime, NaiveDateTime, Utc};
2 use serde_json::{Value, json};
3 use session::{GRAPH, Method, Request, Scope};
4
5 use super::Calendar;
6 use super::schedule::CALENDARS_SCOPE;
7 use crate::cards::CardTransport;
8 use crate::error::{Error, Result};
9 use crate::messages::encode;
10
11 const QUERY_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%SZ";
12 const GRAPH_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%S";
13 const GRAPH_READ_FORMAT: &str = "%Y-%m-%dT%H:%M:%S%.f";
14 const UTC_PREFERENCE: &str = "outlook.timezone=\"UTC\"";
15 const MAX_PAGES: usize = 5;
16
17 #[derive(Debug, Clone, PartialEq, Eq)]
18 pub struct Reminder {
19 pub event_id: String,
20 pub fire_time: DateTime<Utc>,
21 }
22
23 fn reminder_view_url(start: DateTime<Utc>, end: DateTime<Utc>) -> String {
24 format!(
25 "{GRAPH}/v1.0/me/reminderView(startDateTime='{}',endDateTime='{}')",
26 start.format(QUERY_TIME_FORMAT),
27 end.format(QUERY_TIME_FORMAT)
28 )
29 }
30
31 fn reminder_action_url(event_id: &str, action: &str) -> String {
32 format!("{GRAPH}/v1.0/me/events/{}/{action}", encode(event_id))
33 }
34
35 fn utc_time(value: &Value) -> Option<DateTime<Utc>> {
36 let text = value.get("dateTime")?.as_str()?;
37 let zone = value
38 .get("timeZone")
39 .and_then(Value::as_str)
40 .unwrap_or("UTC");
41 if !zone.eq_ignore_ascii_case("UTC") {
42 return None;
43 }
44 NaiveDateTime::parse_from_str(text, GRAPH_READ_FORMAT)
45 .ok()
46 .map(|time| time.and_utc())
47 }
48
49 pub fn parse_reminders(body: &Value) -> Vec<Reminder> {
50 body.get("value")
51 .and_then(Value::as_array)
52 .into_iter()
53 .flatten()
54 .filter_map(|entry| {
55 Some(Reminder {
56 event_id: entry.get("eventId")?.as_str()?.to_owned(),
57 fire_time: utc_time(entry.get("reminderFireTime")?)?,
58 })
59 })
60 .collect()
61 }
62
63 impl<T: CardTransport> Calendar<T> {
64 pub async fn reminder_view(
65 &self,
66 start: DateTime<Utc>,
67 end: DateTime<Utc>,
68 ) -> Result<Vec<Reminder>> {
69 let mut url = reminder_view_url(start, end);
70 let mut reminders = Vec::new();
71 for _ in 0..MAX_PAGES {
72 let mut request = Request::get(&url);
73 request
74 .headers
75 .push(("Prefer".to_owned(), UTC_PREFERENCE.to_owned()));
76 let answer = self
77 .transport
78 .send(request, Scope::graph(CALENDARS_SCOPE))
79 .await?;
80 if !answer.is_success() {
81 return Err(Error::Session(session::Error::api(
82 answer.status,
83 &url,
84 answer.body,
85 )));
86 }
87 reminders.extend(parse_reminders(&answer.body));
88 match answer.body.get("@odata.nextLink").and_then(Value::as_str) {
89 Some(next) => url = next.to_owned(),
90 None => break,
91 }
92 }
93 Ok(reminders)
94 }
95
96 pub async fn snooze_reminder(&self, event_id: &str, until: DateTime<Utc>) -> Result<()> {
97 let body = json!({"newReminderTime": {
98 "dateTime": until.format(GRAPH_TIME_FORMAT).to_string(),
99 "timeZone": "UTC",
100 }});
101 self.reminder_action(event_id, "snoozeReminder", Some(body))
102 .await
103 }
104
105 pub async fn dismiss_reminder(&self, event_id: &str) -> Result<()> {
106 self.reminder_action(event_id, "dismissReminder", None)
107 .await
108 }
109
110 async fn reminder_action(
111 &self,
112 event_id: &str,
113 action: &str,
114 body: Option<Value>,
115 ) -> Result<()> {
116 let url = reminder_action_url(event_id, action);
117 let request = Request::with_body(Method::Post, &url, body.unwrap_or_else(|| json!({})));
118 let answer = self
119 .transport
120 .send(request, Scope::graph(CALENDARS_SCOPE))
121 .await?;
122 if answer.is_success() {
123 return Ok(());
124 }
125 Err(Error::Session(session::Error::api(
126 answer.status,
127 &url,
128 answer.body,
129 )))
130 }
131 }
132
133 #[cfg(test)]
134 mod tests {
135 use std::sync::Mutex;
136
137 use chrono::TimeZone;
138 use session::ApiResponse;
139
140 use super::*;
141
142 struct Scripted {
143 answers: Mutex<Vec<(u16, Value)>>,
144 sent: Mutex<Vec<Request>>,
145 }
146
147 impl Scripted {
148 fn new(answers: Vec<(u16, Value)>) -> Self {
149 Scripted {
150 answers: Mutex::new(answers),
151 sent: Mutex::new(Vec::new()),
152 }
153 }
154 }
155
156 impl CardTransport for Scripted {
157 async fn send(&self, request: Request, scope: Scope) -> Result<ApiResponse> {
158 assert_eq!(scope, Scope::graph(CALENDARS_SCOPE));
159 self.sent.lock().unwrap().push(request);
160 let (status, body) = self.answers.lock().unwrap().remove(0);
161 Ok(ApiResponse {
162 status,
163 body,
164 retry_after: None,
165 })
166 }
167 }
168
169 fn at(hour: u32, minute: u32) -> DateTime<Utc> {
170 Utc.with_ymd_and_hms(2026, 10, 19, hour, minute, 0).unwrap()
171 }
172
173 fn reminder_entry(event_id: &str, fire_time: &str) -> Value {
174 json!({
175 "eventId": event_id,
176 "eventSubject": "Daily Standup",
177 "eventStartTime": {"dateTime": "2026-10-19T09:45:00.0000000", "timeZone": "UTC"},
178 "reminderFireTime": {"dateTime": fire_time, "timeZone": "UTC"},
179 })
180 }
181
182 #[test]
183 fn reminders_carry_the_event_id_and_the_fire_time() {
184 let body = json!({"value": [
185 reminder_entry("AAMk-a", "2026-10-19T09:30:00.0000000"),
186 {"eventId": "AAMk-b", "reminderFireTime": {"dateTime": "2026-10-19T09:30:00", "timeZone": "W. Europe Standard Time"}},
187 {"reminderFireTime": {"dateTime": "2026-10-19T09:30:00", "timeZone": "UTC"}},
188 ]});
189 assert_eq!(
190 parse_reminders(&body),
191 vec![Reminder {
192 event_id: "AAMk-a".into(),
193 fire_time: at(9, 30),
194 }]
195 );
196 }
197
198 #[tokio::test]
199 async fn the_reminder_view_asks_for_utc_and_follows_the_next_link() {
200 let calendar = Calendar::with_transport(
201 Scripted::new(vec![
202 (
203 200,
204 json!({
205 "value": [reminder_entry("AAMk-a", "2026-10-19T09:30:00.0000000")],
206 "@odata.nextLink": "https://graph.microsoft.com/v1.0/next-page",
207 }),
208 ),
209 (
210 200,
211 json!({"value": [reminder_entry("AAMk-b", "2026-10-19T09:40:00.0000000")]}),
212 ),
213 ]),
214 "emea",
215 );
216 let reminders = calendar.reminder_view(at(9, 0), at(11, 0)).await.unwrap();
217 assert_eq!(reminders.len(), 2);
218 let sent = calendar.transport.sent.lock().unwrap();
219 assert_eq!(
220 sent[0].url,
221 "https://graph.microsoft.com/v1.0/me/reminderView(startDateTime='2026-10-19T09:00:00Z',endDateTime='2026-10-19T11:00:00Z')"
222 );
223 assert!(
224 sent[0]
225 .headers
226 .contains(&("Prefer".to_owned(), UTC_PREFERENCE.to_owned()))
227 );
228 assert_eq!(sent[1].url, "https://graph.microsoft.com/v1.0/next-page");
229 }
230
231 #[tokio::test]
232 async fn snooze_posts_the_new_reminder_time_for_the_occurrence() {
233 let calendar = Calendar::with_transport(Scripted::new(vec![(200, Value::Null)]), "emea");
234 calendar
235 .snooze_reminder("AAMk+a/b=", at(9, 45))
236 .await
237 .unwrap();
238 let sent = calendar.transport.sent.lock().unwrap();
239 assert_eq!(sent[0].method, Method::Post);
240 assert_eq!(
241 sent[0].url,
242 "https://graph.microsoft.com/v1.0/me/events/AAMk%2Ba%2Fb%3D/snoozeReminder"
243 );
244 assert_eq!(
245 sent[0].body,
246 Some(
247 json!({"newReminderTime": {"dateTime": "2026-10-19T09:45:00", "timeZone": "UTC"}})
248 )
249 );
250 }
251
252 #[tokio::test]
253 async fn dismiss_posts_and_reports_a_failure() {
254 let calendar = Calendar::with_transport(
255 Scripted::new(vec![
256 (200, Value::Null),
257 (
258 404,
259 json!({"error": {"message": "The specified object was not found"}}),
260 ),
261 ]),
262 "emea",
263 );
264 calendar.dismiss_reminder("AAMk-a").await.unwrap();
265 let error = calendar.dismiss_reminder("AAMk-gone").await.unwrap_err();
266 assert!(error.to_string().contains("not found"));
267 let sent = calendar.transport.sent.lock().unwrap();
268 assert_eq!(
269 sent[0].url,
270 "https://graph.microsoft.com/v1.0/me/events/AAMk-a/dismissReminder"
271 );
272 }
273 }
@@ -0,0 +1,273 @@
1use chrono::{DateTime, NaiveDateTime, Utc};
2use serde_json::{Value, json};
3use session::{GRAPH, Method, Request, Scope};
4
5use super::Calendar;
6use super::schedule::CALENDARS_SCOPE;
7use crate::cards::CardTransport;
8use crate::error::{Error, Result};
9use crate::messages::encode;
10
11const QUERY_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%SZ";
12const GRAPH_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%S";
13const GRAPH_READ_FORMAT: &str = "%Y-%m-%dT%H:%M:%S%.f";
14const UTC_PREFERENCE: &str = "outlook.timezone=\"UTC\"";
15const MAX_PAGES: usize = 5;
16
17#[derive(Debug, Clone, PartialEq, Eq)]
18pub struct Reminder {
19 pub event_id: String,
20 pub fire_time: DateTime<Utc>,
21}
22
23fn reminder_view_url(start: DateTime<Utc>, end: DateTime<Utc>) -> String {
24 format!(
25 "{GRAPH}/v1.0/me/reminderView(startDateTime='{}',endDateTime='{}')",
26 start.format(QUERY_TIME_FORMAT),
27 end.format(QUERY_TIME_FORMAT)
28 )
29}
30
31fn reminder_action_url(event_id: &str, action: &str) -> String {
32 format!("{GRAPH}/v1.0/me/events/{}/{action}", encode(event_id))
33}
34
35fn utc_time(value: &Value) -> Option<DateTime<Utc>> {
36 let text = value.get("dateTime")?.as_str()?;
37 let zone = value
38 .get("timeZone")
39 .and_then(Value::as_str)
40 .unwrap_or("UTC");
41 if !zone.eq_ignore_ascii_case("UTC") {
42 return None;
43 }
44 NaiveDateTime::parse_from_str(text, GRAPH_READ_FORMAT)
45 .ok()
46 .map(|time| time.and_utc())
47}
48
49pub fn parse_reminders(body: &Value) -> Vec<Reminder> {
50 body.get("value")
51 .and_then(Value::as_array)
52 .into_iter()
53 .flatten()
54 .filter_map(|entry| {
55 Some(Reminder {
56 event_id: entry.get("eventId")?.as_str()?.to_owned(),
57 fire_time: utc_time(entry.get("reminderFireTime")?)?,
58 })
59 })
60 .collect()
61}
62
63impl<T: CardTransport> Calendar<T> {
64 pub async fn reminder_view(
65 &self,
66 start: DateTime<Utc>,
67 end: DateTime<Utc>,
68 ) -> Result<Vec<Reminder>> {
69 let mut url = reminder_view_url(start, end);
70 let mut reminders = Vec::new();
71 for _ in 0..MAX_PAGES {
72 let mut request = Request::get(&url);
73 request
74 .headers
75 .push(("Prefer".to_owned(), UTC_PREFERENCE.to_owned()));
76 let answer = self
77 .transport
78 .send(request, Scope::graph(CALENDARS_SCOPE))
79 .await?;
80 if !answer.is_success() {
81 return Err(Error::Session(session::Error::api(
82 answer.status,
83 &url,
84 answer.body,
85 )));
86 }
87 reminders.extend(parse_reminders(&answer.body));
88 match answer.body.get("@odata.nextLink").and_then(Value::as_str) {
89 Some(next) => url = next.to_owned(),
90 None => break,
91 }
92 }
93 Ok(reminders)
94 }
95
96 pub async fn snooze_reminder(&self, event_id: &str, until: DateTime<Utc>) -> Result<()> {
97 let body = json!({"newReminderTime": {
98 "dateTime": until.format(GRAPH_TIME_FORMAT).to_string(),
99 "timeZone": "UTC",
100 }});
101 self.reminder_action(event_id, "snoozeReminder", Some(body))
102 .await
103 }
104
105 pub async fn dismiss_reminder(&self, event_id: &str) -> Result<()> {
106 self.reminder_action(event_id, "dismissReminder", None)
107 .await
108 }
109
110 async fn reminder_action(
111 &self,
112 event_id: &str,
113 action: &str,
114 body: Option<Value>,
115 ) -> Result<()> {
116 let url = reminder_action_url(event_id, action);
117 let request = Request::with_body(Method::Post, &url, body.unwrap_or_else(|| json!({})));
118 let answer = self
119 .transport
120 .send(request, Scope::graph(CALENDARS_SCOPE))
121 .await?;
122 if answer.is_success() {
123 return Ok(());
124 }
125 Err(Error::Session(session::Error::api(
126 answer.status,
127 &url,
128 answer.body,
129 )))
130 }
131}
132
133#[cfg(test)]
134mod tests {
135 use std::sync::Mutex;
136
137 use chrono::TimeZone;
138 use session::ApiResponse;
139
140 use super::*;
141
142 struct Scripted {
143 answers: Mutex<Vec<(u16, Value)>>,
144 sent: Mutex<Vec<Request>>,
145 }
146
147 impl Scripted {
148 fn new(answers: Vec<(u16, Value)>) -> Self {
149 Scripted {
150 answers: Mutex::new(answers),
151 sent: Mutex::new(Vec::new()),
152 }
153 }
154 }
155
156 impl CardTransport for Scripted {
157 async fn send(&self, request: Request, scope: Scope) -> Result<ApiResponse> {
158 assert_eq!(scope, Scope::graph(CALENDARS_SCOPE));
159 self.sent.lock().unwrap().push(request);
160 let (status, body) = self.answers.lock().unwrap().remove(0);
161 Ok(ApiResponse {
162 status,
163 body,
164 retry_after: None,
165 })
166 }
167 }
168
169 fn at(hour: u32, minute: u32) -> DateTime<Utc> {
170 Utc.with_ymd_and_hms(2026, 10, 19, hour, minute, 0).unwrap()
171 }
172
173 fn reminder_entry(event_id: &str, fire_time: &str) -> Value {
174 json!({
175 "eventId": event_id,
176 "eventSubject": "Daily Standup",
177 "eventStartTime": {"dateTime": "2026-10-19T09:45:00.0000000", "timeZone": "UTC"},
178 "reminderFireTime": {"dateTime": fire_time, "timeZone": "UTC"},
179 })
180 }
181
182 #[test]
183 fn reminders_carry_the_event_id_and_the_fire_time() {
184 let body = json!({"value": [
185 reminder_entry("AAMk-a", "2026-10-19T09:30:00.0000000"),
186 {"eventId": "AAMk-b", "reminderFireTime": {"dateTime": "2026-10-19T09:30:00", "timeZone": "W. Europe Standard Time"}},
187 {"reminderFireTime": {"dateTime": "2026-10-19T09:30:00", "timeZone": "UTC"}},
188 ]});
189 assert_eq!(
190 parse_reminders(&body),
191 vec![Reminder {
192 event_id: "AAMk-a".into(),
193 fire_time: at(9, 30),
194 }]
195 );
196 }
197
198 #[tokio::test]
199 async fn the_reminder_view_asks_for_utc_and_follows_the_next_link() {
200 let calendar = Calendar::with_transport(
201 Scripted::new(vec![
202 (
203 200,
204 json!({
205 "value": [reminder_entry("AAMk-a", "2026-10-19T09:30:00.0000000")],
206 "@odata.nextLink": "https://graph.microsoft.com/v1.0/next-page",
207 }),
208 ),
209 (
210 200,
211 json!({"value": [reminder_entry("AAMk-b", "2026-10-19T09:40:00.0000000")]}),
212 ),
213 ]),
214 "emea",
215 );
216 let reminders = calendar.reminder_view(at(9, 0), at(11, 0)).await.unwrap();
217 assert_eq!(reminders.len(), 2);
218 let sent = calendar.transport.sent.lock().unwrap();
219 assert_eq!(
220 sent[0].url,
221 "https://graph.microsoft.com/v1.0/me/reminderView(startDateTime='2026-10-19T09:00:00Z',endDateTime='2026-10-19T11:00:00Z')"
222 );
223 assert!(
224 sent[0]
225 .headers
226 .contains(&("Prefer".to_owned(), UTC_PREFERENCE.to_owned()))
227 );
228 assert_eq!(sent[1].url, "https://graph.microsoft.com/v1.0/next-page");
229 }
230
231 #[tokio::test]
232 async fn snooze_posts_the_new_reminder_time_for_the_occurrence() {
233 let calendar = Calendar::with_transport(Scripted::new(vec![(200, Value::Null)]), "emea");
234 calendar
235 .snooze_reminder("AAMk+a/b=", at(9, 45))
236 .await
237 .unwrap();
238 let sent = calendar.transport.sent.lock().unwrap();
239 assert_eq!(sent[0].method, Method::Post);
240 assert_eq!(
241 sent[0].url,
242 "https://graph.microsoft.com/v1.0/me/events/AAMk%2Ba%2Fb%3D/snoozeReminder"
243 );
244 assert_eq!(
245 sent[0].body,
246 Some(
247 json!({"newReminderTime": {"dateTime": "2026-10-19T09:45:00", "timeZone": "UTC"}})
248 )
249 );
250 }
251
252 #[tokio::test]
253 async fn dismiss_posts_and_reports_a_failure() {
254 let calendar = Calendar::with_transport(
255 Scripted::new(vec![
256 (200, Value::Null),
257 (
258 404,
259 json!({"error": {"message": "The specified object was not found"}}),
260 ),
261 ]),
262 "emea",
263 );
264 calendar.dismiss_reminder("AAMk-a").await.unwrap();
265 let error = calendar.dismiss_reminder("AAMk-gone").await.unwrap_err();
266 assert!(error.to_string().contains("not found"));
267 let sent = calendar.transport.sent.lock().unwrap();
268 assert_eq!(
269 sent[0].url,
270 "https://graph.microsoft.com/v1.0/me/events/AAMk-a/dismissReminder"
271 );
272 }
273}
crates/chatsvc/src/calendar/schedule.rs +1 −1
@@ -7,7 +7,7 @@ use crate::cards::CardTransport;
7 7 use crate::error::{Error, Result};
8 8 use crate::messages::encode;
9 9
10 const CALENDARS_SCOPE: &str = "Calendars.ReadWrite";
10 pub(super) const CALENDARS_SCOPE: &str = "Calendars.ReadWrite";
11 11 const GRAPH_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%S";
12 12 const GRAPH_DATE_FORMAT: &str = "%Y-%m-%d";
13 13 const TIME_ZONE: &str = "UTC";
@@ -7,7 +7,7 @@ use crate::cards::CardTransport;
7use crate::error::{Error, Result};
7use crate::error::{Error, Result};
8use crate::messages::encode;
8use crate::messages::encode;
9
9
10const CALENDARS_SCOPE: &str = "Calendars.ReadWrite";
10pub(super) const CALENDARS_SCOPE: &str = "Calendars.ReadWrite";
11const GRAPH_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%S";
11const GRAPH_TIME_FORMAT: &str = "%Y-%m-%dT%H:%M:%S";
12const GRAPH_DATE_FORMAT: &str = "%Y-%m-%d";
12const GRAPH_DATE_FORMAT: &str = "%Y-%m-%d";
13const TIME_ZONE: &str = "UTC";
13const TIME_ZONE: &str = "UTC";
crates/chatsvc/src/lib.rs +1 −1
@@ -27,7 +27,7 @@ pub mod translate;
27 27 pub mod window;
28 28
29 29 pub use calendar::{
30 Attendee, Calendar, CalendarEvent, CreatedEvent, NewEvent, Repeat, Reply, ResponseType,
30 Attendee, Calendar, CalendarEvent, CreatedEvent, NewEvent, Reminder, Repeat, Reply, ResponseType,
31 31 meet_now_join_url, new_event_body, parse_calendar_events, parse_created_event,
32 32 };
33 33 pub use calllog::{CallDirection, CallLogEntry, CallOutcome};
@@ -27,7 +27,7 @@ pub mod translate;
27pub mod window;
27pub mod window;
28
28
29pub use calendar::{
29pub use calendar::{
30 Attendee, Calendar, CalendarEvent, CreatedEvent, NewEvent, Repeat, Reply, ResponseType,
30 Attendee, Calendar, CalendarEvent, CreatedEvent, NewEvent, Reminder, Repeat, Reply, ResponseType,
31 meet_now_join_url, new_event_body, parse_calendar_events, parse_created_event,
31 meet_now_join_url, new_event_body, parse_calendar_events, parse_created_event,
32};
32};
33pub use calllog::{CallDirection, CallLogEntry, CallOutcome};
33pub use calllog::{CallDirection, CallLogEntry, CallOutcome};