Skip to content
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

chore: removed biometry migration to MMKV #5894

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions app/sagas/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { call, put, select, takeLatest } from 'redux-saga/effects';
import RNBootSplash from 'react-native-bootsplash';
import AsyncStorage from '@react-native-async-storage/async-storage';

import { BIOMETRY_ENABLED_KEY, CURRENT_SERVER, TOKEN_KEY } from '../lib/constants';
import { CURRENT_SERVER, TOKEN_KEY } from '../lib/constants';
import UserPreferences from '../lib/methods/userPreferences';
import { selectServerRequest } from '../actions/server';
import { setAllPreferences } from '../actions/sortPreferences';
Expand All @@ -20,25 +20,14 @@ export const initLocalSettings = function* initLocalSettings() {
yield put(setAllPreferences(sortPreferences));
};

const BIOMETRY_MIGRATION_KEY = 'kBiometryMigration';

const restore = function* restore() {
console.log('RESTORE');
try {
const server = UserPreferences.getString(CURRENT_SERVER);
let userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);

// Migration biometry setting from WatermelonDB to MMKV
// TODO: remove it after a few versions
const hasMigratedBiometry = UserPreferences.getBool(BIOMETRY_MIGRATION_KEY);
if (!hasMigratedBiometry) {
const serversDB = database.servers;
const serversCollection = serversDB.get('servers');
const servers = yield serversCollection.query().fetch();
const isBiometryEnabled = servers.some(server => !!server.biometry);
UserPreferences.setBool(BIOMETRY_ENABLED_KEY, isBiometryEnabled);
UserPreferences.setBool(BIOMETRY_MIGRATION_KEY, true);
}


if (!server) {
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
Expand Down