diff --git a/language/en/webpushnotifications_module_ucp.php b/language/en/webpushnotifications_module_ucp.php index cf5e237..18e7ff9 100644 --- a/language/en/webpushnotifications_module_ucp.php +++ b/language/en/webpushnotifications_module_ucp.php @@ -53,6 +53,8 @@ 'NOTIFY_WEBPUSH_POPUP_MESSAGE' => 'We would like to send you browser notifications for replies, private messages, and relevant forum activity. Optional — you can manage these settings at any time.', 'NOTIFY_WEBPUSH_POPUP_ALLOW' => 'Allow', 'NOTIFY_WEBPUSH_POPUP_DENY' => 'Deny', - 'NOTIFY_WEBPUSH_POPUP_DISABLE' => 'Disable “Allow Browser Notifications” prompts', - 'NOTIFY_WEBPUSH_POPUP_DISABLE_EXPLAIN' => 'Toggle this on to stop us from asking you to enable web push notifications on any of your devices. Note that we won’t be able to alert you if your web push notifications ever become disabled.', + 'NOTIFY_WEBPUSH_POPUP_DISABLE' => 'Notification reminder pop-ups', + 'NOTIFY_WEBPUSH_POPUP_DISABLE_EXPLAIN' => 'We show a reminder asking you to allow browser notifications when they are not currently enabled or when we cannot detect them. Turn this off to permanently stop these reminder pop-ups on all your devices. If you turn this off, you will not be warned if your browser notifications stop working in the future.', + 'NOTIFY_WEBPUSH_POPUP_ENABLER' => 'Enable reminders', + 'NOTIFY_WEBPUSH_POPUP_DISABLER' => 'Disable reminders', ]); diff --git a/language/ru/webpushnotifications_module_ucp.php b/language/ru/webpushnotifications_module_ucp.php index 64732bb..edfcfc9 100644 --- a/language/ru/webpushnotifications_module_ucp.php +++ b/language/ru/webpushnotifications_module_ucp.php @@ -53,6 +53,8 @@ 'NOTIFY_WEBPUSH_POPUP_MESSAGE' => 'Браузерные уведомления позволяют быстро получать информацию о новых ответах, личных сообщениях и других активностях на данной конференции. Функцию можно отключить или включить в любое время в настройках уведомлений в Личном разделе.', 'NOTIFY_WEBPUSH_POPUP_ALLOW' => 'Включить', 'NOTIFY_WEBPUSH_POPUP_DENY' => 'Отклонить', - 'NOTIFY_WEBPUSH_POPUP_DISABLE' => 'Отключить запросы «Включить браузерные уведомления»', - 'NOTIFY_WEBPUSH_POPUP_DISABLE_EXPLAIN' => 'Включите этот параметр, чтобы мы больше не спрашивали вас о включении веб-push-уведомлений на любом из ваших устройств. Обратите внимание, что в этом случае мы не сможем предупредить вас, если веб-push-уведомления будут отключены.', + 'NOTIFY_WEBPUSH_POPUP_DISABLE' => 'Всплывающие напоминания о уведомлениях', + 'NOTIFY_WEBPUSH_POPUP_DISABLE_EXPLAIN' => 'Мы показываем напоминание с просьбой разрешить уведомления браузера, если они сейчас не включены или если мы не можем их обнаружить. Отключите эту функцию, чтобы навсегда убрать эти напоминания на всех ваших устройствах. Если вы отключите эту функцию, вы больше не будете получать предупреждения, если уведомления браузера перестанут работать в будущем.', + 'NOTIFY_WEBPUSH_POPUP_ENABLER' => 'Включить напоминания', + 'NOTIFY_WEBPUSH_POPUP_DISABLER' => 'Отключить напоминания', ]); diff --git a/notification/method/webpush.php b/notification/method/webpush.php index 162c637..7d58f8f 100644 --- a/notification/method/webpush.php +++ b/notification/method/webpush.php @@ -395,7 +395,7 @@ public function get_ucp_template_data(helper $controller_helper, form_helper $fo 'U_WEBPUSH_WORKER_URL' => $controller_helper->route('phpbb_webpushnotifications_ucp_push_worker_controller'), 'SUBSCRIPTIONS' => $subscriptions, 'WEBPUSH_FORM_TOKENS' => $form_helper->get_form_tokens(\phpbb\webpushnotifications\ucp\controller\webpush::FORM_TOKEN_UCP), - 'S_WEBPUSH_POPUP_PROMPT' => $this->config['wpn_webpush_popup_prompt'] && $this->user->id() != ANONYMOUS && $this->user->data['user_type'] != USER_IGNORE && !($this->user->data['user_wpn_popup_disabled'] ?? 0), + 'S_WEBPUSH_POPUP_PROMPT' => $this->config['wpn_webpush_popup_prompt'] && $this->user->id() != ANONYMOUS && $this->user->data['user_type'] != USER_IGNORE, 'S_WEBPUSH_POPUP_DISABLED' => $this->user->data['user_wpn_popup_disabled'] ?? 0, ]; } diff --git a/styles/all/template/webpush.js b/styles/all/template/webpush.js index 440406c..2605b5f 100644 --- a/styles/all/template/webpush.js +++ b/styles/all/template/webpush.js @@ -389,19 +389,10 @@ function PhpbbWebpush() { .then(data => { loadingIndicator.fadeOut(phpbb.alertTime); if (data.success) { - // Update toggle icon based on new state + // Update button text based on new state const button = document.getElementById('toggle_popup_prompt'); if (button) { - const icon = button.querySelector('i'); - if (icon) { - if (data.disabled) { - icon.classList.remove('fa-toggle-off'); - icon.classList.add('fa-toggle-on'); - } else { - icon.classList.remove('fa-toggle-on'); - icon.classList.add('fa-toggle-off'); - } - } + button.value = data.disabled ? button.getAttribute('data-l-enable') : button.getAttribute('data-l-disable'); } if ('form_tokens' in data) { updateFormTokens(data.form_tokens); diff --git a/styles/all/template/webpush_popup.html b/styles/all/template/webpush_popup.html index cff48bd..e76c102 100644 --- a/styles/all/template/webpush_popup.html +++ b/styles/all/template/webpush_popup.html @@ -1,4 +1,4 @@ -{% if S_WEBPUSH_POPUP_PROMPT %} +{% if S_WEBPUSH_POPUP_PROMPT and not S_WEBPUSH_POPUP_DISABLED %}