Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved IPlatformServices.GetNamedSize into a separate service #4570

Merged
merged 5 commits into from
Feb 11, 2022

Conversation

mattleibow
Copy link
Member

Description of Change

This will be removed eventually, but we need to first clear up the old Device and Forns.Init things - and that means removing the IPlatformServices interface.

This PR moves the implementation into a compatibility dependency service so that they are not only decoupled, but the logic is clearly compatibility. This API might be useful still, so we don't remove it. And, at a later date, we can merge this or similar into Core.

Implements #1965
Fixes #3948

Additions made

  • Adds IFontNamedSizeService
  • Removes IPlatformServices.GetNamedSize

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the WinUI, Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

  • Does this PR introduce a new control? (If yes, add an example using SemanticProperties to the SemanticsPage)
  • APIs that modify focusability?
  • APIs that modify any text property on a control?
  • Does this PR modify view nesting or view arrangement in anyway?
  • Is there the smallest possibility that your PR will change accessibility?
  • I'm not sure, please help me

If any of the above checkboxes apply to your PR, then the PR will need to provide testing to demonstrate that accessibility still works.

This will be removed eventiallu, but we need to firstclear up the old Device and Forns.Init things and that means removing the IPlatformServices interface.
@mattleibow mattleibow self-assigned this Feb 8, 2022
@mattleibow mattleibow added this to the 6.0.300-preview.14 milestone Feb 8, 2022
# Conflicts:
#	src/Compatibility/Core/src/Android/Forms.cs
#	src/Compatibility/Core/src/Windows/WindowsPlatformServices.cs
#	src/Compatibility/Core/src/iOS/Forms.cs
#	src/Controls/tests/Core.UnitTests/MockPlatformServices.cs
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Platform;

[assembly: Microsoft.Maui.Controls.Dependency(typeof(Microsoft.Maui.Controls.Compatibility.Platform.UWP.FontNamedSizeService))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were we trying to avoid assembly attributes for dependency declarations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are, but for tests, this is how it is still used. For normal apps, it is registered and locked as part of the build with an explicit registration.

I am doing this now so I can reduce the churn on the test code. In another PR I will remove these attributes altogether and have each test register the required services.

But in order for that to work, we need to get rid of the Device's reliance on IPlatformServices. Also, this is just living in compatibility.

@mattleibow mattleibow enabled auto-merge (squash) February 10, 2022 01:36
@mattleibow mattleibow merged commit 6553547 into main Feb 11, 2022
@mattleibow mattleibow deleted the dev/named-size branch February 11, 2022 22:49
@samhouts samhouts added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Aug 28, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

GetNamedSize - remove
3 participants