This commit is contained in:
Daniel 2024-11-23 09:48:08 +08:00
parent 8639955ff0
commit 65f55b0dbe
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
15 changed files with 58 additions and 49 deletions

View file

@ -7,7 +7,7 @@ import {exportLayout} from "../layout/util";
/// #endif
import {fetchPost} from "./fetch";
import {appearance} from "../config/appearance";
import {isInAndroid, isInIOS} from "../protyle/util/compatibility";
import {isInAndroid, isInHarmony, isInIOS} from "../protyle/util/compatibility";
const loadThirdIcon = (iconURL: string, data: Config.IAppearance) => {
addScript(iconURL, "iconDefaultScript").then(() => {
@ -329,7 +329,7 @@ const rgba2hex = (rgba: string) => {
};
const updateMobileTheme = (OSTheme: string) => {
if (isInIOS() || isInAndroid()) {
if (isInIOS() || isInAndroid() || isInHarmony()) {
setTimeout(() => {
const backgroundColor = rgba2hex(getComputedStyle(document.body).getPropertyValue("--b3-theme-background").trim());
let mode = window.siyuan.config.appearance.mode;
@ -342,7 +342,7 @@ const updateMobileTheme = (OSTheme: string) => {
}
if (isInIOS()) {
window.webkit.messageHandlers.changeStatusBar.postMessage((backgroundColor || (mode === 0 ? "#fff" : "#1e1e1e")) + " " + mode);
} else if (isInAndroid()) {
} else if (isInAndroid() || isInHarmony()) {
window.JSAndroid.changeStatusBarColor(backgroundColor, mode);
}
}, 500); // 移动端需要加载完才可以获取到颜色

View file

@ -2,9 +2,9 @@ export const isMobile = () => {
return document.getElementById("sidebar") ? true : false;
};
// "windows" | "linux" | "darwin" | "docker" | "android" | "ios"
// "windows" | "linux" | "darwin" | "docker" | "android" | "ios" | "harmony"
export const getBackend = () => {
if (["docker", "ios", "android"].includes(window.siyuan.config.system.container)) {
if (["docker", "ios", "android", "harmony"].includes(window.siyuan.config.system.container)) {
return window.siyuan.config.system.container;
} else {
return window.siyuan.config.system.os;