Skip to content

fix: sync theme updates with the map-ready message#653

Open
Daamii wants to merge 8 commits into
developfrom
fix/PRD-593
Open

fix: sync theme updates with the map-ready message#653
Daamii wants to merge 8 commits into
developfrom
fix/PRD-593

Conversation

@Daamii
Copy link
Copy Markdown
Contributor

@Daamii Daamii commented May 4, 2026

Added new message to let map-viewer know what's the current device preferred color scheme.

@Daamii Daamii requested review from R-lagoman and cristian-situm May 4, 2026 12:09
Comment thread lib/src/situm_map_view.dart
Comment thread lib/src/controller.dart Outdated
String? _lastStatusToSend;
String? _lastErrorToSend;
Brightness? _lastThemeToSend;
bool _isMapReady = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

É realmente necesario _isMapReady? Non se pode enviar o tema e listo (a chamada sobre o webview non é idempotente)?
Con eso tamén te aforras _onMapWillLoad, que non me molesta pero en conxunto parece que queda todo bastante ad-hoc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O theme en si é idempotente, si, pero o problema non é ese: o envío fai runJavaScript(...) sobre o webview e iso pode ocorrer antes de que o viewer estea listo para recibir ui.set_preferred_theme. Agora mesmo _isMapReady é o que evita iso e, ademais, garante que o tema non se perda durante un reload(). Ao mellor e demasiado complexo e non queremos protexernos ante reloads... pero non me parece mala práxis

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pd: xa me cargo _onMapWillLoad, porque solo poñía o _isMapReady a false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants