-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[FIX] Enable face id after re-login if was enabled before #3247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
584b754
e4a51dc
7b1cb1d
0b0c69d
7f6d083
ee39e6b
10e6010
6eb3515
09da831
41cba97
4e17175
a6d8f72
b0802f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,11 +8,14 @@ import UserPreferences from '../lib/userPreferences'; | |
| import store from '../lib/createStore'; | ||
| import database from '../lib/database'; | ||
| import { | ||
| ATTEMPTS_KEY, | ||
| CHANGE_PASSCODE_EMITTER, | ||
| LOCAL_AUTHENTICATE_EMITTER, | ||
| LOCKED_OUT_TIMER_KEY, | ||
| PASSCODE_KEY | ||
| ATTEMPTS_KEY, | ||
| PASSCODE_KEY, | ||
| CHANGE_PASSCODE_EMITTER, | ||
| UNLOCK_FACE_ID, | ||
| AUTO_LOCK, | ||
| AUTO_LOCK_TIME | ||
| } from '../constants/localAuthentication'; | ||
| import I18n from '../i18n'; | ||
| import { setLocalAuthenticated } from '../actions/login'; | ||
|
|
@@ -96,13 +99,45 @@ export const checkHasPasscode = async ({ force = true, serverRecord }) => { | |
| return Promise.resolve(); | ||
| }; | ||
|
|
||
| export const saveStatusLocalAuthentication = async ({ autoLock, autoLockTime, biometry, server }) => { | ||
| await UserPreferences.setBoolAsync(AUTO_LOCK + server, autoLock); | ||
|
reinaldonetof marked this conversation as resolved.
Outdated
|
||
| await UserPreferences.setStringAsync(AUTO_LOCK_TIME + server, autoLockTime.toString()); | ||
|
reinaldonetof marked this conversation as resolved.
Outdated
|
||
| await UserPreferences.setBoolAsync(UNLOCK_FACE_ID + server, biometry); | ||
| }; | ||
|
|
||
| export const checkAutoLockAndTime = async server => { | ||
|
reinaldonetof marked this conversation as resolved.
Outdated
|
||
| const storedAutoLock = await UserPreferences.getBoolAsync(AUTO_LOCK + server); | ||
| const storedAutoLockTime = await UserPreferences.getStringAsync(AUTO_LOCK_TIME + server); | ||
| const storedBiometry = await UserPreferences.getBoolAsync(UNLOCK_FACE_ID + server); | ||
|
|
||
| return { | ||
| storedAutoLock, | ||
| storedAutoLockTime: Number.parseInt(storedAutoLockTime, 10), | ||
| storedBiometry | ||
| }; | ||
| }; | ||
|
|
||
| export const localAuthenticate = async server => { | ||
| const serversDB = database.servers; | ||
| const serversCollection = serversDB.get('servers'); | ||
| const { Force_Screen_Lock, Force_Screen_Lock_After } = store.getState().settings; | ||
|
|
||
| let serverRecord; | ||
| try { | ||
| serverRecord = await serversCollection.find(server); | ||
|
|
||
| const { storedAutoLock, storedAutoLockTime, storedBiometry } = await checkAutoLockAndTime(server); | ||
| await serversDB.action(async () => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't get what we're trying to do here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I needed to do that because when we are starting the app the |
||
| await serverRecord.update(record => { | ||
| if (serverRecord.autoLock !== storedAutoLock && !Force_Screen_Lock) { | ||
| record.autoLock = storedAutoLock; | ||
| } | ||
| if (!Force_Screen_Lock || Force_Screen_Lock_After === 0) { | ||
| record.autoLockTime = storedAutoLockTime; | ||
| } | ||
| record.biometry = storedBiometry; | ||
| }); | ||
| }); | ||
|
reinaldonetof marked this conversation as resolved.
Outdated
|
||
| } catch (error) { | ||
| return Promise.reject(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.