Hide remote folders in the gallery section

This commit is contained in:
Vishnu Mohandas 2020-05-28 02:33:30 +05:30
parent 650e2f3161
commit 4dbf9c8078
2 changed files with 7 additions and 2 deletions

View file

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:logging/logging.dart';
import 'package:photos/models/photo.dart';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
@ -10,6 +11,8 @@ class PhotoDB {
static final _databaseName = "ente.photos.db";
static final _databaseVersion = 1;
static final Logger _logger = Logger("PhotoDB");
static final table = 'photos';
static final columnGeneratedId = '_id';
@ -202,12 +205,13 @@ class PhotoDB {
);
}
Future<List<String>> getDistinctPaths() async {
Future<List<String>> getLocalPaths() async {
final db = await instance.database;
final rows = await db.query(
table,
columns: [columnDeviceFolder],
distinct: true,
where: '$columnRemoteFolderId IS NULL',
);
List<String> result = List<String>();
for (final row in rows) {
@ -233,6 +237,7 @@ class PhotoDB {
}
Future<Photo> getLatestPhotoInRemoteFolder(int folderId) async {
_logger.info("Querying for folder: " + folderId.toString());
final db = await instance.database;
var rows = await db.query(
table,

View file

@ -54,7 +54,7 @@ class _DeviceFolderGalleryWidgetState extends State<DeviceFolderGalleryWidget> {
}
Future<List<DeviceFolder>> _getDeviceFolders() async {
final paths = await PhotoDB.instance.getDistinctPaths();
final paths = await PhotoDB.instance.getLocalPaths();
final folders = List<DeviceFolder>();
for (final path in paths) {
final photo = await PhotoDB.instance.getLatestPhotoInPath(path);