mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-05-18 13:28:12 -04:00
Improve mobile app flow for pending migration check (#957)
This commit is contained in:
committed by
Leendert de Borst
parent
70bb8ef3e4
commit
80e40b3ceb
@@ -23,7 +23,7 @@ import NativeVaultManager from '@/specs/NativeVaultManager';
|
||||
*/
|
||||
export default function UnlockScreen() : React.ReactNode {
|
||||
const { isLoggedIn, username, isBiometricsEnabled } = useAuth();
|
||||
const { testDatabaseConnection } = useDb();
|
||||
const dbContext = useDb();
|
||||
const [password, setPassword] = useState('');
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isBiometricsAvailable, setIsBiometricsAvailable] = useState(false);
|
||||
@@ -100,7 +100,13 @@ export default function UnlockScreen() : React.ReactNode {
|
||||
const passwordHashBase64 = Buffer.from(passwordHash).toString('base64');
|
||||
|
||||
// Initialize the database with the vault response and password
|
||||
if (await testDatabaseConnection(passwordHashBase64)) {
|
||||
if (await dbContext.testDatabaseConnection(passwordHashBase64)) {
|
||||
// Check if the vault is up to date, if not, redirect to the upgrade page.
|
||||
if (await dbContext.hasPendingMigrations()) {
|
||||
router.replace('/upgrade');
|
||||
return;
|
||||
}
|
||||
|
||||
// Navigate to credentials
|
||||
router.replace('/(tabs)/credentials');
|
||||
} else {
|
||||
|
||||
@@ -116,7 +116,7 @@ export const useVaultSync = () : {
|
||||
await dbContext.initializeDatabase(vaultResponseJson as VaultResponse);
|
||||
|
||||
// Check if the current vault version is known and up to date, if not known trigger an exception, if not up to date redirect to the upgrade page.
|
||||
if (await dbContext.hasPendingMigrations()) {
|
||||
if (await NativeVaultManager.isVaultUnlocked() && await dbContext.hasPendingMigrations()) {
|
||||
onUpgradeRequired?.();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user