Update app manifest icons

This commit is contained in:
atjn 2022-04-28 13:26:59 +02:00
parent dc05172272
commit 420f4c54b7
4 changed files with 63 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 1920 1920">
<rect fill="#1872a2" width="1920" height="1920"/>
<path fill="#febf19" d="M390 595q0-84 61-145 60-60 144-60h730q85 0 145 60 60 61 60 145v730q0 84-60 145-60 60-145 60H595q-84 0-144-60-60-61-61-145zm935-160h-183v274H778v231l363-2 1 273H778v274h547q67 0 114-47 46-46 45-113V595q0-67-45-113-46-46-114-47z"/>
</svg>

After

Width:  |  Height:  |  Size: 403 B

View file

@ -31,8 +31,6 @@ class Manifest extends BaseModule
{ {
$config = DI::config(); $config = DI::config();
$touch_icon = $config->get('system', 'touch_icon') ?: 'images/friendica-192.png';
$theme = DI::config()->get('system', 'theme'); $theme = DI::config()->get('system', 'theme');
$manifest = [ $manifest = [
@ -44,18 +42,6 @@ class Manifest extends BaseModule
'lang' => $config->get('system', 'language'), 'lang' => $config->get('system', 'language'),
'dir' => 'auto', 'dir' => 'auto',
'categories' => ['social network', 'internet'], 'categories' => ['social network', 'internet'],
'icons' => [
[
'src' => DI::baseUrl()->get() . '/' . $touch_icon,
'sizes' => '192x192',
'type' => 'image/png',
],
[
'src' => DI::baseUrl()->get() . '/' . $touch_icon,
'sizes' => '512x512',
'type' => 'image/png',
],
],
'shortcuts' => [ 'shortcuts' => [
[ [
'name' => 'Latest posts', 'name' => 'Latest posts',
@ -80,6 +66,65 @@ class Manifest extends BaseModule
] ]
]; ];
/// @TODO If the admin provides their own touch icon, the manifest will regress
/// to a smaller set of icons that do not follow the web app manifest spec.
/// There should be a mechanism to allow the admin to provide all of the 6
/// different images that are required for a fully valid web app manifest.
$touch_icon = $config->get('system', 'touch_icon');
if($touch_icon){
$manifest['icons'] = [
[
'src' => DI::baseUrl()->get() . '/' . $touch_icon,
'sizes' => '192x192',
'type' => 'image/png',
],
[
'src' => DI::baseUrl()->get() . '/' . $touch_icon,
'sizes' => '512x512',
'type' => 'image/png',
],
];
} else {
$manifest['icons'] = [
[
'src' => DI::baseUrl()->get() . '/images/friendica.svg',
'sizes' => 'any',
'type' => 'image/svg+xml',
'purpose' => 'any',
],
[
'src' => DI::baseUrl()->get() . '/images/friendica-192.png',
'sizes' => '192x192',
'type' => 'image/png',
'purpose' => 'any',
],
[
'src' => DI::baseUrl()->get() . '/images/friendica-512.png',
'sizes' => '512x512',
'type' => 'image/png',
'purpose' => 'any',
],
[
'src' => DI::baseUrl()->get() . '/images/friendica-maskable.svg',
'sizes' => 'any',
'type' => 'image/svg+xml',
'purpose' => 'maskable',
],
[
'src' => DI::baseUrl()->get() . '/images/friendica-maskable-192.png',
'sizes' => '192x192',
'type' => 'image/png',
'purpose' => 'maskable',
],
[
'src' => DI::baseUrl()->get() . '/images/friendica-maskable-512.png',
'sizes' => '512x512',
'type' => 'image/png',
'purpose' => 'maskable',
],
];
}
if ($background_color = Core\Theme::getBackgroundColor($theme)) { if ($background_color = Core\Theme::getBackgroundColor($theme)) {
$manifest['background_color'] = $background_color; $manifest['background_color'] = $background_color;
} }