Resolve with false instead of throwing for platforms that can't imply authentication

This commit is contained in:
Joel Arvidsson 2018-02-27 11:51:13 +01:00
parent add90c5769
commit c2cc3285b7
1 changed files with 2 additions and 4 deletions

View File

@ -68,10 +68,8 @@ type Options = {
* @return {Promise} Resolves to `true` when supported, otherwise `false`
*/
export function canImplyAuthentication(options?: Options): Promise {
if (RNKeychainManager.canCheckAuthentication) {
return Promise.reject(
new Error(`canImplyAuthentication() is not supported on this platform`)
);
if (!RNKeychainManager.canCheckAuthentication) {
return Promise.resolve(false);
}
return RNKeychainManager.canCheckAuthentication(options);
}