Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Drive: an empty storage answer shows the count alone instead of breaking the screen; calendar alerts above the tests, as clippy asks
Yashwanth Kamireddi6c7f88ef303d
diff --git a/probe/examples/storage_info.rs b/probe/examples/storage_info.rsindex a86cb3d..bcebb81 100644--- a/probe/examples/storage_info.rs+++ b/probe/examples/storage_info.rs@@ -15,6 +15,6 @@ async fn main() -> Result<()> {.await?;println!("{}", r.status());let t = r.text().await?;- println!("{}", &t.chars().take(900).collect::<String>());+ println!("{}", t.chars().take(900).collect::<String>());Ok(())}diff --git a/probe/src/main.rs b/probe/src/main.rsindex e57ce9f..9e32e32 100644--- a/probe/src/main.rs+++ b/probe/src/main.rs@@ -1240,6 +1240,7 @@ async fn main() -> Result<()> {modified_at: None,editable: true,etag: None,+ runs: None,};match quince_icloud::notes::edit_cloudkit(&http,diff --git a/src-tauri/src/alerts.rs b/src-tauri/src/alerts.rsindex 16fd7ff..c81fc75 100644--- a/src-tauri/src/alerts.rs+++ b/src-tauri/src/alerts.rs@@ -202,79 +202,6 @@ fn show(app: AppHandle, due: DueAlarm) {});}-#[cfg(test)]-mod tests {- use super::*;- use quince_core::alarms::{Alarm, AlarmTrigger};- use quince_core::reminders::{Reminder, ReminderList};-- fn library_with(fires: &[(&str, i64)]) -> quince_core::Library {- let dir = tempfile::tempdir().unwrap();- let mut lib = quince_core::Library::open(&dir.keep()).unwrap();- lib.put_reminder_lists(&[ReminderList {- guid: "L".into(),- title: "Home".into(),- enabled: true,- ..Default::default()- }])- .unwrap();- let mut reminders = Vec::new();- let mut alarms = Vec::new();- let mut triggers = Vec::new();- for (id, at) in fires {- reminders.push(Reminder {- guid: format!("R{id}"),- list_guid: "L".into(),- title: format!("Do {id}"),- ..Default::default()- });- alarms.push(Alarm {- id: format!("A{id}"),- reminder_guid: format!("R{id}"),- trigger_id: format!("T{id}"),- acknowledged_at: None,- });- triggers.push(AlarmTrigger {- id: format!("T{id}"),- fires_at: *at,- });- }- lib.put_reminders(&reminders).unwrap();- lib.put_alarms(&alarms, &triggers, &[], true).unwrap();- lib- }-- #[test]- fn a_due_alert_is_taken_once_and_the_next_is_named() {- let mut lib = library_with(&[("now", 1_000_000), ("later", 1_003_600)]);- let (ring, next) = take_due(&mut lib, 1_000_000);- assert_eq!(- ring.iter().map(|d| d.title.as_str()).collect::<Vec<_>>(),- ["Do now"]- );- assert_eq!(next, Some(1_003_600));- // A second wake at the same moment — resume and a pass together — rings nothing.- let (again, _) = take_due(&mut lib, 1_000_000);- assert!(again.is_empty());- }-- #[test]- fn missed_while_away_rings_once_but_long_gone_stays_quiet() {- let now = 10_000_000;- let mut lib = library_with(&[- ("an hour ago", now - 3_600),- ("last week", now - 7 * 86_400),- ]);- let (ring, _) = take_due(&mut lib, now);- assert_eq!(- ring.iter().map(|d| d.title.as_str()).collect::<Vec<_>>(),- ["Do an hour ago"]- );- // And the old one is recorded, not left to surface later.- assert!(lib.due_alarms(now).unwrap().is_empty());- }-}-/// Calendar alerts on the desktop, rung as the phone rings them.////// Apple keeps an event's alerts beside it, read one event at a time, so this looks only at@@ -402,3 +329,76 @@ fn show_event(app: AppHandle, event: quince_core::calendar::Event, minutes: i64)}});}++#[cfg(test)]+mod tests {+ use super::*;+ use quince_core::alarms::{Alarm, AlarmTrigger};+ use quince_core::reminders::{Reminder, ReminderList};++ fn library_with(fires: &[(&str, i64)]) -> quince_core::Library {+ let dir = tempfile::tempdir().unwrap();+ let mut lib = quince_core::Library::open(&dir.keep()).unwrap();+ lib.put_reminder_lists(&[ReminderList {+ guid: "L".into(),+ title: "Home".into(),+ enabled: true,+ ..Default::default()+ }])+ .unwrap();+ let mut reminders = Vec::new();+ let mut alarms = Vec::new();+ let mut triggers = Vec::new();+ for (id, at) in fires {+ reminders.push(Reminder {+ guid: format!("R{id}"),+ list_guid: "L".into(),+ title: format!("Do {id}"),+ ..Default::default()+ });+ alarms.push(Alarm {+ id: format!("A{id}"),+ reminder_guid: format!("R{id}"),+ trigger_id: format!("T{id}"),+ acknowledged_at: None,+ });+ triggers.push(AlarmTrigger {+ id: format!("T{id}"),+ fires_at: *at,+ });+ }+ lib.put_reminders(&reminders).unwrap();+ lib.put_alarms(&alarms, &triggers, &[], true).unwrap();+ lib+ }++ #[test]+ fn a_due_alert_is_taken_once_and_the_next_is_named() {+ let mut lib = library_with(&[("now", 1_000_000), ("later", 1_003_600)]);+ let (ring, next) = take_due(&mut lib, 1_000_000);+ assert_eq!(+ ring.iter().map(|d| d.title.as_str()).collect::<Vec<_>>(),+ ["Do now"]+ );+ assert_eq!(next, Some(1_003_600));+ // A second wake at the same moment — resume and a pass together — rings nothing.+ let (again, _) = take_due(&mut lib, 1_000_000);+ assert!(again.is_empty());+ }++ #[test]+ fn missed_while_away_rings_once_but_long_gone_stays_quiet() {+ let now = 10_000_000;+ let mut lib = library_with(&[+ ("an hour ago", now - 3_600),+ ("last week", now - 7 * 86_400),+ ]);+ let (ring, _) = take_due(&mut lib, now);+ assert_eq!(+ ring.iter().map(|d| d.title.as_str()).collect::<Vec<_>>(),+ ["Do an hour ago"]+ );+ // And the old one is recorded, not left to surface later.+ assert!(lib.due_alarms(now).unwrap().is_empty());+ }+}diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex f61d875..a09bc0c 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -245,8 +245,12 @@ export function DriveView() {/** What is free, as icloud.com says it under a folder's name: "5.18 GB available". */const [available, setAvailable] = useState<string | null>(null);useEffect(() => {+ // Shown only when Apple says: an empty or odd answer leaves the count on its own.api.storageInfo().then(- ({ usedBytes, totalBytes }) => setAvailable(decimalSize(Math.max(0, totalBytes - usedBytes))),+ (s) => setAvailable(+ s && Number.isFinite(s.totalBytes) && Number.isFinite(s.usedBytes)+ ? decimalSize(Math.max(0, s.totalBytes - s.usedBytes))+ : null),() => setAvailable(null),);}, []);