Files
LanMountainDesktop/docs/auto_commit_md/20260518_93758fc0.md

322 lines
9.3 KiB
Markdown
Raw Normal View History

合并对设置系统的更新 (#11) * Add Windows system chrome patchers (Harmony) Introduce support for toggling the system chrome on Windows using Harmony patchers. Adds Lib.Harmony.Thin to package props and project, new patcher infrastructure (ChromePatchState, PatcherEntrance) and two Harmony patches that disable FluentAvalonia's Windows chrome when configured. Program.cs now loads the chrome setting and installs patchers conditionally on Windows/x86-x64. Settings viewmodel and view updated: expose IsWindowsOs, require restart on appearance changes, migrate SettingsWindow to FAAppWindow and adapt titlebar/layout (include Windows caption placeholder and footer menu items). Also add a .gitkeep and a build log file. * Refactor settings window UI and theming Improve theming and layout for the Settings window and related services. - MaterialSurfaceService: add special material parameters for SettingsWindowBackground (lower alpha, no blur) and avoid hot-switching real backdrops for non-settings windows. - GlassEffectService: add AdaptiveSettingsWindowTintBrush + ResolveSettingsWindowTintAlpha to provide optional content tinting tied to system material mode. - SettingsWindowService: refactor theme application into ApplyThemeVariantAndResources, ensure settings window material is applied at show/activate times, and tidy theme/resource application flow. - SettingsWindow.axaml / .axaml.cs: restructure title bar (separate Grid.Row=0 border) and FANavigationView host, add pane-footer toggle button for :minimal layout, use dynamic corner radius resource, and update toggle/visibility/icon logic and responsive layout code. - SettingsPages: remove some IconText usages and adjust margins; use DesignCornerRadiusLg for update card corner radius. - Add NuGet.Config to set local globalPackagesFolder and ignore .nuget/packages in .gitignore. These changes aim to improve visuals, avoid backdrop overdraw, and make the settings window behavior consistent across themes and layouts. * Add localization and localize settings pages Add many new localization keys (en-US and zh-CN) for notifications, developer tools, about page, status bar, and video wallpaper. Update Notification, Dev, About and StatusBar view models to use LocalizationService, expose localized ObservableProperties, and refresh localized text at construction. Localize selection options and test notification texts, and fix notification severity handling. Wire up XAML to the new localized properties (About/Dev/StatusBar pages) and update the settings page title for notifications. Also adjust copyright line generation and replace hardcoded placeholders with bound Watermark properties. * Redesign settings window with fluent shell & search Rebuild the settings window as a Fluent shell: adds a custom 48-DIP titlebar with Back, pane toggle, icon/title, search box, restart/more menu, and caption-button spacer; moves compact pane toggle into the titlebar and preserves FANavigationView as the primary navigation surface. Introduces a SettingsSearchService (with UI AutoComplete integration, search indexing, navigation-by-result, and search result highlighting) plus focused tests for search filtering and theme material normalization. Adds navigation history/back stack, updates SettingsViewModels for new bindings and localization keys, and updates General/Apearance pages to expose new strings and options. Implements an "auto" system material mode: default in AppSettingsSnapshot, new MaterialAuto constants and normalization/resolution logic in ThemeAppearanceValues, WindowMaterialService and MaterialSurfaceService adjustments to prefer Mica on Win11 and Acrylic on Win10 using TransparencyLevelHint. GlassEffectService and AppearanceThemeService updated to use effective material mode and to track live theme state changes. Adds localization entries (en-US, zh-CN), spec/tasks docs, and other UI/style tweaks to support the redesign. * fix.修折叠与展开按钮 * Add OOBE startup presentation and settings merge Introduce a new OOBE step for "Startup & Presentation" that exposes startup and UI preferences in OobeWindow (toggles for taskbar, slide/fade transitions, fused popup, and autostart). Add HostAppSettingsOobeMerger to read/write Host settings.json (PascalCase fields) and MergeStartupPresentation behavior, plus LauncherWindowsStartupService to sync the current Launcher into the Windows Run key on Windows. Wire UI handlers, persist choices on Next, and load defaults when entering the step. Include unit tests for the merger, adjust SettingsWindow navigation pane/toggle handling, and update docs/LAUNCHER.md to describe the new OOBE step and implementation files. * Move whiteboard persistence to file storage Switch whiteboard note storage from legacy DB rows to per-note JSON files and add migration support. Update WhiteboardNoteSnapshot schema (version bump, viewport, canvas, expires, PathSvgData) and change IWhiteboardNotePersistenceService.SaveNote to return bool to surface write failures (e.g. read-only files). Implement file-based WhiteboardNotePersistenceService with legacy DB migration/cleanup, retention handling, and logging. Add comprehensive unit tests for persistence, stroke path builder, SVG import and viewport helper. Also add ThirdParty/DotNetCampus.InkCanvas project and reference it in the main csproj, and bump PostHog package to 2.6.0. * Introduce render gate and chart caching Replace UI DispatcherTimer polling with a StudySnapshotRenderGate across multiple widgets to queue and apply only the latest analytics snapshot; components updated include StudyDeductionReasonsWidget, StudyEnvironmentWidget, StudyInterruptDensityWidget, StudyNoiseCurveWidget. Add StudySnapshotRenderGate implementation to coordinate rendering and monitoring leases and update subscription/lease lifecycle handling (subscribe/unsubscribe, Acquire/Dispose leases, Clear/Dispose gate). Rewrite chart controls (StudyNoiseCurveChartControl and StudyNoiseDistributionScatterChartControl) to use stable logical-time origins, split series into static vs dynamic tails, add geometry/sample caching, stable jitter/coordinate mapping helpers, and expose internal helpers & counts for testing. Add unit tests (StudyComponentRenderingTests) covering the render gate and chart behaviors (layer counts, logical X mapping, stable jitter, cache rebuild). These changes improve rendering correctness and performance by avoiding redundant renders and enabling deterministic chart layout. * Use MaterialColorSnapshot in appearance flow Introduce unified material/color spec and tests, and refactor appearance plumbing to use MaterialColorSnapshot as the single source of truth. Add .trae material-color-service spec/checklist/tasks and integration/unit tests for plugin mapping and appearance VM behavior. AppearanceChangedEvent extended with new appearance change flags and HasChanged logic. ComponentEditorMaterialThemeAdapter rewritten to accept MaterialColorSnapshot and derive palette from snapshot data. Simplify AppearanceSettingsPageViewModel and related view code: remove legacy preview/custom-seed UI logic, preserve material/color fields when updating theme or corner radius, and update save calls to use with-expressions. Update ComponentEditorWindow to use adapter-provided OnPrimary brush and minor docs updates. * Add material color services, plugin DTOs, and tests Introduce IPC wire-format appearance DTOs (PluginIsolation.Contracts) and clarify they are distinct from the runtime PluginSdk snapshot. Update PluginSdk comments to document the runtime-facing snapshot shape. Change ComponentColorSchemeHelper to use the HostMaterialColorProvider and add an overload that accepts a MaterialColorSnapshot. Add new services and pipelines (MaterialColorService, MaterialSurfaceService, WindowMaterialService, WallpaperColorPipeline) and refactor AppearanceThemeService to depend on MaterialColorService while removing legacy internal implementations. Add multiple unit tests (ComponentColorSchemeHelper, PluginAppearanceBoundary, SettingsCatalogService, WallpaperSettingsPageViewModel) and update localization resources with new material_color and wallpaper keys. * Add CODE_WIKI and update localization Add a comprehensive CODE_WIKI.md documenting project architecture, modules, startup flow, plugin system, testing and developer workflows. Update localization resources (en-US.json, zh-CN.json) with new/translated keys for wallpaper controls (custom color UI), material & color settings (semantic roles, surfaces, refresh/polling state), appearance (corner radius), status bar font size options, privacy policy text, component library labels, clock settings, and new language entry (Korean). Also modify settings-related ViewModels and Settings page views to surface these new features and texts (MaterialColorSettingsPageViewModel.cs, SettingsViewModels.cs, WallpaperSettingsPageViewModel.cs, MainWindow.SettingsHardCut.Stubs.cs, ComponentsSettingsPage.axaml, WallpaperSettingsPage.axaml). * Add Data settings page and storage scanner Introduce a new "Data" settings page to visualize and manage local app storage. Adds DataStorageService (scanning, disk info, clean operations), DataSettingsPageViewModel, XAML view and code-behind, and HexToColor/HexToBrush converters; registers converters in App.axaml. Also update localization strings for the new page and add icon mapping so the settings entry uses the Database icon. Enables per-category and global cleaning workflows and formatted size display. * Add IPC backoff/retries and safer disposal Introduce exponential backoff, jitter and retry logic across IPC components to improve robustness and avoid tight retry loops; make disposal idempotent and add connection guards. Key changes: - LauncherCoordinatorIpcServer / LauncherIpcServer: add backoff constants, ComputeBackoff(), consecutive error tracking and delayed retries with jitter. - LanMountainDesktopIpcClient / LauncherIpcClient: add connect retry loops, timeouts, delayed retries, improved error logging, and use ArrayPool for buffered async writes; ensure proper cleanup on failures. - PublicIpcHostService: add disposed flag, guard OnPeerConnected and Dispose, and clear connected peers on dispose. - Add many auto-generated commit analysis docs under docs/auto_commit_md and new scripts for analyzing/generating commit docs. These changes aim to make IPC connection handling more resilient and resource-safe. * Add preview controls and settings UI tweaks Introduce GridPreviewControl and CornerRadiusPreviewControl for visual previews and wire them into the Components settings (add ScreenAspectRatio, CornerRadiusPreviewValue, and screen aspect init). Refactor ComponentsSettingsPage UI to show live previews. Improve DataSettingsPage layout and storage bar logic (use item percentages directly, include remaining segment, adjust visuals and visibility triggers). Simplify LauncherSettingsPage header/appearance layout. Add SECURITY_AUDIT_REPORT.md, analysis summary, mockup HTML, and a local .claude settings file. * Add install checkpoint/resume and DDSS workflows Introduce install checkpoint support and resume logic for updates, plus related locking and validation. Adds InstallCheckpoint model, AppJsonContext serialization, and UpdatePaths helpers for deployment lock, apply-in-progress lock and install-checkpoint path. UpdateEngineService gains checkpoint load/save/delete, incoming-state validation, resume logic for PLONDS and legacy updates, apply lock handling, and safer cleanup; ApplyPendingPlondsUpdateAsync and ApplyPendingUpdate flow updated accordingly. Add DeploymentLock contract and extend UpdateState with pause/resume/cancel helpers. Tests updated to cover stale/valid checkpoint resume and legacy/PLONDS flows. CI: enhance ddss-publish to detect release channel, validate S3 assets, prepare and atomically publish channel pointer; add ddss-rollback workflow to publish rollbacks; adjust plonds-build concurrency and release events. * changed.更了好多 * fix.消息盒子媒体播放器组件服务修复 * change.重做天气,为回到系统提供自定义功能。 * feat.airapp与融合桌面 * feat.动画优化与更新界面 * feat.数字时钟,白板功能修复 * feat.完善了时钟轻应用,为启动器提供了多语言支持 * feat.发布与打包优化 * changed.天气选项卡更新
2026-05-19 07:55:21 +08:00
# Git 提交分析报告
## 提交基本信息
| 属性 | 值 |
|------|-----|
| **提交哈希** | `93758fc08355d1f523180aa22ab8f3b40b080ed4` |
| **作者** | lincube <lincube3@hotmail.com> |
| **提交时间** | 2026-05-18 08:30:40 |
| **提交分支** | - |
| **提交类型** | Feature (feat) |
## 提交信息摘要
**feat.数字时钟,白板功能修复**
本次提交主要包含两个功能更新:
1. 新增待机数字时钟组件Standby Digital Clock
2. 修复白板Whiteboard组件的视口布局同步和墨迹颜色处理问题
---
## 变更统计
| 指标 | 数值 |
|------|------|
| **修改文件数** | 28 个 |
| **新增行数** | +1,729 行 |
| **删除行数** | -81 行 |
| **净增行数** | +1,648 行 |
### 按文件类型分布
- **AXAML 文件**7 个UI 布局文件)
- **C# 源文件**15 个(逻辑代码)
- **文档文件**3 个(规格文档)
- **项目文件**2 个(.csproj
- **测试文件**1 个(单元测试)
---
## 详细变更分析
### 1. 新增功能:待机数字时钟组件
#### 1.1 新增文件
**规格文档 (.comate/specs/standby-digital-clock/)**
- `doc.md`291 行)- 待机数字时钟的详细规格说明
- `summary.md`52 行)- 功能摘要
- `tasks.md`25 行)- 任务清单
**UI 组件文件**
- `StandbyDigitalClockWidget.axaml`149 行)- 数字时钟 XAML 布局
- `StandbyDigitalClockWidget.axaml.cs`489 行)- 数字时钟逻辑实现
#### 1.2 核心功能特性
根据代码分析,待机数字时钟组件具备以下功能:
**时间显示**
- 12/24 小时制切换支持
- 多语言本地化支持(中文、英文等)
- 自动根据系统语言设置选择文化格式
**夜间模式**
- 自动检测系统主题Dark/Light
- 根据背景亮度智能判断夜间模式
- 独立的夜间模式配色方案
**视觉效果**
- 渐变背景效果
- 自适应文字颜色
- 响应式缩放支持0.58x - 1.95x
**样式细节**
- 半透明日期显示(#7E8593 颜色)
- 模拟时钟元素(日/夜指示器)
- 多时区支持(默认北京时间)
#### 1.3 配置与设置
```csharp
// 设置加载流程
- 语言代码规范化处理
- 时区解析(支持 "China Standard Time" 等)
- 颜色方案动态切换
```
### 2. 功能修复:白板组件
#### 2.1 视口布局同步问题
**问题描述**
- 白板组件在附加到视觉树或大小变化时,存在视口布局同步不及时的问题
**解决方案**
1. **新增视口大小解析记录结构**
```csharp
internal readonly record struct WhiteboardViewportSizeResolution(
Size Size,
string Source,
bool IsFallback
);
```
2. **多层回退机制**
- 第一层:使用 `ViewportRoot.Bounds.Size`
- 第二层:使用 `CanvasBorder.Bounds.Size`
- 第三层:使用基于单元格大小的计算值
3. **异步队列同步**
```csharp
private void QueueViewportLayoutSync(string reason)
{
Dispatcher.UIThread.Post(
() => SynchronizeViewportLayout(reason),
DispatcherPriority.Loaded);
}
```
4. **新增事件处理器**
- `OnViewportRootSizeChanged`
- `OnColorPickerPopupClosed`
#### 2.2 墨迹颜色透明度修复
**问题描述**
- 用户选择的颜色通过颜色选择器后,透明度设置不正确
**修复代码**
```csharp
// 修复前
InkColorPicker.Color = new Color(
_selectedInkColor.Alpha, // 不正确的透明度来源
_selectedInkColor.Red,
_selectedInkColor.Green,
_selectedInkColor.Blue);
// 修复后
InkColorPicker.Color = new Color(
byte.MaxValue, // 强制使用完全不透明
_selectedInkColor.Red,
_selectedInkColor.Green,
_selectedInkColor.Blue);
```
#### 2.3 墨迹输入恢复机制
**新增方法**
```csharp
private void RestoreInkInputAfterToolPopup(string reason, int attempt = 0)
```
**重试策略**
- 最多尝试 3 次
- 使用 `DispatcherPriority.Background` 延迟执行
- 异常处理与日志记录
### 3. AirApp 集成更新
#### 3.1 AirAppHost 项目变更
- `AirApp.axaml` - 更新了 AirApp 的 XAML 布局
- `AirAppLaunchOptions.cs` - 优化了启动选项处理
- `AirAppWindow.axaml.cs` - 新增了窗口相关功能
- `AirAppWindowDescriptor.cs` - 更新了窗口描述符
- `Program.cs` - 修改了程序入口逻辑
#### 3.2 世界时钟交互改进
**WorldClockWidget.axaml.cs 变更**
```csharp
// 新增日志记录
AppLogger.Info(
"AirAppLauncher",
$"World clock component clicked. ComponentId='{_componentId}'; PlacementId='{_placementId}'.");
// 修改了方法签名
AirAppLauncherServiceProvider.GetOrCreate().OpenWorldClock(
_componentId, // 新增参数
_placementId);
```
### 4. 组件系统更新
#### 4.1 组件注册
**BuiltInComponentIds.cs**
```csharp
// 新增待机数字时钟组件 ID
public const string DesktopStandbyDigitalClock = "...";
```
**ComponentRegistry.cs**
- 更新了组件注册表
#### 4.2 布局规则
**MainWindow.ComponentSystem.cs**
```csharp
// 新增待机数字时钟的缩放规则(与现有世界时钟一致)
if (string.Equals(componentId, BuiltInComponentIds.DesktopStandbyDigitalClock, ...))
{
// 保持 2:1 宽高比
return SnapSpanToScaleRules(span,
new ComponentScaleRule(WidthUnit: 2, HeightUnit: 1, MinScale: 2));
}
```
#### 4.3 删除旧代码
**移除的代码**
- `TryOpenAirAppFromDesktopComponent` 方法被移除
- 相关的桌面组件点击处理逻辑被简化
### 5. 测试覆盖
#### 5.1 新增测试文件
- `AirAppLauncherServiceTests.cs`15 行)- AirApp 启动服务测试
- `WhiteboardWidgetLayoutSyncTests.cs`155 行)- 白板布局同步测试
- `WindowLayerIsolationTests.cs`69 行)- 窗口层级隔离测试
---
## 代码审查要点
### ✅ 优点
1. **良好的日志记录**
- 使用 `AppLogger.Info` 记录关键操作
- 包含丰富的上下文信息ComponentId, PlacementId 等)
2. **完善的错误处理**
- 白板墨迹恢复机制包含重试逻辑
- 异常捕获和降级处理
3. **响应式设计**
- 数字时钟支持多级缩放
- 主题自适应支持
4. **向后兼容性**
- 保留了现有世界时钟的布局规则
### ⚠️ 建议关注
1. **视口同步频率**
- `DispatcherPriority.Loaded` 可能导致频繁重绘
- 建议监控性能影响
2. **颜色透明度处理**
- 修改为强制不透明可能会影响某些使用场景
- 建议添加配置选项
3. **时区解析**
- 使用 "China Standard Time" 作为默认时区
- 考虑添加用户可配置的默认时区
4. **测试覆盖**
- 新增测试文件内容需要进一步验证
- 建议添加集成测试
---
## 文件变更清单
### 新增文件
```
.comate/specs/standby-digital-clock/doc.md (+291 行)
.comate/specs/standby-digital-clock/summary.md (+52 行)
.comate/specs/standby-digital-clock/tasks.md (+25 行)
LanMountainDesktop/Views/Components/StandbyDigitalClockWidget.axaml (+149 行)
LanMountainDesktop/Views/Components/StandbyDigitalClockWidget.axaml.cs (+489 行)
LanMountainDesktop.AirAppHost/LanMountainDesktop.AirAppHost.csproj (+1 行)
```
### 修改文件
```
LanMountainDesktop.AirAppHost/AirApp.axaml (±52 行)
LanMountainDesktop.AirAppHost/AirAppLaunchOptions.cs (±19 行)
LanMountainDesktop.AirAppHost/AirAppWindow.axaml.cs (+42 行)
LanMountainDesktop.AirAppHost/AirAppWindowDescriptor.cs (±6 行)
LanMountainDesktop.AirAppHost/Program.cs (±36 行)
LanMountainDesktop.AirAppHost/WorldClockAirAppView.axaml (±10 行)
LanMountainDesktop.Launcher/App.axaml.cs (±8 行)
LanMountainDesktop.Launcher/Services/AirApp/IAirAppProcessStarter.cs (±32 行)
LanMountainDesktop.Launcher/Tests/Services/AirApp/AirAppLauncherServiceTests.cs (+15 行)
LanMountainDesktop/Tests/ComponentSystem/WhiteboardWidgetLayoutSyncTests.cs (+155 行)
LanMountainDesktop/Tests/ComponentSystem/WindowLayerIsolationTests.cs (+69 行)
LanMountainDesktop/ComponentSystem/BuiltInComponentIds.cs (+1 行)
LanMountainDesktop/ComponentSystem/ComponentRegistry.cs (±9 行)
LanMountainDesktop/Desktop/DesktopEditing/DesktopEditGhostView.cs (±20 行)
LanMountainDesktop/Desktop/DesktopEditing/DesktopEditOverlayPresenter.cs (±30 行)
LanMountainDesktop/Launcher/Services/AirApp/AirAppLauncherService.cs (±18 行)
LanMountainDesktop/Services/AppDataPathProvider.cs (±10 行)
LanMountainDesktop/Views/Components/AnalogClockWidget.axaml.cs (±31 行)
LanMountainDesktop/Views/Components/DesktopComponentRuntimeRegistry.cs (+4 行)
LanMountainDesktop/Views/Components/WhiteboardWidget.axaml.cs (+202 行)
LanMountainDesktop/Views/Components/WorldClockWidget.axaml.cs (±5 行)
LanMountainDesktop/Views/MainWindow.ComponentSystem.cs (±29 行)
```
---
## 结论
本次提交是一次重要的功能更新,主要包含:
1. **新功能**:待机数字时钟组件的完整实现
2. **缺陷修复**:白板组件的多项交互和渲染问题
3. **架构优化**AirApp 集成和组件系统的改进
4. **测试补充**:新增单元测试提高代码覆盖率
建议后续关注:
- 数字时钟组件的用户界面测试
- 白板组件在复杂场景下的性能表现
- 时区功能在不同文化环境下的显示效果