mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-08 18:28:53 +01:00
Add trashbin properties to File
This commit is contained in:
parent
ca5714c816
commit
832f866d00
5 changed files with 262 additions and 1 deletions
|
@ -175,6 +175,9 @@ class _Files {
|
||||||
hasPreview,
|
hasPreview,
|
||||||
size,
|
size,
|
||||||
richWorkspace,
|
richWorkspace,
|
||||||
|
trashbinFilename,
|
||||||
|
trashbinOriginalLocation,
|
||||||
|
trashbinDeletionTime,
|
||||||
Map<String, String>? customNamespaces,
|
Map<String, String>? customNamespaces,
|
||||||
List<String>? customProperties,
|
List<String>? customProperties,
|
||||||
}) async {
|
}) async {
|
||||||
|
@ -195,7 +198,11 @@ class _Files {
|
||||||
shareTypes != null ||
|
shareTypes != null ||
|
||||||
checksums != null ||
|
checksums != null ||
|
||||||
size != null);
|
size != null);
|
||||||
final bool hasNcNs = (hasPreview != null || richWorkspace != null);
|
final bool hasNcNs = (hasPreview != null ||
|
||||||
|
richWorkspace != null ||
|
||||||
|
trashbinFilename != null ||
|
||||||
|
trashbinOriginalLocation != null ||
|
||||||
|
trashbinDeletionTime != null);
|
||||||
if (!hasDavNs && !hasOcNs && !hasNcNs) {
|
if (!hasDavNs && !hasOcNs && !hasNcNs) {
|
||||||
// no body
|
// no body
|
||||||
return await _api.request("PROPFIND", path);
|
return await _api.request("PROPFIND", path);
|
||||||
|
@ -265,6 +272,15 @@ class _Files {
|
||||||
if (richWorkspace != null) {
|
if (richWorkspace != null) {
|
||||||
builder.element("nc:rich-workspace");
|
builder.element("nc:rich-workspace");
|
||||||
}
|
}
|
||||||
|
if (trashbinFilename != null) {
|
||||||
|
builder.element("nc:trashbin-filename");
|
||||||
|
}
|
||||||
|
if (trashbinOriginalLocation != null) {
|
||||||
|
builder.element("nc:trashbin-original-location");
|
||||||
|
}
|
||||||
|
if (trashbinDeletionTime != null) {
|
||||||
|
builder.element("nc:trashbin-deletion-time");
|
||||||
|
}
|
||||||
for (final p in customProperties ?? []) {
|
for (final p in customProperties ?? []) {
|
||||||
builder.element(p);
|
builder.element(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,9 @@ class File with EquatableMixin {
|
||||||
this.metadata,
|
this.metadata,
|
||||||
this.isArchived,
|
this.isArchived,
|
||||||
this.overrideDateTime,
|
this.overrideDateTime,
|
||||||
|
this.trashbinFilename,
|
||||||
|
this.trashbinOriginalLocation,
|
||||||
|
this.trashbinDeletionTime,
|
||||||
}) : this.path = path.trimAny("/");
|
}) : this.path = path.trimAny("/");
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -240,6 +243,11 @@ class File with EquatableMixin {
|
||||||
hasPreview: json["hasPreview"],
|
hasPreview: json["hasPreview"],
|
||||||
fileId: json["fileId"],
|
fileId: json["fileId"],
|
||||||
ownerId: json["ownerId"],
|
ownerId: json["ownerId"],
|
||||||
|
trashbinFilename: json["trashbinFilename"],
|
||||||
|
trashbinOriginalLocation: json["trashbinOriginalLocation"],
|
||||||
|
trashbinDeletionTime: json["trashbinDeletionTime"] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json["trashbinDeletionTime"]),
|
||||||
metadata: json["metadata"] == null
|
metadata: json["metadata"] == null
|
||||||
? null
|
? null
|
||||||
: Metadata.fromJson(
|
: Metadata.fromJson(
|
||||||
|
@ -291,6 +299,15 @@ class File with EquatableMixin {
|
||||||
if (ownerId != null) {
|
if (ownerId != null) {
|
||||||
product += "ownerId: '$ownerId', ";
|
product += "ownerId: '$ownerId', ";
|
||||||
}
|
}
|
||||||
|
if (trashbinFilename != null) {
|
||||||
|
product += "trashbinFilename: '$trashbinFilename', ";
|
||||||
|
}
|
||||||
|
if (trashbinOriginalLocation != null) {
|
||||||
|
product += "trashbinOriginalLocation: '$trashbinOriginalLocation', ";
|
||||||
|
}
|
||||||
|
if (trashbinDeletionTime != null) {
|
||||||
|
product += "trashbinDeletionTime: $trashbinDeletionTime, ";
|
||||||
|
}
|
||||||
if (metadata != null) {
|
if (metadata != null) {
|
||||||
product += "metadata: $metadata, ";
|
product += "metadata: $metadata, ";
|
||||||
}
|
}
|
||||||
|
@ -316,6 +333,11 @@ class File with EquatableMixin {
|
||||||
if (hasPreview != null) "hasPreview": hasPreview,
|
if (hasPreview != null) "hasPreview": hasPreview,
|
||||||
if (fileId != null) "fileId": fileId,
|
if (fileId != null) "fileId": fileId,
|
||||||
if (ownerId != null) "ownerId": ownerId,
|
if (ownerId != null) "ownerId": ownerId,
|
||||||
|
if (trashbinFilename != null) "trashbinFilename": trashbinFilename,
|
||||||
|
if (trashbinOriginalLocation != null)
|
||||||
|
"trashbinOriginalLocation": trashbinOriginalLocation,
|
||||||
|
if (trashbinDeletionTime != null)
|
||||||
|
"trashbinDeletionTime": trashbinDeletionTime!.toUtc().toIso8601String(),
|
||||||
if (metadata != null) "metadata": metadata!.toJson(),
|
if (metadata != null) "metadata": metadata!.toJson(),
|
||||||
if (isArchived != null) "isArchived": isArchived,
|
if (isArchived != null) "isArchived": isArchived,
|
||||||
if (overrideDateTime != null)
|
if (overrideDateTime != null)
|
||||||
|
@ -334,6 +356,9 @@ class File with EquatableMixin {
|
||||||
bool? hasPreview,
|
bool? hasPreview,
|
||||||
int? fileId,
|
int? fileId,
|
||||||
String? ownerId,
|
String? ownerId,
|
||||||
|
String? trashbinFilename,
|
||||||
|
String? trashbinOriginalLocation,
|
||||||
|
DateTime? trashbinDeletionTime,
|
||||||
OrNull<Metadata>? metadata,
|
OrNull<Metadata>? metadata,
|
||||||
OrNull<bool>? isArchived,
|
OrNull<bool>? isArchived,
|
||||||
OrNull<DateTime>? overrideDateTime,
|
OrNull<DateTime>? overrideDateTime,
|
||||||
|
@ -349,6 +374,10 @@ class File with EquatableMixin {
|
||||||
hasPreview: hasPreview ?? this.hasPreview,
|
hasPreview: hasPreview ?? this.hasPreview,
|
||||||
fileId: fileId ?? this.fileId,
|
fileId: fileId ?? this.fileId,
|
||||||
ownerId: ownerId ?? this.ownerId,
|
ownerId: ownerId ?? this.ownerId,
|
||||||
|
trashbinFilename: trashbinFilename ?? this.trashbinFilename,
|
||||||
|
trashbinOriginalLocation:
|
||||||
|
trashbinOriginalLocation ?? this.trashbinOriginalLocation,
|
||||||
|
trashbinDeletionTime: trashbinDeletionTime ?? this.trashbinDeletionTime,
|
||||||
metadata: metadata == null ? this.metadata : metadata.obj,
|
metadata: metadata == null ? this.metadata : metadata.obj,
|
||||||
isArchived: isArchived == null ? this.isArchived : isArchived.obj,
|
isArchived: isArchived == null ? this.isArchived : isArchived.obj,
|
||||||
overrideDateTime: overrideDateTime == null
|
overrideDateTime: overrideDateTime == null
|
||||||
|
@ -386,6 +415,9 @@ class File with EquatableMixin {
|
||||||
hasPreview,
|
hasPreview,
|
||||||
fileId,
|
fileId,
|
||||||
ownerId,
|
ownerId,
|
||||||
|
trashbinFilename,
|
||||||
|
trashbinOriginalLocation,
|
||||||
|
trashbinDeletionTime,
|
||||||
// metadata is handled separately, see [equals]
|
// metadata is handled separately, see [equals]
|
||||||
isArchived,
|
isArchived,
|
||||||
overrideDateTime,
|
overrideDateTime,
|
||||||
|
@ -402,6 +434,9 @@ class File with EquatableMixin {
|
||||||
// maybe null when loaded from old cache
|
// maybe null when loaded from old cache
|
||||||
final int? fileId;
|
final int? fileId;
|
||||||
final String? ownerId;
|
final String? ownerId;
|
||||||
|
final String? trashbinFilename;
|
||||||
|
final String? trashbinOriginalLocation;
|
||||||
|
final DateTime? trashbinDeletionTime;
|
||||||
// metadata
|
// metadata
|
||||||
final Metadata? metadata;
|
final Metadata? metadata;
|
||||||
final bool? isArchived;
|
final bool? isArchived;
|
||||||
|
|
|
@ -40,6 +40,9 @@ class FileWebdavDataSource implements FileDataSource {
|
||||||
hasPreview: 1,
|
hasPreview: 1,
|
||||||
fileid: 1,
|
fileid: 1,
|
||||||
ownerId: 1,
|
ownerId: 1,
|
||||||
|
trashbinFilename: 1,
|
||||||
|
trashbinOriginalLocation: 1,
|
||||||
|
trashbinDeletionTime: 1,
|
||||||
customNamespaces: {
|
customNamespaces: {
|
||||||
"com.nkming.nc_photos": "app",
|
"com.nkming.nc_photos": "app",
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,6 +68,9 @@ class WebdavFileParser {
|
||||||
Metadata? metadata;
|
Metadata? metadata;
|
||||||
bool? isArchived;
|
bool? isArchived;
|
||||||
DateTime? overrideDateTime;
|
DateTime? overrideDateTime;
|
||||||
|
String? trashbinFilename;
|
||||||
|
String? trashbinOriginalLocation;
|
||||||
|
DateTime? trashbinDeletionTime;
|
||||||
|
|
||||||
for (final child in element.children.whereType<XmlElement>()) {
|
for (final child in element.children.whereType<XmlElement>()) {
|
||||||
if (child.matchQualifiedName("href",
|
if (child.matchQualifiedName("href",
|
||||||
|
@ -101,6 +104,9 @@ class WebdavFileParser {
|
||||||
metadata = propParser.metadata;
|
metadata = propParser.metadata;
|
||||||
isArchived = propParser.isArchived;
|
isArchived = propParser.isArchived;
|
||||||
overrideDateTime = propParser.overrideDateTime;
|
overrideDateTime = propParser.overrideDateTime;
|
||||||
|
trashbinFilename = propParser.trashbinFilename;
|
||||||
|
trashbinOriginalLocation = propParser.trashbinOriginalLocation;
|
||||||
|
trashbinDeletionTime = propParser.trashbinDeletionTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +124,9 @@ class WebdavFileParser {
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
isArchived: isArchived,
|
isArchived: isArchived,
|
||||||
overrideDateTime: overrideDateTime,
|
overrideDateTime: overrideDateTime,
|
||||||
|
trashbinFilename: trashbinFilename,
|
||||||
|
trashbinOriginalLocation: trashbinOriginalLocation,
|
||||||
|
trashbinDeletionTime: trashbinDeletionTime,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +186,16 @@ class _PropParser {
|
||||||
} else if (child.matchQualifiedName("owner-id",
|
} else if (child.matchQualifiedName("owner-id",
|
||||||
prefix: "http://owncloud.org/ns", namespaces: namespaces)) {
|
prefix: "http://owncloud.org/ns", namespaces: namespaces)) {
|
||||||
_ownerId = child.innerText;
|
_ownerId = child.innerText;
|
||||||
|
} else if (child.matchQualifiedName("trashbin-filename",
|
||||||
|
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||||
|
_trashbinFilename = child.innerText;
|
||||||
|
} else if (child.matchQualifiedName("trashbin-original-location",
|
||||||
|
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||||
|
_trashbinOriginalLocation = child.innerText;
|
||||||
|
} else if (child.matchQualifiedName("trashbin-deletion-time",
|
||||||
|
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
|
||||||
|
_trashbinDeletionTime = DateTime.fromMillisecondsSinceEpoch(
|
||||||
|
int.parse(child.innerText) * 1000);
|
||||||
} else if (child.matchQualifiedName("is-archived",
|
} else if (child.matchQualifiedName("is-archived",
|
||||||
prefix: "com.nkming.nc_photos", namespaces: namespaces)) {
|
prefix: "com.nkming.nc_photos", namespaces: namespaces)) {
|
||||||
_isArchived = child.innerText == "true";
|
_isArchived = child.innerText == "true";
|
||||||
|
@ -216,6 +235,9 @@ class _PropParser {
|
||||||
Metadata? get metadata => _metadata;
|
Metadata? get metadata => _metadata;
|
||||||
bool? get isArchived => _isArchived;
|
bool? get isArchived => _isArchived;
|
||||||
DateTime? get overrideDateTime => _overrideDateTime;
|
DateTime? get overrideDateTime => _overrideDateTime;
|
||||||
|
String? get trashbinFilename => _trashbinFilename;
|
||||||
|
String? get trashbinOriginalLocation => _trashbinOriginalLocation;
|
||||||
|
DateTime? get trashbinDeletionTime => _trashbinDeletionTime;
|
||||||
|
|
||||||
final Map<String, String> namespaces;
|
final Map<String, String> namespaces;
|
||||||
|
|
||||||
|
@ -234,6 +256,9 @@ class _PropParser {
|
||||||
Metadata? _metadata;
|
Metadata? _metadata;
|
||||||
bool? _isArchived;
|
bool? _isArchived;
|
||||||
DateTime? _overrideDateTime;
|
DateTime? _overrideDateTime;
|
||||||
|
String? _trashbinFilename;
|
||||||
|
String? _trashbinOriginalLocation;
|
||||||
|
DateTime? _trashbinDeletionTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
extension on XmlElement {
|
extension on XmlElement {
|
||||||
|
|
|
@ -434,6 +434,38 @@ void main() {
|
||||||
expect(file, File(path: "", ownerId: "admin"));
|
expect(file, File(path: "", ownerId: "admin"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("trashbinFilename", () {
|
||||||
|
final json = <String, dynamic>{
|
||||||
|
"path": "",
|
||||||
|
"trashbinFilename": "test.jpg",
|
||||||
|
};
|
||||||
|
final file = File.fromJson(json);
|
||||||
|
expect(file, File(path: "", trashbinFilename: "test.jpg"));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinOriginalLocation", () {
|
||||||
|
final json = <String, dynamic>{
|
||||||
|
"path": "",
|
||||||
|
"trashbinOriginalLocation": "Photos/test.jpg",
|
||||||
|
};
|
||||||
|
final file = File.fromJson(json);
|
||||||
|
expect(
|
||||||
|
file, File(path: "", trashbinOriginalLocation: "Photos/test.jpg"));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinDeletionTime", () {
|
||||||
|
final json = <String, dynamic>{
|
||||||
|
"path": "",
|
||||||
|
"trashbinDeletionTime": "2022-01-02T03:04:05.000Z",
|
||||||
|
};
|
||||||
|
final file = File.fromJson(json);
|
||||||
|
expect(
|
||||||
|
file,
|
||||||
|
File(
|
||||||
|
path: "",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5)));
|
||||||
|
});
|
||||||
|
|
||||||
test("metadata", () {
|
test("metadata", () {
|
||||||
final json = <String, dynamic>{
|
final json = <String, dynamic>{
|
||||||
"path": "",
|
"path": "",
|
||||||
|
@ -567,6 +599,32 @@ void main() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("trashbinFilename", () {
|
||||||
|
final file = File(path: "", trashbinFilename: "test.jpg");
|
||||||
|
expect(file.toJson(), <String, dynamic>{
|
||||||
|
"path": "",
|
||||||
|
"trashbinFilename": "test.jpg",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinOriginalLocation", () {
|
||||||
|
final file =
|
||||||
|
File(path: "", trashbinOriginalLocation: "Photos/test.jpg");
|
||||||
|
expect(file.toJson(), <String, dynamic>{
|
||||||
|
"path": "",
|
||||||
|
"trashbinOriginalLocation": "Photos/test.jpg",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinDeletionTime", () {
|
||||||
|
final file = File(
|
||||||
|
path: "", trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5));
|
||||||
|
expect(file.toJson(), <String, dynamic>{
|
||||||
|
"path": "",
|
||||||
|
"trashbinDeletionTime": "2022-01-02T03:04:05.000Z",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("metadata", () {
|
test("metadata", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
|
@ -614,6 +672,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
metadata: null,
|
metadata: null,
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
|
@ -634,6 +695,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -654,6 +718,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -674,6 +741,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -694,6 +764,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -715,6 +788,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -735,6 +811,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -755,6 +834,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -775,6 +857,9 @@ void main() {
|
||||||
hasPreview: false,
|
hasPreview: false,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -795,6 +880,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 321,
|
fileId: 321,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -815,6 +903,79 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "user",
|
ownerId: "user",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
|
isArchived: true,
|
||||||
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinFilename", () {
|
||||||
|
final file = src.copyWith(trashbinFilename: "test2.jpg");
|
||||||
|
expect(
|
||||||
|
file,
|
||||||
|
File(
|
||||||
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
|
contentLength: 123,
|
||||||
|
contentType: "image/jpeg",
|
||||||
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
lastModified: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
|
isCollection: true,
|
||||||
|
usedBytes: 123456,
|
||||||
|
hasPreview: true,
|
||||||
|
fileId: 123,
|
||||||
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test2.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
|
isArchived: true,
|
||||||
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinOriginalLocation", () {
|
||||||
|
final file = src.copyWith(trashbinOriginalLocation: "Photos2/test.jpg");
|
||||||
|
expect(
|
||||||
|
file,
|
||||||
|
File(
|
||||||
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
|
contentLength: 123,
|
||||||
|
contentType: "image/jpeg",
|
||||||
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
lastModified: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
|
isCollection: true,
|
||||||
|
usedBytes: 123456,
|
||||||
|
hasPreview: true,
|
||||||
|
fileId: 123,
|
||||||
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos2/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
|
isArchived: true,
|
||||||
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("trashbinDeletionTime", () {
|
||||||
|
final now = DateTime.now();
|
||||||
|
final file = src.copyWith(trashbinDeletionTime: now);
|
||||||
|
expect(
|
||||||
|
file,
|
||||||
|
File(
|
||||||
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
|
contentLength: 123,
|
||||||
|
contentType: "image/jpeg",
|
||||||
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
lastModified: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
|
isCollection: true,
|
||||||
|
usedBytes: 123456,
|
||||||
|
hasPreview: true,
|
||||||
|
fileId: 123,
|
||||||
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: now,
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -836,6 +997,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
|
@ -854,6 +1018,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
metadata: Metadata(),
|
metadata: Metadata(),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
|
@ -872,6 +1039,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -892,6 +1062,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: false,
|
isArchived: false,
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
|
@ -912,6 +1085,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
overrideDateTime: DateTime.utc(2021, 1, 2, 3, 4, 5),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
@ -932,6 +1108,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
overrideDateTime: DateTime.utc(2022, 3, 4, 5, 6, 7),
|
overrideDateTime: DateTime.utc(2022, 3, 4, 5, 6, 7),
|
||||||
));
|
));
|
||||||
|
@ -952,6 +1131,9 @@ void main() {
|
||||||
hasPreview: true,
|
hasPreview: true,
|
||||||
fileId: 123,
|
fileId: 123,
|
||||||
ownerId: "admin",
|
ownerId: "admin",
|
||||||
|
trashbinFilename: "test.jpg",
|
||||||
|
trashbinOriginalLocation: "Photos/test.jpg",
|
||||||
|
trashbinDeletionTime: DateTime.utc(2022, 1, 2, 3, 4, 5),
|
||||||
isArchived: true,
|
isArchived: true,
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue