Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: use correct messaging for trash

Prateek Sunalb10f3bfb7664
diff --git a/mobile/apps/auth/lib/l10n/arb/app_en.arb b/mobile/apps/auth/lib/l10n/arb/app_en.arb
index 7dbfc7e61f..2ae20ed7a4 100644
--- a/mobile/apps/auth/lib/l10n/arb/app_en.arb
+++ b/mobile/apps/auth/lib/l10n/arb/app_en.arb
@@ -9,6 +9,10 @@
"onBoardingBody": "Securely backup your 2FA codes",
"onBoardingGetStarted": "Get Started",
"setupFirstAccount": "Setup your first account",
+ "allTabEmptyHint": "Nothing here yet. Tap + to add a code or open Trash to recover one.",
+ "@allTabEmptyHint": {
+ "description": "Shown when the All tab has no active codes but Trash contains codes"
+ },
"importScanQrCode": "Scan a QR Code",
"qrCode": "QR code",
"qr": "QR",
@@ -588,4 +592,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/mobile/apps/auth/lib/ui/home_page.dart b/mobile/apps/auth/lib/ui/home_page.dart
index 44200452c3..5e613f3562 100644
--- a/mobile/apps/auth/lib/ui/home_page.dart
+++ b/mobile/apps/auth/lib/ui/home_page.dart
@@ -1473,7 +1473,8 @@ class _HomePageState extends State<HomePage> {
final crossAxisCount = _calculateGridColumnCount(context);
_currentGridColumns = crossAxisCount;
if (_hasLoaded) {
- if (_filteredCodes.isEmpty && _searchText.isEmpty) {
+ final bool noCodesAnywhere = !hasNonTrashedCodes && !hasTrashedCodes;
+ if (_filteredCodes.isEmpty && _searchText.isEmpty && noCodesAnywhere) {
return HomeEmptyStateWidget(
onScanTap: _redirectToScannerPage,
onManuallySetupTap: _redirectToManualEntryPage,
@@ -1482,8 +1483,18 @@ class _HomePageState extends State<HomePage> {
final anyCodeHasError =
_allCodes?.firstWhereOrNull((element) => element.hasError) != null;
final indexOffset = anyCodeHasError ? 1 : 0;
- final itemCount = (hasNonTrashedCodes ? tags.length + 1 : 0) +
- (hasTrashedCodes ? 1 : 0);
+ final bool showAllChip = hasNonTrashedCodes || hasTrashedCodes;
+ final bool showTrashChip = hasTrashedCodes;
+ final int itemCount =
+ (showAllChip ? 1 : 0) + tags.length + (showTrashChip ? 1 : 0);
+ final bool showAllEmptyHint =
+ showAllChip &&
+ selectedTag.isEmpty &&
+ !_isTrashOpen &&
+ _filteredCodes.isEmpty &&
+ _searchText.isEmpty &&
+ !hasNonTrashedCodes &&
+ hasTrashedCodes;
final list = Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -1499,7 +1510,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox(width: 8),
itemCount: itemCount,
itemBuilder: (context, index) {
- if (index == 0 && hasNonTrashedCodes) {
+ if (showAllChip && index == 0) {
return TagChip(
label: l10n.all,
state: selectedTag == "" && _isTrashOpen == false
@@ -1516,7 +1527,7 @@ class _HomePageState extends State<HomePage> {
);
}
- if (index == itemCount - 1 && hasTrashedCodes) {
+ if (showTrashChip && index == itemCount - 1) {
return TagChip(
label: l10n.trash,
state: _isTrashOpen
@@ -1532,7 +1543,7 @@ class _HomePageState extends State<HomePage> {
iconData: Icons.delete,
);
}
- final customTagIndex = index - 1;
+ final customTagIndex = index - (showAllChip ? 1 : 0);
if (customTagIndex >= 0 && customTagIndex < tags.length) {
return TagChip(
label: tags[customTagIndex],
@@ -1562,6 +1573,25 @@ class _HomePageState extends State<HomePage> {
Expanded(
child: Builder(
builder: (context) {
+ if (showAllEmptyHint) {
+ final textStyle = Theme.of(context).textTheme.bodyLarge ??
+ Theme.of(context).textTheme.bodyMedium ??
+ const TextStyle();
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 64.0),
+ child: Center(
+ child: Padding(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 24.0),
+ child: Text(
+ l10n.allTabEmptyHint,
+ textAlign: TextAlign.center,
+ style: textStyle,
+ ),
+ ),
+ ),
+ );
+ }
final gridView = AlignedGridView.count(
crossAxisCount: crossAxisCount,
physics: const AlwaysScrollableScrollPhysics(),