FIX: PWA install was broken due to missing basic logo

The current manifest validation in Chrome requires at least one
non-maskable icon to make it installable.

This commit adds the maskable entry as another entry, following up
on changes added in 3e590b8
This commit is contained in:
Rafael dos Santos Silva 2019-09-22 00:20:25 -04:00
parent 3e590b87cf
commit 7543695744
1 changed files with 10 additions and 6 deletions

View File

@ -47,12 +47,16 @@ class MetadataController < ApplicationController
} }
logo = SiteSetting.site_manifest_icon_url logo = SiteSetting.site_manifest_icon_url
manifest[:icons] << { if logo
src: UrlHelper.absolute(logo), icon_entry = {
purpose: "maskable", src: UrlHelper.absolute(logo),
sizes: "512x512", sizes: "512x512",
type: MiniMime.lookup_by_filename(logo)&.content_type || "image/png" type: MiniMime.lookup_by_filename(logo)&.content_type || "image/png"
} if logo }
manifest[:icons] << icon_entry.dup
icon_entry[:purpose] = "maskable"
manifest[:icons] << icon_entry
end
manifest[:short_name] = SiteSetting.short_title if SiteSetting.short_title.present? manifest[:short_name] = SiteSetting.short_title if SiteSetting.short_title.present?