mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-01 18:30:16 +01:00
🎨 Support HarmonyOS NEXT system https://github.com/siyuan-note/siyuan/issues/13184
This commit is contained in:
parent
8639955ff0
commit
65f55b0dbe
15 changed files with 58 additions and 49 deletions
|
|
@ -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); // 移动端需要加载完才可以获取到颜色
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue