diff --git a/acp/wpn_acp_module.php b/acp/wpn_acp_module.php
index 30c3e5f..88131ab 100644
--- a/acp/wpn_acp_module.php
+++ b/acp/wpn_acp_module.php
@@ -379,7 +379,7 @@ protected function get_styles(): array
FROM ' . STYLES_TABLE . '
WHERE style_active = 1
ORDER BY style_name';
- $result = $this->db->sql_query($sql, 3600);
+ $result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
diff --git a/adm/style/wpn_acp_pwa.html b/adm/style/wpn_acp_pwa.html
index d0b6391..d9b74a4 100644
--- a/adm/style/wpn_acp_pwa.html
+++ b/adm/style/wpn_acp_pwa.html
@@ -53,11 +53,11 @@
{{ lang('PWA_THEME_COLOURS') }}
-
+
-
+
diff --git a/controller/manifest.php b/controller/manifest.php
index a1b71ba..19649dd 100644
--- a/controller/manifest.php
+++ b/controller/manifest.php
@@ -61,10 +61,18 @@ public function handle(): JsonResponse
'orientation' => 'portrait',
'start_url' => $start_url,
'scope' => $scope,
- 'theme_color' => !empty($this->user->style['pwa_theme_color']) ? $this->user->style['pwa_theme_color'] : ext::PWA_THEME_COLOR,
- 'background_color' => !empty($this->user->style['pwa_bg_color']) ? $this->user->style['pwa_bg_color'] : ext::PWA_BG_COLOR,
];
+ if (!empty($this->user->style['pwa_theme_color']))
+ {
+ $manifest['theme_color'] = $this->user->style['pwa_theme_color'];
+ }
+
+ if (!empty($this->user->style['pwa_bg_color']))
+ {
+ $manifest['background_color'] = $this->user->style['pwa_bg_color'];
+ }
+
if (!empty($this->config['pwa_icon_small']) && !empty($this->config['pwa_icon_large']))
{
$manifest['icons'] = [
diff --git a/event/listener.php b/event/listener.php
index 4e5ae34..3e882d2 100644
--- a/event/listener.php
+++ b/event/listener.php
@@ -155,8 +155,8 @@ public function pwa_manifest()
'U_MANIFEST_URL' => $this->controller_helper->route('phpbb_webpushnotifications_manifest_controller'),
'U_TOUCH_ICON' => $this->config['pwa_icon_small'] ? ext::PWA_ICON_DIR . '/' . $this->config['pwa_icon_small'] : null,
'SHORT_SITE_NAME' => $this->config['pwa_short_name'] ?: $this->trim_shortname($this->config['sitename']),
- 'PWA_THEME_COLOR' => !empty($this->user->style['pwa_theme_color']) ? $this->user->style['pwa_theme_color'] : ext::PWA_THEME_COLOR,
- 'PWA_BG_COLOR' => !empty($this->user->style['pwa_bg_color']) ? $this->user->style['pwa_bg_color'] : ext::PWA_BG_COLOR,
+ 'PWA_THEME_COLOR' => $this->user->style['pwa_theme_color'] ?? '',
+ 'PWA_BG_COLOR' => $this->user->style['pwa_bg_color'] ?? '',
'S_PWA_SHOW_BANNER' => !empty($this->config['pwa_show_install_banner']) && $this->is_mobile_phone(),
]);
}
diff --git a/ext.php b/ext.php
index e58af68..56f2872 100644
--- a/ext.php
+++ b/ext.php
@@ -20,12 +20,6 @@ class ext extends \phpbb\extension\base
*/
public const PWA_ICON_DIR = 'images/site_icons';
- /** @var string PWA theme color */
- public const PWA_THEME_COLOR = '#000000';
-
- /** @var string PWA background color */
- public const PWA_BG_COLOR = '#ffffff';
-
/**
* Require phpBB 3.3.12 due to new template and core events.
*/
diff --git a/styles/all/template/event/overall_header_head_append.html b/styles/all/template/event/overall_header_head_append.html
index e29b1bb..2fc12ad 100644
--- a/styles/all/template/event/overall_header_head_append.html
+++ b/styles/all/template/event/overall_header_head_append.html
@@ -1,8 +1,12 @@
-
+{% if PWA_THEME_COLOR %}
+{% endif %}
+{% if PWA_BG_COLOR %}
+
+{% endif %}
diff --git a/tests/controller/controller_manifest_test.php b/tests/controller/controller_manifest_test.php
index 03258f7..874153e 100644
--- a/tests/controller/controller_manifest_test.php
+++ b/tests/controller/controller_manifest_test.php
@@ -36,6 +36,8 @@ protected function setUp(): void
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$language = new \phpbb\language\language($lang_loader);
$user = $this->user = new \phpbb\user($language, '\phpbb\datetime');
+ $this->user->style['pwa_theme_color'] = '#000000';
+ $this->user->style['pwa_bg_color'] = '#ffffff';
$this->manifest = new \phpbb\webpushnotifications\controller\manifest($this->config, $this->user);
}
diff --git a/tests/event/listener_test.php b/tests/event/listener_test.php
index 1bba37f..e08c99c 100644
--- a/tests/event/listener_test.php
+++ b/tests/event/listener_test.php
@@ -349,8 +349,8 @@ public function test_pwa_manifest()
'U_MANIFEST_URL' => $this->controller_helper->route('phpbb_webpushnotifications_manifest_controller'),
'U_TOUCH_ICON' => ext::PWA_ICON_DIR . '/icon-192x192.png',
'SHORT_SITE_NAME' => 'Test',
- 'PWA_THEME_COLOR' => ext::PWA_THEME_COLOR,
- 'PWA_BG_COLOR' => ext::PWA_BG_COLOR,
+ 'PWA_THEME_COLOR' => '',
+ 'PWA_BG_COLOR' => '',
'S_PWA_SHOW_BANNER' => false,
]);
diff --git a/tests/functional/functional_test.php b/tests/functional/functional_test.php
index 9ad95c6..b4bb6f2 100644
--- a/tests/functional/functional_test.php
+++ b/tests/functional/functional_test.php
@@ -133,6 +133,8 @@ public function test_manifest()
$form_data = [
'config[pwa_short_name]' => $expected['short_name'],
+ 'pwa_theme_color_1' => $expected['theme_color'],
+ 'pwa_bg_color_1' => $expected['background_color'],
];
$form = $crawler->selectButton('submit')->form($form_data);
$crawler = self::submit($form);