修东西
This commit is contained in:
lincube
2026-03-21 22:40:07 +08:00
parent 46a8df5900
commit 73cdefe296
5 changed files with 39 additions and 61 deletions

View File

@@ -337,6 +337,14 @@ public sealed class PostHogUsageTelemetryService : IDisposable
["timestamp"] = timestamp.ToString("o"),
["properties"] = new Dictionary<string, object?>
{
["install_id"] = installId,
["app_version"] = TelemetryEnvironmentInfo.GetAppVersion(),
["os_name"] = TelemetryEnvironmentInfo.GetOsName(),
["os_version"] = TelemetryEnvironmentInfo.GetOsVersion(),
["device_model"] = TelemetryEnvironmentInfo.GetDeviceModel(),
["device_arch"] = TelemetryEnvironmentInfo.GetDeviceArchitecture(),
["runtime_version"] = TelemetryEnvironmentInfo.GetRuntimeVersion(),
["language"] = TelemetryEnvironmentInfo.GetSystemLanguage(),
["launch_time_utc"] = timestamp.ToString("o")
}
};

View File

@@ -78,25 +78,6 @@ public sealed class TelemetryIdentityService
}
}
public string RefreshTelemetryId()
{
lock (_syncRoot)
{
EnsureInitialized();
var snapshot = _settingsFacade.Settings.LoadSnapshot<AppSettingsSnapshot>(SettingsScope.App);
snapshot.TelemetryId = GenerateId();
_settingsFacade.Settings.SaveSnapshot(
SettingsScope.App,
snapshot,
changedKeys: [nameof(AppSettingsSnapshot.TelemetryId)]);
_telemetryId = snapshot.TelemetryId ?? GenerateId();
AppLogger.Info("TelemetryIdentity", $"Telemetry id refreshed. TelemetryId={_telemetryId}");
return _telemetryId;
}
}
public bool MarkBaselineReported()
{
lock (_syncRoot)

View File

@@ -58,9 +58,6 @@ public sealed partial class PrivacySettingsPageViewModel : ViewModelBase
[ObservableProperty]
private string _telemetryIdDescription = string.Empty;
[ObservableProperty]
private string _refreshTelemetryIdText = string.Empty;
[ObservableProperty]
private string _viewPrivacyPolicyText = string.Empty;
@@ -75,27 +72,6 @@ public sealed partial class PrivacySettingsPageViewModel : ViewModelBase
TelemetryId = TelemetryServices.Identity?.TelemetryId ?? string.Empty;
}
[RelayCommand]
private void RefreshTelemetryId()
{
try
{
var identity = TelemetryServices.Identity;
if (identity is null)
{
AppLogger.Warn("PrivacySettings", "Telemetry identity service is unavailable.");
return;
}
TelemetryId = identity.RefreshTelemetryId();
AppLogger.Info("PrivacySettings", $"Telemetry ID refreshed: {TelemetryId}");
}
catch (Exception ex)
{
AppLogger.Warn("PrivacySettings", "Failed to refresh telemetry ID.", ex);
}
}
partial void OnUploadAnonymousCrashDataChanged(bool value)
{
if (_isInitializing)
@@ -137,8 +113,7 @@ public sealed partial class PrivacySettingsPageViewModel : ViewModelBase
TelemetryIdHeader = L("settings.privacy.telemetry_id_title", "Telemetry ID");
TelemetryIdDescription = L(
"settings.privacy.telemetry_id_description",
"A refreshable anonymous identifier used for detailed telemetry sessions.");
RefreshTelemetryIdText = L("settings.privacy.refresh_telemetry_id", "Refresh");
"An anonymous identifier used for detailed telemetry sessions.");
PrivacyPolicyHintPrefix = L("settings.privacy.policy_hint_prefix", "For more details, please ");
ViewPrivacyPolicyText = L("settings.privacy.view_policy", "view our privacy policy");
}

View File

@@ -62,15 +62,34 @@
</ui:InfoBar.IconSource>
</ui:InfoBar>
<Border Classes="settings-section-card">
<StackPanel Spacing="12">
<controls:IconText Icon="WindowConsole"
Text="{Binding RenderBackendLabel}" />
<TextBlock Classes="settings-item-description"
Text="{Binding RenderBackendText}"
TextWrapping="Wrap" />
</StackPanel>
</Border>
<!-- 版权声明 - 放在渲染显示前面 -->
<ui:SettingsExpander Header="版权声明"
IsExpanded="True">
<ui:SettingsExpander.IconSource>
<fi:SymbolIconSource Symbol="Document" />
</ui:SettingsExpander.IconSource>
<ui:SettingsExpanderItem>
<ui:SettingsExpanderItem.Footer>
<WrapPanel>
<WrapPanel.Styles>
<Style Selector="HyperlinkButton">
<Setter Property="Padding" Value="4" />
<Setter Property="Margin" Value="2" />
</Style>
</WrapPanel.Styles>
<HyperlinkButton NavigateUri="https://github.com/Lincube/LanMountainDesktop">
<TextBlock Text="GitHub 仓库" />
</HyperlinkButton>
<HyperlinkButton NavigateUri="https://github.com/Lincube/LanMountainDesktop/issues">
<TextBlock Text="问题反馈" />
</HyperlinkButton>
</WrapPanel>
</ui:SettingsExpanderItem.Footer>
<TextBlock>
<Run Text="Copyright (c) 2024-" /><Run Text="2025" /> Lincube
</TextBlock>
</ui:SettingsExpanderItem>
</ui:SettingsExpander>
</StackPanel>
</ScrollViewer>
</UserControl>

View File

@@ -51,14 +51,9 @@
FontFamily="Consolas"
FontSize="12"
Focusable="False"
IsTabStop="False" />
IsTabStop="False"
HorizontalAlignment="Stretch" />
</StackPanel>
<Button Grid.Column="1"
Content="{Binding RefreshTelemetryIdText}"
Command="{Binding RefreshTelemetryIdCommand}"
VerticalAlignment="Center"
Margin="16,0,0,0"
Classes="accent-button" />
</Grid>
</Border>