From 990388586292581db2b39ceecc928217f0e7655f Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 3 May 2023 00:37:25 -0700 Subject: [PATCH] nx: base layout --- lib/Controller/PageController.php | 9 ++++++++- src/global.scss | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 066aba6e..58884216 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -55,7 +55,6 @@ class PageController extends Controller // Scripts OCPUtil::addScript($this->appName, 'memories-main'); - $this->eventDispatcher->dispatchTyped(new LoadSidebar()); // Extra translations if (Util::recognizeIsEnabled()) { @@ -67,6 +66,14 @@ class PageController extends Controller $response->setContentSecurityPolicy(self::getCSP()); $response->cacheFor(0); + // Check if requested from native app + $userAgent = $this->request->getHeader('User-Agent'); + if (strpos($userAgent, 'memories-native') !== false) { + $response->renderAs(TemplateResponse::RENDER_AS_BASE); + } else { + $this->eventDispatcher->dispatchTyped(new LoadSidebar()); + } + return $response; } diff --git a/src/global.scss b/src/global.scss index 38c4f31e..783ec0da 100644 --- a/src/global.scss +++ b/src/global.scss @@ -25,6 +25,12 @@ body { border-top-left-radius: var(--body-container-radius); border-bottom-left-radius: var(--body-container-radius); } + + // Nothing on top + body.layout-base & { + margin-top: 0 !important; + height: 100vh !important; + } } // Top bar is above everything else on mobile