mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-22 15:09:22 +01:00
Get rid of useless hack
This commit is contained in:
parent
511e95b237
commit
f01ab2f648
2 changed files with 7 additions and 10 deletions
|
@ -8,7 +8,6 @@ import 'package:nc_photos/entity/file.dart';
|
||||||
import 'package:nc_photos/entity/file/data_source.dart';
|
import 'package:nc_photos/entity/file/data_source.dart';
|
||||||
import 'package:nc_photos/exception.dart';
|
import 'package:nc_photos/exception.dart';
|
||||||
import 'package:nc_photos/iterable_extension.dart';
|
import 'package:nc_photos/iterable_extension.dart';
|
||||||
import 'package:nc_photos/k.dart' as k;
|
|
||||||
import 'package:nc_photos/object_extension.dart';
|
import 'package:nc_photos/object_extension.dart';
|
||||||
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
|
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
|
||||||
import 'package:nc_photos/touch_token_manager.dart';
|
import 'package:nc_photos/touch_token_manager.dart';
|
||||||
|
@ -133,10 +132,9 @@ class FileCacheUpdater {
|
||||||
final fileStore = transaction.objectStore(AppDb.file2StoreName);
|
final fileStore = transaction.objectStore(AppDb.file2StoreName);
|
||||||
|
|
||||||
// add files to db
|
// add files to db
|
||||||
await remote.forEachAsync(
|
await Future.wait(remote.map((f) => fileStore.put(
|
||||||
(f) => fileStore.put(AppDbFile2Entry.fromFile(account, f).toJson(),
|
AppDbFile2Entry.fromFile(account, f).toJson(),
|
||||||
AppDbFile2Entry.toPrimaryKeyForFile(account, f)),
|
AppDbFile2Entry.toPrimaryKeyForFile(account, f))));
|
||||||
k.simultaneousQuery);
|
|
||||||
|
|
||||||
// results from remote also contain the dir itself
|
// results from remote also contain the dir itself
|
||||||
final resultGroup =
|
final resultGroup =
|
||||||
|
|
|
@ -9,7 +9,6 @@ import 'package:nc_photos/di_container.dart';
|
||||||
import 'package:nc_photos/entity/file.dart';
|
import 'package:nc_photos/entity/file.dart';
|
||||||
import 'package:nc_photos/event/event.dart';
|
import 'package:nc_photos/event/event.dart';
|
||||||
import 'package:nc_photos/iterable_extension.dart';
|
import 'package:nc_photos/iterable_extension.dart';
|
||||||
import 'package:nc_photos/k.dart' as k;
|
|
||||||
import 'package:nc_photos/list_util.dart' as list_util;
|
import 'package:nc_photos/list_util.dart' as list_util;
|
||||||
import 'package:nc_photos/use_case/list_favorite_offline.dart';
|
import 'package:nc_photos/use_case/list_favorite_offline.dart';
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ class CacheFavorite {
|
||||||
(db) => db.transaction(AppDb.file2StoreName, idbModeReadWrite),
|
(db) => db.transaction(AppDb.file2StoreName, idbModeReadWrite),
|
||||||
(transaction) async {
|
(transaction) async {
|
||||||
final fileStore = transaction.objectStore(AppDb.file2StoreName);
|
final fileStore = transaction.objectStore(AppDb.file2StoreName);
|
||||||
await newFavorites.forEachAsync((f) async {
|
await Future.wait(newFavorites.map((f) async {
|
||||||
_log.info("[call] New favorite: ${f.path}");
|
_log.info("[call] New favorite: ${f.path}");
|
||||||
try {
|
try {
|
||||||
await fileStore.put(AppDbFile2Entry.fromFile(account, f).toJson(),
|
await fileStore.put(AppDbFile2Entry.fromFile(account, f).toJson(),
|
||||||
|
@ -53,8 +52,8 @@ class CacheFavorite {
|
||||||
e,
|
e,
|
||||||
stackTrace);
|
stackTrace);
|
||||||
}
|
}
|
||||||
}, k.simultaneousQuery);
|
}));
|
||||||
await removedFavorites.forEachAsync((f) async {
|
await Future.wait(removedFavorites.map((f) async {
|
||||||
_log.info("[call] Remove favorite: ${f.path}");
|
_log.info("[call] Remove favorite: ${f.path}");
|
||||||
try {
|
try {
|
||||||
await fileStore.put(AppDbFile2Entry.fromFile(account, f).toJson(),
|
await fileStore.put(AppDbFile2Entry.fromFile(account, f).toJson(),
|
||||||
|
@ -65,7 +64,7 @@ class CacheFavorite {
|
||||||
e,
|
e,
|
||||||
stackTrace);
|
stackTrace);
|
||||||
}
|
}
|
||||||
}, k.simultaneousQuery);
|
}));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue