Skip to content

Commit

Permalink
remove cdn option #501
Browse files Browse the repository at this point in the history
  • Loading branch information
Scighost committed Dec 31, 2023
1 parent 7c6d266 commit 65679e9
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 242 deletions.
18 changes: 18 additions & 0 deletions src/Starward.Language/Lang.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/Starward.Language/Lang.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1244,4 +1244,10 @@ Do you accept the risk and continue to use it?</value>
<data name="ExperienceSettingPage_DisableRedDotReminderForGameNotices" xml:space="preserve">
<value>Disable red dot reminder for game notices</value>
</data>
<data name="SelectLanguagePage_NetworkTest" xml:space="preserve">
<value>Network Test</value>
</data>
<data name="SelectLanguagePage_AreYouAbleToReceiveUpdatesForStarward" xml:space="preserve">
<value>Are you able to receive updates for Starward?</value>
</data>
</root>
6 changes: 6 additions & 0 deletions src/Starward.Language/Lang.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1243,4 +1243,10 @@
<data name="ExperienceSettingPage_DisableRedDotReminderForGameNotices" xml:space="preserve">
<value>禁用游戏通知的红点提醒</value>
</data>
<data name="SelectLanguagePage_AreYouAbleToReceiveUpdatesForStarward" xml:space="preserve">
<value>您是否能接收到 Starward 的更新?</value>
</data>
<data name="SelectLanguagePage_NetworkTest" xml:space="preserve">
<value>网络测试</value>
</data>
</root>
9 changes: 1 addition & 8 deletions src/Starward/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private static void BuildServiceProvider()
sc.AddSingleton<HoyolabClient>();
sc.AddSingleton<LauncherClient>();
sc.AddSingleton<SelfQueryClient>();
sc.AddSingleton(p => new MetadataClient(ApiCDNIndex, p.GetService<HttpClient>()));
sc.AddSingleton<MetadataClient>();

sc.AddSingleton<DatabaseService>();
sc.AddSingleton<GameService>();
Expand Down Expand Up @@ -289,13 +289,6 @@ public static ILogger<T> GetLogger<T>()



public static int ApiCDNIndex
{
get => GetValue<int>();
set => SetValue(value);
}


public static bool EnablePreviewRelease
{
get => GetValue<bool>();
Expand Down
4 changes: 0 additions & 4 deletions src/Starward/MyWindows/WelcomeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public void NavigateTo(Type page, object parameter, NavigationTransitionInfo inf

public int WindowSizeMode { get; set; }

public int ApiCDNIndex { get; set; }

public string UserDataFolder { get; set; }


Expand All @@ -103,7 +101,6 @@ public void Reset()
{
TextLanguage = null!;
WindowSizeMode = 0;
ApiCDNIndex = 0;
UserDataFolder = null!;
}

Expand All @@ -115,7 +112,6 @@ public void ApplySetting()
AppConfig.UserDataFolder = UserDataFolder;
AppConfig.Language = TextLanguage;
AppConfig.WindowSizeMode = WindowSizeMode;
AppConfig.ApiCDNIndex = ApiCDNIndex;
}


Expand Down
139 changes: 41 additions & 98 deletions src/Starward/Pages/Welcome/SelectLanguagePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,11 @@
Stretch="Uniform" />


<Grid Name="Grid_OverMask"
Grid.ColumnSpan="2"
Background="{ThemeResource CustomOverlayAcrylicBrush}"
IsHitTestVisible="False"
Loaded="Grid_OverMask_Loaded" />



<Grid Name="Grid_Setting"
Grid.Column="1"
Margin="0,48,48,96"
Padding="24,12,24,12"
Padding="24"
HorizontalAlignment="Left"
VerticalAlignment="Center"
x:Load="{x:Bind SettingGridLoad}"
Expand All @@ -59,22 +52,21 @@
</TransitionCollection>
</Grid.Transitions>
<StackPanel Spacing="8">
<!-- language -->
<TextBlock FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Text="{x:Bind lang:Lang.SettingPage_Language}" />
<ComboBox Name="ComboBox_Language"
MinWidth="300"
SelectionChanged="ComboBox_Language_SelectionChanged" />

<!-- window size -->
<TextBlock Margin="0,8,0,0"
FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Text="{x:Bind lang:Lang.SettingPage_WindowsSize}" />
<StackPanel Margin="0,-4,0,0"
Orientation="Horizontal"
Spacing="16">
<StackPanel Orientation="Horizontal" Spacing="16">
<RadioButton Name="RadioButton_WindowSize_Normal"
Click="RadioButton_WindowSize_Click"
GroupName="WindowSize"
Expand All @@ -94,98 +86,49 @@
</StackPanel>
</RadioButton>
</StackPanel>

<!-- speed test -->
<TextBlock Margin="0,4,0,0"
FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Text="{x:Bind lang:Lang.SelectLanguagePage_NetworkTest}" />
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind lang:Lang.SelectLanguagePage_AreYouAbleToReceiveUpdatesForStarward}"
TextWrapping="Wrap" />
<StackPanel Margin="0,8,0,0"
Orientation="Horizontal"
Spacing="8">
<TextBlock VerticalAlignment="Center"
FontSize="20"
FontWeight="SemiBold"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Text="CDN" />
<Button Width="24"
Height="24"
Padding="0"
VerticalAlignment="Bottom"
Style="{ThemeResource DateTimePickerFlyoutButtonStyle}">
<FontIcon FontSize="14"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Glyph="&#xE9CE;" />
<Button.Flyout>
<Flyout>
<TextBlock MaxWidth="360"
Text="{x:Bind lang:Lang.SettingPage_CDNTips}"
TextWrapping="Wrap" />
</Flyout>
</Button.Flyout>
<Button Height="36"
HorizontalAlignment="Left"
BorderThickness="0"
Command="{x:Bind TestSpeedCommand}"
CornerRadius="8,18,18,8"
Style="{ThemeResource AccentButtonStyle}">
<StackPanel Margin="6,0,6,0"
Orientation="Horizontal"
Spacing="8">
<Grid>
<FontIcon FontSize="20"
Glyph="&#xE768;"
Visibility="{x:Bind TestSpeedCommand.IsRunning, Converter={StaticResource BoolToVisibilityReversedConverter}}" />
<ProgressRing Width="20"
Height="20"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
IsActive="{x:Bind TestSpeedCommand.IsRunning}" />
</Grid>
<TextBlock Text="Go" />
</StackPanel>
</Button>
<TextBlock Name="TextBlock_Delay"
Margin="16,0,0,0"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<TextBlock Name="TextBlock_Speed"
Margin="16,0,0,0"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
</StackPanel>

<RadioButtons Margin="0,-4,0,0">
<RadioButton Name="RadioButton_CF"
Click="RadioButton_CDN_Click"
Tag="cf">
<StackPanel Orientation="Horizontal">
<TextBlock MinWidth="80" Text="CloudFlare" />
<ProgressRing Name="ProgressRing_TestCND_CF"
Width="20"
Height="20"
Margin="16,0,0,0"
Visibility="Collapsed" />
<TextBlock Name="TextBlock_TestCND_CF"
Margin="16,0,0,0"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</RadioButton>
<RadioButton Name="RadioButton_GH"
Margin="0,-4,0,0"
Click="RadioButton_CDN_Click"
Tag="gh">
<StackPanel Orientation="Horizontal">
<TextBlock MinWidth="80" Text="GitHub" />
<ProgressRing Name="ProgressRing_TestCND_GH"
Width="20"
Height="20"
Margin="16,0,0,0"
Visibility="Collapsed" />
<TextBlock Name="TextBlock_TestCDN_GH"
Margin="16,0,0,0"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</RadioButton>
<RadioButton Name="RadioButton_JD"
Margin="0,-8,0,0"
Click="RadioButton_CDN_Click"
Tag="jd">
<StackPanel Orientation="Horizontal">
<TextBlock MinWidth="80" Text="jsDelivr" />
<ProgressRing Name="ProgressRing_TestCND_JD"
Width="20"
Height="20"
Margin="16,0,0,0"
Visibility="Collapsed" />
<TextBlock Name="TextBlock_TestCDN_JD"
Margin="16,0,0,0"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</RadioButton>
</RadioButtons>
<Button Height="32"
HorizontalAlignment="Left"
BorderThickness="0"
Command="{x:Bind TestCDNCommand}"
Style="{ThemeResource AccentButtonStyle}">
<StackPanel Margin="12,0,12,0"
Orientation="Horizontal"
Spacing="8">
<FontIcon Glyph="&#xF6FA;" />
<TextBlock Text="Test" />
</StackPanel>
</Button>


</StackPanel>
</Grid>
Expand Down
Loading

0 comments on commit 65679e9

Please sign in to comment.