etesync-web icon indicating copy to clipboard operation
etesync-web copied to clipboard

Feature request: clear completed tasks

Open AbleLincoln opened this issue 5 years ago • 1 comments

I would like to add a way delete all completed tasks.

Does the library currently provide any way to perform a batch delete?

AbleLincoln avatar Mar 31 '20 18:03 AbleLincoln

Yeah, it does, though not as part of the PIM abstraction, you will have to implement it yourself. Take a look at etesync-helpers.ts you have there the current wrapper we use (addJournalEntry), you should create another one (or modify this one?) to accept an array instead of just one and then create multiple entries and call addEntries with the array.

Things to keep in mind:

  1. prevUid is the uid of the previous item. So when you create multiple items, you need to update it every time, and every time set it to the uid of the entry you are just going to send.
  2. You probably don't want to upload 400 changes at once, so you should loop over it in chunks of e.g. 30 and push them each. You can take a look at helpers.tsx in the ios repo for a helper function to split an array to a chunks iterator. You can also look at sync/SyncManagerBase.ts there for how we push in chunks.

Let me know if you need anything.

tasn avatar Mar 31 '20 20:03 tasn