Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Tweak alert dialogs and app startup migration

Leendert de Borstfc60426e0f87
diff --git a/apps/mobile-app/app/(tabs)/credentials/index.tsx b/apps/mobile-app/app/(tabs)/credentials/index.tsx
index 9bc18576d..e8ccc5b57 100644
--- a/apps/mobile-app/app/(tabs)/credentials/index.tsx
+++ b/apps/mobile-app/app/(tabs)/credentials/index.tsx
@@ -179,7 +179,11 @@ export default function CredentialsScreen() : React.ReactNode {
* Authentication errors are handled in useVaultSync
* For other errors, show alert
*/
- Alert.alert(t('common.error'), error);
+ Alert.alert(
+ t('common.error'),
+ error,
+ [{ text: t('common.ok'), style: 'default' }]
+ );
},
/**
* On upgrade required.
diff --git a/apps/mobile-app/app/initialize.tsx b/apps/mobile-app/app/initialize.tsx
index 7fe691812..ebd98b734 100644
--- a/apps/mobile-app/app/initialize.tsx
+++ b/apps/mobile-app/app/initialize.tsx
@@ -289,7 +289,11 @@ export default function Initialize() : React.ReactNode {
* Authentication errors are already handled in useVaultSync
* Show modal with error message for other errors
*/
- Alert.alert(t('common.error'), error);
+ Alert.alert(
+ t('common.error'),
+ error,
+ [{ text: t('common.ok'), style: 'default' }]
+ );
router.replace('/unlock');
return;
},
diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsx
index eb6651ba6..13e56077d 100644
--- a/apps/mobile-app/app/login.tsx
+++ b/apps/mobile-app/app/login.tsx
@@ -191,7 +191,11 @@ export default function LoginScreen() : React.ReactNode {
checkSuccess = false;
// Show modal with error message
- Alert.alert(t('common.error'), message);
+ Alert.alert(
+ t('common.error'),
+ message,
+ [{ text: t('common.ok'), style: 'default' }]
+ );
// Error will trigger logout through the sync process
setIsLoading(false);
},
diff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsx
index b5b9384ea..937bc01f5 100644
--- a/apps/mobile-app/app/unlock.tsx
+++ b/apps/mobile-app/app/unlock.tsx
@@ -71,7 +71,11 @@ export default function UnlockScreen() : React.ReactNode {
*/
const handleUnlock = async () : Promise<void> => {
if (!password) {
- Alert.alert(t('common.error'), t('auth.errors.enterPassword'));
+ Alert.alert(
+ t('common.error'),
+ t('auth.errors.enterPassword'),
+ [{ text: t('common.ok'), style: 'default' }]
+ );
return;
}
@@ -113,7 +117,11 @@ export default function UnlockScreen() : React.ReactNode {
*/
router.replace('/initialize');
} else {
- Alert.alert(t('common.error'), t('auth.errors.incorrectPassword'));
+ Alert.alert(
+ t('common.error'),
+ t('auth.errors.incorrectPassword'),
+ [{ text: t('common.ok'), style: 'default' }]
+ );
}
} catch (error) {
if (error instanceof VaultVersionIncompatibleError) {
@@ -122,7 +130,11 @@ export default function UnlockScreen() : React.ReactNode {
}
console.error('Unlock error:', error);
- Alert.alert(t('common.error'), t('auth.errors.incorrectPassword'));
+ Alert.alert(
+ t('common.error'),
+ t('auth.errors.incorrectPassword'),
+ [{ text: t('common.ok'), style: 'default' }]
+ );
} finally {
setIsLoading(false);
}
diff --git a/apps/mobile-app/app/upgrade.tsx b/apps/mobile-app/app/upgrade.tsx
index 0a9ba3539..28a2c4d62 100644
--- a/apps/mobile-app/app/upgrade.tsx
+++ b/apps/mobile-app/app/upgrade.tsx
@@ -68,7 +68,11 @@ export default function UpgradeScreen() : React.ReactNode {
*/
const handleUpgrade = async (): Promise<void> => {
if (!sqliteClient || !currentVersion || !latestVersion) {
- Alert.alert(t('common.error'), t('upgrade.alerts.unableToGetVersionInfo'));
+ Alert.alert(
+ t('common.error'),
+ t('upgrade.alerts.unableToGetVersionInfo'),
+ [{ text: t('common.ok'), style: 'default' }]
+ );
return;
}
@@ -101,7 +105,11 @@ export default function UpgradeScreen() : React.ReactNode {
*/
const performUpgrade = async (): Promise<void> => {
if (!sqliteClient || !currentVersion || !latestVersion) {
- Alert.alert(t('common.error'), t('upgrade.alerts.unableToGetVersionInfo'));
+ Alert.alert(
+ t('common.error'),
+ t('upgrade.alerts.unableToGetVersionInfo'),
+ [{ text: t('common.ok'), style: 'default' }]
+ );
return;
}
@@ -162,13 +170,21 @@ export default function UpgradeScreen() : React.ReactNode {
*/
onError: (error: Error) => {
console.error('Upgrade failed:', error);
- Alert.alert(t('upgrade.alerts.upgradeFailed'), error.message);
+ Alert.alert(
+ t('upgrade.alerts.upgradeFailed'),
+ error.message,
+ [{ text: t('common.ok'), style: 'default' }]
+ );
}
});
} catch (error) {
console.error('Upgrade failed:', error);
- Alert.alert(t('upgrade.alerts.upgradeFailed'), error instanceof Error ? error.message : t('common.errors.unknownError'));
+ Alert.alert(
+ t('upgrade.alerts.upgradeFailed'),
+ error instanceof Error ? error.message : t('common.errors.unknownError'),
+ [{ text: t('common.ok'), style: 'default' }]
+ );
} finally {
setIsLoading(false);
setUpgradeStatus(t('upgrade.status.preparingUpgrade'));
diff --git a/apps/mobile-app/context/AuthContext.tsx b/apps/mobile-app/context/AuthContext.tsx
index 93be91ffc..f22e90944 100644
--- a/apps/mobile-app/context/AuthContext.tsx
+++ b/apps/mobile-app/context/AuthContext.tsx
@@ -139,7 +139,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
*/
const initializeAuth = useCallback(async (): Promise<{ isLoggedIn: boolean; enabledAuthMethods: AuthMethod[] }> => {
// Sync legacy config to native layer (can be removed in future version 0.25.0+)
- syncLegacyConfigToNative();
+ // IMPORTANT: We must await this to ensure migration completes before checking auth status
+ await syncLegacyConfigToNative();
const accessToken = await NativeVaultManager.getAccessToken();
const username = await NativeVaultManager.getUsername();
@@ -219,7 +220,11 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
if (errorMessage) {
// Show alert
- Alert.alert(i18n.t('common.error'), errorMessage);
+ Alert.alert(
+ i18n.t('common.error'),
+ errorMessage,
+ [{ text: i18n.t('common.ok'), style: 'default' }]
+ );
}
setUsername(null);