Phase 6: glance widget with cached address
App type changed to widget for glance support. GlanceView shows event type, date/time, and street+housenumber (or coordinates as fallback). Addresses are cached in Event storage on first view in history. Glance-required modules annotated with (:glance). Address distance threshold raised to 70m. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
eea1a835cd
commit
79cdb9f210
9 changed files with 134 additions and 12 deletions
|
|
@ -62,6 +62,11 @@ class HistoryView extends WatchUi.View {
|
|||
if (_events.size() == 0) { return; }
|
||||
if (_addressCache.hasKey(_index)) { return; }
|
||||
var evt = _events[_index];
|
||||
// Use cached address from event if available.
|
||||
if (evt.address != null) {
|
||||
_addressCache[_index] = evt.address;
|
||||
return;
|
||||
}
|
||||
if (evt.lat == null || evt.lon == null) { return; }
|
||||
_addressLoading = true;
|
||||
_geocoder = new GeocodingService(
|
||||
|
|
@ -74,6 +79,12 @@ class HistoryView extends WatchUi.View {
|
|||
function _onAddress(address as String or Null) as Void {
|
||||
_addressCache[_index] = address;
|
||||
_addressLoading = false;
|
||||
// Persist address in the event so the glance can show it.
|
||||
if (address != null && _index < _events.size()) {
|
||||
var evt = _events[_index];
|
||||
evt.address = address;
|
||||
EventStore.updateAt(_index, evt);
|
||||
}
|
||||
WatchUi.requestUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue