fix: navbar overlapping with system navbar

This commit is contained in:
NoCrypt 2024-08-03 22:34:41 +07:00
parent 0e5cb1bb7a
commit 0aeac57a99
5 changed files with 47 additions and 46 deletions

View file

@ -37,7 +37,7 @@
"capacitor-nodejs": "https://github.com/funniray/Capacitor-NodeJS/releases/download/nodejs-18/capacitor-nodejs-1.0.0-beta.6.tgz",
"capacitor-plugin-safe-area": "^2.0.5",
"common": "workspace:*",
"cordova-plugin-navigationbar": "^1.0.31",
"cordova-plugin-navigationbar-color": "^0.1.0",
"cordova-plugin-pip": "^0.0.2",
"cordova-plugin-screen-orientation": "^3.0.4",
"es6-promise-plugin": "^4.2.2"

View file

@ -1,4 +1,4 @@
/* globals navigationbar, PictureInPicture */
/* globals NavigationBar, PictureInPicture */
import { StatusBar, Style } from '@capacitor/status-bar'
import { SafeArea } from 'capacitor-plugin-safe-area'
import { App } from '@capacitor/app'
@ -88,7 +88,8 @@ updateInsets()
StatusBar.setStyle({ style: Style.Dark })
StatusBar.setOverlaysWebView({ overlay: true })
navigationbar.setUp(true)
// @ts-ignore
NavigationBar.setUp(true)
// cordova screen orientation plugin is also used, and it patches global screen.orientation.lock

View file

@ -2,6 +2,7 @@ import { append, element } from 'svelte/internal'
import { writable } from 'simple-store-svelte'
import { settings } from './settings'
import { get } from 'svelte/store'
import { SUPPORTS } from '@/modules/support.js'
const style = element('style')
style.id = 'customThemes'
@ -44,5 +45,6 @@ export function updateTheme(value) {
} else {
value += NORMAL
}
if (SUPPORTS.isAndroid) window.NavigationBar.backgroundColorByHexString(get(settings).amoledTheme ? "#000000" : "#17191D")
style.textContent = `:root{${value.replace(/{|}/g, '')}}`
}

View file

@ -107,9 +107,11 @@
isFullscreen = !!document.fullscreenElement
if (document.fullscreenElement) {
window.Capacitor.Plugins.StatusBar.hide()
window.NavigationBar.hide()
screen.orientation.lock('landscape')
} else {
window.Capacitor.Plugins.StatusBar.show()
window.NavigationBar.show()
screen.orientation.unlock()
}
})

View file

