From 459556053788956dd5e428099d6fe6db593f288c Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Thu, 14 May 2020 16:32:53 -0300 Subject: [PATCH] FIX: Use proper icons for App shortcut menu Follow up to 3b0fa9b using the new icon URL introduced in e618efe Will automatically use icons of the primary color of the active theme for the user during install. --- app/controllers/metadata_controller.rb | 27 ++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb index ce6f1f85c61..2ce4adaa3f2 100644 --- a/app/controllers/metadata_controller.rb +++ b/app/controllers/metadata_controller.rb @@ -33,6 +33,9 @@ class MetadataController < ApplicationController end end + primary_color = ColorScheme.hex_for_name('primary', view_context.scheme_id) + icon_url_base = UrlHelper.absolute("/svg-sprite/#{Discourse.current_hostname}/icon/#{primary_color}") + manifest = { name: SiteSetting.title, short_name: SiteSetting.short_title.presence || SiteSetting.title.truncate(12, separator: ' ', omission: ''), @@ -58,9 +61,9 @@ class MetadataController < ApplicationController url: "/new-topic", icons: [ { - src: ActionController::Base.helpers.image_url("push-notifications/check.png"), - sizes: "128x128", - type: "image/png" + src: "#{icon_url_base}/plus.svg", + sizes: "any", + type: "image/svg+xml" } ] }, @@ -70,9 +73,9 @@ class MetadataController < ApplicationController url: "/my/messages", icons: [ { - src: ActionController::Base.helpers.image_url("push-notifications/private_message.png"), - sizes: "128x128", - type: "image/png" + src: "#{icon_url_base}/envelope.svg", + sizes: "any", + type: "image/svg+xml" } ] }, @@ -82,9 +85,9 @@ class MetadataController < ApplicationController url: "/my/bookmarks", icons: [ { - src: ActionController::Base.helpers.image_url("push-notifications/check.png"), - sizes: "128x128", - type: "image/png" + src: "#{icon_url_base}/bookmark.svg", + sizes: "any", + type: "image/svg+xml" } ] }, @@ -94,9 +97,9 @@ class MetadataController < ApplicationController url: "/top", icons: [ { - src: ActionController::Base.helpers.image_url("push-notifications/check.png"), - sizes: "128x128", - type: "image/png" + src: "#{icon_url_base}/signal.svg", + sizes: "any", + type: "image/svg+xml" } ] }