nx: use js for detection

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-05-03 01:24:22 -07:00
parent 18e85006e7
commit 4c6f1a7017
4 changed files with 23 additions and 6 deletions

View File

@ -238,6 +238,11 @@ export default defineComponent({
},
})
);
// Check for native interface
if (window.nativex?.isNative()) {
document.body.classList.add('native');
}
},
async beforeMount() {

View File

@ -2,6 +2,18 @@ body {
overflow: hidden;
}
// Native app styles
body.native {
#content-vue {
margin-top: 0 !important;
height: 100vh !important;
}
#header {
display: none !important;
}
}
// Nextcloud 25+: get rid of gap and border radius at right
#content-vue.remove-gap {
// was var(--body-container-radius)
@ -25,12 +37,6 @@ 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

View File

@ -12,6 +12,7 @@ import { getRequestToken } from '@nextcloud/auth';
import type { Route } from 'vue-router';
import type { IPhoto } from './types';
import type { NativeX } from './types-native';
import type PlyrType from 'plyr';
import type videojsType from 'video.js';
@ -48,6 +49,8 @@ declare global {
var Plyr: typeof PlyrType;
var videoClientId: string;
var videoClientIdPersistent: string;
var nativex: NativeX | undefined;
}
// Allow global access to the router

View File

@ -0,0 +1,3 @@
export type NativeX = {
isNative: () => boolean;
};