lichess-org / mobile

Lichess mobile app v2
GNU General Public License v3.0
1.36k stars 197 forks source link

[study] refactor: make EngineLines independent of AnalysisController #1063

Closed tom-anders closed 1 month ago

tom-anders commented 1 month ago

We'll want to reuse it for the study screen. It's easiest to remove the dependency from the widget for now (alternative would be to use an interface that both AnalysisController and StudyController derive from, but as discussed we won't do that for now)

veloce commented 1 month ago

I have now an example of Notifier mixin: https://github.com/lichess-org/mobile/blob/ef9fc55fdc08a606f26a7069140e73a1308c3e21/lib/src/model/settings/preferences_storage.dart#L15

We might eventually use this approach to share engine logic in different controllers. I'm not sure but I suspect it is not that easy to do.

tom-anders commented 1 month ago

I have now an example of Notifier mixin:

https://github.com/lichess-org/mobile/blob/ef9fc55fdc08a606f26a7069140e73a1308c3e21/lib/src/model/settings/preferences_storage.dart#L15

We might eventually use this approach to share engine logic in different controllers. I'm not sure but I suspect it is not that easy to do.

Ah that sounds very useful indeed, I'll see if I can use it in the study branch.

But I think for now it's safer to go with the callbacks, we can always refactor again later.