Skip to content

Commit

Permalink
Finish task and publish 4.6.816.0 version
Browse files Browse the repository at this point in the history
1.Finish task and publish 4.6.816.0 version
2.Update Microsoft.Web.webView2 to 1.0.2651.64 version
3.Add more WebView2 data clean rule
4.Add ToggleSwitchHelper to get ToggleSwitch flowDirection
  • Loading branch information
Gaoyifei1011 committed Aug 16, 2024
1 parent 9ce1d01 commit ed0d65d
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 57 deletions.
6 changes: 3 additions & 3 deletions GetStoreApp/GetStoreApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
<Optimize>False</Optimize>
<OutputType>WinExe</OutputType>
<Platforms>x86;x64;ARM64</Platforms>
<PublishAot>true</PublishAot>
<PublishProtocol>FileSystem</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSelfContained>true</PublishSelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishAot>true</PublishAot>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<RootNamespace>GetStoreApp</RootNamespace>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<SelfContained>true</SelfContained>
<StartupObject>GetStoreApp.Program</StartupObject>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
Expand Down Expand Up @@ -110,7 +109,8 @@
<None Remove="Views\Pages\WinGetPage.xaml" />
<None Remove="Views\Windows\MainWindow.xaml" />
<None Remove="WinUIApp.xaml" />


<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2651.64" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240807006-preview1" />

Expand Down
Binary file modified GetStoreApp/GetStoreApp.res
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace GetStoreApp.Helpers.Controls.Extensions
{
/// <summary>
/// 扩展后的内容对话框辅助类,只允许在同一时间段内打开一个内容对话框
/// 扩展后的内容对话框控件辅助类
/// </summary>
public static class ContentDialogHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace GetStoreApp.Helpers.Controls.Extensions
{
/// <summary>
/// 扩展后的教学提示辅助类,使用教学提示来显示应用内通知
/// 扩展后的教学提示控件辅助类
/// </summary>
public static class TeachingTipHelper
{
Expand Down
18 changes: 18 additions & 0 deletions GetStoreApp/Helpers/Controls/Extensions/ToggleSwitchHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.UI.Xaml;

namespace GetStoreApp.Helpers.Controls.Extensions
{
/// <summary>
/// 扩展后的切换开关控件辅助类
/// </summary>
public static class ToggleSwitchHelper
{
/// <summary>
/// 获取 ToggleSwitch 的文字转向
/// </summary>
public static FlowDirection GetFlowDirection(FlowDirection flowDirection)
{
return flowDirection is FlowDirection.LeftToRight ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
}
}
}
6 changes: 3 additions & 3 deletions GetStoreApp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
[assembly: AssemblyCompany("高怡飞")]
[assembly: AssemblyCopyright("Copyright ©2022-2024 高怡飞, All Rights Reserved.")]
[assembly: AssemblyDescription("获取商店应用")]
[assembly: AssemblyFileVersion("4.5.815.0")]
[assembly: AssemblyInformationalVersion("4.5.815.0")]
[assembly: AssemblyFileVersion("4.6.816.0")]
[assembly: AssemblyInformationalVersion("4.6.816.0")]
[assembly: AssemblyProduct("获取商店应用")]
[assembly: AssemblyTitle("获取商店应用")]
[assembly: AssemblyVersion("4.5.815.0")]
[assembly: AssemblyVersion("4.6.816.0")]

// 应用程序默认区域性的资源控制器设置
[assembly: NeutralResourcesLanguage("en-us")]
Expand Down
13 changes: 7 additions & 6 deletions GetStoreApp/Views/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:collection="using:System.Collections"
xmlns:controlHelper="using:GetStoreApp.Helpers.Controls.Extensions"
xmlns:converter="using:GetStoreApp.Helpers.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helper="using:GetStoreApp.Helpers.Root"
Expand Down Expand Up @@ -350,7 +351,7 @@
Grid.Column="2"
MinWidth="0"
Margin="0,-2,0,0"
FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}"
FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}"
IsEnabled="{x:Bind converter:ValueCheckConverterHelper.ObjectCompareReverseConvert(Backdrop.Value, BackdropList[0].Value), Mode=OneWay}"
IsEnabledChanged="{x:Bind OnIsEnabledChanged}"
IsOn="{x:Bind AlwaysShowBackdropValue, Mode=OneWay}"
Expand Down Expand Up @@ -520,7 +521,7 @@
Grid.Column="2"
MinWidth="0"
Margin="0,-2,0,0"
FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}"
FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}"
IsOn="{x:Bind TopMostValue, Mode=OneWay}"
OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/TopMostOffContent')}"
OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/TopMostOnContent')}"
Expand Down Expand Up @@ -604,7 +605,7 @@
Grid.Column="3"
MinWidth="0"
Margin="0,-2,0,0"
FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}"
FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}"
IsOn="{x:Bind Notification, Mode=OneWay}"
OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/NotificationOffContent')}"
OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/NotificationOnContent')}"
Expand Down Expand Up @@ -843,7 +844,7 @@
<ToggleSwitch
Grid.Column="1"
MinWidth="0"
FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}"
FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}"
IsOn="{x:Bind EncryptedPackageFilterValue, Mode=OneWay}"
OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/EncryptedPackageOffContent')}"
OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/EncryptedPackageOnContent')}"
Expand Down Expand Up @@ -891,7 +892,7 @@
<ToggleSwitch
Grid.Column="1"
MinWidth="0"
FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}"
FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}"
IsOn="{x:Bind BlockMapFilterValue, Mode=OneWay}"
OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/BlockMapOffContent')}"
OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/BlockMapOnContent')}"
Expand Down Expand Up @@ -1080,7 +1081,7 @@
<ToggleSwitch
Grid.Column="1"
MinWidth="0"
FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}"
FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}"
IsOn="{x:Bind UseDevVersion, Mode=OneWay}"
OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/UseDevFirstOffContent')}"
OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/UseDevFirstOnContent')}"
Expand Down
8 changes: 0 additions & 8 deletions GetStoreApp/Views/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,6 @@ private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArg

