ankidroid / ankidroid/Anki-Android
Proposal: Support sync from any activity
- Lingua principale
- Kotlin
- Stelle
- 11.8k
- Fork
- 2.9k
- Merge medio
- 2g 3h
- PR unite (30g)
- 171
Descrizione
> [!NOTE]
> This only intends for our syncing mechanism supports this use case, not implementation
> Even when implemented, this will not introduce a 'sync' button on every screen.
As part of a DeckPicker refactoring, I will need to move sync logic to a ViewModel.
In future, I would like to allow `MSG_DO_SYNC`, and addons to be able to sync from any screen, without requiring that the user opens the DeckPicker.
Much of DeckPicker's complexity stems from the following issues:
* What if the collection/backend is not usable
* What if the collection is syncing
* `CollectionManager.queue` uses `Dispatchers.IO.limitedParallelism(1)`, therefore blocking all future calls until syncing is completed, and the backend itself blocks access to the collection
* Handling `Message` from other screens in the app
Handling sync externally (via a `SyncManager`) would reduce complexity
### Issues/Considerations
These issues are currently present:
* What should `withCol` calls do? Block or cancel pending work?
* Some mutations may no longer be valid for the new collection
* Some 'valid' operations could be lost, whereas recovery is reasonable (`addNote`, assuming the note type still exists)
* What should the API do while syncing?
* What happens if the user is within a method with multiple `withCol` calls when syncing occurs
* `ReviewerViewModel.answerCardInternal` would want consideration
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.