FEATURE: Enable offline browsing and fullscreen PWA in iOS by default

This commit is contained in:
Rafael dos Santos Silva 2020-04-07 16:58:21 -03:00
parent 3f49b13e5f
commit 3053c6d95e
No known key found for this signature in database
GPG Key ID: 5E50360227B34938
2 changed files with 10 additions and 10 deletions

View File

@ -1975,7 +1975,7 @@ uncategorized:
hidden: true
pwa_display_browser_regex:
default: "iPad|iPhone"
default: "a^"
hidden: true
app_association_android:

View File

@ -55,20 +55,20 @@ RSpec.describe MetadataController do
expect(manifest["display"]).to eq("standalone")
end
it 'defaults to display browser for iPhone' do
get "/manifest.webmanifest", params: {}, headers: { 'USER-AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' }
manifest = JSON.parse(response.body)
expect(manifest["display"]).to eq("browser")
end
it 'can be changed to display standalone for iPhones using a site setting' do
SiteSetting.pwa_display_browser_regex = "a^" # this never matches
it 'defaults to display standalone for iPhone' do
get "/manifest.webmanifest", params: {}, headers: { 'USER-AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' }
manifest = JSON.parse(response.body)
expect(manifest["display"]).to eq("standalone")
end
it 'can be changed to display browser for iPhones using a site setting' do
SiteSetting.pwa_display_browser_regex = "iPhone"
get "/manifest.webmanifest", params: {}, headers: { 'USER-AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' }
manifest = JSON.parse(response.body)
expect(manifest["display"]).to eq("browser")
end
it 'uses the short_title if it is set' do
title = 'FooBarBaz Forum'
SiteSetting.title = title