#endregion 第三部分:设置页面——挂载的事件

/// <summary>
/// 获取 ToggleSwitch 的文字转向
/// </summary>
private FlowDirection GetToggleSwitchDirection(FlowDirection flowDirection)
{
return flowDirection is FlowDirection.LeftToRight ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
}

private string LocalizeDisplayNumber(DictionaryEntry selectedBackdrop)
{
int index = BackdropList.FindIndex(item => item.Value.Equals(selectedBackdrop.Value));
Expand Down
2 changes: 1 addition & 1 deletion GetStoreAppPackage/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="Gaoyifei1011.GetStoreApp"
Publisher="CN=高怡飞"
Version="4.5.815.0" />
Version="4.6.816.0" />

<Properties>
<DisplayName>ms-resource:PackageDisplayName</DisplayName>
Expand Down
3 changes: 1 addition & 2 deletions GetStoreAppWebView/GetStoreAppWebView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@
<Page Include="Styles\UWP\TextBlock.xaml" Generator="MSBuild:Compile" SubType="Designer" />
<Page Include="UI\Dialogs\ProcessFailedDialog.xaml" Generator="MSBuild:Compile" SubType="Designer" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.14" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2651.64" />
</ItemGroup>
<ItemGroup />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
26 changes: 4 additions & 22 deletions GetStoreAppWebView/Pages/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ private async void OnClearWebCacheClicked(object sender, RoutedEventArgs args)
{
if (WebView2Browser is not null && WebView2Browser.CoreWebView2 is not null)
{
WebView2Browser.CoreWebView2.CookieManager.DeleteAllCookies();
await WebView2Browser.CoreWebView2.Profile.ClearBrowsingDataAsync();
await WebView2Browser.CoreWebView2.ClearServerCertificateErrorActionsAsync();
}
}
}
Expand Down Expand Up @@ -373,6 +375,8 @@ private async void OnCoreProcessFailed(object sender, CoreWebView2ProcessFailedE
/// </summary>
private void OnCoreWebView2Initialized(object sender, CoreWebView2InitializedEventArgs args)
{
WebView2Browser.CoreWebView2.Settings.AreDefaultScriptDialogsEnabled = false;
WebView2Browser.CoreWebView2.Settings.AreDevToolsEnabled = false;
WebView2Browser.CoreWebView2.NewWindowRequested += OnCoreWebViewNewWindowRequested;
WebView2Browser.CoreWebView2.SourceChanged += OnSourceChanged;
IsEnabled = true;
Expand Down Expand Up @@ -461,27 +465,5 @@ private void SetTitleBarTheme(ElementTheme theme)
}

#endregion 第五部分:窗口属性设置

/// <summary>
/// 关闭窗口时注销的事件
/// </summary>
public void CloseWindow()
{
if (WebKernelService.WebKernel == WebKernelService.WebKernelList[1] && WebView2Browser is not null)
{
try
{
if (WebView2Browser.CoreWebView2 is not null)
{
WebView2Browser.CoreWebView2.NewWindowRequested -= OnCoreWebViewNewWindowRequested;
WebView2Browser.CoreWebView2.SourceChanged -= OnSourceChanged;
}
}
catch (Exception e)
{
LogService.WriteLog(LoggingLevel.Error, "WebView2 unloaded event failed", e);
}
}
}
}
}
6 changes: 3 additions & 3 deletions GetStoreAppWebView/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
[assembly: AssemblyCompany("高怡飞")]
[assembly: AssemblyCopyright("Copyright ©2022-2024 高怡飞, All Rights Reserved.")]
[assembly: AssemblyDescription("网页浏览器")]
[assembly: AssemblyFileVersion("4.5.815.0")]
[assembly: AssemblyInformationalVersion("4.5.815.0")]
[assembly: AssemblyFileVersion("4.6.816.0")]
[assembly: AssemblyInformationalVersion("4.6.816.0")]
[assembly: AssemblyProduct("网页浏览器")]
[assembly: AssemblyTitle("网页浏览器")]
[assembly: AssemblyVersion("4.5.815.0")]
[assembly: AssemblyVersion("4.6.816.0")]

