house-of-abbey / GarminHomeAssistantWidget

Garmin widget to provide a dashboard to control your Home Assistant
https://community.home-assistant.io/t/home-assistant-app-for-garmin/637348
MIT License
1 stars 0 forks source link

Cached Menu will still be used, even if the setting is deactivated #12

Closed Someone0nEarth closed 6 months ago

Someone0nEarth commented 6 months ago

When the menu is cached and the setting for caching will be deactivated, the menu will be still shown as cached (and maybe even teh cached one will be used).

I would expect, that, when deactivating the menu caching option, that the menu will get fetched, even if a cached menu is in the storage.

What do you say to this @philipabbey ?

philipabbey commented 6 months ago

The original intention remains that if the cache is cleared, it is deleted.

https://github.com/house-of-abbey/GarminHomeAssistantWidget/blob/main/source%2FHomeAssistantApp.mc#L150

The user may no longer require the function, e.g. if the menu becomes volatile.

The root view should reflect the status change:

https://github.com/house-of-abbey/GarminHomeAssistantWidget/blob/main/source%2FRootView.mc#L136

Philip

philipabbey commented 6 months ago

Okay, I see the problem.

Unticking the option "Should the application cache the menu configuration?" should also clear the cache by inference ("Should the application clear the existing cache next time it is started?").

This is a bug with the application too.

philipabbey commented 6 months ago

It would be nice if Settings.update() function could check if mCacheConfig is false and then Storage.deleteValue("menu"); but then (HomeAssistantApp.)mMenuStatus = WatchUi.loadResource($.Rez.Strings.Available) as Lang.String; need fixing up too. So the control logic seems to get messy.