FEATURE: Opt-in native Discourse app install banner on Android/iOS

This commit is contained in:
Rafael dos Santos Silva 2017-01-03 15:50:45 -02:00
parent d8be3e8bb1
commit d7c8c2d5e3
4 changed files with 23 additions and 1 deletions

View File

@ -13,7 +13,7 @@ class MetadataController < ApplicationController
private
def default_manifest
{
manifest = {
name: SiteSetting.title,
short_name: SiteSetting.title,
display: 'standalone',
@ -29,5 +29,19 @@ class MetadataController < ApplicationController
}
]
}
if SiteSetting.native_app_install_banner
manifest = manifest.merge({
prefer_related_applications: true,
related_applications: [
{
platform: "play",
id: "com.discourse"
}
]
})
end
manifest
end
end

View File

@ -47,6 +47,10 @@
<%= render_google_universal_analytics_code %>
<link rel="manifest" href="<%= Discourse.base_uri %>/manifest.json">
<%- if SiteSetting.native_app_install_banner? %>
<meta name="apple-itunes-app" content="app-id=1173672076">
<%- end %>
<%= yield :head %>
</head>

View File

@ -1367,6 +1367,8 @@ en:
topic_page_title_includes_category: "Topic page title includes the category name."
native_app_install_banner: "Asks recurring visitors to install Discourse native app."
max_prints_per_hour_per_user: "Maximum number of /print page impressions (set to 0 to disable)"
full_name_required: "Full name is a required field of a user's profile."

View File

@ -1260,6 +1260,8 @@ uncategorized:
topic_page_title_includes_category: true
native_app_install_banner: false
user_preferences:
default_email_digest_frequency: