[FIX] Touch/Face ID toggle does not enable automatically the first time (#4576)
* [FIX] Touch/Face ID toggle does not enable automatically the first time * minor tweak no competition setState
This commit is contained in:
parent
63e2a3a85c
commit
300e5fc793
|
@ -91,14 +91,15 @@ class ScreenLockConfigView extends React.Component<IScreenLockConfigViewProps, I
|
|||
const { server } = this.props;
|
||||
const serversDB = database.servers;
|
||||
const serversCollection = serversDB.get('servers');
|
||||
const hasBiometry = userPreferences.getBool(BIOMETRY_ENABLED_KEY) ?? DEFAULT_BIOMETRY;
|
||||
try {
|
||||
this.serverRecord = await serversCollection.find(server);
|
||||
this.setState({
|
||||
this.setState(
|
||||
{
|
||||
autoLock: this.serverRecord?.autoLock,
|
||||
autoLockTime: this.serverRecord?.autoLockTime === null ? DEFAULT_AUTO_LOCK : this.serverRecord?.autoLockTime,
|
||||
biometry: hasBiometry
|
||||
});
|
||||
autoLockTime: this.serverRecord?.autoLockTime === null ? DEFAULT_AUTO_LOCK : this.serverRecord?.autoLockTime
|
||||
},
|
||||
() => this.hasBiometry()
|
||||
);
|
||||
} catch (error) {
|
||||
// Do nothing
|
||||
}
|
||||
|
@ -119,6 +120,11 @@ class ScreenLockConfigView extends React.Component<IScreenLockConfigViewProps, I
|
|||
});
|
||||
};
|
||||
|
||||
hasBiometry = () => {
|
||||
const biometry = userPreferences.getBool(BIOMETRY_ENABLED_KEY) ?? DEFAULT_BIOMETRY;
|
||||
this.setState({ biometry });
|
||||
};
|
||||
|
||||
changePasscode = async ({ force }: { force: boolean }) => {
|
||||
logEvent(events.SLC_CHANGE_PASSCODE);
|
||||
await changePasscode({ force });
|
||||
|
@ -133,6 +139,7 @@ class ScreenLockConfigView extends React.Component<IScreenLockConfigViewProps, I
|
|||
if (autoLock) {
|
||||
try {
|
||||
await checkHasPasscode({ force: false });
|
||||
this.hasBiometry();
|
||||
} catch {
|
||||
this.toggleAutoLock();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue