Merge pull request #337 from ente-io/hide_hidden_memories
Hide hidden memories from memories widget 🍭
This commit is contained in:
commit
82c26ef1c9
4 changed files with 20 additions and 21 deletions
|
@ -580,9 +580,10 @@ class FilesDB {
|
|||
|
||||
Future<List<File>> getFilesCreatedWithinDurations(
|
||||
List<List<int>> durations,
|
||||
Set<int> ignoredCollectionIDs,
|
||||
) async {
|
||||
final db = await instance.database;
|
||||
String whereClause = "";
|
||||
String whereClause = "( ";
|
||||
for (int index = 0; index < durations.length; index++) {
|
||||
whereClause += "($columnCreationTime > " +
|
||||
durations[index][0].toString() +
|
||||
|
@ -593,12 +594,14 @@ class FilesDB {
|
|||
whereClause += " OR ";
|
||||
}
|
||||
}
|
||||
whereClause += ") AND $columnMMdVisibility = $kVisibilityVisible";
|
||||
final results = await db.query(
|
||||
table,
|
||||
where: whereClause,
|
||||
orderBy: '$columnCreationTime ASC',
|
||||
);
|
||||
return _convertToFiles(results);
|
||||
final files = _convertToFiles(results);
|
||||
return _deduplicatedAndFilterIgnoredFiles(files, ignoredCollectionIDs);
|
||||
}
|
||||
|
||||
Future<List<File>> getFilesToBeUploadedWithinFolders(
|
||||
|
|
|
@ -10,25 +10,17 @@ class ImportantItemsFilter implements GalleryItemsFilter {
|
|||
|
||||
@override
|
||||
bool shouldInclude(File file) {
|
||||
if (_importantPaths.isEmpty) {
|
||||
if (Platform.isAndroid) {
|
||||
if (file.uploadedFileID != null) {
|
||||
return true;
|
||||
}
|
||||
final String folder = basename(file.deviceFolder);
|
||||
return folder == "Camera" ||
|
||||
folder == "Recents" ||
|
||||
folder == "DCIM" ||
|
||||
folder == "Download" ||
|
||||
folder == "Screenshot";
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (file.uploadedFileID != null) {
|
||||
return true;
|
||||
}
|
||||
final folder = basename(file.deviceFolder);
|
||||
final String folder = basename(file.deviceFolder);
|
||||
if (_importantPaths.isEmpty && Platform.isAndroid) {
|
||||
return folder == "Camera" ||
|
||||
folder == "Recents" ||
|
||||
folder == "DCIM" ||
|
||||
folder == "Download" ||
|
||||
folder == "Screenshot";
|
||||
}
|
||||
return _importantPaths.contains(folder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:photos/db/files_db.dart';
|
|||
import 'package:photos/db/memories_db.dart';
|
||||
import 'package:photos/models/filters/important_items_filter.dart';
|
||||
import 'package:photos/models/memory.dart';
|
||||
import 'package:photos/services/collections_service.dart';
|
||||
|
||||
class MemoriesService extends ChangeNotifier {
|
||||
final _logger = Logger("MemoryService");
|
||||
|
@ -70,7 +71,10 @@ class MemoriesService extends ChangeNotifier {
|
|||
date.add(Duration(days: daysAfter)).microsecondsSinceEpoch;
|
||||
durations.add([startCreationTime, endCreationTime]);
|
||||
}
|
||||
final files = await _filesDB.getFilesCreatedWithinDurations(durations);
|
||||
final archivedCollectionIds =
|
||||
CollectionsService.instance.getArchivedCollections();
|
||||
final files = await _filesDB.getFilesCreatedWithinDurations(
|
||||
durations, archivedCollectionIds);
|
||||
final seenTimes = await _memoriesDB.getSeenTimes();
|
||||
final List<Memory> memories = [];
|
||||
final filter = ImportantItemsFilter();
|
||||
|
|
|
@ -334,8 +334,8 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
|
|||
child: IconButton(
|
||||
icon: Icon(
|
||||
Icons.adaptive.share,
|
||||
color: Colors.white,
|
||||
), //same for both themes
|
||||
color: Colors.white, //same for both themes
|
||||
),
|
||||
onPressed: () {
|
||||
share(context, [file]);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue