Update OperatingSystem2 v1.4

This commit is contained in:
Aigio Liu
2021-10-21 15:19:52 +08:00
parent 6c3606fe79
commit 704fdc4b4e
11 changed files with 41 additions and 49 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<PackageVersion Include="ReactiveUI" Version="16.2.6" />
<PackageVersion Include="DynamicData" Version="7.4.1" />
<PackageVersion Include="Splat" Version="13.1.22" />
<PackageVersion Include="OperatingSystem2" Version="1.3.0" />
<PackageVersion Include="OperatingSystem2" Version="1.4.0" />
<PackageVersion Include="Microsoft.AppCenter" Version="4.4.0" />
<PackageVersion Include="Microsoft.AppCenter.Analytics" Version="4.4.0" />
<PackageVersion Include="Microsoft.AppCenter.Crashes" Version="4.4.0" />
+12 -5
View File
@@ -10,7 +10,6 @@ using AndroidApplication = Android.App.Application;
#endif
using System.Properties;
using System.Text;
using System.Windows;
using System.Linq;
using System.Diagnostics;
using System.Application.Services;
@@ -373,17 +372,25 @@ namespace System.Application.UI
#endif
#if AVALONIA
if (IApplication.IsAvaloniaApp)
if (OperatingSystem2.Application.UseAvalonia)
{
b.Append("[avalonia.ver] ");
b.Append(GetAssemblyVersion(Type.GetType(IApplication.TypeNames.Avalonia)!.Assembly));
b.Append(GetAssemblyVersion(OperatingSystem2.Application.Types.Avalonia!.Assembly));
b.AppendLine();
}
#endif
if (IApplication.IsXamarinForms)
if (OperatingSystem2.Application.UseXamarinForms)
{
b.Append("[forms.ver] ");
b.Append(GetAssemblyVersion(Type.GetType(IApplication.TypeNames.XamarinForms)!.Assembly));
b.Append(GetAssemblyVersion(OperatingSystem2.Application.Types.XamarinForms!.Assembly));
b.AppendLine();
}
var controllerType = Type.GetType("Microsoft.AspNetCore.Mvc.ControllerBase, Microsoft.AspNetCore.Mvc.Core");
if (controllerType != null)
{
b.Append("[mvc.ver] ");
b.Append(GetAssemblyVersion(controllerType.Assembly));
b.AppendLine();
}
+16 -16
View File
@@ -158,25 +158,25 @@ namespace System
#if !NET35
#region BaseDirectory
public const string DirName_Bin = "Bin";
//public const string DirName_Bin = "Bin";
static readonly Lazy<string> _BaseDirectory = new(() =>
{
var value = AppContext.BaseDirectory;
if (OperatingSystem2.IsWindows && !DesktopBridge.IsRunningAsUwp) // 启用将发布 Host 入口点重定向到 Bin 目录中时重定向基目录
{
var value2 = new DirectoryInfo(value);
if (value2.Parent != null && string.Equals(value2.Name, DirName_Bin, StringComparison.OrdinalIgnoreCase))
{
value = value2.Parent.FullName;
}
}
return value;
});
//static readonly Lazy<string> _BaseDirectory = new(() =>
//{
// var value = AppContext.BaseDirectory;
// if (OperatingSystem2.IsWindows && !DesktopBridge.IsRunningAsUwp) // 启用将发布 Host 入口点重定向到 Bin 目录中时重定向基目录
// {
// var value2 = new DirectoryInfo(value);
// if (value2.Parent != null && string.Equals(value2.Name, DirName_Bin, StringComparison.OrdinalIgnoreCase))
// {
// value = value2.Parent.FullName;
// }
// }
// return value;
//});
public static string BaseDirectory =>
//AppContext.BaseDirectory;
_BaseDirectory.Value;
AppContext.BaseDirectory;
//_BaseDirectory.Value;
#endregion
#endif
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="6" android:versionName="2.5.0" package="net.steampp.app" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<application android:fullBackupContent="@xml/auto_backup_rules"></application>
<!-- Required for API Level 30 to make sure the app can detect browsers and other apps where communication is needed.-->
<!--https://developer.android.com/training/basics/intents/package-visibility-use-cases-->
+1 -1
View File
@@ -113,7 +113,7 @@ namespace System.Application
{
if (filePathOrResUri == null)
return null;
if (IApplication.IsAvaloniaApp)
if (OperatingSystem2.Application.UseAvalonia)
{
if (filePathOrResUri.StartsWith("avares:"))
return filePathOrResUri;
+1 -1
View File
@@ -107,7 +107,7 @@ namespace System.Application.Services
{
get
{
if (IApplication.IsAvaloniaApp)
if (OperatingSystem2.Application.UseAvalonia)
{
return "avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/avater_default.png";
}
-12
View File
@@ -45,17 +45,5 @@ namespace System.Application.UI
/// <para>reference to the ViewController (if using Xamarin.iOS), Activity (if using Xamarin.Android) IWin32Window or IntPtr (if using .Net Framework).</para>
/// </summary>
object CurrentPlatformUIHost { get; }
private static readonly Lazy<bool> mIsAvaloniaApp = new(() => Type.GetType(TypeNames.Avalonia) != null);
static bool IsAvaloniaApp => mIsAvaloniaApp.Value;
private static readonly Lazy<bool> mIsXamarinForms = new(() => Type.GetType(TypeNames.XamarinForms) != null);
static bool IsXamarinForms => mIsXamarinForms.Value;
static class TypeNames
{
public const string Avalonia = "Avalonia.Application, Avalonia.Controls";
public const string XamarinForms = "Xamarin.Forms.Application, Xamarin.Forms.Core";
}
}
}
@@ -21,7 +21,7 @@ namespace System.Application.UI.ViewModels
protected static string GetTitleByDisplayName(string displayName)
{
if (IApplication.IsAvaloniaApp)
if (OperatingSystem2.Application.UseAvalonia)
{
return Constants.HARDCODED_APP_NAME + " | " + displayName;
}
+7 -10
View File
@@ -505,17 +505,14 @@ namespace System.Application
ActiveUserPost(ActiveUserType.OnStartup);
if (GeneralSettings.IsAutoCheckUpdate.Value)
{
//if (!OperatingSystem2.IsAndroid)
try
{
try
{
var appUpdateService = IApplicationUpdateService.Instance;
await appUpdateService.CheckUpdateAsync(showIsExistUpdateFalse: false);
}
catch (Exception e)
{
Log.Error(nameof(Startup), e, "OnStartup");
}
var appUpdateService = IApplicationUpdateService.Instance;
await appUpdateService.CheckUpdateAsync(showIsExistUpdateFalse: false);
}
catch (Exception e)
{
Log.Error(nameof(Startup), e, "OnStartup");
}
}
}