2023-04-13 17:32:31 +02:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:nc_photos/entity/collection.dart';
|
|
|
|
import 'package:nc_photos/entity/collection/adapter.dart';
|
|
|
|
import 'package:nc_photos/entity/collection_item.dart';
|
|
|
|
import 'package:nc_photos/entity/collection_item/util.dart';
|
|
|
|
import 'package:nc_photos/entity/file_descriptor.dart';
|
2023-04-17 18:15:29 +02:00
|
|
|
import 'package:nc_photos/or_null.dart';
|
2023-04-13 17:32:31 +02:00
|
|
|
import 'package:np_common/type.dart';
|
|
|
|
|
|
|
|
/// A read-only collection that does not support modifying its items
|
|
|
|
mixin CollectionReadOnlyAdapter implements CollectionAdapter {
|
|
|
|
@override
|
|
|
|
Future<int> addFiles(
|
|
|
|
List<FileDescriptor> files, {
|
|
|
|
ErrorWithValueHandler<FileDescriptor>? onError,
|
|
|
|
required ValueChanged<Collection> onCollectionUpdated,
|
|
|
|
}) {
|
|
|
|
throw UnsupportedError("Operation not supported");
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<Collection> edit({
|
|
|
|
String? name,
|
|
|
|
List<CollectionItem>? items,
|
|
|
|
CollectionItemSort? itemSort,
|
2023-04-17 18:15:29 +02:00
|
|
|
OrNull<FileDescriptor>? cover,
|
2023-04-22 16:32:34 +02:00
|
|
|
List<CollectionItem>? knownItems,
|
2023-04-13 17:32:31 +02:00
|
|
|
}) {
|
|
|
|
throw UnsupportedError("Operation not supported");
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<int> removeItems(
|
|
|
|
List<CollectionItem> items, {
|
|
|
|
ErrorWithValueIndexedHandler<CollectionItem>? onError,
|
|
|
|
required ValueChanged<Collection> onCollectionUpdated,
|
|
|
|
}) {
|
|
|
|
throw UnsupportedError("Operation not supported");
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2023-04-17 18:15:29 +02:00
|
|
|
bool isItemRemovable(CollectionItem item) => false;
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool isManualCover() => false;
|
2023-04-22 05:43:13 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<Collection?> updatePostLoad(List<CollectionItem> items) =>
|
|
|
|
Future.value(null);
|
2023-04-13 17:32:31 +02:00
|
|
|
}
|