use remoteDb
This commit is contained in:
@@ -1509,24 +1509,6 @@ class FilesDB with SqlDbBase {
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<Set<int>> getAllCollectionIDsOfFile(
|
||||
int uploadedFileID,
|
||||
) async {
|
||||
final db = await instance.sqliteAsyncDB;
|
||||
final results = await db.getAll(
|
||||
'''
|
||||
SELECT DISTINCT $columnCollectionID FROM $filesTable
|
||||
WHERE $columnUploadedFileID = ? AND $columnCollectionID != -1
|
||||
''',
|
||||
[uploadedFileID],
|
||||
);
|
||||
final collectionIDsOfFile = <int>{};
|
||||
for (var result in results) {
|
||||
collectionIDsOfFile.add(result['collection_id'] as int);
|
||||
}
|
||||
return collectionIDsOfFile;
|
||||
}
|
||||
|
||||
///Each collectionIDs in list aren't necessarily unique
|
||||
Future<List<int>> getAllCollectionIDsOfFiles(
|
||||
List<int> uploadedFileIDs,
|
||||
|
||||
@@ -8,4 +8,12 @@ extension CollectionFileRead on RemoteDB {
|
||||
);
|
||||
return row["count"] as int;
|
||||
}
|
||||
|
||||
Future<Set<int>> getAllCollectionIDsOfFile(int fileID) async {
|
||||
final rows = await sqliteDB.getAll(
|
||||
"SELECT collection_id FROM collection_files WHERE file_id = ?",
|
||||
[fileID],
|
||||
);
|
||||
return rows.map((row) => row["collection_id"] as int).toSet();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:logging/logging.dart";
|
||||
import "package:photos/core/event_bus.dart";
|
||||
import "package:photos/db/files_db.dart";
|
||||
import "package:photos/db/remote/read/collection_files.dart";
|
||||
import "package:photos/events/pause_video_event.dart";
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import 'package:photos/models/collection/collection.dart';
|
||||
import 'package:photos/models/collection/collection_items.dart';
|
||||
import 'package:photos/models/file/file.dart';
|
||||
import "package:photos/service_locator.dart";
|
||||
import "package:photos/services/collections_service.dart";
|
||||
import "package:photos/ui/components/buttons/chip_button_widget.dart";
|
||||
import "package:photos/ui/components/info_item_widget.dart";
|
||||
@@ -30,7 +31,7 @@ class AlbumsItemWidget extends StatelessWidget {
|
||||
final Future<Set<String>> allDeviceFoldersOfFile =
|
||||
Future.sync(() => {file.deviceFolder ?? ''});
|
||||
if (fileIsBackedup) {
|
||||
allCollectionIDsOfFile = FilesDB.instance.getAllCollectionIDsOfFile(
|
||||
allCollectionIDsOfFile = remoteDB.getAllCollectionIDsOfFile(
|
||||
file.uploadedFileID!,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user