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
Notes: one sync pass at a time, so an older pass can no longer store over a newer save; a folder deleted on a phone leaves the sidebar
Yashwanth Kamireddiad4c04d70d67
diff --git a/crates/quince-icloud/src/notes.rs b/crates/quince-icloud/src/notes.rsindex 8f550a3..fd81c75 100644--- a/crates/quince-icloud/src/notes.rs+++ b/crates/quince-icloud/src/notes.rs@@ -257,6 +257,10 @@ pub fn apply_cloudkit(// which is exactly how a deleted note reappears.if removed {if let Some(name) = field::record_name(record) {+ // A tombstone does not say what it was: a folder's name is tried as a+ // folder too — removing one this library does not have does nothing — or+ // a folder deleted on a phone stayed in the sidebar here for good.+ gone_folders.push(name.clone());gone.push(name);}}@@ -1068,6 +1072,38 @@ mod tests {/// A folder deleted elsewhere — flagged `Deleted` on its way out, as icloud.com does it —/// leaves the list, and a note still filed in it is kept, unfiled, not lost.+ /// A folder deleted on a phone arrives as a bare tombstone — a name, no type — and still+ /// leaves the sidebar.+ #[tokio::test]+ async fn a_folder_tombstone_removes_the_folder() {+ let mut library = Library::in_memory().unwrap();+ let first = serve(json!({ "zones": [{+ "records": [folder_record("F-gone", "Old")], "syncToken": "t1", "moreComing": false }] }))+ .await;+ sync_cloudkit(+ &reqwest::Client::new(),+ &first.uri(),+ vec![],+ &mut library,+ None,+ )+ .await+ .unwrap();+ let second = serve(json!({ "zones": [{+ "records": [{ "recordName": "F-gone", "deleted": true }], "syncToken": "t2", "moreComing": false }] }))+ .await;+ sync_cloudkit(+ &reqwest::Client::new(),+ &second.uri(),+ vec![],+ &mut library,+ Some("t1"),+ )+ .await+ .unwrap();+ assert!(library.note_folders().unwrap().is_empty());+ }+#[tokio::test]async fn a_folder_flagged_deleted_leaves_the_list() {let mut library = Library::in_memory().unwrap();diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex 315e68a..47e8ed4 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -100,12 +100,21 @@ async fn refresh_reminders(}/// The same for Notes.+/// One notes pass at a time, held from reading the sync position through storing the answer.+///+/// Passes fetch without holding the library, so two could overlap — the timer's and the one+/// after a save — and the slower, older one would store last: text from before the save put+/// back over it, and a note just made here pruned as unknown. This is not the library's lock;+/// every other screen keeps reading while a pass is out.+pub static NOTES_PASS: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());+async fn refresh_notes(http: &reqwest::Client,root: &str,params: Vec<(String, String)>,data: &State<'_, Data>,) -> Result<(), String> {+ let _one = NOTES_PASS.lock().await;let since = data.0.lock()diff --git a/src-tauri/src/refresh.rs b/src-tauri/src/refresh.rsindex f0be33d..8a621b2 100644--- a/src-tauri/src/refresh.rs+++ b/src-tauri/src/refresh.rs@@ -194,6 +194,9 @@ pub async fn all(client: &Arc<Mutex<Client>>, data: &Mutex<Library>) -> Refreshreports.push(match ctx.cloudkit.as_deref() {None => unavailable("notes", "Notes"),Some(root) => {+ // One notes pass at a time, from reading the position through storing what came+ // back — see `NOTES_PASS`.+ let _one = crate::NOTES_PASS.lock().await;let since = token(data, "notes").await;let full = since.is_none();let fetched = quince_icloud::notes::fetch_cloudkit(