Skip to content
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

Modify the weather app so that the units (for the measurement unit) query param is dependent on the current location. #110

Open
nicomiguelino opened this issue Aug 15, 2023 · 1 comment · May be fixed by #111

Comments

@nicomiguelino
Copy link
Contributor

nicomiguelino commented Aug 15, 2023

Overview

  • The weather app does an API call to OpenWeatherMap to get the current data.
  • The endpoint requires units (metric or imperial) as one of the query parameters.
  • For instance, we can make an API call to an endpoint that gives the country code (e.g. US, GB, etc.) given the coordinates (latitude and longitude).

Mocked screenly.js

The coordinates are not that precise. They're autogenerated by GitHub Copilot.

const getCoordinates = (area) => {
  switch (area) {
    case 'San Francisco':
      return [
        '37.7749',
        '-122.4194'
      ]
    case 'Manila':
      return [
        '14.5995',
        '120.9842'
      ]
    case 'Dijon':
      return [
        '47.3220',
        '5.0415'
      ]
    case 'New York':
      return [
        '40.7128',
        '-74.0060'
      ]
    default:
      return []
  }
}

const screenly = {
  metadata: {
    coordinates: getCoordinates('New York'),
    hardware: 'Screenly Player Max',
    hostname: 'srly-abcdefghijklmno',
    location: 'San Francisco, USA',
    screen_name: 'Edge App Test',
    screenly_version: 'v1.0.0',
    tags: [
        'All Screens'
    ]
  },
  settings: {
    disable_analytics: false,
    ga_api_key: 'mcd0n4ld5',
    sentry_id: 'p4nd4expr355',
    // Make sure to obfuscate the OpenWeatherMap API key as well.
    openweathermap_api_key: '[redacted]',
  }
}

Screenshots

San Francisco, CA, US

image

Manila, PH

image

Dijon, FR

image

New York, USA

image

Relevant GitHub issues and PRs

@nicomiguelino
Copy link
Contributor Author

@vpetersson, here's the new issue that I've created for the review comment created in #105.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant