Skip to content

Commit

Permalink
Merge branch 'copy-main' into merge-net7
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarinho authored Nov 11, 2022
2 parents e78fa1e + b2c66e4 commit bb996a9
Show file tree
Hide file tree
Showing 17 changed files with 80 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
This project has adopted the code of conduct defined by the Contributor Covenant
to clarify expected behavior in our community.

For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/about/policies/code-of-conduct).
Binary file added Assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<MicrosoftAspNetCoreMetadataPackageVersion>7.0.0</MicrosoftAspNetCoreMetadataPackageVersion>
<MicrosoftJSInteropPackageVersion>7.0.0</MicrosoftJSInteropPackageVersion>
<!-- Other packages -->
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0-preview1.22553.2</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0-preview1.22559.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisPublicApiAnalyzersVersion>3.3.3</MicrosoftCodeAnalysisPublicApiAnalyzersVersion>
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.3.3</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
<SystemNumericsVectorsVersion>4.5.0</SystemNumericsVectorsVersion>
Expand Down
15 changes: 13 additions & 2 deletions src/Controls/Foldable/src/Controls.Foldable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
<AssemblyName>Microsoft.Maui.Controls.Foldable</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Foldable</RootNamespace>
<WarningsNotAsErrors>BI1234</WarningsNotAsErrors>
<IsPackable>true</IsPackable>
<IsTrimmable>false</IsTrimmable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<!-- TODO: remove this when Foldable is made into a nupkg -->
<UseMaui Condition=" '$(UseWorkload)' == 'true' ">true</UseMaui>

<!-- Add specifics for this NuGet -->
<IsPackable>True</IsPackable>
<RepositoryType>git</RepositoryType>
<PackageTags>dotnet-maui;maui;foldable;android;surface-duo</PackageTags>
<Title>.NET MAUI Foldable</Title>
<Description>.NET MAUI Foldable provides additional APIs to better support foldable mobile devices.</Description>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />
<ItemGroup Condition=" '$(UseMaui)' != 'true' ">
Expand All @@ -31,4 +37,9 @@
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' ">
<PackageReference Include="Xamarin.AndroidX.Window.WindowJava" />
</ItemGroup>

<!-- Add icon for NuGet -->
<ItemGroup>
<None Include="..\..\..\..\Assets\icon.png" PackagePath="icon.png" Pack="true" />
</ItemGroup>
</Project>
15 changes: 13 additions & 2 deletions src/Controls/Maps/src/Controls.Maps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<AssemblyName>Microsoft.Maui.Controls.Maps</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Maps</RootNamespace>
<IsPackable>true</IsPackable>
<IsTrimmable>false</IsTrimmable>
<Nullable>enable</Nullable>
<_MauiDesignDllBuild Condition=" '$(OS)' != 'Unix' ">True</_MauiDesignDllBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;RS0041;RS0026;RS0027;RS0022</NoWarn>

<!-- Add specifics for this NuGet -->
<IsPackable>True</IsPackable>
<RepositoryType>git</RepositoryType>
<PackageTags>dotnet-maui;maui;maps;map;ios;android;macos</PackageTags>
<Title>.NET MAUI Maps</Title>
<Description>.NET MAUI Maps provides a map control for .NET MAUI apps.</Description>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
Expand All @@ -19,5 +26,9 @@
</ItemGroup>

<Import Project="$(MauiSrcDirectory)PublicAPI.targets" />


<!-- Add icon for NuGet -->
<ItemGroup>
<None Include="..\..\..\..\Assets\icon.png" PackagePath="icon.png" Pack="true" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Controls/src/Core.Design/Controls.Core.Design.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Compile Include="LinearItemsLayoutDesignTypeConverter.cs" />
<Compile Include="FontSizeDesignTypeConverter.cs" />
<Compile Include="FlexEnumDesignTypeConverters.cs" />
<PackageReference Include="Microsoft.VisualStudio.DesignTools.Extensibility" Version="17.3.32804.24" />
<PackageReference Include="Microsoft.VisualStudio.DesignTools.Extensibility" Version="17.4.33103.184" />
</ItemGroup>
<!-- The IDE will look for a top level assembly resource called 'Microsoft.Maui.toolbox.xml' to -->
<!-- load the toolbox metadata from. -->
Expand Down
4 changes: 2 additions & 2 deletions src/Controls/src/Core/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public partial class Entry : InputView, IFontElement, ITextAlignmentElement, IEn
public static readonly BindableProperty SelectionLengthProperty = BindableProperty.Create(nameof(SelectionLength), typeof(int), typeof(Entry), 0, validateValue: (b, v) => (int)v >= 0);

/// <summary>
/// Backing store for the <see cref="SelectionLength"/> property.
/// Backing store for the <see cref="ClearButtonVisibility"/> property.
/// </summary>
public static readonly BindableProperty ClearButtonVisibilityProperty = BindableProperty.Create(nameof(SelectionLength), typeof(ClearButtonVisibility), typeof(Entry), ClearButtonVisibility.Never);
public static readonly BindableProperty ClearButtonVisibilityProperty = BindableProperty.Create(nameof(ClearButtonVisibility), typeof(ClearButtonVisibility), typeof(Entry), ClearButtonVisibility.Never);

readonly Lazy<PlatformConfigurationRegistry<Entry>> _platformConfigurationRegistry;

Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Xaml.Design/Controls.Xaml.Design.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RegisterMetadata.cs" />
<PackageReference Include="Microsoft.VisualStudio.DesignTools.Extensibility">
<Version>17.3.32804.24</Version>
<Version>17.4.33103.184</Version>
</PackageReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.DesignTools.Extensibility" Version="17.3.32804.24" />
<PackageReference Include="Microsoft.VisualStudio.DesignTools.Extensibility" Version="17.4.33103.184" />
<ProjectReference Include="..\..\src\Core.Design\Controls.Core.Design.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
14 changes: 13 additions & 1 deletion src/Core/maps/src/Maps.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
<RootNamespace>Microsoft.Maui.Maps</RootNamespace>
<AssemblyName>Microsoft.Maui.Maps</AssemblyName>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<IsTrimmable>false</IsTrimmable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591;RS0041;RS0026;RS0027</NoWarn>

<!-- Add specifics for this NuGet -->
<IsPackable>True</IsPackable>
<RepositoryType>git</RepositoryType>
<PackageTags>dotnet-maui;maui;maps;map;ios;android;macos</PackageTags>
<Title>.NET MAUI Maps Core</Title>
<Description>.NET MAUI Maps provides a map control for .NET MAUI apps. This only contains the core types. If you want the Map control, please install the Microsoft.Maui.Controls.Maps package.</Description>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />
Expand All @@ -29,4 +36,9 @@
</ItemGroup>

<Import Project="$(MauiSrcDirectory)PublicAPI.targets" />

