diff options
author | Simon L. <szaimen@e.mail.de> | 2025-02-27 12:06:42 +0100 |
---|---|---|
committer | Simon L. <szaimen@e.mail.de> | 2025-02-28 15:32:43 +0100 |
commit | 6235ed6222401ef79da7a523fab6f74969b824b8 (patch) | |
tree | dec7260ebf0b9d3311e4dc220056eb03396c1be9 | |
parent | 951a35cc3841e33e11266ae11dd1eac70c3ab3b3 (diff) | |
download | nextcloud-server-enh/49868/add-display-override.tar.gz nextcloud-server-enh/49868/add-display-override.zip |
feat(PWA): add `display_override` to set the display-mode to `minimal-ui` on supported browsersenh/49868/add-display-override
Signed-off-by: Simon L. <szaimen@e.mail.de>
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 3 | ||||
-rw-r--r-- | apps/theming/openapi.json | 7 | ||||
-rw-r--r-- | apps/theming/tests/Controller/ThemingControllerTest.php | 3 | ||||
-rw-r--r-- | core/img/manifest.json | 1 |
4 files changed, 12 insertions, 2 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index c3f365a11b6..8d9e7aaf060 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -422,7 +422,7 @@ class ThemingController extends Controller { * * @param string $app ID of the app * @psalm-suppress LessSpecificReturnStatement The content of the Manifest doesn't need to be described in the return type - * @return JSONResponse<Http::STATUS_OK, array{name: string, short_name: string, start_url: string, theme_color: string, background_color: string, description: string, icons: list<array{src: non-empty-string, type: string, sizes: string}>, display: string}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array{}, array{}> + * @return JSONResponse<Http::STATUS_OK, array{name: string, short_name: string, start_url: string, theme_color: string, background_color: string, description: string, icons: list<array{src: non-empty-string, type: string, sizes: string}>, display_override: list<string>, display: string}, array{}>|JSONResponse<Http::STATUS_NOT_FOUND, array{}, array{}> * * 200: Manifest returned * 404: App not found @@ -481,6 +481,7 @@ class ThemingController extends Controller { 'sizes' => '16x16' ] ], + 'display_override' => [$this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'minimal-ui' : ''], 'display' => $this->config->getSystemValueBool('theming.standalone_window.enabled', true) ? 'standalone' : 'browser' ]; $response = new JSONResponse($responseJS); diff --git a/apps/theming/openapi.json b/apps/theming/openapi.json index 7ad7242d744..bc316232ee8 100644 --- a/apps/theming/openapi.json +++ b/apps/theming/openapi.json @@ -343,6 +343,7 @@ "background_color", "description", "icons", + "display_override", "display" ], "properties": { @@ -387,6 +388,12 @@ } } }, + "display_override": { + "type": "array", + "items": { + "type": "string" + } + }, "display": { "type": "string" } diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 90dfca1b317..6dfbb72bb77 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -745,7 +745,7 @@ class ThemingControllerTest extends TestCase { ['theming.Icon.getFavicon', ['app' => 'core'], 'favicon'], ]); $this->config - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('getSystemValueBool') ->with('theming.standalone_window.enabled', true) ->willReturn($standalone); @@ -765,6 +765,7 @@ class ThemingControllerTest extends TestCase { 'sizes' => '16x16' ] ], + 'display_override' => [$standalone ? 'minimal-ui' : ''], 'display' => $standalone ? 'standalone' : 'browser', 'short_name' => 'Nextcloud', 'theme_color' => null, diff --git a/core/img/manifest.json b/core/img/manifest.json index 04e77df7a59..5d2d7d8a2d2 100644 --- a/core/img/manifest.json +++ b/core/img/manifest.json @@ -10,5 +10,6 @@ "type": "image/svg+xml", "sizes": "16x16" }], + "display_override": ["minimal-ui"], "display": "standalone" } |