From 7480915ea9d7d9ba8c744f8d52cf2cdfaa1fb876 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 10:33:19 +0100 Subject: [PATCH 01/10] [create-pull-request] automated change (#10030) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../Controls.Sample/Pages/Core/BorderGalleries/BorderPage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controls/samples/Controls.Sample/Pages/Core/BorderGalleries/BorderPage.cs b/src/Controls/samples/Controls.Sample/Pages/Core/BorderGalleries/BorderPage.cs index 543d74ecb547..85814641f934 100644 --- a/src/Controls/samples/Controls.Sample/Pages/Core/BorderGalleries/BorderPage.cs +++ b/src/Controls/samples/Controls.Sample/Pages/Core/BorderGalleries/BorderPage.cs @@ -12,7 +12,7 @@ public BorderPage() var descriptionLabel = new Label { Text = "Border Galleries", Margin = new Thickness(2, 2, 2, 2) }; - Title = "Border Galleries"; + Title = "Border Galleries"; Content = new ScrollView { @@ -26,7 +26,7 @@ public BorderPage() GalleryBuilder.NavButton("Border using styles", () => new BorderStyles(), Navigation), } -} + } }; } } From 99119a971f1fa1bceca9dc53908a279ceb552fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Mon, 12 Sep 2022 12:36:58 +0200 Subject: [PATCH 02/10] [Core] Fix ImageButton IsLoading property (#9917) Fixes #9073 * Fix ImageButton IsLoading property * Added device tests --- .../Pages/Controls/ImageButtonPage.xaml | 3 + .../Pages/Controls/ImageButtonPage.xaml.cs | 6 ++ .../ImageButton/ImageButton.Impl.cs | 10 +-- .../ImageButtonHandlerTests.Android.cs | 3 + .../ImageButton/ImageButtonHandlerTests.cs | 63 +++++++++++++++++++ .../ImageButtonHandlerTests.iOS.cs | 3 + .../DeviceTests/Stubs/ImageButtonStub.cs | 2 - 7 files changed, 83 insertions(+), 7 deletions(-) diff --git a/src/Controls/samples/Controls.Sample/Pages/Controls/ImageButtonPage.xaml b/src/Controls/samples/Controls.Sample/Pages/Controls/ImageButtonPage.xaml index 2ab793d61210..1fd848fd5df4 100644 --- a/src/Controls/samples/Controls.Sample/Pages/Controls/ImageButtonPage.xaml +++ b/src/Controls/samples/Controls.Sample/Pages/Controls/ImageButtonPage.xaml @@ -13,6 +13,7 @@ Text="AspectFit" Style="{StaticResource Headline}"/> + { + if (e.PropertyName == ImageButton.IsLoadingProperty.PropertyName) + Debug.WriteLine($"{e.PropertyName}: {ImageButton01.IsLoading}"); + }; } void OnImageButtonClicked(object sender, EventArgs e) diff --git a/src/Controls/src/Core/HandlerImpl/ImageButton/ImageButton.Impl.cs b/src/Controls/src/Core/HandlerImpl/ImageButton/ImageButton.Impl.cs index 2d6db98028e4..79e9413cbea5 100644 --- a/src/Controls/src/Core/HandlerImpl/ImageButton/ImageButton.Impl.cs +++ b/src/Controls/src/Core/HandlerImpl/ImageButton/ImageButton.Impl.cs @@ -1,14 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.Maui.Graphics; +using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls { /// public partial class ImageButton : IImageButton { - void IImageSourcePart.UpdateIsLoading(bool isLoading) { } + void IImageSourcePart.UpdateIsLoading(bool isLoading) + { + ((IImageController)this)?.SetIsLoading(isLoading); + } bool IImageSourcePart.IsAnimationPlaying => false; diff --git a/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.Android.cs b/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.Android.cs index 06f22548f09f..a12eaf6a8a6b 100644 --- a/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.Android.cs +++ b/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.Android.cs @@ -53,5 +53,8 @@ Task ValidateHasColor(IImageButton imageButton, Color color, Action action = nul platformImageButton.AssertContainsColor(color); }); } + + bool ImageSourceLoaded(ImageButtonHandler imageButtonHandler) => + imageButtonHandler.PlatformView.Drawable != null; } } \ No newline at end of file diff --git a/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.cs b/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.cs index aa3f6f4e4d08..dfedd49636de 100644 --- a/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.cs +++ b/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.cs @@ -32,6 +32,69 @@ public async Task ClickEventFires() Assert.True(clicked); } + [Theory(DisplayName = "ImageSource Initializes Correctly")] + [InlineData("red.png", "#FF0000")] + [InlineData("green.png", "#00FF00")] + [InlineData("black.png", "#000000")] + public async Task ImageSourceInitializesCorrectly(string filename, string colorHex) + { + var imageButton = new ImageButtonStub + { + Background = new SolidPaintStub(Colors.Black), + ImageSource = new FileImageSourceStub(filename), + }; + + var order = new List(); + + await InvokeOnMainThreadAsync(async () => + { + var handler = CreateHandler(imageButton); + + bool imageLoaded = await Wait(() => ImageSourceLoaded(handler)); + + Assert.True(imageLoaded); + var expectedColor = Color.FromArgb(colorHex); + await handler.PlatformView.AssertContainsColor(expectedColor); + }); + } + + [Fact(DisplayName = "LoadingCompleted event fires")] + public async Task LoadingCompletedEventFires() + { + bool loadingStarted = false; + bool loadingCompleted = false; + + var imageButton = new ImageButtonStub + { + Background = new SolidPaintStub(Colors.Black), + ImageSource = new FileImageSourceStub("red.png"), + }; + + imageButton.LoadingStarted += delegate + { + loadingStarted = true; + }; + + imageButton.LoadingCompleted += delegate + { + loadingCompleted = true; + }; + + var order = new List(); + + await InvokeOnMainThreadAsync(async () => + { + var handler = CreateHandler(imageButton); + + bool imageLoaded = await Wait(() => ImageSourceLoaded(handler)); + + Assert.True(imageLoaded); + }); + + Assert.True(loadingStarted); + Assert.True(loadingCompleted); + } + [Theory(DisplayName = "Padding Initializes Correctly")] [InlineData(0, 0, 0, 0)] [InlineData(1, 1, 1, 1)] diff --git a/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.iOS.cs b/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.iOS.cs index fd5d64a63146..3c142cad853f 100644 --- a/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.iOS.cs +++ b/src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.iOS.cs @@ -63,5 +63,8 @@ Task PerformClick(IImageButton button) UIEdgeInsets GetNativePadding(ImageButtonHandler imageButtonHandler) => GetPlatformImageButton(imageButtonHandler).ContentEdgeInsets; + + bool ImageSourceLoaded(ImageButtonHandler imageButtonHandler) => + imageButtonHandler.PlatformView.ImageView.Image != null; } } \ No newline at end of file diff --git a/src/Core/tests/DeviceTests/Stubs/ImageButtonStub.cs b/src/Core/tests/DeviceTests/Stubs/ImageButtonStub.cs index de23cdd3138a..dcd56c0e72f1 100644 --- a/src/Core/tests/DeviceTests/Stubs/ImageButtonStub.cs +++ b/src/Core/tests/DeviceTests/Stubs/ImageButtonStub.cs @@ -1,6 +1,4 @@ using System; -using System.Threading.Tasks; -using Microsoft.Maui.Graphics; namespace Microsoft.Maui.DeviceTests.Stubs { From b1b12e83a624e157207893609ac58d32dec72e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Mon, 12 Sep 2022 12:43:55 +0200 Subject: [PATCH 03/10] Fix rendering using WebView without Source on Android (#9916) Fixes #9392 --- src/Core/src/Platform/Android/WebViewExtensions.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Core/src/Platform/Android/WebViewExtensions.cs b/src/Core/src/Platform/Android/WebViewExtensions.cs index 34214c9f18ad..31e8642aae82 100644 --- a/src/Core/src/Platform/Android/WebViewExtensions.cs +++ b/src/Core/src/Platform/Android/WebViewExtensions.cs @@ -14,12 +14,19 @@ public static void UpdateSource(this AWebView platformWebView, IWebView webView) public static void UpdateSource(this AWebView platformWebView, IWebView webView, IWebViewDelegate? webViewDelegate) { - if (webViewDelegate != null) + IWebViewSource? source = webView.Source; + + if (source != null) { - webView.Source?.Load(webViewDelegate); + if (webViewDelegate != null) + { + source.Load(webViewDelegate); - platformWebView.UpdateCanGoBackForward(webView); + platformWebView.UpdateCanGoBackForward(webView); + } } + else + platformWebView.LoadUrl("about:blank"); } public static void UpdateSettings(this AWebView platformWebView, IWebView webView, bool javaScriptEnabled, bool domStorageEnabled) From f2a921138802f0a37cecb764eb26217a0f1f4851 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:58:19 +0100 Subject: [PATCH 04/10] Update dependencies from https://github.com/xamarin/xamarin-macios build 20220909.2 (#10018) Microsoft.iOS.Sdk , Microsoft.MacCatalyst.Sdk , Microsoft.macOS.Sdk , Microsoft.tvOS.Sdk From Version 15.4.454 -> To Version 15.4.455 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b65fb483b466..a691e8964c9f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -12,21 +12,21 @@ https://github.com/xamarin/xamarin-android 04623cdc317c3da5efce46cb16d94befe4833125 - + https://github.com/xamarin/xamarin-macios - 4bd34d034c8c5a4e092c8bd3c8868153d94277b4 + 9ed77490baef852ec98513d2b791884b0242715e - + https://github.com/xamarin/xamarin-macios - 4bd34d034c8c5a4e092c8bd3c8868153d94277b4 + 9ed77490baef852ec98513d2b791884b0242715e - + https://github.com/xamarin/xamarin-macios - 4bd34d034c8c5a4e092c8bd3c8868153d94277b4 + 9ed77490baef852ec98513d2b791884b0242715e - + https://github.com/xamarin/xamarin-macios - 4bd34d034c8c5a4e092c8bd3c8868153d94277b4 + 9ed77490baef852ec98513d2b791884b0242715e https://github.com/dotnet/emsdk diff --git a/eng/Versions.props b/eng/Versions.props index e1784c7c9b7a..7776fd95c354 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,10 +11,10 @@ 32.0.468 - 15.4.454 - 15.4.454 - 12.3.454 - 15.4.454 + 15.4.455 + 15.4.455 + 12.3.455 + 15.4.455 7.0.400-preview.1.0 From 189c07180d849993bf1979ed295104e9800bb187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez?= Date: Mon, 12 Sep 2022 13:01:58 +0200 Subject: [PATCH 05/10] Align GraphicsView Background behavior between platforms (#9944) Fixes #9740 --- .../Platform/iOS/PlatformTouchGraphicsView.cs | 57 ++++++++++--------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/Core/src/Platform/iOS/PlatformTouchGraphicsView.cs b/src/Core/src/Platform/iOS/PlatformTouchGraphicsView.cs index 34dc4ef8b0b3..990f6bb52e27 100644 --- a/src/Core/src/Platform/iOS/PlatformTouchGraphicsView.cs +++ b/src/Core/src/Platform/iOS/PlatformTouchGraphicsView.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Foundation; using Microsoft.Maui.Graphics; using Microsoft.Maui.Graphics.Platform; @@ -10,45 +8,52 @@ namespace Microsoft.Maui.Platform { public class PlatformTouchGraphicsView : PlatformGraphicsView { + IGraphicsView? _graphicsView; + UIHoverGestureRecognizer? _hoverGesture; + RectF _rect; + bool _pressedContained = false; - IGraphicsView? graphicsView; - UIHoverGestureRecognizer? hoverGesture; - RectF rect; - bool pressedContained = false; + public PlatformTouchGraphicsView() + { + Opaque = false; + BackgroundColor = null; + } public override void LayoutSubviews() { base.LayoutSubviews(); - rect = this.Bounds.AsRectangleF(); + _rect = Bounds.AsRectangleF(); } public void Connect(IGraphicsView graphicsView) { - this.graphicsView = graphicsView; + _graphicsView = graphicsView; + if (OperatingSystem.IsIOSVersionAtLeast(13)) - AddGestureRecognizer(hoverGesture = new UIHoverGestureRecognizer(OnHover)); + AddGestureRecognizer(_hoverGesture = new UIHoverGestureRecognizer(OnHover)); } + public void Disconnect() { - RemoveGestureRecognizer(hoverGesture!); - hoverGesture = null; - graphicsView = null; + RemoveGestureRecognizer(_hoverGesture!); + _hoverGesture = null; + _graphicsView = null; } void OnHover() { - if (hoverGesture!.State == UIGestureRecognizerState.Began) + if (_hoverGesture!.State == UIGestureRecognizerState.Began) { - var touch = hoverGesture.LocationInView(this); - graphicsView?.StartHoverInteraction(new[] { (PointF)touch.ToPoint() }); + var touch = _hoverGesture.LocationInView(this); + _graphicsView?.StartHoverInteraction(new[] { (PointF)touch.ToPoint() }); } - else if (hoverGesture.State == UIGestureRecognizerState.Changed) + else if (_hoverGesture.State == UIGestureRecognizerState.Changed) { - var touch = hoverGesture.LocationInView(this); - graphicsView?.MoveHoverInteraction(new[] { (PointF)touch.ToPoint() }); + var touch = _hoverGesture.LocationInView(this); + _graphicsView?.MoveHoverInteraction(new[] { (PointF)touch.ToPoint() }); } else - graphicsView?.EndHoverInteraction(); + _graphicsView?.EndHoverInteraction(); } public override void TouchesBegan(NSSet touches, UIEvent? evt) @@ -56,23 +61,23 @@ public override void TouchesBegan(NSSet touches, UIEvent? evt) if (!IsFirstResponder) BecomeFirstResponder(); var viewPoints = this.GetPointsInView(evt); - graphicsView?.StartInteraction(viewPoints); - pressedContained = true; + _graphicsView?.StartInteraction(viewPoints); + _pressedContained = true; } public override void TouchesMoved(NSSet touches, UIEvent? evt) { var viewPoints = this.GetPointsInView(evt); - pressedContained = rect.ContainsAny(viewPoints); - graphicsView?.DragInteraction(viewPoints); + _pressedContained = _rect.ContainsAny(viewPoints); + _graphicsView?.DragInteraction(viewPoints); } public override void TouchesEnded(NSSet touches, UIEvent? evt) => - graphicsView?.EndInteraction(this.GetPointsInView(evt), pressedContained); + _graphicsView?.EndInteraction(this.GetPointsInView(evt), _pressedContained); public override void TouchesCancelled(NSSet touches, UIEvent? evt) { - pressedContained = false; - graphicsView?.CancelInteraction(); + _pressedContained = false; + _graphicsView?.CancelInteraction(); } } } From 1ec2a2cf603b5d54e4cfe7fa45089d98c4d21842 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 12:05:58 +0100 Subject: [PATCH 06/10] Bump Xamarin.Google.Crypto.Tink.Android from 1.6.1.7 to 1.7.0 (#9845) Bumps [Xamarin.Google.Crypto.Tink.Android](https://github.com/xamarin/AndroidX) from 1.6.1.7 to 1.7.0. - [Release notes](https://github.com/xamarin/AndroidX/releases) - [Commits](https://github.com/xamarin/AndroidX/commits/20220705-stable-updates-kotlin-1.7.0) --- updated-dependencies: - dependency-name: Xamarin.Google.Crypto.Tink.Android dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 2fab99191f8b..89a85ba05d77 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -47,7 +47,7 @@ <_XamarinAndroidGlideVersion>4.13.2.2 <_XamarinAndroidXSecurityVersion>1.1.0-alpha03 - <_XamarinGoogleCryptoTinkAndroidVersion>1.6.1.7 + <_XamarinGoogleCryptoTinkAndroidVersion>1.7.0 117.0.0 32.0.468 - 15.4.455 - 15.4.455 - 12.3.455 - 15.4.455 + 15.4.454 + 15.4.454 + 12.3.454 + 15.4.454 7.0.400-preview.1.0 From 79e8c79520770b7f994b6fad212029b64ef95a1d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 23:59:46 +0200 Subject: [PATCH 10/10] Update dependencies from https://github.com/dotnet/xharness build 20220906.1 (#9990) Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 1.0.0-prerelease.22451.1 -> To Version 1.0.0-prerelease.22456.1 Co-authored-by: dotnet-maestro[bot] Co-authored-by: Rui Marinho --- .config/dotnet-tools.json | 2 +- eng/Version.Details.xml | 12 ++++++------ eng/Versions.props | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index ca80c586f08f..05d0b0c4a0af 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "1.0.0-prerelease.22451.1", + "version": "1.0.0-prerelease.22456.1", "commands": [ "xharness" ] diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f85ed2f668ee..437e8e0d3194 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -75,17 +75,17 @@ https://github.com/dotnet/Microsoft.Maui.Graphics 015c4cd2d4ce120e516d75601ef5e80004b141a7 - + https://github.com/dotnet/xharness - 919daad8a314e5b0e16f15db62352c367a306c85 + 55e8420fb913c035522bbb30e28d4fd7181ecd69 - + https://github.com/dotnet/xharness - 919daad8a314e5b0e16f15db62352c367a306c85 + 55e8420fb913c035522bbb30e28d4fd7181ecd69 - + https://github.com/dotnet/xharness - 919daad8a314e5b0e16f15db62352c367a306c85 + 55e8420fb913c035522bbb30e28d4fd7181ecd69 diff --git a/eng/Versions.props b/eng/Versions.props index 89a85ba05d77..33fb7b398d98 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -60,9 +60,9 @@ <_HarfBuzzSharpVersion>2.8.2.2 <_SkiaSharpNativeAssetsVersion>0.0.0-commit.193b587552cb0ed39372a049d7e6c692db98c267.483 7.0.100-preview.5.22226.1 - 1.0.0-prerelease.22451.1 - 1.0.0-prerelease.22451.1 - 1.0.0-prerelease.22451.1 + 1.0.0-prerelease.22456.1 + 1.0.0-prerelease.22456.1 + 1.0.0-prerelease.22456.1 0.9.0 0.5.13 1.2.0