1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-04 15:57:45 +02:00

[ticket/17333] Add push subscribe toggle to notification dropdown

PHPBB-17333

Signed-off-by: Matt Friedman <maf675@gmail.com>
This commit is contained in:
Matt Friedman
2024-06-04 09:34:02 -07:00
parent e35a6f7aa5
commit d55ec608ec
12 changed files with 51 additions and 8 deletions

View File

@@ -3853,6 +3853,9 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
$timezone_name = $user->lang['timezones'][$timezone_name];
}
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
// Output the notifications
$notifications = false;
if ($config['load_notifications'] && $config['allow_board_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE)
@@ -3869,10 +3872,19 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
{
$template->assign_block_vars('notifications', $notification->prepare_for_display());
}
// Get web push notification data
$methods = $phpbb_notifications->get_subscription_methods();
if ($config['webpush_dropdown_subscribe'] && array_key_exists('notification.method.webpush', $methods))
{
/** @var \phpbb\form\form_helper $form_helper */
$form_helper = $phpbb_container->get('form_helper');
$template_ary = $methods['notification.method.webpush']['method']->get_ucp_template_data($controller_helper, $form_helper);
$template->assign_vars($template_ary);
}
}
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
$notification_mark_hash = generate_link_hash('mark_all_notifications_read');
$phpbb_version_parts = explode('.', PHPBB_VERSION, 3);