[FIX] Screen Lock Time respect local value (#2141)
* [FIX] Screen Lock Time respect local value * [FIX] Enable biometry at the first passcode change
This commit is contained in:
parent
d1e751bf12
commit
1abd3ad79e
|
@ -55,12 +55,14 @@ const serverInfoUpdate = async(serverInfo, iconSetting) => {
|
||||||
return { ...allSettings, autoLock };
|
return { ...allSettings, autoLock };
|
||||||
}
|
}
|
||||||
if (setting._id === 'Force_Screen_Lock_After') {
|
if (setting._id === 'Force_Screen_Lock_After') {
|
||||||
|
const forceScreenLock = serverInfo.find(s => s._id === 'Force_Screen_Lock')?.valueAsBoolean;
|
||||||
|
|
||||||
// if Force_Screen_Lock_After === 0 and autoLockTime is null, set app's default value
|
// if Force_Screen_Lock_After === 0 and autoLockTime is null, set app's default value
|
||||||
if (setting.valueAsNumber === 0 && !server.autoLockTime) {
|
if (setting.valueAsNumber === 0 && !server.autoLockTime) {
|
||||||
return { ...allSettings, autoLockTime: DEFAULT_AUTO_LOCK };
|
return { ...allSettings, autoLockTime: DEFAULT_AUTO_LOCK };
|
||||||
}
|
}
|
||||||
// if Force_Screen_Lock_After > 0, use it
|
// if Force_Screen_Lock_After > 0 and forceScreenLock is enabled, use it
|
||||||
if (setting.valueAsNumber > 0) {
|
if (setting.valueAsNumber > 0 && forceScreenLock) {
|
||||||
return { ...allSettings, autoLockTime: setting.valueAsNumber };
|
return { ...allSettings, autoLockTime: setting.valueAsNumber };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,12 @@ class ScreenLockConfigView extends React.Component {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.observable && this.observable.unsubscribe) {
|
||||||
|
this.observable.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defaultAutoLockOptions = [
|
defaultAutoLockOptions = [
|
||||||
{
|
{
|
||||||
title: I18n.t('Local_authentication_auto_lock_60'),
|
title: I18n.t('Local_authentication_auto_lock_60'),
|
||||||
|
@ -94,6 +100,19 @@ class ScreenLockConfigView extends React.Component {
|
||||||
|
|
||||||
const biometryLabel = await supportedBiometryLabel();
|
const biometryLabel = await supportedBiometryLabel();
|
||||||
this.setState({ biometryLabel });
|
this.setState({ biometryLabel });
|
||||||
|
|
||||||
|
this.observe();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We should observe biometry value
|
||||||
|
* because it can be changed by PasscodeChange
|
||||||
|
* when the user set his first passcode
|
||||||
|
*/
|
||||||
|
observe = () => {
|
||||||
|
this.observable = this.serverRecord?.observe()?.subscribe(({ biometry }) => {
|
||||||
|
this.setState({ biometry });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save = async() => {
|
save = async() => {
|
||||||
|
|
Loading…
Reference in New Issue