Skip to content

Commit 36ec633

Browse files
authored
Merge pull request #92 from rxu/issue/91
2 parents 6ab4e67 + 591a08c commit 36ec633

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

notification/method/webpush.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use phpbb\controller\helper;
1616
use phpbb\db\driver\driver_interface;
1717
use phpbb\log\log_interface;
18-
use phpbb\notification\method\messenger_base;
18+
use phpbb\notification\method\base;
1919
use phpbb\notification\type\type_interface;
2020
use phpbb\path_helper;
2121
use phpbb\user;
@@ -27,7 +27,7 @@
2727
* Web Push notification method class
2828
* This class handles sending push messages for notifications
2929
*/
30-
class webpush extends messenger_base implements extended_method_interface
30+
class webpush extends base implements extended_method_interface
3131
{
3232
/** @var config */
3333
protected $config;
@@ -38,12 +38,21 @@ class webpush extends messenger_base implements extended_method_interface
3838
/** @var log_interface */
3939
protected $log;
4040

41+
/** @var user_loader */
42+
protected $user_loader;
43+
4144
/** @var user */
4245
protected $user;
4346

4447
/** @var path_helper */
4548
protected $path_helper;
4649

50+
/** @var string */
51+
protected $phpbb_root_path;
52+
53+
/** @var string */
54+
protected $php_ext;
55+
4756
/** @var string Notification Web Push table */
4857
protected $notification_webpush_table;
4958

@@ -73,13 +82,14 @@ class webpush extends messenger_base implements extended_method_interface
7382
public function __construct(config $config, driver_interface $db, log_interface $log, user_loader $user_loader, user $user, path_helper $path_helper,
7483
string $phpbb_root_path, string $php_ext, string $notification_webpush_table, string $push_subscriptions_table)
7584
{
76-
parent::__construct($user_loader, $phpbb_root_path, $php_ext);
77-
7885
$this->config = $config;
7986
$this->db = $db;
8087
$this->log = $log;
88+
$this->user_loader = $user_loader;
8189
$this->user = $user;
8290
$this->path_helper = $path_helper;
91+
$this->phpbb_root_path = $phpbb_root_path;
92+
$this->php_ext = $php_ext;
8393
$this->notification_webpush_table = $notification_webpush_table;
8494
$this->push_subscriptions_table = $push_subscriptions_table;
8595
}
@@ -97,8 +107,9 @@ public function get_type(): string
97107
*/
98108
public function is_available(type_interface $notification_type = null): bool
99109
{
100-
return parent::is_available($notification_type) && $this->config['wpn_webpush_enable']
101-
&& !empty($this->config['wpn_webpush_vapid_public']) && !empty($this->config['wpn_webpush_vapid_private']);
110+
return $this->config->offsetGet('wpn_webpush_enable')
111+
&& $this->config->offsetGet('wpn_webpush_vapid_public')
112+
&& $this->config->offsetGet('wpn_webpush_vapid_private');
102113
}
103114

104115
/**

0 commit comments

Comments
 (0)