Always show daytime icons in forecast

master
Skylar Ittner 5 years ago
parent 0dbc9b3cfd
commit 5f9327bff6

@ -35,6 +35,10 @@ class Conditions {
* @var bool True if daytime, false if nighttime. Set with setDayOrNight(). * @var bool True if daytime, false if nighttime. Set with setDayOrNight().
*/ */
private $daytime = true; private $daytime = true;
/**
* @var type bool If true, don't generate nighttime icon
*/
public $disablenight = false;
/** /**
* @var float Temperature in degrees Celsius * @var float Temperature in degrees Celsius
@ -208,7 +212,7 @@ class Conditions {
if ($this->isOvercast()) { if ($this->isOvercast()) {
return "wi-$downfall$wind"; return "wi-$downfall$wind";
} else { } else {
$daynight = $this->isDay() ? "day" : "night-alt"; $daynight = $this->isDay() || $this->disablenight ? "day" : "night-alt";
return "wi-$daynight-$downfall$wind"; return "wi-$daynight-$downfall$wind";
} }
} }
@ -218,14 +222,14 @@ class Conditions {
} }
if ($this->isCloudy()) { if ($this->isCloudy()) {
return $this->isDay() ? "wi-day-cloudy" : "wi-night-alt-cloudy"; return $this->isDay() || $this->disablenight ? "wi-day-cloudy" : "wi-night-alt-cloudy";
} }
if ($this->isCold()) { if ($this->isCold()) {
return "wi-snowflake-cold"; return "wi-snowflake-cold";
} }
if ($this->isDay()) { if ($this->isDay() || $this->disablenight) {
if ($this->isHot()) { if ($this->isHot()) {
return "wi-hot"; return "wi-hot";
} }

@ -51,6 +51,7 @@ class Weather_DarkSky extends Weather {
$daily->summary = $day->summary; $daily->summary = $day->summary;
$daily->setDayorNight(); $daily->setDayorNight();
$daily->disablenight = true;
$daily->tempHigh = $day->temperatureMax; $daily->tempHigh = $day->temperatureMax;
$daily->tempLow = $day->temperatureMin; $daily->tempLow = $day->temperatureMin;

Loading…
Cancel
Save