Compare commits

..

1 Commits

Author SHA1 Message Date
lincube
73cdefe296 0.7.3
修东西
2026-03-21 22:40:07 +08:00
5 changed files with 39 additions and 61 deletions

View File

@@ -337,6 +337,14 @@ public sealed class PostHogUsageTelemetryService : IDisposable
["timestamp"] = timestamp.ToString("o"), ["timestamp"] = timestamp.ToString("o"),
["properties"] = new Dictionary<string, object?> ["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") ["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() public bool MarkBaselineReported()
{ {
lock (_syncRoot) lock (_syncRoot)

View File

@@ -58,9 +58,6 @@ public sealed partial class PrivacySettingsPageViewModel : ViewModelBase
[ObservableProperty] [ObservableProperty]
private string _telemetryIdDescription = string.Empty; private string _telemetryIdDescription = string.Empty;
[ObservableProperty]
private string _refreshTelemetryIdText = string.Empty;
[ObservableProperty] [ObservableProperty]
private string _viewPrivacyPolicyText = string.Empty; private string _viewPrivacyPolicyText = string.Empty;
@@ -75,27 +72,6 @@ public sealed partial class PrivacySettingsPageViewModel : ViewModelBase
TelemetryId = TelemetryServices.Identity?.TelemetryId ?? string.Empty; 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) partial void OnUploadAnonymousCrashDataChanged(bool value)
{ {
if (_isInitializing) if (_isInitializing)
@@ -137,8 +113,7 @@ public sealed partial class PrivacySettingsPageViewModel : ViewModelBase
TelemetryIdHeader = L("settings.privacy.telemetry_id_title", "Telemetry ID"); TelemetryIdHeader = L("settings.privacy.telemetry_id_title", "Telemetry ID");
TelemetryIdDescription = L( TelemetryIdDescription = L(
"settings.privacy.telemetry_id_description", "settings.privacy.telemetry_id_description",
"A refreshable anonymous identifier used for detailed telemetry sessions."); "An anonymous identifier used for detailed telemetry sessions.");
RefreshTelemetryIdText = L("settings.privacy.refresh_telemetry_id", "Refresh");
PrivacyPolicyHintPrefix = L("settings.privacy.policy_hint_prefix", "For more details, please "); PrivacyPolicyHintPrefix = L("settings.privacy.policy_hint_prefix", "For more details, please ");
ViewPrivacyPolicyText = L("settings.privacy.view_policy", "view our privacy policy"); ViewPrivacyPolicyText = L("settings.privacy.view_policy", "view our privacy policy");
} }

View File

@@ -62,15 +62,34 @@
</ui:InfoBar.IconSource> </ui:InfoBar.IconSource>
</ui:InfoBar> </ui:InfoBar>
<Border Classes="settings-section-card"> <!-- 版权声明 - 放在渲染显示前面 -->
<StackPanel Spacing="12"> <ui:SettingsExpander Header="版权声明"
<controls:IconText Icon="WindowConsole" IsExpanded="True">
Text="{Binding RenderBackendLabel}" /> <ui:SettingsExpander.IconSource>
<TextBlock Classes="settings-item-description" <fi:SymbolIconSource Symbol="Document" />
Text="{Binding RenderBackendText}" </ui:SettingsExpander.IconSource>
TextWrapping="Wrap" /> <ui:SettingsExpanderItem>
</StackPanel> <ui:SettingsExpanderItem.Footer>
</Border> <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> </StackPanel>
</ScrollViewer> </ScrollViewer>
</UserControl> </UserControl>

View File

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