<!-- Add icon for NuGet -->
<ItemGroup>
<None Include="..\..\..\..\Assets\icon.png" PackagePath="icon.png" Pack="true" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions src/Core/src/Handlers/Switch/SwitchHandler.iOS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Microsoft.Maui.Graphics;
using ObjCRuntime;
using UIKit;
using RectangleF = CoreGraphics.CGRect;
Expand All @@ -7,6 +8,12 @@ namespace Microsoft.Maui.Handlers
{
public partial class SwitchHandler : ViewHandler<ISwitch, UISwitch>
{
// the UISwitch control becomes inaccessible if it grows to a width > 101
// An issue has been logged with Apple
// This ensures that the UISwitch remains the natural size that iOS expects
// But the container can be used for setting BGColors and other features.
public override bool NeedsContainer => true;

protected override UISwitch CreatePlatformView()
{
return new UISwitch(RectangleF.Empty);
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ override Microsoft.Maui.Handlers.ScrollViewHandler.PlatformArrange(Microsoft.Mau
override Microsoft.Maui.Handlers.MenuFlyoutSeparatorHandler.CreatePlatformElement() -> UIKit.UIMenu!
override Microsoft.Maui.Handlers.EditorHandler.SetVirtualView(Microsoft.Maui.IView! view) -> void
override Microsoft.Maui.Handlers.EntryHandler.SetVirtualView(Microsoft.Maui.IView! view) -> void
override Microsoft.Maui.Handlers.SwitchHandler.NeedsContainer.get -> bool
override Microsoft.Maui.Handlers.WindowHandler.ConnectHandler(UIKit.UIWindow! platformView) -> void
override Microsoft.Maui.Platform.ContentView.SetNeedsLayout() -> void
override Microsoft.Maui.Platform.LayoutView.HitTest(CoreGraphics.CGPoint point, UIKit.UIEvent? uievent) -> UIKit.UIView!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ override Microsoft.Maui.Handlers.ScrollViewHandler.PlatformArrange(Microsoft.Mau
override Microsoft.Maui.Handlers.MenuFlyoutSeparatorHandler.CreatePlatformElement() -> UIKit.UIMenu!
override Microsoft.Maui.Handlers.EditorHandler.SetVirtualView(Microsoft.Maui.IView! view) -> void
override Microsoft.Maui.Handlers.EntryHandler.SetVirtualView(Microsoft.Maui.IView! view) -> void
override Microsoft.Maui.Handlers.SwitchHandler.NeedsContainer.get -> bool
override Microsoft.Maui.Handlers.WindowHandler.ConnectHandler(UIKit.UIWindow! platformView) -> void
override Microsoft.Maui.Platform.ContentView.SetNeedsLayout() -> void
override Microsoft.Maui.Platform.LayoutView.HitTest(CoreGraphics.CGPoint point, UIKit.UIEvent? uievent) -> UIKit.UIView!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected Task<CATransform3D> GetLayerTransformAsync(TStub view)
}

protected CATransform3D GetLayerTransform(IViewHandler viewHandler) =>
((UIView)viewHandler.PlatformView).Layer.Transform;
((UIView)viewHandler.ToPlatform()).Layer.Transform;

protected string GetAutomationId(IViewHandler viewHandler) =>
((UIView)viewHandler.PlatformView).AccessibilityIdentifier;
Expand Down Expand Up @@ -190,7 +190,7 @@ protected Maui.Graphics.Rect GetBoundingBox(IViewHandler viewHandler) =>
viewHandler.VirtualView.ToPlatform().GetBoundingBox();

protected System.Numerics.Matrix4x4 GetViewTransform(IViewHandler viewHandler) =>
((UIView)viewHandler.PlatformView).GetViewTransform();
((UIView)viewHandler.ToPlatform()).GetViewTransform();

protected string GetSemanticDescription(IViewHandler viewHandler) =>
GetAccessiblePlatformView(viewHandler).AccessibilityLabel;
Expand All @@ -203,11 +203,11 @@ protected SemanticHeadingLevel GetSemanticHeading(IViewHandler viewHandler) =>
? SemanticHeadingLevel.Level1 : SemanticHeadingLevel.None;

protected nfloat GetOpacity(IViewHandler viewHandler) =>
((UIView)viewHandler.PlatformView).Alpha;
((UIView)viewHandler.ToPlatform()).Alpha;

protected Visibility GetVisibility(IViewHandler viewHandler)
{
var platformView = (UIView)viewHandler.PlatformView;
var platformView = (UIView)viewHandler.ToPlatform();

foreach (var constraint in platformView.Constraints)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.Maui.DeviceTests.Stubs;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
using ObjCRuntime;
Expand Down Expand Up @@ -42,5 +43,24 @@ async Task ValidateThumbColor(ISwitch switchStub, Color color, Action action = n

Assert.Equal(expected, color);
}

/// <summary>
/// If a UISwitch grows beyond 101 pixels it's no longer
/// clickable via Voice Over
/// </summary>
/// <returns></returns>
[Fact(DisplayName = "Ensure UISwitch Stays Below 101 Width")]
public async Task EnsureUISwitchStaysBelow101Width()
{
var switchStub = new SwitchStub()
{
Width = 400,
Height = 400
};

var width = await GetValueAsync(switchStub, handler => GetNativeSwitch(handler).Bounds.Width);

Assert.True(width < 100, $"UISwitch width is too much {width}");
}
}
}
2 changes: 1 addition & 1 deletion src/Essentials/src/DeviceInfo/DeviceInfo.uwp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public DeviceType DeviceType
static bool GetIsInTabletMode()
{
var supportsTablet = GetSystemMetrics(SM_TABLETPC) != 0;
var inTabletMode = GetSystemMetrics(SM_CONVERTIBLESLATEMODE) != 0;
var inTabletMode = GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0;
return inTabletMode && supportsTablet;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Essentials/src/Screenshot/Screenshot.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public interface IScreenshotResult
Task<Stream> OpenReadAsync(ScreenshotFormat format = ScreenshotFormat.Png, int quality = 100);
#pragma warning restore CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)

/// <include file="../../docs/Microsoft.Maui.Essentials/IScreenshotResult.xml" path="//Member[@MemberName='CopyToAsync']/Docs/*" />
Task CopyToAsync(Stream destination, ScreenshotFormat format = ScreenshotFormat.Png, int quality = 100);
}

Expand Down

0 comments on commit bb996a9

Please sign in to comment.