mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
Fix removing file from Nextcloud album incorrectly deleted it
This commit is contained in:
parent
bfbfaffe5c
commit
1cfff45039
3 changed files with 60 additions and 1 deletions
|
@ -53,7 +53,14 @@ class CollectionNcAlbumAdapter
|
||||||
);
|
);
|
||||||
return items.map((i) {
|
return items.map((i) {
|
||||||
final f = found.firstWhereOrNull((e) => e.fdId == i.fileId);
|
final f = found.firstWhereOrNull((e) => e.fdId == i.fileId);
|
||||||
return CollectionFileItemNcAlbumItemAdapter(i, f);
|
return CollectionFileItemNcAlbumItemAdapter(
|
||||||
|
i,
|
||||||
|
// retain the path such that it is correct recognized as part of an
|
||||||
|
// album
|
||||||
|
f?.copyWith(
|
||||||
|
fdPath: i.path,
|
||||||
|
),
|
||||||
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:copy_with/copy_with.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:nc_photos/entity/file.dart';
|
import 'package:nc_photos/entity/file.dart';
|
||||||
import 'package:np_common/type.dart';
|
import 'package:np_common/type.dart';
|
||||||
|
@ -18,6 +19,7 @@ int compareFileDescriptorDateTimeDescending(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@genCopyWith
|
||||||
@toString
|
@toString
|
||||||
class FileDescriptor with EquatableMixin {
|
class FileDescriptor with EquatableMixin {
|
||||||
const FileDescriptor({
|
const FileDescriptor({
|
||||||
|
|
|
@ -2,6 +2,56 @@
|
||||||
|
|
||||||
part of 'file_descriptor.dart';
|
part of 'file_descriptor.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// CopyWithLintRuleGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// ignore_for_file: library_private_types_in_public_api, duplicate_ignore
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// CopyWithGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
abstract class $FileDescriptorCopyWithWorker {
|
||||||
|
FileDescriptor call(
|
||||||
|
{String? fdPath,
|
||||||
|
int? fdId,
|
||||||
|
String? fdMime,
|
||||||
|
bool? fdIsArchived,
|
||||||
|
bool? fdIsFavorite,
|
||||||
|
DateTime? fdDateTime});
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$FileDescriptorCopyWithWorkerImpl
|
||||||
|
implements $FileDescriptorCopyWithWorker {
|
||||||
|
_$FileDescriptorCopyWithWorkerImpl(this.that);
|
||||||
|
|
||||||
|
@override
|
||||||
|
FileDescriptor call(
|
||||||
|
{dynamic fdPath,
|
||||||
|
dynamic fdId,
|
||||||
|
dynamic fdMime = copyWithNull,
|
||||||
|
dynamic fdIsArchived,
|
||||||
|
dynamic fdIsFavorite,
|
||||||
|
dynamic fdDateTime}) {
|
||||||
|
return FileDescriptor(
|
||||||
|
fdPath: fdPath as String? ?? that.fdPath,
|
||||||
|
fdId: fdId as int? ?? that.fdId,
|
||||||
|
fdMime: fdMime == copyWithNull ? that.fdMime : fdMime as String?,
|
||||||
|
fdIsArchived: fdIsArchived as bool? ?? that.fdIsArchived,
|
||||||
|
fdIsFavorite: fdIsFavorite as bool? ?? that.fdIsFavorite,
|
||||||
|
fdDateTime: fdDateTime as DateTime? ?? that.fdDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
final FileDescriptor that;
|
||||||
|
}
|
||||||
|
|
||||||
|
extension $FileDescriptorCopyWith on FileDescriptor {
|
||||||
|
$FileDescriptorCopyWithWorker get copyWith => _$copyWith;
|
||||||
|
$FileDescriptorCopyWithWorker get _$copyWith =>
|
||||||
|
_$FileDescriptorCopyWithWorkerImpl(this);
|
||||||
|
}
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// ToStringGenerator
|
// ToStringGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue