fix.调整了OOBE流程,修复了启动器打包问题

This commit is contained in:
lincube
2026-06-05 12:14:14 +08:00
parent 8c88e305ee
commit f142307729
2 changed files with 51 additions and 58 deletions

View File

@@ -503,26 +503,6 @@ public partial class OobeWindow : Window
await NavigateToStep(5);
}
private void SaveOobeStartupPresentation()
{
try
{
var choices = CollectOobeStartupChoices();
var path = HostAppSettingsOobeMerger.GetSettingsFilePath(_resolver.ResolveDataRoot());
HostAppSettingsOobeMerger.MergeStartupPresentation(path, choices);
if (OperatingSystem.IsWindows())
{
_ = new LauncherWindowsStartupService().SetEnabled(choices.AutoStartWithWindows);
}
Logger.Info($"[OobeWindow] 启动与展示已写入 '{path}'.");
}
catch (Exception ex)
{
Logger.Warn($"[OobeWindow] 启动与展示保存失败: {ex.Message}");
}
}
private void RefreshOobeStartupPresentationFromDisk()
{
var path = HostAppSettingsOobeMerger.GetSettingsFilePath(ResolveSelectedDataRoot());
@@ -1039,44 +1019,6 @@ public partial class OobeWindow : Window
}
}
private void SavePrivacySettings()
{
try
{
var crashTelemetryEnabled = this.FindControl<ToggleSwitch>("CrashTelemetryToggle")?.IsChecked ?? true;
var usageTelemetryEnabled = this.FindControl<ToggleSwitch>("UsageTelemetryToggle")?.IsChecked ?? true;
var telemetryId = this.FindControl<TextBox>("TelemetryIdTextBox")?.Text ?? Guid.NewGuid().ToString("N");
// 保存到启动器配置
var privacyConfig = new PrivacyConfig
{
CrashTelemetryEnabled = crashTelemetryEnabled,
UsageTelemetryEnabled = usageTelemetryEnabled,
TelemetryId = telemetryId
};
var configPath = Path.Combine(_resolver.ResolveLauncherDataPath(), "privacy-config.json");
var json = System.Text.Json.JsonSerializer.Serialize(privacyConfig, AppJsonContext.Default.PrivacyConfig);
File.WriteAllText(configPath, json);
// 保存隐私协议同意状态(带防篡改保护)
var agreementService = new PrivacyAgreementService(_resolver.ResolveLauncherDataPath());
var isAgreed = this.FindControl<CheckBox>("PrivacyAgreementCheckBox")?.IsChecked ?? false;
// 生成用户ID和设备ID
var userId = telemetryId;
var deviceId = GetDeviceIdentifier();
agreementService.SaveAgreement(isAgreed, userId, deviceId);
Logger.Info($"[OobeWindow] 隐私设置已保存: Crash={crashTelemetryEnabled}, Usage={usageTelemetryEnabled}, Agreement={isAgreed}");
}
catch (Exception ex)
{
Logger.Warn($"[OobeWindow] 保存隐私设置失败: {ex.Message}");
}
}
/// <summary>
/// 获取设备标识符
/// </summary>