Skip to content

Commit

Permalink
Merge branch 'net7.0' into release/7.0.1xx-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Sep 30, 2022
2 parents 0c5147d + 5f97959 commit 6ac46c1
Show file tree
Hide file tree
Showing 88 changed files with 849 additions and 305 deletions.
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- Begin: Package sources from dotnet-aspnetcore -->
<!-- End: Package sources from dotnet-aspnetcore -->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-pub-dotnet-runtime-cdf48ab" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-cdf48abd/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-runtime -->
<!-- Begin: Package sources from dotnet-windowsdesktop -->
<!-- End: Package sources from dotnet-windowsdesktop -->
Expand Down
36 changes: 36 additions & 0 deletions eng/provisioning/provisioning.csx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,42 @@ if(String.IsNullOrWhiteSpace(ANDROID_API_SDKS))
AndroidSystemImageApi.Google,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API24",
AndroidApiLevel.Nougat,
AndroidSystemImageApi.GooglePlayStore,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API25",
AndroidApiLevel.Nougat_7_1,
AndroidSystemImageApi.GooglePlayStore,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API26",
AndroidApiLevel.Oreo,
AndroidSystemImageApi.GooglePlayStore,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API27",
AndroidApiLevel.Oreo_8_1 ,
AndroidSystemImageApi.GooglePlayStore,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API28",
AndroidApiLevel.P,
AndroidSystemImageApi.GooglePlayStore,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API29",
AndroidApiLevel.Q,
AndroidSystemImageApi.GooglePlayStore,
AndroidSystemImageAbi.x86,
AndroidVirtualDevice.NEXUS_5X)
.VirtualDevice(
"Android_API30",
AndroidApiLevel.R,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public static async Task WaitForWebViewReady(AWebView webview)
{
for (int i = 0; i < MaxWaitTimes; i++)
{
var blazorObject = await ExecuteScriptAsync(webview, "window.Blazor !== null");
var blazorObject = await ExecuteScriptAsync(webview, "(window.Blazor !== null) && (window.__BlazorStarted === true)");
if (blazorObject == "true")
{
return;
}
await Task.Delay(WaitTimeInMS);
}

throw new Exception($"Waited {MaxWaitTimes * WaitTimeInMS}ms but couldn't get window.Blazor to be non-null.");
throw new Exception($"Waited {MaxWaitTimes * WaitTimeInMS}ms but couldn't get window.Blazor to be non-null *and* have window.__BlazorStarted to be true.");
}

public static Task<string> ExecuteScriptAsync(AWebView webview, string script)
Expand All @@ -48,7 +48,10 @@ public static async Task WaitForControlDiv(AWebView webView, string controlValue
await Task.Delay(WaitTimeInMS);
}

throw new Exception($"Waited {MaxWaitTimes * WaitTimeInMS}ms but couldn't get controlDiv to have value '{controlValueToWaitFor}'. Most recent value was '{latestControlValue}'.");
var documentHtmlJavaScriptEncoded = await ExecuteScriptAsync(webView, "document.body.innerHTML");
var documentHtmlString = System.Text.Json.JsonSerializer.Deserialize<string>(documentHtmlJavaScriptEncoded);

throw new Exception($"Waited {MaxWaitTimes * WaitTimeInMS}ms but couldn't get controlDiv to have value '{controlValueToWaitFor}'. Most recent value was '{latestControlValue}'. document.body.innerHTML = {documentHtmlString}");
}

class JavascriptResult : Java.Lang.Object, IValueCallback
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/Controls/samples/Controls.Sample/Pages/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ShellContent Icon="coffee.png" Title = "Button Page" ContentTemplate="{DataTemplate pages:ButtonPage}"></ShellContent>
<ShellContent Title = "Semantics Page" ContentTemplate="{DataTemplate pages:SemanticsPage}"></ShellContent>
</FlyoutItem>
<FlyoutItem Title = "Flyout Item 2">
<FlyoutItem Title = "Flyout Item 2" FlyoutDisplayOptions="AsMultipleItems">
<ShellSection Title = "Tab 1">
<ShellContent Icon="calculator.png" Title = "Flyout Gallery" ContentTemplate="{DataTemplate shellPages:ShellChromeGallery}"></ShellContent>
<ShellContent Icon="coffee.png" Title = "Button Page" ContentTemplate="{DataTemplate pages:ButtonPage}"></ShellContent>
Expand Down
16 changes: 10 additions & 6 deletions src/Controls/src/Core/AcceleratorTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@

