-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make Device.Idiom and Device.RuntimePlatform use Essentials #4548
Conversation
public static TargetIdiom Idiom | ||
{ | ||
get | ||
{ | ||
var idiom = DeviceInfo.Idiom; | ||
if (idiom == DeviceIdiom.Tablet) | ||
return TargetIdiom.Tablet; | ||
if (idiom == DeviceIdiom.Phone) | ||
return TargetIdiom.Phone; | ||
if (idiom == DeviceIdiom.Desktop) | ||
return TargetIdiom.Desktop; | ||
if (idiom == DeviceIdiom.TV) | ||
return TargetIdiom.TV; | ||
if (idiom == DeviceIdiom.Watch) | ||
return TargetIdiom.Watch; | ||
return TargetIdiom.Unsupported; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically not very extensible, but in reality, this API needs to be obsoleted. I'll do that in another PR because that will involve many code changes. #4549
@@ -152,7 +152,6 @@ Task("dotnet-test") | |||
"**/Core.UnitTests.csproj", | |||
"**/Essentials.UnitTests.csproj", | |||
"**/Resizetizer.UnitTests.csproj", | |||
"**/Controls.Sample.Tests.csproj" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved these tests into Controls.Core.UnitTests.csproj
since that is all it really was.
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Description of Change
This PR makes the
Device.Idiom
property get the value from Essentials instead ofIPlatformServices
.Swapping out of this feature for testing can now be done in essentials using the
DeviceInfo.SetCurrent(IDeviceInfo)
member.Additions made
Device.SetIdiom
andDevice.SetTargetIdiom
IPlatformServices.RuntimePlatform
Device.Idiom
now just returnsDeviceInfo.Idiom
Device.RuntimePlatform
now just returnsDeviceInfo.Platform
MockDeviceInfo
for unit testingPR Checklist
Does this PR touch anything that might affect accessibility?
If any of the above checkboxes apply to your PR, then the PR will need to provide testing to demonstrate that accessibility still works.