mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Merge pull request #6632 from iMattPro/ticket/17333
[ticket/17333] UX Enhancements for Web Push Subscribing
This commit is contained in:
47
phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
Normal file
47
phpBB/phpbb/db/migration/data/v400/add_webpush_options.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v400;
|
||||
|
||||
use phpbb\db\migration\migration;
|
||||
|
||||
class add_webpush_options extends migration
|
||||
{
|
||||
public static function depends_on(): array
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v400\add_webpush',
|
||||
];
|
||||
}
|
||||
|
||||
public function effectively_installed(): bool
|
||||
{
|
||||
return $this->config->offsetExists('webpush_method_default_enable') || $this->config->offsetExists('webpush_dropdown_subscribe');
|
||||
}
|
||||
|
||||
public function update_data(): array
|
||||
{
|
||||
return [
|
||||
['config.add', ['webpush_method_default_enable', true]],
|
||||
['config.add', ['webpush_dropdown_subscribe', true]],
|
||||
];
|
||||
}
|
||||
|
||||
public function revert_data(): array
|
||||
{
|
||||
return [
|
||||
['config.remove', ['webpush_method_default_enable']],
|
||||
['config.remove', ['webpush_dropdown_subscribe']],
|
||||
];
|
||||
}
|
||||
}
|
@@ -94,6 +94,14 @@ class webpush extends messenger_base implements extended_method_interface
|
||||
&& !empty($this->config['webpush_vapid_public']) && !empty($this->config['webpush_vapid_private']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function is_enabled_by_default()
|
||||
{
|
||||
return (bool) $this->config['webpush_method_default_enable'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -352,7 +360,7 @@ class webpush extends messenger_base implements extended_method_interface
|
||||
}
|
||||
|
||||
return [
|
||||
'NOTIFICATIONS_WEBPUSH_ENABLE' => true,
|
||||
'NOTIFICATIONS_WEBPUSH_ENABLE' => $this->config['webpush_dropdown_subscribe'] || stripos($this->user->page['page'], 'notification_options'),
|
||||
'U_WEBPUSH_SUBSCRIBE' => $controller_helper->route('phpbb_ucp_push_subscribe_controller'),
|
||||
'U_WEBPUSH_UNSUBSCRIBE' => $controller_helper->route('phpbb_ucp_push_unsubscribe_controller'),
|
||||
'VAPID_PUBLIC_KEY' => $this->config['webpush_vapid_public'],
|
||||
|
Reference in New Issue
Block a user