namespace Microsoft.Maui.Controls
{
/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="Type[@FullName='Microsoft.Maui.Controls.AcceleratorTypeConverter']/Docs/*" />
/// <summary>
/// Class that the XAML parser uses to convert strings to <see cref="Accelerator" /> objects.
/// </summary>
/// <remarks>
/// The given string value may contain a combination of "CTRL", "CMD", "ALT", "SHIFT", "FN", or "WIN",
/// in any combination of upper or lower case letters, as well as any available keys on the platform.
/// The returned <see cref="Accelerator" /> has its <see cref="Accelerator.Modifiers" /> array filled with the specified modifiers,
/// and its <see cref="Accelerator.Keys" /> array filled with the remaining keys.</remarks>
public class AcceleratorTypeConverter : TypeConverter
{
/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='CanConvertFrom']/Docs/*" />
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
=> sourceType == typeof(string);

/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='CanConvertTo']/Docs/*" />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
=> destinationType == typeof(string);

/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='ConvertFrom']/Docs/*" />

public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
var strValue = value?.ToString();
Expand All @@ -26,11 +30,11 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
return Accelerator.FromString(strValue);
}

/// <include file="../../docs/Microsoft.Maui.Controls/AcceleratorTypeConverter.xml" path="//Member[@MemberName='ConvertTo']/Docs/*" />
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (value is not Accelerator acc)
throw new NotSupportedException();

return acc.ToString();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Controls/src/Core/ActivityIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public bool IsRunning
get { return (bool)GetValue(IsRunningProperty); }
set { SetValue(IsRunningProperty, value); }
}
/// <include file="../../docs/Microsoft.Maui.Controls/ActivityIndicator.xml" path="//Member[@MemberName='On']/Docs/*" />

/// <inheritdoc/>
public IPlatformElementConfiguration<T, ActivityIndicator> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ internal void NotifyOfWindowModalEvent(EventArgs eventArgs)
[Obsolete("Properties API is obsolete, use Microsoft.Maui.Storage.Preferences instead.", error: true)]
public Task SavePropertiesAsync() => throw new NotSupportedException("Properties API is obsolete, use Microsoft.Maui.Storage.Preferences instead.");

/// <include file="../../docs/Microsoft.Maui.Controls/Application.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Application> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/BoxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public CornerRadius CornerRadius
set => SetValue(CornerElement.CornerRadiusProperty, value);
}

/// <include file="../../docs/Microsoft.Maui.Controls/BoxView.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, BoxView> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public Button()
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Button>>(() => new PlatformConfigurationRegistry<Button>(this));
}

/// <include file="../../docs/Microsoft.Maui.Controls/Button.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Button> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/CarouselPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CarouselPage()
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<CarouselPage>>(() => new PlatformConfigurationRegistry<CarouselPage>(this));
}

/// <include file="../../docs/Microsoft.Maui.Controls/CarouselPage.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public new IPlatformElementConfiguration<T, CarouselPage> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Cells/Cell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ void OnParentPropertyChanging(object sender, PropertyChangingEventArgs e)
// This creates a nested class to keep track of IElementConfiguration<Cell> because adding
// IElementConfiguration<Cell> to the Cell itself tanks performance on UWP ListViews
// Issue has been logged with UWP
/// <include file="../../../docs/Microsoft.Maui.Controls/Cell.xml" path="//Member[@MemberName='On']/Docs/*" />
public IPlatformElementConfiguration<T, Cell> On<T>() where T : IConfigPlatform
{
return GetElementConfiguration().On<T>();
Expand All @@ -346,6 +345,7 @@ public ElementConfiguration(Cell cell)
new Lazy<PlatformConfigurationRegistry<Cell>>(() => new PlatformConfigurationRegistry<Cell>(cell));
}

/// <inheritdoc/>
public IPlatformElementConfiguration<T, Cell> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected internal override void ChangeVisualState()

public event EventHandler<CheckedChangedEventArgs> CheckedChanged;

/// <include file="../../docs/Microsoft.Maui.Controls/CheckBox.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, CheckBox> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ void ClearPrototype()
if (_prototype != null)
{
var element = _prototype.VirtualView;
element.Handler?.DisconnectHandler();
element?.Handler?.DisconnectHandler();
//_prototype?.Dispose();
//_prototype = null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/DatePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static bool ValidateMinimumDate(BindableObject bindable, object value)
return ((DateTime)value).Date <= ((DatePicker)bindable).MaximumDate.Date;
}

/// <include file="../../docs/Microsoft.Maui.Controls/DatePicker.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, DatePicker> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public Editor()
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Editor>>(() => new PlatformConfigurationRegistry<Editor>(this));
}

/// <include file="../../docs/Microsoft.Maui.Controls/Editor.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Editor> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void SendCompleted()
}
}

/// <include file="../../docs/Microsoft.Maui.Controls/Entry.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Entry> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/FlyoutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public FlyoutPage()

readonly Lazy<PlatformConfigurationRegistry<FlyoutPage>> _platformConfigurationRegistry;

/// <include file="../../docs/Microsoft.Maui.Controls/FlyoutPage.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public new IPlatformElementConfiguration<T, FlyoutPage> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public float CornerRadius

double IBorderElement.BorderWidthDefaultValue => -1d;

/// <include file="../../docs/Microsoft.Maui.Controls/Frame.xml" path="//Member[@MemberName='On']/Docs/*" />
/// <inheritdoc/>
public IPlatformElementConfiguration<T, Frame> On<T>() where T : IConfigPlatform
{
return _platformConfigurationRegistry.Value.On<T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,27 @@ bool IView.IsFocused

Semantics IView.Semantics
{
get => _semantics;
get
{
UpdateSemantics();
return _semantics;
}
}

// We don't want to initialize Semantics until someone explicitly
// wants to modify some aspect of the semantics class
internal Semantics SetupSemantics() =>
void UpdateSemantics()
{
if (!this.IsSet(SemanticProperties.HintProperty) &&
!this.IsSet(SemanticProperties.DescriptionProperty) &&
!this.IsSet(SemanticProperties.HeadingLevelProperty))
{
return;
}

_semantics ??= new Semantics();
_semantics.Description = SemanticProperties.GetDescription(this);
_semantics.HeadingLevel = SemanticProperties.GetHeadingLevel(this);
_semantics.Hint = SemanticProperties.GetHint(this);
}

static double EnsurePositive(double value)
{
Expand Down
20 changes: 19 additions & 1 deletion src/Controls/src/Core/HandlerImpl/VisualElement/VisualElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public partial class VisualElement
[PlatformConfiguration.WindowsSpecific.VisualElement.AccessKeyVerticalOffsetProperty.PropertyName] = MapAccessKeyVerticalOffset,
#endif
[nameof(BackgroundColor)] = MapBackgroundColor,
[nameof(Page.BackgroundImageSource)] = MapBackgroundImageSource
[nameof(Page.BackgroundImageSource)] = MapBackgroundImageSource,
[SemanticProperties.DescriptionProperty.PropertyName] = MapSemanticPropertiesDescriptionProperty,
[SemanticProperties.HintProperty.PropertyName] = MapSemanticPropertiesHintProperty,
[SemanticProperties.HeadingLevelProperty.PropertyName] = MapSemanticPropertiesHeadingLevelProperty,
};

internal static void RemapForControls()
Expand All @@ -34,5 +37,20 @@ public static void MapBackgroundImageSource(IViewHandler handler, IView view)
{
handler.UpdateValue(nameof(Background));
}

static void MapSemanticPropertiesHeadingLevelProperty(IViewHandler handler, IView element) =>
(element as VisualElement)?.UpdateSemanticsFromMapper();

static void MapSemanticPropertiesHintProperty(IViewHandler handler, IView element) =>
(element as VisualElement)?.UpdateSemanticsFromMapper();

static void MapSemanticPropertiesDescriptionProperty(IViewHandler handler, IView element) =>
(element as VisualElement)?.UpdateSemanticsFromMapper();

void UpdateSemanticsFromMapper()
{
UpdateSemantics();
Handler?.UpdateValue(nameof(IView.Semantics));
}
}
}
Loading

0 comments on commit 6ac46c1

Please sign in to comment.