ankidroid / ankidroid/Anki-Android

Proposal: Support sync from any activity

Offen
#20,721 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
11.8k
Forks
2.9k
Ø Merge
2 T. 3 Std.
Gemergte PRs (30 T.)
171

Beschreibung

> [!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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.