Skip to content

Commit 892b1b1

Browse files
committed
Simplify the OS checks
1 parent e8c7f5a commit 892b1b1

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

Directory.Build.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
<DefineConstants>$(DefineConstants);SUPPORTS_NAMED_PIPE_STATIC_FACTORY_WITH_ACL</DefineConstants>
7070
<DefineConstants>$(DefineConstants);SUPPORTS_ONE_SHOT_HASHING_METHODS</DefineConstants>
7171
<DefineConstants>$(DefineConstants);SUPPORTS_ONE_SHOT_KEY_DERIVATION_METHODS</DefineConstants>
72-
<DefineConstants>$(DefineConstants);SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON</DefineConstants>
7372
<DefineConstants>$(DefineConstants);SUPPORTS_PEM_ENCODED_KEY_IMPORT</DefineConstants>
7473
<DefineConstants>$(DefineConstants);SUPPORTS_REDIRECTION_ON_SIGN_IN</DefineConstants>
7574
<DefineConstants>$(DefineConstants);SUPPORTS_TEXT_ELEMENT_ENUMERATOR</DefineConstants>

src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,9 @@ public void PostConfigure(string? name, OpenIddictClientSystemIntegrationOptions
6262
ArgumentNullException.ThrowIfNull(options);
6363

6464
// Ensure the operating system version is supported.
65-
if ((OperatingSystem.IsAndroid() && !OperatingSystem.IsAndroidVersionAtLeast(21)) ||
66-
(OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(12)) ||
67-
OperatingSystem.IsLinux() ||
68-
(OperatingSystem.IsMacCatalyst() && !OperatingSystem.IsMacCatalystVersionAtLeast(13, 1)) ||
69-
(OperatingSystem.IsMacOS() && !OperatingSystem.IsMacOSVersionAtLeast(10, 15)) ||
70-
(OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(7)))
65+
if (!OperatingSystem.IsAndroidVersionAtLeast(21) && !OperatingSystem.IsIOSVersionAtLeast(12) &&
66+
!OperatingSystem.IsLinux() && !OperatingSystem.IsMacCatalystVersionAtLeast(13, 1) &&
67+
!OperatingSystem.IsMacOSVersionAtLeast(10, 15) && !OperatingSystem.IsWindowsVersionAtLeast(7))
7168
{
7269
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0389));
7370
}

src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationExtensions.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ public static OpenIddictClientSystemIntegrationBuilder UseSystemIntegration(this
2828
ArgumentNullException.ThrowIfNull(builder);
2929

3030
// Ensure the operating system version is supported.
31-
if ((OperatingSystem.IsAndroid() && !OperatingSystem.IsAndroidVersionAtLeast(21)) ||
32-
(OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(12)) ||
33-
OperatingSystem.IsLinux() ||
34-
(OperatingSystem.IsMacCatalyst() && !OperatingSystem.IsMacCatalystVersionAtLeast(13, 1)) ||
35-
(OperatingSystem.IsMacOS() && !OperatingSystem.IsMacOSVersionAtLeast(10, 15)) ||
36-
(OperatingSystem.IsWindows() && !OperatingSystem.IsWindowsVersionAtLeast(7)))
31+
if (!OperatingSystem.IsAndroidVersionAtLeast(21) && !OperatingSystem.IsIOSVersionAtLeast(12) &&
32+
!OperatingSystem.IsLinux() && !OperatingSystem.IsMacCatalystVersionAtLeast(13, 1) &&
33+
!OperatingSystem.IsMacOSVersionAtLeast(10, 15) && !OperatingSystem.IsWindowsVersionAtLeast(7))
3734
{
3835
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0389));
3936
}

src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static class OpenIddictClientSystemIntegrationHelpers
7777
[SupportedOSPlatformGuard("maccatalyst13.1")]
7878
[SupportedOSPlatformGuard("macos10.15")]
7979
internal static bool IsASWebAuthenticationSessionSupported()
80-
#if SUPPORTS_AUTHENTICATION_SERVICES && SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
80+
#if SUPPORTS_AUTHENTICATION_SERVICES
8181
=> OperatingSystem.IsIOSVersionAtLeast(12) ||
8282
OperatingSystem.IsMacCatalystVersionAtLeast(13) ||
8383
OperatingSystem.IsMacOSVersionAtLeast(10, 15);
@@ -92,7 +92,7 @@ internal static bool IsASWebAuthenticationSessionSupported()
9292
[MethodImpl(MethodImplOptions.AggressiveInlining)]
9393
[SupportedOSPlatformGuard("android21.0")]
9494
internal static bool IsCustomTabsIntentSupported()
95-
#if SUPPORTS_ANDROIDX_BROWSER && SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
95+
#if SUPPORTS_ANDROIDX_BROWSER
9696
=> OperatingSystem.IsAndroidVersionAtLeast(21);
9797
#else
9898
=> false;

0 commit comments

Comments
 (0)