refactor stock widget to cache data and handle updates better #22

Merged
ericthelin merged 13 commits from stock-widget-update into dev 2024-06-03 22:08:55 +00:00
ericthelin commented 2024-05-30 17:16:24 +00:00 (Migrated from github.com)

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.

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.
ericthelin commented 2024-05-30 17:47:41 +00:00 (Migrated from github.com)

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.

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.
Jkitche (Migrated from github.com) reviewed 2024-05-30 21:52:23 +00:00
@ -1,38 +1,32 @@
#ifndef STOCK_WIDGET_H
Jkitche (Migrated from github.com) commented 2024-05-30 21:52:23 +00:00

We 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)

We 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)
ericthelin (Migrated from github.com) reviewed 2024-05-30 21:57:26 +00:00
@ -1,38 +1,32 @@
#ifndef STOCK_WIDGET_H
ericthelin (Migrated from github.com) commented 2024-05-30 21:57:26 +00:00

Fair 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.

Fair 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.
ericthelin (Migrated from github.com) reviewed 2024-05-30 23:39:48 +00:00
@ -1,38 +1,32 @@
#ifndef STOCK_WIDGET_H
ericthelin (Migrated from github.com) commented 2024-05-30 23:39:48 +00:00

But 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.

But 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.
tecnovel (Migrated from github.com) approved these changes 2024-06-01 01:01:12 +00:00
tecnovel (Migrated from github.com) left a comment

looks good, have not fully studied the stockDataModel files but caching works good

looks good, have not fully studied the stockDataModel files but caching works good
tecnovel commented 2024-06-01 12:16:14 +00:00 (Migrated from github.com)

what are the refresh intervals right now here?

what are the refresh intervals right now here?
ericthelin commented 2024-06-01 13:51:07 +00:00 (Migrated from github.com)

Five minutes as requested by Brett in trello

Five minutes as requested by Brett in trello
tecnovel commented 2024-06-01 14:54:22 +00:00 (Migrated from github.com)

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?

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?
ericthelin commented 2024-06-01 14:58:17 +00:00 (Migrated from github.com)

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.

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.
ericthelin commented 2024-06-01 14:59:53 +00:00 (Migrated from github.com)

Now with catching working better I think we need to change the weather update interval.

Now with catching working better I think we need to change the weather update interval.
ericthelin commented 2024-06-02 18:40:50 +00:00 (Migrated from github.com)

This is updated to the latest dev branch. As far as I know it is ready to merge.

This is updated to the latest `dev` branch. As far as I know it is ready to merge.
ericthelin commented 2024-06-02 18:46:04 +00:00 (Migrated from github.com)

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?

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

> 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? 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
tecnovel (Migrated from github.com) approved these changes 2024-06-03 18:03:11 +00:00
tecnovel (Migrated from github.com) left a comment

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

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
tecnovel (Migrated from github.com) approved these changes 2024-06-03 22:08:36 +00:00
tecnovel (Migrated from github.com) left a comment

love it!

love it!
Sign in to join this conversation.
No description provided.