Skip to content

Commit

Permalink
Advanced settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelo420 committed Dec 11, 2024
1 parent fc7a0b2 commit 72eb4c6
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 70 deletions.
12 changes: 6 additions & 6 deletions gamevault/Helper/AnalyticsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void SendErrorLog(Exception ex)
{
try
{
var jsonContent = new StringContent(JsonSerializer.Serialize(new AnalyticsData() { ExceptionType = ex.GetType().ToString(), ExceptionMessage = $"Message:{ex.Message} | InnerException:{ex.InnerException?.Message} | StackTrace:{ex.StackTrace?.Substring(0, Math.Min(2000, ex.StackTrace.Length))} | Is Windows Package: {(App.IsWindowsPackage == true ? "True" : "False")}", Timezone = timeZone, Language = language }), Encoding.UTF8, "application/json");
var jsonContent = new StringContent(JsonSerializer.Serialize(new AnalyticsData() { ExceptionType = ex.GetType().ToString(), ExceptionMessage = $"Message:{ex.Message} | InnerException:{ex.InnerException?.Message} | StackTrace:{ex.StackTrace?.Substring(0, Math.Min(2000, ex.StackTrace.Length))} | Is Windows Package: {(App.IsWindowsPackage == true ? "True" : "False")} | Version: {SettingsViewModel.Instance.Version}", Timezone = timeZone, Language = language }), Encoding.UTF8, "application/json");
await client.PostAsync(AnalyticsTargets.ER, jsonContent);
}
catch (Exception ex) { }
Expand All @@ -218,9 +218,9 @@ public void SendCustomEvent(string eventName, object meta)
try
{
var jsonContent = new StringContent(JsonSerializer.Serialize(new AnalyticsData() { Event = eventName, Metadata = meta, Timezone = timeZone, Language = language }), Encoding.UTF8, "application/json");
/*HttpResponseMessage res =*/
HttpResponseMessage res =
await client.PostAsync(AnalyticsTargets.CU, jsonContent);
//string responseMessage = await res.Content.ReadAsStringAsync();
string responseMessage = await res.Content.ReadAsStringAsync();
}
catch { }
});
Expand Down Expand Up @@ -287,13 +287,13 @@ public string PrepareSettingsForAnalytics()
{
try
{
var propertiesToExclude = new[] { "Instance", "UserName", "RootPath", "ServerUrl", "License", "RegistrationUser", "SendAnonymousAnalytics" };
var propertiesToExclude = new[] { "Instance", "UserName", "RootPath", "ServerUrl", "License", "RegistrationUser", "SendAnonymousAnalytics", "IgnoreList", "Themes" };
var trimmedObject = SettingsViewModel.Instance.GetType()
.GetProperties()
.Where(prop => !propertiesToExclude.Contains(prop.Name))
.ToDictionary(prop => prop.Name, prop => prop.GetValue(SettingsViewModel.Instance));
.ToDictionary(prop => prop.Name, prop => prop.GetValue(SettingsViewModel.Instance).ToString());

trimmedObject.Add("HasLicence", SettingsViewModel.Instance.License?.IsActive() == true);
trimmedObject.Add("HasLicence", (SettingsViewModel.Instance.License?.IsActive() == true).ToString());
return JsonSerializer.Serialize(trimmedObject);
}
catch { }
Expand Down
12 changes: 6 additions & 6 deletions gamevault/Helper/LoginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ public async Task PhalcodeLogin(bool startHidden = false)
{
HttpClient client = new HttpClient();

#if DEBUG
var getRequest = new HttpRequestMessage(HttpMethod.Get, $"https://customer-backend-test.platform.phalco.de/api/v1/customers/me/subscriptions/prod_PuyurQTh7H5uZe");
#else
var getRequest = new HttpRequestMessage(HttpMethod.Get, $"https://customer-backend.platform.phalco.de/api/v1/customers/me/subscriptions/prod_PEZqFd8bFRNg6R");
#endif
if (SettingsViewModel.Instance.DevTargetPhalcodeTestBackend)
{
getRequest = new HttpRequestMessage(HttpMethod.Get, $"https://customer-backend-test.platform.phalco.de/api/v1/customers/me/subscriptions/prod_PuyurQTh7H5uZe");
}
getRequest.Headers.Add("Authorization", $"Bearer {token}");
var licenseResponse = await client.SendAsync(getRequest);
licenseResponse.EnsureSuccessStatusCode();
Expand All @@ -232,7 +232,7 @@ public async Task PhalcodeLogin(bool startHidden = false)
}
licenseData[0].UserName = username;
SettingsViewModel.Instance.License = licenseData[0];
Preferences.Set(AppConfigKey.Phalcode2, JsonSerializer.Serialize(SettingsViewModel.Instance.License), AppFilePath.UserFile, true);
Preferences.Set(AppConfigKey.Phalcode2, JsonSerializer.Serialize(SettingsViewModel.Instance.License), AppFilePath.UserFile, true);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -266,7 +266,7 @@ public void PhalcodeLogout()
Preferences.DeleteKey(AppConfigKey.Theme, AppFilePath.UserFile);
try
{
Directory.Delete(AppFilePath.WebConfigDir,true);
Directory.Delete(AppFilePath.WebConfigDir, true);
//wpfEmbeddedBrowser.ClearAllCookies();
}
catch (Exception ex) { }
Expand Down
6 changes: 5 additions & 1 deletion gamevault/Models/AppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public enum AppConfigKey
LastCommunitySortBy,
ForcedInstallationType,
SyncSteamShortcuts,
SyncDiscordPresence
SyncDiscordPresence,
//DevMode
DevModeEnabled,
DevTargetPhalcodeTestBackend
//
}
public static class AppFilePath
{
Expand Down
12 changes: 6 additions & 6 deletions gamevault/PipeServiceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ private static void SafeDispose(IDisposable? disposable)
{
try
{
#if DEBUG
string url = "https://test.phalco.de/products/gamevault-plus/checkout?hit_paywall=true";
#else
string url = "https://phalco.de/products/gamevault-plus/checkout?hit_paywall=true";
#endif
if (SettingsViewModel.Instance.DevTargetPhalcodeTestBackend)
{
url = "https://test.phalco.de/products/gamevault-plus/checkout?hit_paywall=true";
}
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
return null;
}
Expand Down Expand Up @@ -619,10 +619,10 @@ await Dispatch(() =>
private async Task ExecuteJumpListCommand(int id)
{
// Ensure we're on the UI thread
await Dispatch(async() =>
await Dispatch(async () =>
{
switch (id)
{
{
case 15:
{
await App.Instance.ExitApp();
Expand Down
99 changes: 61 additions & 38 deletions gamevault/UserControls/SettingsUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<TextBlock Text="Settings" FontSize="35" Margin="20,0,0,0" Foreground="{DynamicResource MahApps.Brushes.ThemeForeground}"/>
</Grid>
</Border>
<TextBlock Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{Binding Version,StringFormat='{}V {0}'}" Margin="20,0,0,5"/>
<TextBlock Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{Binding Version,StringFormat='{}V {0}'}" Margin="20,0,0,5" Panel.ZIndex="1" MouseLeftButtonDown="DevMode_Click"/>
<ScrollViewer Grid.Row="1" Margin="10" VerticalScrollBarVisibility="Auto">
<TabControl x:Name="uiTabControl" TabStripPlacement="Left" SelectionChanged="TabControl_SelectionChanged" FocusVisualStyle="{x:Null}">
<TabItem Header="Application">
Expand Down Expand Up @@ -356,52 +356,58 @@
</local:IconButton>
<!--Features-->
<StackPanel>
<StackPanel.Style>
<Style TargetType="StackPanel">
<Setter Property="IsEnabled" Value="False"/>
<Style.Triggers>
<DataTrigger Binding="{Binding License.UserName,Converter={StaticResource licenseConv}}" Value="True">
<Setter Property="IsEnabled" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<StackPanel Margin="0,30,0,0">
<TextBlock Text="Features" FontSize="20" FontWeight="Bold"/>
<StackPanel Orientation="Horizontal" Margin="10,10,0,0">
<StackPanel>
<StackPanel.Style>
<Style TargetType="StackPanel">
<Setter Property="IsEnabled" Value="False"/>
<Style.Triggers>
<DataTrigger Binding="{Binding License.UserName,Converter={StaticResource licenseConv}}" Value="True">
<Setter Property="IsEnabled" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<StackPanel Margin="0,30,0,0">
<TextBlock Text="Features" FontSize="20" FontWeight="Bold"/>
<StackPanel Orientation="Horizontal" Margin="10,10,0,0">
<Rectangle Fill="{StaticResource MahApps.Brushes.Accent}" Width="2"/>
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<Path Data="{StaticResource IconGameSettingsSteam}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<ScaleTransform ScaleX="1.1" ScaleY="1.1"/>
</Path.RenderTransform>
</Path>
<TextBlock FontSize="20" FontWeight="Bold" Margin="5,0,0,0">
<Hyperlink NavigateUri="https://gamevau.lt/docs/gamevault-plus/integrations/steam" RequestNavigate="Hyperlink_RequestNavigate" TextDecorations="None">Steam</Hyperlink>
</TextBlock>
</StackPanel>
<TextBlock Text="GameVault+ offers seamless integration with Steam through the Steam Sync Integration. When enabled, all your installed &#x0a;games are automatically synced to your Steam Library and appear as Non-Steam Games. Launching these games via Steam will &#x0a;route them through GameVault, ensuring all your custom launch options are preserved." FontSize="15"/>
<mah:ToggleSwitch Header="Sync (You have to restart the steam client to see the changes)" Margin="0,10,0,0" IsOn="{Binding SyncSteamShortcuts}" Toggled="SyncSteamShortcuts_Toggled"/>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<local:IconButton Text="Restore Backup" Kind="Danger" FontSize="15" Icon="{DynamicResource IconReload}" IconMargin="0,0,5,2" Width="135" Height="30" HorizontalAlignment="Right" Click="RestoreSteamShortcutBackup_Click"/>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10,20,0,0">
<Rectangle Fill="{StaticResource MahApps.Brushes.Accent}" Width="2"/>
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<Path Data="{StaticResource IconGameSettingsSteam}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Path Data="{StaticResource IconGameSettingsDiscord}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<ScaleTransform ScaleX="1.1" ScaleY="1.1"/>
</Path.RenderTransform>
</Path>
<TextBlock Text="Steam" FontSize="20" FontWeight="Bold" Margin="5,0,0,0"/>
</StackPanel>
<TextBlock Text="GameVault+ offers seamless integration with Steam through the Steam Sync Integration. When enabled, all your installed &#x0a;games are automatically synced to your Steam Library and appear as Non-Steam Games. Launching these games via Steam will &#x0a;route them through GameVault, ensuring all your custom launch options are preserved." FontSize="15"/>
<mah:ToggleSwitch Header="Sync (You have to restart the steam client to see the changes)" Margin="0,10,0,0" IsOn="{Binding SyncSteamShortcuts}" Toggled="SyncSteamShortcuts_Toggled"/>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<local:IconButton Text="Restore Backup" Kind="Danger" FontSize="15" Icon="{DynamicResource IconReload}" IconMargin="0,0,5,2" Width="135" Height="30" HorizontalAlignment="Right" Click="RestoreSteamShortcutBackup_Click"/>
<TextBlock FontSize="20" FontWeight="Bold" Margin="5,0,0,0">
<Hyperlink NavigateUri="https://gamevau.lt/docs/gamevault-plus/integrations/discord" RequestNavigate="Hyperlink_RequestNavigate" TextDecorations="None">Discord</Hyperlink>
</TextBlock>
</StackPanel>
<TextBlock Text="When enabled, your currently played game will be synced with the Discord Presence. This means that all your discord friends can see what you are currently playing" FontSize="15"/>
<mah:ToggleSwitch Header="Sync" Margin="0,10,0,0" IsOn="{Binding SyncDiscordPresence}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10,20,0,0">
<Rectangle Fill="{StaticResource MahApps.Brushes.Accent}" Width="2"/>
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<Path Data="{StaticResource IconGameSettingsDiscord}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<ScaleTransform ScaleX="1.1" ScaleY="1.1"/>
</Path.RenderTransform>
</Path>
<TextBlock Text="Discord" FontSize="20" FontWeight="Bold" Margin="5,0,0,0"/>
</StackPanel>
<TextBlock Text="When enabled, your currently played game will be synced with the Discord Presence. This means that all your discord friends can see what you are currently playing" FontSize="15"/>
<mah:ToggleSwitch Header="Sync" Margin="0,10,0,0" IsOn="{Binding SyncDiscordPresence}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10,20,0,0">
<Rectangle Fill="{StaticResource MahApps.Brushes.Accent}" Width="2"/>
<StackPanel Margin="10,0,0,0">
Expand All @@ -415,10 +421,10 @@
</StackPanel>
<TextBlock Text="GameVault+ integrates seamlessly with Playnite using our Playnite Library Extension" FontSize="15"/>
<TextBlock FontSize="15">
<Hyperlink NavigateUri="https://playnite.link/addons.html#GameVault_fab8be77-18ab-4e6c-ad3d-89097b492d74" RequestNavigate="Hyperlink_RequestNavigate">Download Playnite Extension</Hyperlink>
<Hyperlink NavigateUri="https://playnite.link/addons.html#GameVault_fab8be77-18ab-4e6c-ad3d-89097b492d74" RequestNavigate="Hyperlink_RequestNavigate">Download Playnite Extension</Hyperlink>
</TextBlock>
<TextBlock FontSize="15">
<Hyperlink NavigateUri="https://gamevau.lt/docs/gamevault-plus/integrations/playnite/" RequestNavigate="Hyperlink_RequestNavigate">Setup Guide</Hyperlink>
<Hyperlink NavigateUri="https://gamevau.lt/docs/gamevault-plus/integrations/playnite/" RequestNavigate="Hyperlink_RequestNavigate">Setup Guide</Hyperlink>
</TextBlock>
</StackPanel>
</StackPanel>
Expand Down Expand Up @@ -471,6 +477,23 @@
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Header="Developer">
<TabItem.Style>
<Style TargetType="TabItem" BasedOn="{StaticResource MahApps.Styles.TabItem}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DevModeEnabled}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TabItem.Style>
<StackPanel Margin="30,0,0,0">
<TextBlock Text="Developer Settings" FontSize="20" FontWeight="Bold"/>
<TextBlock Text="You may need to restart the client for the changes to take effect" Margin="0,5,0,0"/>
<mah:ToggleSwitch Header="Target Phalcode TEST backend" IsOn="{Binding DevTargetPhalcodeTestBackend}" Margin="5,15,0,0"/>
</StackPanel>
</TabItem>
</TabControl>
</ScrollViewer>
<Rectangle Grid.Row="1" Stroke="{DynamicResource MahApps.Brushes.ThemeForeground}" Width="1" HorizontalAlignment="Left" Margin="175,10,0,10"/>
Expand Down
Loading

0 comments on commit 72eb4c6

Please sign in to comment.