Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

[API] Rearchitect ChangeManager to support CardContentProvider

Open david-allison opened this issue 7 months ago • 4 comments

Our API (CardContentProvider) does not support ChangeManager. It is infeasible to make CardContentProvider compatible with suspend due to Android limitations.

This affects some screens, widgets etc...

Some methods in CardContentProvider do yet not produce an OpChanges, and need to be updated/rewritten.


Proposed solution

  1. Decouple consumers/producers in ChangeManager, primarily for use in the API
    • A non-blocking publish(OpChanges) method can be used
    • Future: batching will be available
    • Current methods continue to block until subscribers are notified.
  2. Update all methods in CardContentProvider to publish, publishing via a method similar to notifySubscribersAllValuesChanged iif an OpChanges is not available
  3. Gradually transition away from notifySubscribersAllValuesChanged * This notifies of more changes than necessary

For now, only the API would use the sync method, to ensure no ordering-related issues are introduced.


If you would like to work on the issue, let me know and I'll split (1) into a subtask

david-allison avatar Apr 30 '26 16:04 david-allison

@david-allison I would like to work on this issue! Please let me know once you have split (1) the subtask so I can start working on it

DoomsCoder avatar May 17 '26 17:05 DoomsCoder

  • https://github.com/ankidroid/Anki-Android/issues/21102

david-allison avatar May 20 '26 02:05 david-allison

@david-allison Should i start working on the remaining tasks or would you like to split (2 & 3) those into separate subtasks first?

DoomsCoder avatar Jun 02 '26 13:06 DoomsCoder

I think 2, and a TODO on the method you use inside the API will be sufficient to close this

david-allison avatar Jun 02 '26 14:06 david-allison