-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mtnclock] Fix widgets disappearing on weather update #3586
[mtnclock] Fix widgets disappearing on weather update #3586
Conversation
You can try it out on my app loader: https://gloriousdan.github.io/BangleApps/?q=mtnclock |
Sounds good, thanks for the fix - looks like there's two lint errors if you're ok to sort those out? What do you think to merging the whole file each time, like a sort of: writeJson(
"mtnclock.json",
Object.assign(
readJson("mtnclock.json"),
newSettings,
)
); |
3d519f8
to
bda48c6
Compare
Good point, I thought about that too but at first implemented the simpler fix. But now I implemented your recommendations. The linter issues should also be fixed now. Unfortunately I didn't get to set up the tests locally, so let's see if the workflows succeed this time :) Edit: I now checked it in the espruino IDE and there were no errors anymore |
bda48c6
to
87d9cd6
Compare
87d9cd6
to
0849edf
Compare
Can I somehow get the CI to run within in my fork? |
Sure, I've kicked off CI here if that helps, it was because the PR was in draft. Those changes look great btw, I'll merge if you're happy with everything? |
Thanks, I marked it as draft because I thought of a potential error I still wanted to check/ fix. Maybe you could also help me determine wether it's a problem or not. Since I load set the updated weather data not to the Is my understanding correct, that line 1 is only run once at the start? I probably get around to fixing this soon, and afterwards we can merge it. |
Yeah that's right, line 1 only runs at the start so the settings are read once - we can reassign to |
That looks good, that's pretty much how I would have done it as well. I just have one more Question concerning how the app's code is run. When I exit the clock while opening the launcher, is the app paused in the background and resumes running or does it exit and start again from scratch after exiting the launcher? If the former is the case, the current code might not pick up a change of the mtnclock showWidgets setting and then overwrite it with the outdated value again. |
Sweet, and no you're safe - the app is restarted if you go from the launcher back to the clock, so that's all good. I'll merge - thanks for the fix! |
Great! Thank you for merging and your help 👍 |
Thanks for the time to put together the fix! |
Fixes #3441
I found the issue for why the widget bar keeps disappearing in the mountain clock app.
It's related to the weather update but the bug is within mtnclock's
app.js
file.The widget setting is written within the
mtnclock.json
file. The weather data is written to the same file. When a weather update comes in, the file is overwritten and theshowWidgets
setting consequently deleted from the file which leads to the widget bar disappearing.This should fix it. We could also read the current state of data before writing it but in my testing it worked fine like this.