mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-09 09:51:02 +01:00
Conditional load of biometrics API on Win10+ (#169)
* Conditional load of biometrics API on Win10+ * consolidate if block * Return -1 instead of null
This commit is contained in:
parent
5e0a2d1d99
commit
27bcbf4b41
@ -48,7 +48,7 @@ export default class BiometricWindowsMain implements BiometricMain {
|
|||||||
|
|
||||||
getWindowsSecurityCredentialsUiModule(): any {
|
getWindowsSecurityCredentialsUiModule(): any {
|
||||||
try {
|
try {
|
||||||
if (this.windowsSecurityCredentialsUiModule == null) {
|
if (this.windowsSecurityCredentialsUiModule == null && this.getWindowsMajorVersion() >= 10) {
|
||||||
this.windowsSecurityCredentialsUiModule = require('@nodert-win10-rs4/windows.security.credentials.ui');
|
this.windowsSecurityCredentialsUiModule = require('@nodert-win10-rs4/windows.security.credentials.ui');
|
||||||
}
|
}
|
||||||
return this.windowsSecurityCredentialsUiModule;
|
return this.windowsSecurityCredentialsUiModule;
|
||||||
@ -110,4 +110,16 @@ export default class BiometricWindowsMain implements BiometricMain {
|
|||||||
} catch { /*Ignore error*/ }
|
} catch { /*Ignore error*/ }
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getWindowsMajorVersion(): number {
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const version = require('os').release();
|
||||||
|
return Number.parseInt(version.split('.')[0], 10);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user