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

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

diff --git a/config/site_settings.yml b/config/site_settings.yml
index 018d739..ea69ebe 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -1975,7 +1975,7 @@ uncategorized:
     hidden: true
 
   pwa_display_browser_regex:
-    default: "iPad|iPhone"
+    default: "a^"
     hidden: true
 
   app_association_android:
diff --git a/spec/requests/metadata_controller_spec.rb b/spec/requests/metadata_controller_spec.rb
index 3089bc3..4e00f5a 100644
--- a/spec/requests/metadata_controller_spec.rb
+++ b/spec/requests/metadata_controller_spec.rb
@@ -55,18 +55,18 @@ RSpec.describe MetadataController do
       expect(manifest["display"]).to eq("standalone")
     end
 
-    it 'defaults to display browser for iPhone' do
+    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("browser")
+      expect(manifest["display"]).to eq("standalone")
     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 '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("standalone")
+      expect(manifest["display"]).to eq("browser")
     end
 
     it 'uses the short_title if it is set' do

GitHub sha: 3053c6d9

Note: the regexp here always fails. This is a temporary attempt to enable it everywhere. If it works a follow up will remove the setting altogether.

1 Like