Files
LanMountainDesktop/LanMountainDesktop/Models/AppSettingsSnapshot.cs
lincube 0b603384b4 Launcher fix (#6)
* fix.hy3试图修复中

* Resolve dev paths and fix splash UI thread

Compute a solutionRoot and expand development search paths (LanMountainDesktop and dev-test) in DeploymentLocator, add logging when scanning/finding hosts, and return distinct full paths. Ensure backward-compatible path checks. Fix cross-thread UI calls: invoke splashWindow.DismissAsync on the UI thread in LauncherFlowCoordinator, and make SplashWindow.DismissAsync ensure it runs on the UI thread before closing (simplified Close call). These changes improve development host discovery and prevent UI-thread access issues during shutdown.

* Add configurable data location (portable/system)

Introduce support for choosing and resolving the application's data root (system user dir vs. portable app folder). Adds DataLocationConfig model, DataLocationResolver (load/save/resolve/migrate), a UI prompt (DataLocationPromptWindow) and an OOBE step (DataLocationOobeStep) to let users pick and optionally migrate existing data. Wire the chosen data root into the launcher flow and host launch plan (forwarded via --data-root and LMD_DATA_ROOT), and add AppDataPathProvider to let runtime services read the effective data root (initialized in Program.Main). Update various services (logging, settings, DB, plugin/market, startup registry, etc.) to use the new provider/resolver and register the config type in the JSON context. This enables portable installs, safe migration, and runtime overrides via CLI or environment variable.

* Add dev/debug startup flow and launch profiles

Handle design-time initialization and add a developer debug startup path: App now skips normal startup when in design mode and shows a DevDebugWindow when running in debug (unless a preview or apply-update command). CommandContext.IsDebugMode is extended to include DOTNET_ENVIRONMENT=Development via a new IsDevelopmentEnvironment helper. Program.Main and BuildAvaloniaApp are made public to aid tooling. Added multiple launchSettings profiles for debug and preview commands that set DOTNET_ENVIRONMENT=Development to simplify IDE debugging and UI previewing.

* Simplify splash to fade; add themed about banners

Simplify splash startup visuals by removing the multi-mode/slide behavior and always using a fade animation. Update App to create SplashWindow without a StartupVisualMode parameter and remove related fields, layout configuration, slide animation, and easing helpers from SplashWindow. Clean up unused using. Replace the single about_banner asset with theme-aware variants (about_banner_dark.png and about_banner_light.png), delete the old about_banner.png, and update AboutSettingsPage to use a DynamicResource ImageBrush (AboutBannerBrush) that selects the appropriate banner per theme.

* Use AppJsonContext for startup state serialization

Switch serialization to the source-generated System.Text.Json context: add JsonSerializable(typeof(StartupAttemptRecord)) to AppJsonContext and replace the previous JsonSerializerOptions-based Serialize/Deserialize calls with AppJsonContext.Default.StartupAttemptRecord. Also remove the now-unused SerializerOptions field. Additionally, update .gitignore to exclude /test-aot-publish.

* Add OOBE redesign, theme & data location support

Introduce a redesigned OOBE flow and data-location/theme support across the launcher. Adds a new ThemeService for applying light/dark and accent colors; integrates FluentIcons.Avalonia package for icons. Overhauls OobeWindow (UX animations, typing effect, multi-step theme and data-location pages, Monet options, and final welcome step) and its code-behind to handle step navigation, accent selection, and data-location resolution. Adds DataLocation UI and handlers (DataLocationPromptWindow changes, DataLocation resolver usage) and wires a DevDebug UI for toggling/opening the data-location page. UpdateEngineService now resolves the launcher root via DataLocationResolver. Misc: update various view models, localization entries and remove TrimmerRoots.xml.

* Refactor data location paths and add background service

Refactor DataLocationResolver to centralize data path resolution (ResolveLauncherDataPath, ResolveDesktopDataPath, ResolveConfigPath, ResolveLauncherLogsPath, ResolveLauncherStatePath) and replace usages of the previous ".launcher" layout with a "Launcher" folder. Update API: LoadConfig/SaveConfig reorganized and ApplyLocationChoice now accepts an optional custom path and migration flag; migration logic updated accordingly. Update dependent services and views (Logger, DeploymentLocator, UpdateEngineService, OobeStateService, StartupAttemptRegistry, LauncherDebugSettingsStore, OobeWindow) to use the new resolver APIs and paths. Add LauncherBackgroundService to load/validate/cache a custom splash background image and wire it into SplashWindow (AXAML/Axaml.cs) with UI placeholders and overlay. Misc: minor cleanup of Oobe/Splash XAML and related code adjustments and logging improvements.
2026-04-25 18:41:26 +08:00

268 lines
8.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using LanMountainDesktop.Settings.Core;
namespace LanMountainDesktop.Models;
public sealed class AppSettingsSnapshot
{
public int GridShortSideCells { get; set; } = 12;
public string GridSpacingPreset { get; set; } = "Relaxed";
public int DesktopEdgeInsetPercent { get; set; } = 18;
public bool? IsNightMode { get; set; }
public string? ThemeColor { get; set; }
public bool UseSystemChrome { get; set; }
public double GlobalCornerRadiusScale { get; set; } = GlobalAppearanceSettings.DefaultCornerRadiusScale;
public string CornerRadiusStyle { get; set; } = GlobalAppearanceSettings.DefaultCornerRadiusStyle;
public string ThemeColorMode { get; set; } = "default_neutral";
public string SystemMaterialMode { get; set; } = "none";
public string? SelectedWallpaperSeed { get; set; }
public string ThemeMode { get; set; } = "light";
public string? WallpaperPath { get; set; }
public string WallpaperType { get; set; } = "Image";
public string? WallpaperColor { get; set; }
public string WallpaperPlacement { get; set; } = "Fill";
public int SystemWallpaperRefreshIntervalSeconds { get; set; } = 300;
public int SettingsTabIndex { get; set; } = 0;
public string? SettingsTabTag { get; set; }
public string LanguageCode { get; set; } = "zh-CN";
public string? TimeZoneId { get; set; }
public string WeatherLocationMode { get; set; } = "CitySearch";
public string WeatherLocationKey { get; set; } = string.Empty;
public string WeatherLocationName { get; set; } = string.Empty;
public double WeatherLatitude { get; set; } = 39.9042;
public double WeatherLongitude { get; set; } = 116.4074;
public bool WeatherAutoRefreshLocation { get; set; }
public string WeatherLocationQuery { get; set; } = string.Empty;
public string WeatherExcludedAlerts { get; set; } = string.Empty;
public string WeatherIconPackId { get; set; } = "HyperOS3";
public bool WeatherNoTlsRequests { get; set; }
public bool AutoStartWithWindows { get; set; }
public string AppRenderMode { get; set; } = "Default";
public bool IncludePrereleaseUpdates { get; set; }
public bool UploadAnonymousCrashData { get; set; }
public bool UploadAnonymousUsageData { get; set; }
public string? TelemetryInstallId { get; set; }
public string? TelemetryId { get; set; }
public bool HasReportedTelemetryBaseline { get; set; }
public string UpdateChannel { get; set; } = "stable";
public string UpdateMode { get; set; } = "download_then_confirm";
public string UpdateDownloadSource { get; set; } = "stcn";
public int UpdateDownloadThreads { get; set; } = 4;
public string? PendingUpdateInstallerPath { get; set; }
public string? PendingUpdateVersion { get; set; }
public long? PendingUpdatePublishedAtUtcMs { get; set; }
public long? LastUpdateCheckUtcMs { get; set; }
public string? PendingUpdateSha256 { get; set; }
public List<string> TopStatusComponentIds { get; set; } = [];
public List<string> PinnedTaskbarActions { get; set; } =
[
TaskbarActionId.MinimizeToWindows.ToString()
];
public bool EnableDynamicTaskbarActions { get; set; } = true;
public string TaskbarLayoutMode { get; set; } = "BottomFullRowMacStyle";
public string ClockDisplayFormat { get; set; } = "HourMinuteSecond";
public bool StatusBarClockTransparentBackground { get; set; }
public string ClockPosition { get; set; } = "Left"; // Left, Center, Right
public string ClockFontSize { get; set; } = "Medium"; // Small, Medium, Large
public bool ShowTextCapsule { get; set; } = false;
public string TextCapsuleContent { get; set; } = "**Hello** World!";
public string TextCapsulePosition { get; set; } = "Right"; // Left, Center, Right
public bool TextCapsuleTransparentBackground { get; set; } = false;
public string TextCapsuleFontSize { get; set; } = "Medium"; // Small, Medium, Large
public bool ShowNetworkSpeed { get; set; } = false;
public string NetworkSpeedPosition { get; set; } = "Right"; // Left, Center, Right
public string NetworkSpeedDisplayMode { get; set; } = "Both"; // Upload, Download, Both
public bool NetworkSpeedTransparentBackground { get; set; } = false;
public bool ShowNetworkTypeIcon { get; set; } = false;
public string NetworkSpeedFontSize { get; set; } = "Medium"; // Small, Medium, Large
public string StatusBarSpacingMode { get; set; } = "Relaxed";
public bool StatusBarShadowEnabled { get; set; } = false;
public string StatusBarShadowColor { get; set; } = "#000000";
public double StatusBarShadowOpacity { get; set; } = 0.3;
public int StatusBarCustomSpacingPercent { get; set; } = 12;
public bool EnableThreeFingerSwipe { get; set; } = false;
public bool EnableFadeTransition { get; set; } = true;
public bool EnableSlideTransition { get; set; } = false;
public bool ShowInTaskbar { get; set; } = false;
public bool EnableFusedDesktop { get; set; } = false;
public List<string> DisabledPluginIds { get; set; } = [];
public bool IsDevModeEnabled { get; set; }
public string? DevPluginPath { get; set; }
#region Study Settings
public bool StudyEnabled { get; set; } = true;
public int? StudyFrameMs { get; set; }
public double? StudyScoreThresholdDbfs { get; set; }
public int? StudyFocusDurationMinutes { get; set; }
public int? StudyBreakDurationMinutes { get; set; }
public int? StudyLongBreakDurationMinutes { get; set; }
public int? StudySessionsBeforeLongBreak { get; set; }
public bool? StudyAutoStartBreak { get; set; }
public bool? StudyAutoStartFocus { get; set; }
public bool? StudyNoiseAlertEnabled { get; set; }
public int? StudyMaxInterruptsPerMinute { get; set; }
public bool? StudyShowRealtimeDb { get; set; }
public double? StudyBaselineDb { get; set; }
public int? StudyAvgWindowSec { get; set; }
#endregion
#region Notification Settings
public bool NotificationEnabled { get; set; } = true;
public string NotificationDefaultPosition { get; set; } = "TopRight";
public int NotificationDurationSeconds { get; set; } = 4;
public bool NotificationHoverPauseEnabled { get; set; } = true;
public bool NotificationClickCloseEnabled { get; set; } = true;
public int NotificationMaxPerPosition { get; set; } = 5;
#endregion
#region Notification Box Settings ()
/// <summary>
/// 启用消息盒子功能Windows通知监听
/// </summary>
public bool NotificationBoxEnabled { get; set; } = true;
/// <summary>
/// 隐私模式:开启后只显示"您有新的通知",不显示具体内容
/// </summary>
public bool NotificationBoxPrivacyMode { get; set; } = false;
/// <summary>
/// 被屏蔽的应用列表(不接收这些应用的通知)
/// </summary>
public List<string> NotificationBoxBlockedApps { get; set; } = [];
/// <summary>
/// 历史记录保留天数
/// </summary>
public int NotificationBoxHistoryRetentionDays { get; set; } = 7;
/// <summary>
/// 最大存储通知数量(防止内存无限增长)
/// </summary>
public int NotificationBoxMaxStoredCount { get; set; } = 500;
#endregion
public AppSettingsSnapshot Clone()
{
var clone = (AppSettingsSnapshot)MemberwiseClone();
clone.TopStatusComponentIds = TopStatusComponentIds is { Count: > 0 }
? new List<string>(TopStatusComponentIds)
: [];
clone.PinnedTaskbarActions = PinnedTaskbarActions is { Count: > 0 }
? new List<string>(PinnedTaskbarActions)
: [];
clone.DisabledPluginIds = DisabledPluginIds is { Count: > 0 }
? new List<string>(DisabledPluginIds)
: [];
clone.NotificationBoxBlockedApps = NotificationBoxBlockedApps is { Count: > 0 }
? new List<string>(NotificationBoxBlockedApps)
: [];
return clone;
}
}