aves_mio1/lib/remote/remote_gallery_bridge.dart
FabioMich66 507c131502
Some checks are pending
Quality check / Flutter analysis (push) Waiting to run
Quality check / CodeQL analysis (java-kotlin) (push) Waiting to run
ok2
2026-03-07 23:53:27 +01:00

19 lines
No EOL
661 B
Dart

// lib/remote/remote_gallery_bridge.dart
import 'package:aves/model/entry/entry.dart';
import 'package:aves/services/common/services.dart';
class RemoteGalleryBridge {
static Future<Set<AvesEntry>> loadRemoteEntries() async {
final remotes = await localMediaDb.loadEntries(origin: 1); // usa API esistente
return remotes.where((e) => e.trashed == 0).toSet();
}
static List<AvesEntry> mergeWithLocal(List<AvesEntry> locals, Set<AvesEntry> remotes) {
final ids = {...locals.map((e) => e.id)};
final merged = <AvesEntry>[...locals];
for (final r in remotes) {
if (!ids.contains(r.id)) merged.add(r);
}
return merged;
}
}