Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add sync and navigation improvements after saving info files

vishnukvmdc403aec93b64
diff --git a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart
index c9992fe686..ac6b75674a 100644
--- a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart
@@ -8,6 +8,7 @@ import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/info_file_service.dart';
import 'package:locker/ui/components/collection_selection_widget.dart';
import 'package:locker/ui/components/form_text_input_widget.dart';
+import 'package:locker/ui/pages/home_page.dart';
class AccountCredentialsPage extends StatefulWidget {
final AccountCredentialData? existingData;
@@ -333,21 +334,33 @@ class _AccountCredentialsPageState extends State<AccountCredentialsPage> {
);
}
- if (mounted) {
- Navigator.of(context).pop(); // Go back to information page
+ // Trigger sync after successful save
+ await CollectionService.instance.sync();
+ if (mounted) {
// Show success message
final collectionCount = selectedCollections.length;
final message = collectionCount == 1
? context.l10n.recordSavedSuccessfully
: 'Record saved to $collectionCount collections successfully';
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(message),
- backgroundColor: Colors.green,
- ),
+ // Navigate to home page and clear all previous routes
+ await Navigator.of(context).pushAndRemoveUntil(
+ MaterialPageRoute(builder: (context) => const HomePage()),
+ (route) => false,
);
+
+ // Show success message after navigation
+ Future.delayed(const Duration(milliseconds: 100), () {
+ if (mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: Text(message),
+ backgroundColor: Colors.green,
+ ),
+ );
+ }
+ });
}
} catch (e) {
if (mounted) {
diff --git a/mobile/apps/locker/lib/ui/pages/emergency_contact_page.dart b/mobile/apps/locker/lib/ui/pages/emergency_contact_page.dart
index 7189a46d35..50f7c859be 100644
--- a/mobile/apps/locker/lib/ui/pages/emergency_contact_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/emergency_contact_page.dart
@@ -8,6 +8,7 @@ import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/info_file_service.dart';
import 'package:locker/ui/components/collection_selection_widget.dart';
import 'package:locker/ui/components/form_text_input_widget.dart';
+import 'package:locker/ui/pages/home_page.dart';
class EmergencyContactPage extends StatefulWidget {
final EmergencyContactData? existingData;
@@ -233,21 +234,33 @@ class _EmergencyContactPageState extends State<EmergencyContactPage> {
);
}
- if (mounted) {
- Navigator.of(context).pop(); // Go back to information page
+ // Trigger sync after successful save
+ await CollectionService.instance.sync();
+ if (mounted) {
// Show success message
final collectionCount = selectedCollections.length;
final message = collectionCount == 1
? context.l10n.recordSavedSuccessfully
: 'Record saved to $collectionCount collections successfully';
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(message),
- backgroundColor: Colors.green,
- ),
+ // Navigate to home page and clear all previous routes
+ await Navigator.of(context).pushAndRemoveUntil(
+ MaterialPageRoute(builder: (context) => const HomePage()),
+ (route) => false,
);
+
+ // Show success message after navigation
+ Future.delayed(const Duration(milliseconds: 100), () {
+ if (mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: Text(message),
+ backgroundColor: Colors.green,
+ ),
+ );
+ }
+ });
}
} catch (e) {
if (mounted) {
diff --git a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
index a6bbb754c3..79784249e2 100644
--- a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
@@ -8,6 +8,7 @@ import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/info_file_service.dart';
import 'package:locker/ui/components/collection_selection_widget.dart';
import 'package:locker/ui/components/form_text_input_widget.dart';
+import 'package:locker/ui/pages/home_page.dart';
class PersonalNotePage extends StatefulWidget {
final PersonalNoteData? existingData;
@@ -218,22 +219,33 @@ class _PersonalNotePageState extends State<PersonalNotePage> {
);
}
- if (mounted) {
- Navigator.of(context)
- .pop(); // Close this page and return to information page
+ // Trigger sync after successful save
+ await CollectionService.instance.sync();
+ if (mounted) {
// Show success message
final collectionCount = selectedCollections.length;
final message = collectionCount == 1
? context.l10n.recordSavedSuccessfully
: 'Record saved to $collectionCount collections successfully';
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(message),
- backgroundColor: Colors.green,
- ),
+ // Navigate to home page and clear all previous routes
+ await Navigator.of(context).pushAndRemoveUntil(
+ MaterialPageRoute(builder: (context) => const HomePage()),
+ (route) => false,
);
+
+ // Show success message after navigation
+ Future.delayed(const Duration(milliseconds: 100), () {
+ if (mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: Text(message),
+ backgroundColor: Colors.green,
+ ),
+ );
+ }
+ });
}
} catch (e) {
if (mounted) {
diff --git a/mobile/apps/locker/lib/ui/pages/physical_records_page.dart b/mobile/apps/locker/lib/ui/pages/physical_records_page.dart
index f134035c1b..6047138236 100644
--- a/mobile/apps/locker/lib/ui/pages/physical_records_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/physical_records_page.dart
@@ -8,6 +8,7 @@ import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/info_file_service.dart';
import 'package:locker/ui/components/collection_selection_widget.dart';
import 'package:locker/ui/components/form_text_input_widget.dart';
+import 'package:locker/ui/pages/home_page.dart';
class PhysicalRecordsPage extends StatefulWidget {
final PhysicalRecordData? existingData;
@@ -232,21 +233,33 @@ class _PhysicalRecordsPageState extends State<PhysicalRecordsPage> {
);
}
- if (mounted) {
- Navigator.of(context).pop(); // Go back to information page
+ // Trigger sync after successful save
+ await CollectionService.instance.sync();
+ if (mounted) {
// Show success message
final collectionCount = selectedCollections.length;
final message = collectionCount == 1
? context.l10n.recordSavedSuccessfully
: 'Record saved to $collectionCount collections successfully';
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(message),
- backgroundColor: Colors.green,
- ),
+ // Navigate to home page and clear all previous routes
+ await Navigator.of(context).pushAndRemoveUntil(
+ MaterialPageRoute(builder: (context) => const HomePage()),
+ (route) => false,
);
+
+ // Show success message after navigation
+ Future.delayed(const Duration(milliseconds: 100), () {
+ if (mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: Text(message),
+ backgroundColor: Colors.green,
+ ),
+ );
+ }
+ });
}
} catch (e) {
if (mounted) {