Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mob][gallery] Refactor grouping to enable week/month/year wise groups #1610

Merged
merged 26 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cc74e08
[mob] Add groupType with common extn methods
ua741 May 4, 2024
da329c4
[mob] Add groupType in Gallery context state
ua741 May 4, 2024
e75be71
[mob] Refactor groupHeader to use groupType
ua741 May 4, 2024
5f9b0d1
[mob] Gallery: Support grouping by day/week/month/year
ua741 May 4, 2024
cff695d
[mob] Fix title for month grouping
ua741 May 4, 2024
241c755
Merge branch 'main' into generic_group_by
ua741 May 21, 2024
c21a0cf
[mob] Lint fix
ua741 May 21, 2024
ce6160a
Merge branch 'main' into generic_group_by
ua741 May 22, 2024
3ce8a09
Merge branch 'main' into generic_group_by
ua741 May 23, 2024
643b77e
Fix title for month
ua741 May 23, 2024
22ff318
[mob] Fix bug in daysInSameWeek check
ua741 May 23, 2024
5e4d530
[mob] Fix range calculation while refresh lazy gallery group
ua741 May 23, 2024
bcf3084
Merge branch 'main' into generic_group_by
ua741 May 27, 2024
95bb363
Add widget to show fileSize overlay
ua741 May 27, 2024
ac3c6b1
Gallery: Support for group by size
ua741 May 27, 2024
f5093dd
Stick to old grouping behaviour for magicsearch
ua741 May 27, 2024
f876ba6
Merge branch 'main' into generic_group_by
ua741 Jun 4, 2024
72f4ebf
Merge branch 'generic_group_by' into group_by_size
ua741 Jun 4, 2024
8a81c0e
generated strings
ua741 Jun 4, 2024
0f99fa2
Rename Backed up folder -> Automatic backups'
ua741 Jun 4, 2024
943dceb
Move free up space options into separate page
ua741 Jun 4, 2024
f8b933a
Add descriptions to sections
ua741 Jun 4, 2024
f47fc2c
Add view large file option
ua741 Jun 4, 2024
e5a71da
Revert "Rename Backed up folder -> Automatic backups'"
ua741 Jun 4, 2024
e3bbd7f
Remove shared files from large files list
ua741 Jun 4, 2024
9dac3bf
[mob] Group by size (#1886)
ua741 Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
361 changes: 205 additions & 156 deletions mobile/lib/generated/intl/messages_de.dart

Large diffs are not rendered by default.

227 changes: 117 additions & 110 deletions mobile/lib/generated/intl/messages_en.dart

Large diffs are not rendered by default.

188 changes: 94 additions & 94 deletions mobile/lib/generated/intl/messages_es.dart

Large diffs are not rendered by default.

212 changes: 106 additions & 106 deletions mobile/lib/generated/intl/messages_fr.dart

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions mobile/lib/generated/intl/messages_it.dart

Large diffs are not rendered by default.

220 changes: 110 additions & 110 deletions mobile/lib/generated/intl/messages_nl.dart

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mobile/lib/generated/intl/messages_pl.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

222 changes: 112 additions & 110 deletions mobile/lib/generated/intl/messages_pt.dart

Large diffs are not rendered by default.

222 changes: 112 additions & 110 deletions mobile/lib/generated/intl/messages_zh.dart

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions mobile/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions mobile/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,13 @@
"backedUpFolders": "Backed up folders",
"backup": "Backup",
"freeUpDeviceSpace": "Free up device space",
"freeUpDeviceSpaceDesc": "Save space on your device by clearing files that have been already backed up.",
"allClear": "✨ All clear",
"noDeviceThatCanBeDeleted": "You've no files on this device that can be deleted",
"removeDuplicates": "Remove duplicates",
"removeDuplicatesDesc": "Review and remove files that are exact duplicates.",
"viewLargeFiles": "Large files",
"viewLargeFilesDesc": "View files that are consuming the most amount of storage",
"noDuplicates": "✨ No duplicates",
"youveNoDuplicateFilesThatCanBeCleared": "You've no duplicate files that can be cleared",
"success": "Success",
Expand Down
151 changes: 6 additions & 145 deletions mobile/lib/ui/settings/backup/backup_section_widget.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
import "dart:async";
import 'dart:io';

import 'package:flutter/material.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/backup_status.dart';
import 'package:photos/models/duplicate_files.dart';
import 'package:photos/services/deduplication_service.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/services/update_service.dart';
import 'package:photos/theme/ente_theme.dart';
import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/captioned_text_widget.dart";
import "package:photos/ui/components/dialog_widget.dart";
import 'package:photos/ui/components/expandable_menu_item_widget.dart';
import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart';
import "package:photos/ui/components/models/button_type.dart";
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
import 'package:photos/ui/settings/backup/backup_settings_screen.dart';
import "package:photos/ui/settings/backup/free_space_options.dart";
import 'package:photos/ui/settings/common_settings.dart';
import 'package:photos/ui/tools/deduplicate_page.dart';
import "package:photos/ui/tools/free_space_page.dart";
import 'package:photos/utils/data_util.dart';
import 'package:photos/utils/dialog_util.dart';
import "package:photos/utils/local_settings.dart";
import 'package:photos/utils/navigation_util.dart';
import 'package:photos/utils/toast_util.dart';

class BackupSectionWidget extends StatefulWidget {
const BackupSectionWidget({Key? key}) : super(key: key);
Expand Down Expand Up @@ -84,71 +68,17 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
[
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: S.of(context).freeUpDeviceSpace,
title: S.of(context).freeUpSpace,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
showOnlyLoadingState: true,
onTap: () async {
BackupStatus status;
try {
status = await SyncService.instance.getBackupStatus();
} catch (e) {
await showGenericErrorDialog(context: context, error: e);
return;
}

if (status.localIDs.isEmpty) {
// ignore: unawaited_futures
showErrorDialog(
context,
S.of(context).allClear,
S.of(context).noDeviceThatCanBeDeleted,
);
} else {
final bool? result =
await routeToPage(context, FreeSpacePage(status));
if (result == true) {
_showSpaceFreedDialog(status);
}
}
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: S.of(context).removeDuplicates,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
showOnlyLoadingState: true,
onTap: () async {
List<DuplicateFiles> duplicates;
try {
duplicates =
await DeduplicationService.instance.getDuplicateFiles();
} catch (e) {
await showGenericErrorDialog(context: context, error: e);
return;
}

if (duplicates.isEmpty) {
unawaited(
showErrorDialog(
context,
S.of(context).noDuplicates,
S.of(context).youveNoDuplicateFilesThatCanBeCleared,
),
);
} else {
final DeduplicationResult? result =
await routeToPage(context, DeduplicatePage(duplicates));
if (result != null) {
_showDuplicateFilesDeletedDialog(result);
}
}
await routeToPage(
context,
const FreeUpSpaceOptionsScreen(),
);
},
),
sectionOptionSpacing,
Expand All @@ -158,73 +88,4 @@ class BackupSectionWidgetState extends State<BackupSectionWidget> {
children: sectionOptions,
);
}

void _showSpaceFreedDialog(BackupStatus status) {
if (LocalSettings.instance.shouldPromptToRateUs()) {
LocalSettings.instance.setRateUsShownCount(
LocalSettings.instance.getRateUsShownCount() + 1,
);
showChoiceDialog(
context,
title: S.of(context).success,
body:
S.of(context).youHaveSuccessfullyFreedUp(formatBytes(status.size)),
firstButtonLabel: S.of(context).rateUs,
firstButtonOnTap: () async {
await UpdateService.instance.launchReviewUrl();
},
firstButtonType: ButtonType.primary,
secondButtonLabel: S.of(context).ok,
secondButtonOnTap: () async {
if (Platform.isIOS) {
showToast(context, S.of(context).remindToEmptyDeviceTrash);
}
},
);
} else {
showDialogWidget(
context: context,
title: S.of(context).success,
body:
S.of(context).youHaveSuccessfullyFreedUp(formatBytes(status.size)),
icon: Icons.download_done_rounded,
isDismissible: true,
buttons: [
ButtonWidget(
buttonType: ButtonType.neutral,
labelText: S.of(context).ok,
isInAlert: true,
onTap: () async {
if (Platform.isIOS) {
showToast(context, S.of(context).remindToEmptyDeviceTrash);
}
},
),
],
);
}
}

void _showDuplicateFilesDeletedDialog(DeduplicationResult result) {
showChoiceDialog(
context,
title: S.of(context).sparkleSuccess,
body: S.of(context).duplicateFileCountWithStorageSaved(
result.count,
formatBytes(result.size),
),
firstButtonLabel: S.of(context).rateUs,
firstButtonOnTap: () async {
await UpdateService.instance.launchReviewUrl();
},
firstButtonType: ButtonType.primary,
secondButtonLabel: S.of(context).ok,
secondButtonOnTap: () async {
showShortToast(
context,
S.of(context).remindToEmptyEnteTrash,
);
},
);
}
}
Loading