File tree Expand file tree Collapse file tree
styles/all/template/event Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ protected function get_styles(): array
379379 FROM ' . STYLES_TABLE . '
380380 WHERE style_active = 1
381381 ORDER BY style_name ' ;
382- $ result = $ this ->db ->sql_query ($ sql, 3600 );
382+ $ result = $ this ->db ->sql_query ($ sql );
383383
384384 $ rows = $ this ->db ->sql_fetchrowset ($ result );
385385 $ this ->db ->sql_freeresult ($ result );
Original file line number Diff line number Diff line change @@ -53,11 +53,11 @@ <h1>{{ lang('PWA_THEME_COLOURS') }}</h1>
5353 < dt > < label for ="pwa_theme_color_{{ style.style_id }} "> {{ style.style_name ~ lang('COLON') }}</ label > </ dt >
5454 < dd >
5555 < span class ="color-pickers ">
56- < input type ="text " id ="pwa_theme_color_{{ style.style_id }} " name ="pwa_theme_color_{{ style.style_id }} " size ="8 " value ="{{ style.pwa_theme_color }} " placeholder ="{{ constant('phpbb\\webpushnotifications\\ext::PWA_THEME_COLOR') }} ">
56+ < input type ="text " id ="pwa_theme_color_{{ style.style_id }} " name ="pwa_theme_color_{{ style.style_id }} " size ="8 " value ="{{ style.pwa_theme_color }} " placeholder ="#000000 ">
5757 < input type ="color " id ="pwa_theme_color_picker_{{ style.style_id }} " aria-label ="{{ lang('PWA_THEME_COLOUR') }} " value ="{{ style.pwa_theme_color|default(default_color) }} ">
5858 </ span >
5959 < span class ="color-pickers ">
60- < input type ="text " id ="pwa_bg_color_{{ style.style_id }} " name ="pwa_bg_color_{{ style.style_id }} " size ="8 " value ="{{ style.pwa_bg_color }} " placeholder ="{{ constant('phpbb\\webpushnotifications\\ext::PWA_BG_COLOR') }} ">
60+ < input type ="text " id ="pwa_bg_color_{{ style.style_id }} " name ="pwa_bg_color_{{ style.style_id }} " size ="8 " value ="{{ style.pwa_bg_color }} " placeholder ="#ffffff ">
6161 < input type ="color " id ="pwa_bg_color_picker_{{ style.style_id }} " aria-label ="{{ lang('PWA_BACKGROUND_COLOUR') }} " value ="{{ style.pwa_bg_color|default(default_color) }} ">
6262 </ span >
6363 </ dd >
Original file line number Diff line number Diff line change @@ -61,10 +61,18 @@ public function handle(): JsonResponse
6161 'orientation ' => 'portrait ' ,
6262 'start_url ' => $ start_url ,
6363 'scope ' => $ scope ,
64- 'theme_color ' => !empty ($ this ->user ->style ['pwa_theme_color ' ]) ? $ this ->user ->style ['pwa_theme_color ' ] : ext::PWA_THEME_COLOR ,
65- 'background_color ' => !empty ($ this ->user ->style ['pwa_bg_color ' ]) ? $ this ->user ->style ['pwa_bg_color ' ] : ext::PWA_BG_COLOR ,
6664 ];
6765
66+ if (!empty ($ this ->user ->style ['pwa_theme_color ' ]))
67+ {
68+ $ manifest ['theme_color ' ] = $ this ->user ->style ['pwa_theme_color ' ];
69+ }
70+
71+ if (!empty ($ this ->user ->style ['pwa_bg_color ' ]))
72+ {
73+ $ manifest ['background_color ' ] = $ this ->user ->style ['pwa_bg_color ' ];
74+ }
75+
6876 if (!empty ($ this ->config ['pwa_icon_small ' ]) && !empty ($ this ->config ['pwa_icon_large ' ]))
6977 {
7078 $ manifest ['icons ' ] = [
Original file line number Diff line number Diff line change @@ -155,8 +155,8 @@ public function pwa_manifest()
155155 'U_MANIFEST_URL ' => $ this ->controller_helper ->route ('phpbb_webpushnotifications_manifest_controller ' ),
156156 'U_TOUCH_ICON ' => $ this ->config ['pwa_icon_small ' ] ? ext::PWA_ICON_DIR . '/ ' . $ this ->config ['pwa_icon_small ' ] : null ,
157157 'SHORT_SITE_NAME ' => $ this ->config ['pwa_short_name ' ] ?: $ this ->trim_shortname ($ this ->config ['sitename ' ]),
158- 'PWA_THEME_COLOR ' => ! empty ( $ this ->user ->style ['pwa_theme_color ' ]) ? $ this -> user -> style [ ' pwa_theme_color ' ] : ext:: PWA_THEME_COLOR ,
159- 'PWA_BG_COLOR ' => ! empty ( $ this ->user ->style ['pwa_bg_color ' ]) ? $ this -> user -> style [ ' pwa_bg_color ' ] : ext:: PWA_BG_COLOR ,
158+ 'PWA_THEME_COLOR ' => $ this ->user ->style ['pwa_theme_color ' ] ?? '' ,
159+ 'PWA_BG_COLOR ' => $ this ->user ->style ['pwa_bg_color ' ] ?? '' ,
160160 'S_PWA_SHOW_BANNER ' => !empty ($ this ->config ['pwa_show_install_banner ' ]) && $ this ->is_mobile_phone (),
161161 ]);
162162 }
Original file line number Diff line number Diff line change @@ -20,12 +20,6 @@ class ext extends \phpbb\extension\base
2020 */
2121 public const PWA_ICON_DIR = 'images/site_icons ' ;
2222
23- /** @var string PWA theme color */
24- public const PWA_THEME_COLOR = '#000000 ' ;
25-
26- /** @var string PWA background color */
27- public const PWA_BG_COLOR = '#ffffff ' ;
28-
2923 /**
3024 * Require phpBB 3.3.12 due to new template and core events.
3125 */
Original file line number Diff line number Diff line change 11<!-- Android / Chrome PWA support -->
22< meta name ="mobile-web-app-capable " content ="yes ">
3- < meta name =" background-color " content =" {{ PWA_BG_COLOR }} " >
3+ {% if PWA_THEME_COLOR %}
44< meta name ="theme-color " content ="{{ PWA_THEME_COLOR }} ">
55< style > : root { --pwa-theme-colour : {{ PWA_THEME_COLOR }}; }</ style >
6+ {% endif %}
7+ {% if PWA_BG_COLOR %}
8+ < meta name ="background-color " content ="{{ PWA_BG_COLOR }} ">
9+ {% endif %}
610<!-- iOS PWA support -->
711< meta name ="apple-mobile-web-app-capable " content ="yes ">
812< meta name ="apple-mobile-web-app-title " content ="{{ SHORT_SITE_NAME }} ">
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ protected function setUp(): void
3636 $ lang_loader = new \phpbb \language \language_file_loader ($ phpbb_root_path , $ phpEx );
3737 $ language = new \phpbb \language \language ($ lang_loader );
3838 $ user = $ this ->user = new \phpbb \user ($ language , '\phpbb\datetime ' );
39+ $ this ->user ->style ['pwa_theme_color ' ] = '#000000 ' ;
40+ $ this ->user ->style ['pwa_bg_color ' ] = '#ffffff ' ;
3941
4042 $ this ->manifest = new \phpbb \webpushnotifications \controller \manifest ($ this ->config , $ this ->user );
4143 }
Original file line number Diff line number Diff line change @@ -349,8 +349,8 @@ public function test_pwa_manifest()
349349 'U_MANIFEST_URL ' => $ this ->controller_helper ->route ('phpbb_webpushnotifications_manifest_controller ' ),
350350 'U_TOUCH_ICON ' => ext::PWA_ICON_DIR . '/icon-192x192.png ' ,
351351 'SHORT_SITE_NAME ' => 'Test ' ,
352- 'PWA_THEME_COLOR ' => ext:: PWA_THEME_COLOR ,
353- 'PWA_BG_COLOR ' => ext:: PWA_BG_COLOR ,
352+ 'PWA_THEME_COLOR ' => '' ,
353+ 'PWA_BG_COLOR ' => '' ,
354354 'S_PWA_SHOW_BANNER ' => false ,
355355 ]);
356356
Original file line number Diff line number Diff line change @@ -133,6 +133,8 @@ public function test_manifest()
133133
134134 $ form_data = [
135135 'config[pwa_short_name] ' => $ expected ['short_name ' ],
136+ 'pwa_theme_color_1 ' => $ expected ['theme_color ' ],
137+ 'pwa_bg_color_1 ' => $ expected ['background_color ' ],
136138 ];
137139 $ form = $ crawler ->selectButton ('submit ' )->form ($ form_data );
138140 $ crawler = self ::submit ($ form );
You can’t perform that action at this time.
0 commit comments