forked from humhub/fcm-push
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule.php
53 lines (43 loc) · 1.19 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace humhub\modules\fcmPush;
use humhub\modules\fcmPush\models\ConfigureForm;
use humhub\modules\fcmPush\services\DriverService;
use Yii;
use yii\helpers\Url;
use Kreait\Firebase\Factory;
class Module extends \humhub\components\Module
{
/**
* @inheritdoc
*/
public $resourcesPath = 'resources';
public string $humhubProxySenderId = '21392898126';
private ?ConfigureForm $configForm = null;
private ?DriverService $driverService= null;
/**
* @inheritdoc
*/
public function getConfigUrl()
{
return Url::to(['/fcm-push/admin']);
}
public function getConfigureForm(): ConfigureForm
{
if ($this->configForm === null) {
$this->configForm = new ConfigureForm();
$this->configForm->loadSettings();
}
return $this->configForm;
}
public function getDriverService(): DriverService
{
if (!$this->driverService) {
$this->driverService = new DriverService($this->getConfigureForm());
}
return $this->driverService;
}
public static function registerAutoloader()
{
require Yii::getAlias('@fcm-push/vendor/autoload.php');
}
}