@ -96,9 +96,9 @@ importers:
common:
specifier: workspace:*
version: link:../common
cordova-plugin-navigationbar:
specifier: ^1.0.31
version: 1.0.31
cordova-plugin-navigationbar-color:
specifier: ^0.1.0
version: 0.1.0
cordova-plugin-pip:
specifier: ^0.0.2
version: 0.0.2
@ -123,7 +123,7 @@ importers:
version: 4.1.5
webpack-cli:
specifier: ^5.1.4
version: 5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0)
version: 5.1.4(webpack@5.92.0)
webpack-merge:
specifier: ^5.10.0
version: 5.10.0
@ -156,7 +156,7 @@ importers:
version: 4.4.1
jassub:
specifier: latest
version: 1.7.15
version: 1.7.16
js-levenshtein:
specifier: ^1.1.6
version: 1.1.6
@ -1847,9 +1847,9 @@ packages:
peerDependencies:
webpack: ^5.1.0
cordova-plugin-navigationbar@1.0.31:
resolution: {integrity: sha512-xt9tx5Aprf052OvuG2JohjRkkU/6U6XQ8mXOx93HaHFz6cCZI1+B0pl/uoyU/FkJsP41QIw1upnMdzgav11ifw==}
engines: {'0': {name: cordova, version: '>=3.0.0'}}
cordova-plugin-navigationbar-color@0.1.0:
resolution: {integrity: sha512-O/JfdLerNc0Jcq/4nTvsW45IzojtJT0Biayl8ZKSAKtQv6U7tOLUZ1/k+dRGZnBNoQyNc5gC9Lbn6A573v9UhA==}
engines: {cordovaDependencies: {0.1.0: {cordova: '>=3.0.0'}, 3.0.0: {cordova: '>100'}}}
cordova-plugin-pip@0.0.2:
resolution: {integrity: sha512-Wy9aK7rQX3kif6+kUl7RwTG/+arixvW5Sphyr0bPxsVrkVIliseW/S/JhO7BVX25/HGU0lGMvQe8a134yvI9iQ==}
@ -3282,8 +3282,8 @@ packages:
engines: {node: '>=10'}
hasBin: true
jassub@1.7.15:
resolution: {integrity: sha512-8yKAJc++Y1gNfATOPRo3APk0JUhshKl5l7bRkT6WkJ8XP4RvYfVPb6ieH6WDxsMq523exwGzNvjjPEEWT+Z1nQ==}
jassub@1.7.16:
resolution: {integrity: sha512-JDzKtGqQeApqQtEDWM5KzuGs5HKvUOWS35HXKaka6MuHV8HxLfW/F77HDE6gsZVn+Vuhh8omzXv6THevF6z5Jg==}
jest-worker@27.5.1:
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
@ -6559,32 +6559,25 @@ snapshots:
'@webassemblyjs/ast': 1.12.1
'@xtuc/long': 4.2.2
'@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))':
dependencies:
webpack: 5.92.0(webpack-cli@5.1.4)
webpack-cli: 5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0)
'@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.0.2)(webpack@5.91.0))(webpack@5.91.0(webpack-cli@5.1.4))':
dependencies:
webpack: 5.91.0(webpack-cli@5.1.4)
webpack-cli: 5.1.4(webpack-dev-server@5.0.2)(webpack@5.91.0)
'@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))':
'@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))':
dependencies:
webpack: 5.92.0(webpack-cli@5.1.4)
webpack-cli: 5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0)
webpack-cli: 5.1.4(webpack@5.92.0)
'@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.0.2)(webpack@5.91.0))(webpack@5.91.0(webpack-cli@5.1.4))':
dependencies:
webpack: 5.91.0(webpack-cli@5.1.4)
webpack-cli: 5.1.4(webpack-dev-server@5.0.2)(webpack@5.91.0)
'@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0))(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0(webpack-cli@5.1.4))':
'@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))':
dependencies:
webpack: 5.92.0(webpack-cli@5.1.4)
webpack-cli: 5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0)
optionalDependencies:
webpack-dev-server: 5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0)
webpack-cli: 5.1.4(webpack@5.92.0)
'@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.0.2)(webpack@5.91.0))(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.91.0(webpack-cli@5.1.4))':
dependencies:
@ -6593,6 +6586,11 @@ snapshots:
optionalDependencies:
webpack-dev-server: 5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0)
'@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))':
dependencies:
webpack: 5.92.0(webpack-cli@5.1.4)
webpack-cli: 5.1.4(webpack@5.92.0)
'@webtorrent/http-node@1.3.0':
dependencies:
freelist: 1.0.3
@ -7558,7 +7556,7 @@ snapshots:
serialize-javascript: 6.0.2
webpack: 5.91.0(webpack-cli@5.1.4)
cordova-plugin-navigationbar@1.0.31: {}
cordova-plugin-navigationbar-color@0.1.0: {}
cordova-plugin-pip@0.0.2: {}
@ -9204,7 +9202,7 @@ snapshots:
filelist: 1.0.4
minimatch: 3.1.2
jassub@1.7.15:
jassub@1.7.16:
dependencies:
rvfc-polyfill: 1.0.7
@ -11365,25 +11363,6 @@ snapshots:
webidl-conversions@4.0.2:
optional: true
webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0):
dependencies:
'@discoveryjs/json-ext': 0.5.7
'@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))
'@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))
'@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0))(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0(webpack-cli@5.1.4))
colorette: 2.0.20
commander: 10.0.1
cross-spawn: 7.0.3
envinfo: 7.13.0
fastest-levenshtein: 1.0.16
import-local: 3.1.0
interpret: 3.1.1
rechoir: 0.8.0
webpack: 5.92.0(webpack-cli@5.1.4)
webpack-merge: 5.10.0
optionalDependencies:
webpack-dev-server: 5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0)
webpack-cli@5.1.4(webpack-dev-server@5.0.2)(webpack@5.91.0):
dependencies:
'@discoveryjs/json-ext': 0.5.7
@ -11403,6 +11382,23 @@ snapshots:
optionalDependencies:
webpack-dev-server: 5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0)
webpack-cli@5.1.4(webpack@5.92.0):
dependencies:
'@discoveryjs/json-ext': 0.5.7
'@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))
'@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))
'@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack@5.92.0))(webpack@5.92.0(webpack-cli@5.1.4))
colorette: 2.0.20
commander: 10.0.1
cross-spawn: 7.0.3
envinfo: 7.13.0
fastest-levenshtein: 1.0.16
import-local: 3.1.0
interpret: 3.1.1
rechoir: 0.8.0
webpack: 5.92.0(webpack-cli@5.1.4)
webpack-merge: 5.10.0
webpack-dev-middleware@7.2.1(webpack@5.91.0(webpack-cli@5.1.4)):
dependencies:
colorette: 2.0.20
@ -11523,7 +11519,7 @@ snapshots:
watchpack: 2.4.1
webpack-sources: 3.2.3
optionalDependencies:
webpack-cli: 5.1.4(webpack-dev-server@5.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.4)(webpack-cli@5.1.4)(webpack@5.91.0))(webpack@5.92.0)
webpack-cli: 5.1.4(webpack@5.92.0)
transitivePeerDependencies:
- '@swc/core'
- esbuild