Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simpler view interface

vishnukvmd994bb1213b17
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index 9b0b246019..13b2185fba 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -362,6 +362,18 @@
"physicalRecordsDescription": "Document real-world locations of important items.",
"accountCredentials": "Secret",
"accountCredentialsDescription": "Preserve account credentials.",
+ "editSecret": "Edit secret",
+ "@editSecret": {
+ "description": "Title shown when editing an existing secret"
+ },
+ "editLocation": "Edit location",
+ "@editLocation": {
+ "description": "Title shown when editing an existing location record"
+ },
+ "editNote": "Edit note",
+ "@editNote": {
+ "description": "Title shown when editing an existing note"
+ },
"emergencyContact": "Emergency contact",
"emergencyContactDescription": "Keep contact info for key people in crises.",
"noteName": "Title",
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index 8108dd1f10..0d2863e17f 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -1090,6 +1090,24 @@ abstract class AppLocalizations {
/// **'Preserve account credentials.'**
String get accountCredentialsDescription;
+ /// Title shown when editing an existing secret
+ ///
+ /// In en, this message translates to:
+ /// **'Edit secret'**
+ String get editSecret;
+
+ /// Title shown when editing an existing location record
+ ///
+ /// In en, this message translates to:
+ /// **'Edit location'**
+ String get editLocation;
+
+ /// Title shown when editing an existing note
+ ///
+ /// In en, this message translates to:
+ /// **'Edit note'**
+ String get editNote;
+
/// No description provided for @emergencyContact.
///
/// In en, this message translates to:
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index ba86eca5a7..1625b85d2f 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -574,6 +574,15 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get accountCredentialsDescription => 'Preserve account credentials.';
+ @override
+ String get editSecret => 'Edit secret';
+
+ @override
+ String get editLocation => 'Edit location';
+
+ @override
+ String get editNote => 'Edit note';
+
@override
String get emergencyContact => 'Emergency contact';
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 b215dc8067..d295bd7026 100644
--- a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart
@@ -68,7 +68,23 @@ class _AccountCredentialsPageState
}
@override
- String get pageTitle => context.l10n.accountCredentials;
+ String get pageTitle {
+ if (isInEditMode) {
+ return context.l10n.editSecret;
+ }
+
+ final controllerName = _nameController.text.trim();
+ if (controllerName.isNotEmpty) {
+ return controllerName;
+ }
+
+ final dataName = (currentData?.name ?? '').trim();
+ if (dataName.isNotEmpty) {
+ return dataName;
+ }
+
+ return context.l10n.accountCredentials;
+ }
@override
String get submitButtonText => context.l10n.saveRecord;
@@ -167,12 +183,7 @@ class _AccountCredentialsPageState
@override
List<Widget> buildViewFields() {
- return [
- buildViewField(
- label: context.l10n.credentialName,
- value: _nameController.text,
- ),
- const SizedBox(height: 24),
+ final viewFields = <Widget>[
buildViewField(
label: context.l10n.username,
value: _usernameController.text,
@@ -183,15 +194,20 @@ class _AccountCredentialsPageState
value: _passwordController.text,
isSecret: true,
),
- if (_notesController.text.isNotEmpty) ...[
+ ];
+
+ if (_notesController.text.isNotEmpty) {
+ viewFields.addAll([
const SizedBox(height: 24),
buildViewField(
label: context.l10n.credentialNotes,
value: _notesController.text,
maxLines: 3,
),
- ],
- ];
+ ]);
+ }
+
+ return viewFields;
}
void _onFieldChanged() {
diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dart
index ec0adc7b27..372f94f64b 100644
--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart
@@ -32,6 +32,15 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
bool _isLoading = false;
late InfoPageMode _currentMode;
+ @protected
+ InfoPageMode get currentMode => _currentMode;
+
+ @protected
+ bool get isInViewMode => _currentMode == InfoPageMode.view;
+
+ @protected
+ bool get isInEditMode => _currentMode == InfoPageMode.edit;
+
// Current data state (can be updated after saving)
T? _currentData;
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 85a2f4c9f6..e64d4ca564 100644
--- a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
@@ -23,7 +23,8 @@ class _PersonalNotePageState
@override
void initState() {
super.initState();
- _contentController.addListener(_onContentChanged);
+ _nameController.addListener(_onFieldChanged);
+ _contentController.addListener(_onFieldChanged);
_loadExistingData();
}
@@ -43,14 +44,31 @@ class _PersonalNotePageState
@override
void dispose() {
- _contentController.removeListener(_onContentChanged);
+ _nameController.removeListener(_onFieldChanged);
+ _contentController.removeListener(_onFieldChanged);
_nameController.dispose();
_contentController.dispose();
super.dispose();
}
@override
- String get pageTitle => context.l10n.personalNote;
+ String get pageTitle {
+ if (isInEditMode) {
+ return context.l10n.editNote;
+ }
+
+ final controllerTitle = _nameController.text.trim();
+ if (controllerTitle.isNotEmpty) {
+ return controllerTitle;
+ }
+
+ final dataTitle = (currentData?.title ?? '').trim();
+ if (dataTitle.isNotEmpty) {
+ return dataTitle;
+ }
+
+ return context.l10n.personalNote;
+ }
@override
String get submitButtonText => context.l10n.saveRecord;
@@ -104,11 +122,6 @@ class _PersonalNotePageState
@override
List<Widget> buildViewFields() {
return [
- buildViewField(
- label: context.l10n.noteName,
- value: _nameController.text,
- ),
- const SizedBox(height: 24),
buildViewField(
label: context.l10n.noteContent,
value: _contentController.text,
@@ -117,7 +130,7 @@ class _PersonalNotePageState
];
}
- void _onContentChanged() {
+ void _onFieldChanged() {
if (mounted) {
setState(() {});
}
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 534ada89f5..0ab1af163f 100644
--- a/mobile/apps/locker/lib/ui/pages/physical_records_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/physical_records_page.dart
@@ -55,7 +55,23 @@ class _PhysicalRecordsPageState
}
@override
- String get pageTitle => context.l10n.physicalRecords;
+ String get pageTitle {
+ if (isInEditMode) {
+ return context.l10n.editLocation;
+ }
+
+ final controllerName = _nameController.text.trim();
+ if (controllerName.isNotEmpty) {
+ return controllerName;
+ }
+
+ final dataName = (currentData?.name ?? '').trim();
+ if (dataName.isNotEmpty) {
+ return dataName;
+ }
+
+ return context.l10n.physicalRecords;
+ }
@override
String get submitButtonText => context.l10n.saveRecord;
@@ -133,24 +149,24 @@ class _PhysicalRecordsPageState
@override
List<Widget> buildViewFields() {
- return [
- buildViewField(
- label: context.l10n.name,
- value: _nameController.text,
- ),
- const SizedBox(height: 24),
+ final viewFields = <Widget>[
buildViewField(
label: context.l10n.recordLocation,
value: _locationController.text,
),
- if (_notesController.text.isNotEmpty) ...[
+ ];
+
+ if (_notesController.text.isNotEmpty) {
+ viewFields.addAll([
const SizedBox(height: 24),
buildViewField(
label: context.l10n.recordNotes,
value: _notesController.text,
maxLines: 3,
),
- ],
- ];
+ ]);
+ }
+
+ return viewFields;
}
}