Skip to content

Commit

Permalink
拆分 Xamarin.Essentials,在 MAUI 中使用 .NET MAUI Essentials
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed May 30, 2022
1 parent 6d07859 commit 38bd825
Show file tree
Hide file tree
Showing 112 changed files with 2,613 additions and 1,639 deletions.
126 changes: 125 additions & 1 deletion SteamToolsV2+.sln
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FDELauncher", "src\FDELaunc
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Http.Headers", "src\Microsoft.Net.Http.Headers\Microsoft.Net.Http.Headers.csproj", "{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ST.Client.Maui.App", "src\ST.Client.Maui.App\ST.Client.Maui.App.csproj", "{73A9AB65-AF95-4F27-98E2-B3296F9BC198}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Client.Maui.App", "src\ST.Client.Maui.App\ST.Client.Maui.App.csproj", "{73A9AB65-AF95-4F27-98E2-B3296F9BC198}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ST.Client.Maui", "src\ST.Client.Maui\ST.Client.Maui.csproj", "{48417EE3-BACB-4E04-B48D-B3781862AD81}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Essentials", "src\Common.Essentials\Common.Essentials.csproj", "{41434AB5-48C3-47D4-8721-D118D87F472B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Essentials.Xamarin", "src\Common.Essentials.Xamarin\Common.Essentials.Xamarin.csproj", "{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Essentials.Maui", "src\Common.Essentials.Maui\Common.Essentials.Maui.csproj", "{5C440EC2-9251-4DB5-A14E-68FF37814F12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -2236,6 +2244,118 @@ Global
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x86.ActiveCfg = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x86.Build.0 = Release|Any CPU
{73A9AB65-AF95-4F27-98E2-B3296F9BC198}.Release|x86.Deploy.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|ARM.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|ARM.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|ARM64.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|iPhone.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|x64.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|x64.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|x86.ActiveCfg = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Debug|x86.Build.0 = Debug|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|Any CPU.Build.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|ARM.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|ARM.Build.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|ARM64.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|ARM64.Build.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|iPhone.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|iPhone.Build.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|x64.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|x64.Build.0 = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|x86.ActiveCfg = Release|Any CPU
{48417EE3-BACB-4E04-B48D-B3781862AD81}.Release|x86.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|ARM.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|ARM64.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|iPhone.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|x64.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|x64.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|x86.ActiveCfg = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Debug|x86.Build.0 = Debug|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|Any CPU.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|ARM.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|ARM.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|ARM64.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|ARM64.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|iPhone.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|iPhone.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|x64.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|x64.Build.0 = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|x86.ActiveCfg = Release|Any CPU
{41434AB5-48C3-47D4-8721-D118D87F472B}.Release|x86.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|ARM.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|ARM.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|ARM64.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|iPhone.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|x64.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|x64.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|x86.ActiveCfg = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Debug|x86.Build.0 = Debug|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|Any CPU.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|ARM.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|ARM.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|ARM64.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|ARM64.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|iPhone.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|iPhone.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|x64.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|x64.Build.0 = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|x86.ActiveCfg = Release|Any CPU
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526}.Release|x86.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|ARM.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|ARM64.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|iPhone.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|x64.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|x64.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Debug|x86.Build.0 = Debug|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|Any CPU.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|ARM.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|ARM.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|ARM64.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|ARM64.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|iPhone.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|iPhone.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|x64.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|x64.Build.0 = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|x86.ActiveCfg = Release|Any CPU
{5C440EC2-9251-4DB5-A14E-68FF37814F12}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2311,6 +2431,10 @@ Global
{058F9955-8EFE-4BF3-A8F9-44C57B1F812E} = {17667B53-1A09-45A6-855A-0F07F9AE044F}
{FA9F0E89-E410-400A-86F3-C603E51E62A8} = {910D6A0F-42AB-4B65-B532-852E864EC006}
{C7F109B9-EA88-4B7E-ADB5-D6407686ADE0} = {673FF8CD-9E85-4FA1-ABFC-D1149675E138}
{48417EE3-BACB-4E04-B48D-B3781862AD81} = {8E38AAF2-8C7D-4B0D-AB25-AB37EECB4029}
{41434AB5-48C3-47D4-8721-D118D87F472B} = {83186945-EC14-4B3F-8C6F-B205AA184CA4}
{07C9AC06-5D84-41AB-A3C9-5C5B1A27F526} = {83186945-EC14-4B3F-8C6F-B205AA184CA4}
{5C440EC2-9251-4DB5-A14E-68FF37814F12} = {83186945-EC14-4B3F-8C6F-B205AA184CA4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_NeutralResourcesLanguage = zh-Hans
Expand Down
17 changes: 8 additions & 9 deletions src/AboutAppInfoPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using System.Properties;
using System.Reflection;
using System.Text;
using Xamarin.Essentials;
using System.Runtime.InteropServices;

// ReSharper disable once CheckNamespace
Expand Down Expand Up @@ -103,12 +102,12 @@ public static void OnClick()
{
AppendOSName();
}
void AppendOSName() => b.AppendFormat("{0} {1}", DeviceInfo2.OSName, Environment.OSVersion.Version);
void AppendOSName() => b.AppendFormat("{0} {1}", DeviceInfo2.OSName(), Environment.OSVersion.Version);
#endif
b.AppendLine();

b.Append("[os.name] ");
b.Append(DeviceInfo2.OSNameValue);
b.Append(DeviceInfo2.OSNameValue());
b.AppendLine();

b.Append("[app.ver] ");
Expand Down Expand Up @@ -414,25 +413,25 @@ static string GetJavaSystemGetProperty(string propertyKey)
b.AppendLine();
#endif
b.Append("[device.name] ");
b.Append(DeviceInfo2.Name);
b.Append(DeviceInfo2.Name());
b.AppendLine();
b.Append("[device.model] ");
b.Append(
#if __ANDROID__
Build.Model ?? ""
#else
DeviceInfo2.Model
DeviceInfo2.Model()
#endif
);
b.AppendLine();
b.Append("[device.ver] ");
b.Append(DeviceInfo2.VersionString);
b.Append(DeviceInfo2.VersionString());
b.AppendLine();
b.Append("[device.idiom] ");
b.Append(DeviceInfo2.Idiom);
b.Append(DeviceInfo2.Idiom());
b.AppendLine();
b.Append("[device.type] ");
b.Append(DeviceInfo2.DeviceType);
b.Append(DeviceInfo2.DeviceType());
b.AppendLine();
#if __ANDROID__
b.Append("[device.product] ");
Expand All @@ -447,7 +446,7 @@ static string GetJavaSystemGetProperty(string propertyKey)
#if __ANDROID__
Build.Manufacturer ?? ""
#else
DeviceInfo2.Manufacturer
DeviceInfo2.Manufacturer()
#endif
);
b.AppendLine();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
using Android;
using Android.OS;
using XEPermissions = Xamarin.Essentials.Permissions;

namespace System.Application.Services.Implementation.Permissions
{
internal sealed class GetPhoneNumberPermission : XEPermissions.BasePlatformPermission, IPermissions.IGetPhoneNumber
{
XEPermissions.BasePermission IPermissions.IPermission.Permission => this;
namespace System.Application.Services.Implementation.Permissions;

public const string Description = "自动填充输入框中的手机号码";
internal sealed class GetPhoneNumberPermission : BasePlatformPermission, Permissions2.IGetPhoneNumber
{
public const string Description = "自动填充输入框中的手机号码";

public override (string androidPermission, bool isRuntime)[] RequiredPermissions
public override (string androidPermission, bool isRuntime)[] RequiredPermissions
{
get
{
get
string androidPermission;
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
androidPermission = Manifest.Permission.ReadPhoneNumbers;
}
else
{
string androidPermission;
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
androidPermission = Manifest.Permission.ReadPhoneNumbers;
}
else
{
androidPermission = Manifest.Permission.ReadPhoneState;
}
return new[] { (androidPermission, true) };
androidPermission = Manifest.Permission.ReadPhoneState;
}
return new[] { (androidPermission, true) };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ namespace System.Application.Services.Implementation
/// <inheritdoc cref="ITelephonyService"/>
internal sealed class PlatformTelephonyServiceImpl : TelephonyServiceImpl
{
public PlatformTelephonyServiceImpl(IPermissions p) : base(p)
{
}

TelephonyManager? telephonyManager;

public TelephonyManager TelephonyManager
Expand Down
5 changes: 2 additions & 3 deletions src/Common.ClientLib.Droid/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using System.Application;
using System.Application.Services;
using System.Application.Services.Implementation;
using System.Application.Services.Implementation.Permissions;
using System.Diagnostics;
using System.Logging;

// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection
Expand Down Expand Up @@ -40,7 +39,7 @@ public static IServiceCollection AddTelephonyService(this IServiceCollection ser
/// <returns></returns>
public static IServiceCollection AddPlatformPermissions(this IServiceCollection services)
{
services.AddTransient<IPermissions.IGetPhoneNumber, GetPhoneNumberPermission>();
services.AddTransient<Permissions2.IGetPhoneNumber, GetPhoneNumberPermission>();
return services;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Common.ClientLib/Application/Essentials/Browser2.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Xamarin.Essentials;

// ReSharper disable once CheckNamespace
namespace System.Application;

/// <inheritdoc cref="Browser"/>
/// <summary>
/// 提供了一种在应用程序中显示网页的方法。
/// </summary>
public static partial class Browser2
{
public static event Action<Exception>? OnError;
Expand Down
20 changes: 10 additions & 10 deletions src/Common.ClientLib/Application/Essentials/Browser2.utils.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Xamarin.Essentials;
using System.Application.Services;

// ReSharper disable once CheckNamespace
namespace System.Application;
Expand Down Expand Up @@ -56,7 +56,7 @@ static OpenResultCode OpenAnalysis(string? url)
}
else if (IsHttpUrl(url, HttpsOnly))
{
if (DeviceInfo.Platform == DevicePlatform.Unknown)
if (!Essentials.IsSupported)
{
return OpenCoreByProcess(url);
}
Expand All @@ -78,7 +78,7 @@ static async Task<bool> OpenCoreAsync(Uri uri, BrowserLaunchMode launchMode = De
{
try
{
await Browser.OpenAsync(uri, launchMode);
await IBrowserPlatformService.Instance.OpenAsync(uri, launchMode);
return true;
}
catch (Exception e)
Expand All @@ -88,11 +88,11 @@ static async Task<bool> OpenCoreAsync(Uri uri, BrowserLaunchMode launchMode = De
}
}

static async Task<bool> OpenCoreAsync(string? uri, BrowserLaunchMode launchMode = DefaultBrowserLaunchMode)
static async Task<bool> OpenCoreAsync(string uri, BrowserLaunchMode launchMode = DefaultBrowserLaunchMode)
{
try
{
await Browser.OpenAsync(uri, launchMode);
await IBrowserPlatformService.Instance.OpenAsync(uri, launchMode);
return true;
}
catch (Exception e)
Expand All @@ -106,7 +106,7 @@ static async Task<bool> OpenCoreAsync(Uri uri, BrowserLaunchOptions options)
{
try
{
return await Browser.OpenAsync(uri, options);
return await IBrowserPlatformService.Instance.OpenAsync(uri, options);
}
catch (Exception e)
{
Expand All @@ -115,11 +115,11 @@ static async Task<bool> OpenCoreAsync(Uri uri, BrowserLaunchOptions options)
}
}

static async Task<bool> OpenCoreAsync(string? uri, BrowserLaunchOptions options)
static async Task<bool> OpenCoreAsync(string uri, BrowserLaunchOptions options)
{
try
{
await Browser.OpenAsync(uri, options);
await IBrowserPlatformService.Instance.OpenAsync(uri, options);
return true;
}
catch (Exception e)
Expand All @@ -129,11 +129,11 @@ static async Task<bool> OpenCoreAsync(string? uri, BrowserLaunchOptions options)
}
}

static bool OpenCore(string? uri, BrowserLaunchMode launchMode = DefaultBrowserLaunchMode)
static bool OpenCore(string uri, BrowserLaunchMode launchMode = DefaultBrowserLaunchMode)
{
OpenCoreSync(uri, launchMode);
return true;

static async void OpenCoreSync(string? uri, BrowserLaunchMode launchMode) => await OpenCoreAsync(uri, launchMode);
static async void OpenCoreSync(string uri, BrowserLaunchMode launchMode) => await OpenCoreAsync(uri, launchMode);
}
}
Loading

0 comments on commit 38bd825

Please sign in to comment.