-
Notifications
You must be signed in to change notification settings - Fork 7
/
Module.php
60 lines (51 loc) · 1.47 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
54
55
56
57
58
59
60
<?php
namespace humhub\modules\fcmPush;
use humhub\modules\fcmPush\models\ConfigureForm;
use humhub\modules\fcmPush\services\DriverService;
use humhub\modules\fcmPush\services\GoService;
use Yii;
use yii\helpers\Url;
class Module extends \humhub\components\Module
{
/**
* @inheritdoc
*/
public $resourcesPath = 'resources';
public string $humhubProxySenderId = '21392898126';
private ?ConfigureForm $configForm = null;
private ?DriverService $driverService = null;
private ?GoService $goService = 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 === null) {
$this->driverService = new DriverService($this->getConfigureForm());
}
return $this->driverService;
}
public function getGoService(): GoService
{
if ($this->goService === null) {
$this->goService = new GoService('https://go.humhub.com');
}
return $this->goService;
}
public static function registerAutoloader()
{
require Yii::getAlias('@fcm-push/vendor/autoload.php');
}
}