19 lines
No EOL
661 B
Dart
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;
|
|
}
|
|
} |