An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Keep mobile startup background consistent
Danielada8ce98bd27
diff --git a/app/src/assets/template/mobile/index.tpl b/app/src/assets/template/mobile/index.tplindex 5af2c6e560..08116cc38a 100644--- a/app/src/assets/template/mobile/index.tpl+++ b/app/src/assets/template/mobile/index.tpl@@ -6,7 +6,7 @@<meta name="viewport" content="width=device-width, height=device-height, interactive-widget=overlays-content, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover"><link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials"></head>-<body class="fn__flex-column">+<body class="fn__flex-column" style="background-color: #1e1e1e"><div id="loading" class="b3-dialog b3-dialog--open" style="padding: 0;"><div class="b3-dialog__scrim" style="background-color: #1e1e1e"></div><img style="position: absolute;width: 24vh;height: 24vh;" src="../../icon.svg">diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex cbeb700877..4c30b7a1b3 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -25,6 +25,7 @@ import {} from "./util/touch";import {fetchGet, fetchPost} from "../util/fetch";import {initFramework} from "./util/initFramework";+import {finishMobileStartup} from "./util/setEmpty";import {initAssets} from "../util/assets";import {bootSync, lockScreen} from "../dialog/processSystem";import {initMessage, showMessage} from "../dialog/message";@@ -205,7 +206,7 @@ class App {bootSync();appearanceConfigApi.apply(window.siyuan.config.appearance);initMessage();- initAssets();+ initAssets(true);if (!isInMobileApp()) {if (isChromeBrowser()) {document.querySelector('meta[name="viewport"]').setAttribute("content", "width=device-width, height=device-height, interactive-widget=resizes-content, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover");@@ -233,6 +234,7 @@ class App {mainWs.flushMainMessages();} catch (error) {console.error("Failed to initialize mobile framework:", error);+ finishMobileStartup();}});});diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex f369ac1c28..ceb775fb0a 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -8,7 +8,7 @@ import {getEventName, isDisabledFeature, isInMobileApp} from "../../protyle/utilimport {fetchPost} from "../../util/fetch";import {setInlineStyle} from "../../util/assets";import {renderSnippet} from "../../config/util/snippets";-import {setEmpty} from "./setEmpty";+import {finishMobileStartup, setEmpty} from "./setEmpty";import {getOpenNotebookCount, parseUriInfo} from "../../util/pathName";import {popMenu} from "../menu";import {MobileFiles} from "../dock/MobileFiles";@@ -376,6 +376,7 @@ export const initFramework = async (app: App, isStart: boolean) => {const info = parseUriInfo();if (info.id) {if (openStandaloneDatabaseItemByURI(app, info)) {+ finishMobileStartup();return;}if (info.avItemID) {diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.tsindex d1aa059ba5..7ed448b493 100644--- a/app/src/mobile/util/setEmpty.ts+++ b/app/src/mobile/util/setEmpty.ts@@ -10,6 +10,14 @@ import {updateMobileTopBarLayout} from "./mobileTopBar";import {invalidateTrackedRanges} from "../../protyle/util/trackedRange";import {closeAVCellEditor} from "../../protyle/render/av/cellEditor";+export const finishMobileStartup = () => {+ const loadingElement = document.getElementById("loading");+ if (loadingElement) {+ loadingElement.remove();+ document.body.style.removeProperty("background-color");+ }+};+export const setEmpty = (app: App) => {closeAVCellEditor();if (window.siyuan.mobile.editor?.protyle) {@@ -29,6 +37,7 @@ export const setEmpty = (app: App) => {const emptyElement = document.getElementById("empty");emptyElement.classList.remove("fn__none");if (emptyElement.innerHTML !== "") {+ finishMobileStartup();return;}emptyElement.innerHTML = `<div id="emptySearch" class="b3-list-item">@@ -86,6 +95,7 @@ export const setEmpty = (app: App) => {target = target.parentElement;}});+ finishMobileStartup();};export const setEditor = (showTitle = true) => {@@ -97,4 +107,7 @@ export const setEditor = (showTitle = true) => {document.getElementById("editor").classList.remove("fn__none");document.getElementById("empty").classList.add("fn__none");updateMobileTopBarLayout();+ if (showTitle) {+ finishMobileStartup();+ }};diff --git a/app/src/util/assets.ts b/app/src/util/assets.tsindex b9ceb0d569..2b0f5d3199 100644--- a/app/src/util/assets.ts+++ b/app/src/util/assets.ts@@ -290,9 +290,9 @@ export const loadAssets = async (appearance: Config.IAppearance) => {await Promise.all(scriptLoads);};-export const initAssets = () => {+export const initAssets = (keepLoading = false) => {const loadingElement = document.getElementById("loading");- if (loadingElement) {+ if (loadingElement && !keepLoading) {setTimeout(() => {loadingElement.remove();}, 160);@@ -464,6 +464,11 @@ const updateMobileTheme = (OSTheme: string) => {}const fallback = mode === 0 ? "#ffffffff" : "#1e1e1eff";const backgroundColor = rgbaToHex(cssVarToRgba("--b3-theme-background")) || fallback;+ const loadingElement = document.getElementById("loading");+ if (loadingElement) {+ document.body.style.backgroundColor = backgroundColor;+ loadingElement.querySelector<HTMLElement>(".b3-dialog__scrim")?.style.setProperty("background-color", backgroundColor);+ }// 统一传 #RRGGBBAA:iOS 按 #RRGGBBAA 解析,Android / Harmony 将 #RRGGBBAA 转为 #AARRGGBBif (isInIOS()) {window.webkit.messageHandlers.changeStatusBar.postMessage(backgroundColor + " " + mode);