refactor stock widget to cache data and handle updates better #22
No reviewers
Labels
No labels
bug
conflicts
documentation
DO NOT MERGE
duplicate
enhancement
good first issue
hardware
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
greg/info-orbs!22
Loading…
Reference in a new issue
No description provided.
Delete branch "stock-widget-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
https://trello.com/c/VOVaqRYI
https://trello.com/c/ulgNeGBt
https://trello.com/c/xjwMScgJ
Changes
This is a major update to the Stocks Widget to add proper update frequency and data handling. It also updates data from all widgets at startup with a simple loading screen. Which in turn updates the timezone. I haven't removed the timezone from config yet but it should be safe to do so now.
This has a minor glitch that with the buttons being fully responsive with data at boot up the oddity of the pull down on the buttons gives a phantom "press" on boot of each button. This causes blinking to the weather app and back. We should make a fix to improve button handling to avoid that phantom click in a future PR.
@ -1,38 +1,32 @@#ifndef STOCK_WIDGET_HWe should be careful about putting API keys in git - I've done this before and have royally horked the service it was for (spoiler: it was discord. The server owners were very unhappy with me)
@ -1,38 +1,32 @@#ifndef STOCK_WIDGET_HFair concern. I am just moving it here from being hardcoded into the url. This is Brett's call as he intends on paying for the API access and when I suggested that the weather api key should be a user configured value he wanted it hardcoded. So I split the difference here by making it easy to change but still hardcoded.
@ -1,38 +1,32 @@#ifndef STOCK_WIDGET_HBut I did go ahead and move it into the config.h.template like the weather api key. That way it is at least not in the code directly. Maybe we should talk Brett into distributing it outside of git.
looks good, have not fully studied the stockDataModel files but caching works good
what are the refresh intervals right now here?
Five minutes as requested by Brett in trello
alright, i just noticed, when i fast switch through all the widgets, i get stuck in the weather widget for 1-2 seconds, probably because it needs to pull the api. but this does not happen in the stock api, why?
It does happen with the existing dev branch. You are likely testing switching more than before. It has been getting in my way for a while. Take note of the blue led as it now works as a busy indicator.
Now with catching working better I think we need to change the weather update interval.
This is updated to the latest
devbranch. As far as I know it is ready to merge.I just looked at the weather widget and found the issue. I was resetting the update clock on widget switch. I fixed that and the delay you were seeing is fixed
now we are getting there! i like it!
can you make a short explanation what shouldInit() is doing? just for protocoll, after that i will merge it! so we have the new important functions somewhere documented. or are there other new important stuff you may want to add
love it!