gelin / weather-notification

An utility which displays the weather in the Android notification bar
GNU General Public License v3.0
26 stars 11 forks source link

Fix querying weather using automatic location with negative latitude #61

Closed Sorixelle closed 3 years ago

Sorixelle commented 3 years ago

If a location string started with "-", OpenWeatherMapSource#query would return a TestWeather for unit testing purposes, and not query OpenWeatherMap. This caused a problem where locations with a negative latitude would fall into the TestWeather case, as the string would begin with "-". As a result, automatic location detection did not work in such locations (i.e. the Southern Hemisphere).

This PR changes the prefix to "_TEST-" (and also changes the other case to "_TEST+" for consistency), so that locations with a negative latitude don't fall into the unit testing case.

Should fix #40.

gelin commented 3 years ago

Good catch! Thanks a lot!

I've fixed the issue in a bit another way: https://github.com/gelin/weather-notification/commit/8b3f665aadde00027df4e438f1cfd95bb568278c

Thanks.