feat: add biometric authentication support and related UI screens
- Updated AndroidManifest.xml to include permissions for biometric authentication. - Changed MainActivity to extend FlutterFragmentActivity for better compatibility. - Modified gradle.properties to optimize memory settings. - Enhanced app.dart to manage new app phases for biometric authentication. - Implemented LocalVaultService methods for handling biometric key protection. - Created BiometricChoiceScreen and BiometricGateScreen for user interaction. - Updated HomeScreen to handle vault invalidation scenarios. - Registered local_auth plugin for biometric functionality on macOS and Windows. - Updated pubspec.yaml and pubspec.lock to include local_auth dependency.
This commit is contained in:
@@ -15,10 +15,12 @@ class HomeScreen extends StatefulWidget {
|
||||
super.key,
|
||||
required this.repository,
|
||||
required this.onOpenSettings,
|
||||
this.onVaultInvalid,
|
||||
});
|
||||
|
||||
final NoteRepository repository;
|
||||
final VoidCallback onOpenSettings;
|
||||
final Future<void> Function()? onVaultInvalid;
|
||||
|
||||
@override
|
||||
State<HomeScreen> createState() => _HomeScreenState();
|
||||
@@ -38,16 +40,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
}
|
||||
|
||||
Future<void> _loadNotes() async {
|
||||
final List<Note> storedNotes = await widget.repository.loadNotes();
|
||||
try {
|
||||
final List<Note> storedNotes = await widget.repository.loadNotes();
|
||||
|
||||
if (!mounted) {
|
||||
return;
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
_notes = storedNotes;
|
||||
_isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
// If loading notes fails (e.g., DB corrupt), notify the app to reset the vault.
|
||||
if (widget.onVaultInvalid != null) {
|
||||
await widget.onVaultInvalid!();
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_notes = storedNotes;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _openNoteComposer() async {
|
||||
|
||||
Reference in New Issue
Block a user