// 应用程序默认区域性的资源控制器设置
[assembly: NeutralResourcesLanguage("en-us")]
5 changes: 1 addition & 4 deletions GetStoreAppWebView/UI/Controls/WebView2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,7 @@ private void OnCursorChanged(CoreWebView2CompositionController sender, object ar
private async void OnTextScaleFactorChanged(UISettings sender, object args)
{
// OnTextScaleFactorChanged 发生在非 UI 线程中,使用 Dispatcher 在 UI 线程中调用 UpdateCoreWebViewScale。
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
UpdateCoreWebViewScale();
});
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, UpdateCoreWebViewScale);
}

#endregion 第六部分:自定义事件
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
// 程序集信息设置
[assembly: AssemblyCompany("高怡飞")]
[assembly: AssemblyCopyright("©Copyright ©2022-2024 高怡飞, All Rights Reserved.")]
[assembly: AssemblyFileVersion("4.5.815.0")]
[assembly: AssemblyInformationalVersion("4.5.815.0")]
[assembly: AssemblyFileVersion("4.6.816.0")]
[assembly: AssemblyInformationalVersion("4.6.816.0")]
[assembly: AssemblyProduct("获取商店应用 WinGet WinRT 扩展")]
[assembly: AssemblyVersion("4.5.815.0")]
[assembly: AssemblyVersion("4.6.816.0")]

// 设置程序集仅允许在Windows平台上可用
[assembly: SupportedOSPlatform("windows10.0.26100")]

0 comments on commit ed0d65d

Please sign in to comment.