-
Notifications
You must be signed in to change notification settings - Fork 11
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
Rewrite the Weather to an Edge App #105
Rewrite the Weather to an Edge App #105
Conversation
will not be enabled when `screenly.settings.disable_analytics` is set to `true`.
- Do a quick refactor as well to avoid long lines.
@nicomiguelino what are these things? Is this an encoding issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved pending question about encoding issue.
edge-apps/weather/index.html
Outdated
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js" integrity="sha512-42PE0rd+wZ2hNXftlM78BSehIGzezNeQuzihiBCvUEB3CVxHvsShF86wBWwQORNxNINlBPuq7rG4WWhNiTVHFg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> | ||
|
||
<script | ||
src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ship moment as part of the edge app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done (locally). Expect changes on succeeding commit/s.
edge-apps/weather/static/js/main.js
Outdated
try { | ||
const endpointUrl = `https://api.openweathermap.org/data/2.5/forecast` | ||
const apiKey = screenly.settings.openweathermap_api_key | ||
const queryParams = `lat=${lat}&lon=${lng}&units=metric&cnt=10&appid=${apiKey}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's easier to just pass the right unit here (matric
is hard coded) than to do Fahrenheit conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll address this comment on another issue or pull request. I'll keep you posted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #110 for details.
My bad, I haven't updated the screenshots. It's all good now. |
- Host `Moment.js` locally. - Have the indexed DB be cleared first before caching a new set of data. - Refactor how the query parameters are declared (for readability).
@vpetersson, I'd like to request a code review. Thanks. |
General
Checklist
edge-apps/weather/src
intoedge-apps/weather
(the root directory) instead.gulpfile.js
,.babelrc
,load-metadata.js
,load-screenly.js
.index.html
.main.js
get the OpenWeatherMap API key from the settings instead.Screenshots
In order to test the Weather app (rewritten as an Edge App), started a simple HTTP server by running
python3 -m http.server
, which hosts the app at0.0.0.0:8000
by default. I've also used a mockedscreenly.js
, which I didn't commit in this PR.