Closed Dabbel closed 4 months ago
The current implementation is correct, it is supposed to throw an exception so it can be unit-tested easily!
But on platforms that doesn't support biometric there isn't an easy way to check if biometric can be used. And to check if the exception is thrown is a very bad and ugly way to do it.
What is if there would be a bool property on IBiometric that indicates if that platform is able to support biometric? In net8 implementation that property would return false and for iOS and Android true.
You cannot install this package for MacOS and Windows so if the platform is not supported you cannot even build it, And what would be the point of this property I am still unable to get it...
And to check if the exception is thrown is a very bad and ugly way to do it.
As far as I know most people test it that way... Probably even the .NET Maui team themselves...
For unit tests it is okay.
It is possible to install the package in every project that uses net8, only for iOS and Android the platform implementation will be used.
The platform moniker has fallbacks, if you target against net8-windows it will search for net8-windows in the nuget package. If it can't finde that it will fallback to net8.
With the property the developer that uses the package doesn't need to check for the exception if the platform is supported, he can use the property for that.
@Dabbel Guess that makes sense, You can make these changes to your PR?
@FreakyAli will change it. Or do you find it better that net8 target without platform will be removed? This would result that platforms other than iOS and Android can not be build.
@FreakyAli will change it. Or would it be better if the net8 target without a platform were removed? This would mean that platforms other than iOS and Android can not be built.
We need .net8 for unit testing, just add a property that returns false if its an unsupported platform.
Needed to implement a method, in the current c# version there is no partial property
@Dabbel Don't you think you also need the property in the interface?
Sorry, totaly forgot the interface
Happens to us all brother!
For net8 without platform target GetEnrolledBiometricTypesAsync should return BiometricType.None. This makes it possible to check on all platforms if biometric is support without an exception.