Merge branch 'main' into dev/merge-main-into-net9
This commit is contained in:
Коммит
886f8bc98c
|
@ -156,10 +156,10 @@
|
|||
<MauiDeviceTestsPlatforms Condition="'$(IncludeIosTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-ios;$(MauiDeviceTestsPlatforms)</MauiDeviceTestsPlatforms>
|
||||
|
||||
<!-- Embedding TFMs (no Tizen yet) -->
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeWindowsTargetFrameworks)' == 'true'">$(WindowsMauiPlatforms);$(MauiDeviceTestsPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeAndroidTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-android;$(MauiDeviceTestsPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeMacCatalystTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-maccatalyst;$(MauiDeviceTestsPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeIosTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-ios;$(MauiDeviceTestsPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeWindowsTargetFrameworks)' == 'true'">$(WindowsMauiPlatforms);$(MauiEmbeddingPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeAndroidTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-android;$(MauiEmbeddingPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeMacCatalystTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-maccatalyst;$(MauiEmbeddingPlatforms)</MauiEmbeddingPlatforms>
|
||||
<MauiEmbeddingPlatforms Condition="'$(IncludeIosTargetFrameworks)' == 'true'">net$(_MauiDotNetVersion)-ios;$(MauiEmbeddingPlatforms)</MauiEmbeddingPlatforms>
|
||||
|
||||
<!-- Graphics TFMs -->
|
||||
<MauiGraphicsPlatforms>$(MauiPlatforms)</MauiGraphicsPlatforms>
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace Microsoft.AspNetCore.Components.WebView.Maui
|
|||
// Using an IP address means that WebView doesn't wait for any DNS resolution,
|
||||
// making it substantially faster. Note that this isn't real HTTP traffic, since
|
||||
// we intercept all the requests within this origin.
|
||||
private static readonly string AppOrigin = $"https://{BlazorWebView.AppHostAddress}/";
|
||||
private static readonly Uri AppOriginUri = new(AppOrigin);
|
||||
private static readonly AUri AndroidAppOriginUri = AUri.Parse(AppOrigin)!;
|
||||
private static string AppOrigin { get; } = $"https://{BlazorWebView.AppHostAddress}/";
|
||||
private static Uri AppOriginUri { get; } = new(AppOrigin);
|
||||
private static AUri AndroidAppOriginUri { get; } = AUri.Parse(AppOrigin)!;
|
||||
private readonly ILogger _logger;
|
||||
private readonly AWebView _webview;
|
||||
private readonly string _contentRootRelativeToAppRoot;
|
||||
|
|
|
@ -11,7 +11,44 @@ namespace Microsoft.AspNetCore.Components.WebView.Maui
|
|||
/// </summary>
|
||||
public partial class BlazorWebView : View, IBlazorWebView
|
||||
{
|
||||
internal const string AppHostAddress = "0.0.0.0";
|
||||
internal static string AppHostAddress { get; } = GetAppHostAddress();
|
||||
|
||||
private const string AppHostAddressAlways0000Switch = "BlazorWebView.AppHostAddressAlways0000";
|
||||
|
||||
private static bool IsAppHostAddressAlways0000Enabled =>
|
||||
AppContext.TryGetSwitch(AppHostAddressAlways0000Switch, out var enabled) && enabled;
|
||||
|
||||
private static string GetAppHostAddress()
|
||||
{
|
||||
if (IsAppHostAddressAlways0000Enabled)
|
||||
{
|
||||
return "0.0.0.0";
|
||||
}
|
||||
else
|
||||
{
|
||||
#if IOS || MACCATALYST
|
||||
// On iOS/MacCatalyst 18 and higher the 0.0.0.0 address does not work, so we use localhost instead.
|
||||
// This preserves behavior on older versions of those systems, while defaulting to new behavior on
|
||||
// the new system.
|
||||
|
||||
// Note that pre-release versions of iOS/MacCatalyst have the expected Major/Minor values,
|
||||
// but the Build, MajorRevision, MinorRevision, and Revision values are all -1, so we need
|
||||
// to pass in int.MinValue for those values.
|
||||
|
||||
if (System.OperatingSystem.IsIOSVersionAtLeast(major: 18, minor: int.MinValue, build: int.MinValue) ||
|
||||
System.OperatingSystem.IsMacCatalystVersionAtLeast(major: 18, minor: int.MinValue, build: int.MinValue))
|
||||
{
|
||||
return "localhost";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "0.0.0.0";
|
||||
}
|
||||
#else
|
||||
return "0.0.0.0";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private readonly JSComponentConfigurationStore _jSComponents = new();
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace Microsoft.AspNetCore.Components.WebView.Maui
|
|||
{
|
||||
private IOSWebViewManager? _webviewManager;
|
||||
|
||||
internal const string AppOrigin = "app://" + BlazorWebView.AppHostAddress + "/";
|
||||
internal static readonly Uri AppOriginUri = new(AppOrigin);
|
||||
internal static string AppOrigin { get; } = "app://" + BlazorWebView.AppHostAddress + "/";
|
||||
internal static Uri AppOriginUri { get; } = new(AppOrigin);
|
||||
private const string BlazorInitScript = @"
|
||||
window.__receiveMessageCallbacks = [];
|
||||
window.__dispatchMessageCallback = function(message) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче