|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @copyright Copyright (c) 2020, Julien Veyssier |
|
7
|
|
|
* |
|
8
|
|
|
* @author Julien Veyssier <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* @license AGPL-3.0 |
|
11
|
|
|
* |
|
12
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
13
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
14
|
|
|
* as published by the Free Software Foundation. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, |
|
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
* GNU Affero General Public License for more details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
23
|
|
|
* |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
namespace OCA\WeatherStatus\AppInfo; |
|
27
|
|
|
|
|
28
|
|
|
use OCA\WeatherStatus\Capabilities; |
|
29
|
|
|
use OCP\AppFramework\App; |
|
30
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext; |
|
31
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap; |
|
32
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext; |
|
33
|
|
|
use OCP\Dashboard\RegisterWidgetEvent; |
|
34
|
|
|
use OCP\EventDispatcher\IEventDispatcher; |
|
35
|
|
|
use OCP\EventDispatcher\Event; |
|
36
|
|
|
use OCP\Util; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Class Application |
|
40
|
|
|
* |
|
41
|
|
|
* @package OCA\WeatherStatus\AppInfo |
|
42
|
|
|
*/ |
|
43
|
|
|
class Application extends App implements IBootstrap { |
|
44
|
|
|
|
|
45
|
|
|
/** @var string */ |
|
46
|
|
|
public const APP_ID = 'weather_status'; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Application constructor. |
|
50
|
|
|
* |
|
51
|
|
|
* @param array $urlParams |
|
52
|
|
|
*/ |
|
53
|
|
|
public function __construct(array $urlParams = []) { |
|
54
|
|
|
parent::__construct(self::APP_ID, $urlParams); |
|
55
|
|
|
|
|
56
|
|
|
$dispatcher = $this->getContainer()->query(IEventDispatcher::class); |
|
57
|
|
|
$dispatcher->addListener(RegisterWidgetEvent::class, function (Event $e) { |
|
|
|
|
|
|
58
|
|
|
Util::addScript(self::APP_ID, 'weather-status'); |
|
59
|
|
|
}); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @inheritDoc |
|
64
|
|
|
*/ |
|
65
|
|
|
public function register(IRegistrationContext $context): void { |
|
66
|
|
|
// Register OCS Capabilities |
|
67
|
|
|
$context->registerCapability(Capabilities::class); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function boot(IBootContext $context): void { |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.