-
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
Explore using System.OperatingSystem for API checks #461
Comments
Not only that, the new APIs are linker friendly and will remove impossible code paths. This is probably something we should do sooner than later for linker things - such as app size. @jonathanpeppers I know you are working on linker things and trimming fixes, have you seen many cases of actual places to benefit? |
Yes, supposedly if you have something like: if (OperatingSystem.IsAndroidAtLeast(24))
{
//New APIs
}
else
{
//Old APIs
} If your app has We've got to get all the assemblies trimmable first, though. Otherwise, the linker doesn't trim any Maui assemblies. Also we can avoid some JNI calls, if we don't use |
We need to verify the minimum versions for each platform. Probably 10 for iOS? |
I didn't see the APIs but this sounds like the duplicated effort. There are APIs and tooling included in .NET nowadays that help developers to work with platform-specific APIs, including versioning support on the same platform. You can read about it for example at https://github.com/dotnet/designs/blob/main/accepted/2020/platform-checks/platform-checks.md |
@marek-safar The point of this issue is to have MAUI use the APIs discussed in the doc you linked. |
@jonathanpeppers you may have already done most (if not all) of this work for Android already? I'm working on some related changes for iOS so I'll add myself to this for now. |
@pjcollins yes, Android should be good after we got: 34e83cf Might be worth checking if any new usage of |
Context: dotnet#461 Checks for macOS High Sierra 10.13 and lower have been removed. The macOS Mojave check has been updated to use `IsMacCatalystVersionAtLeast` or `IsMacOSVersionAtLeast`. Some other checks for iOS 10 and lower have also been removed as they should not be needed.
Context: dotnet#461 Checks for macOS High Sierra 10.13 and lower have been removed. The macOS Mojave check has been updated to use `IsMacOSVersionAtLeast`. Some other checks for iOS 10 and lower have also been removed as they should not be needed.
Fixes: dotnet#461 Commit 158ffbd accidentially introduced what was likely a breaking change in `Platform.ios.tvos.watchos.HasOSVersion`. The call to `UIDevice.CurrentDevice.CheckSystemVersion` was replaced by `OperatingSystem.IsIOSVersionAtLeast`, however this function was used on platforms other than iOS. Fix this oversight by removing `HasOSVersion` entirely, and use the correct `Is$(Platform)VersionAtLeast` variant at all call sites instead.
Context: #461 Checks for macOS High Sierra 10.13 and lower have been removed. The macOS Mojave check has been updated to use `IsMacOSVersionAtLeast`. Some other checks for iOS 10 and lower have also been removed as they should not be needed.
We've created some nicer APIs for checking for API levels, OS versions, and API support in MAUI. But those are ported from our Forms APIs. It's possible we should be leveraging System.OperatingSystem, and that NativeVersion should be wrapping the stuff in that namespace.
The text was updated successfully, but these errors were encountered: