Skip to content

Commit b17cd50

Browse files
MazhoonAndyScherzinger
authored andcommitted
Allow setting default location for weather widget
In cases where all of the users are from the same geographical area, it would be extremely useful to be able to set a default location for the dashboard weather widget. With these changes, this option becomes available, as default values can be set with occ config:app:set weather_status [lat,lon,altitude,address] --value 'value' These changes also implement the path 2 described in feature request #27908 denied in 2021 Signed-off-by: Tuomas Nurmi <tuomas.nurmi@opinsys.fi>
1 parent 250084f commit b17cd50

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

apps/weather_status/lib/Service/WeatherStatusService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ private function searchForAddress(string $address): array {
287287
* @return WeatherStatusLocationWithMode which contains coordinates, formatted address and current weather status mode
288288
*/
289289
public function getLocation(): array {
290-
$lat = $this->config->getUserValue($this->userId, Application::APP_ID, 'lat', '');
291-
$lon = $this->config->getUserValue($this->userId, Application::APP_ID, 'lon', '');
292-
$address = $this->config->getUserValue($this->userId, Application::APP_ID, 'address', '');
290+
$lat = $this->config->getUserValue($this->userId, Application::APP_ID, 'lat', $this->config->getAppValue(Application::APP_ID, 'lat', ''));
291+
$lon = $this->config->getUserValue($this->userId, Application::APP_ID, 'lon', $this->config->getAppValue(Application::APP_ID, 'lat', ''));
292+
$address = $this->config->getUserValue($this->userId, Application::APP_ID, 'address', $this->config->getAppValue(Application::APP_ID, 'address', ''));
293293
$mode = $this->config->getUserValue($this->userId, Application::APP_ID, 'mode', self::MODE_MANUAL_LOCATION);
294294
return [
295295
'lat' => $lat,
@@ -305,9 +305,9 @@ public function getLocation(): array {
305305
* @return WeatherStatusForecast[]|array{error: string}|WeatherStatusSuccess which contains success state and filtered forecast data
306306
*/
307307
public function getForecast(): array {
308-
$lat = $this->config->getUserValue($this->userId, Application::APP_ID, 'lat', '');
309-
$lon = $this->config->getUserValue($this->userId, Application::APP_ID, 'lon', '');
310-
$alt = $this->config->getUserValue($this->userId, Application::APP_ID, 'altitude', '');
308+
$lat = $this->config->getUserValue($this->userId, Application::APP_ID, 'lat', $this->config->getAppValue(Application::APP_ID, 'lat', ''));
309+
$lon = $this->config->getUserValue($this->userId, Application::APP_ID, 'lon', $this->config->getAppValue(Application::APP_ID, 'lon', ''));
310+
$alt = $this->config->getUserValue($this->userId, Application::APP_ID, 'altitude', $this->config->getAppValue(Application::APP_ID, 'altitude', ''));
311311
if (!is_numeric($alt)) {
312312
$alt = 0;
313313
}

0 commit comments

Comments
 (0)