Owner display name should be shown instead of owner id

This commit is contained in:
Ming Ming 2022-07-12 03:45:20 +08:00
parent 478c25b5d0
commit a65da95f75
8 changed files with 89 additions and 9 deletions

View file

@ -231,6 +231,7 @@ class File with EquatableMixin {
this.fileId, this.fileId,
this.isFavorite, this.isFavorite,
this.ownerId, this.ownerId,
this.ownerDisplayName,
this.metadata, this.metadata,
this.isArchived, this.isArchived,
this.overrideDateTime, this.overrideDateTime,
@ -268,6 +269,7 @@ class File with EquatableMixin {
fileId: json["fileId"], fileId: json["fileId"],
isFavorite: json_util.boolFromJson(json["isFavorite"]), isFavorite: json_util.boolFromJson(json["isFavorite"]),
ownerId: json["ownerId"] == null ? null : CiString(json["ownerId"]), ownerId: json["ownerId"] == null ? null : CiString(json["ownerId"]),
ownerDisplayName: json["ownerDisplayName"],
trashbinFilename: json["trashbinFilename"], trashbinFilename: json["trashbinFilename"],
trashbinOriginalLocation: json["trashbinOriginalLocation"], trashbinOriginalLocation: json["trashbinOriginalLocation"],
trashbinDeletionTime: json["trashbinDeletionTime"] == null trashbinDeletionTime: json["trashbinDeletionTime"] == null
@ -327,6 +329,9 @@ class File with EquatableMixin {
if (ownerId != null) { if (ownerId != null) {
product += "ownerId: '$ownerId', "; product += "ownerId: '$ownerId', ";
} }
if (ownerDisplayName != null) {
product += "ownerDisplayName: '$ownerDisplayName', ";
}
if (trashbinFilename != null) { if (trashbinFilename != null) {
product += "trashbinFilename: '$trashbinFilename', "; product += "trashbinFilename: '$trashbinFilename', ";
} }
@ -362,6 +367,7 @@ class File with EquatableMixin {
if (fileId != null) "fileId": fileId, if (fileId != null) "fileId": fileId,
if (isFavorite != null) "isFavorite": json_util.boolToJson(isFavorite), if (isFavorite != null) "isFavorite": json_util.boolToJson(isFavorite),
if (ownerId != null) "ownerId": ownerId.toString(), if (ownerId != null) "ownerId": ownerId.toString(),
if (ownerDisplayName != null) "ownerDisplayName": ownerDisplayName,
if (trashbinFilename != null) "trashbinFilename": trashbinFilename, if (trashbinFilename != null) "trashbinFilename": trashbinFilename,
if (trashbinOriginalLocation != null) if (trashbinOriginalLocation != null)
"trashbinOriginalLocation": trashbinOriginalLocation, "trashbinOriginalLocation": trashbinOriginalLocation,
@ -386,6 +392,7 @@ class File with EquatableMixin {
int? fileId, int? fileId,
bool? isFavorite, bool? isFavorite,
CiString? ownerId, CiString? ownerId,
String? ownerDisplayName,
String? trashbinFilename, String? trashbinFilename,
String? trashbinOriginalLocation, String? trashbinOriginalLocation,
DateTime? trashbinDeletionTime, DateTime? trashbinDeletionTime,
@ -405,6 +412,7 @@ class File with EquatableMixin {
fileId: fileId ?? this.fileId, fileId: fileId ?? this.fileId,
isFavorite: isFavorite ?? this.isFavorite, isFavorite: isFavorite ?? this.isFavorite,
ownerId: ownerId ?? this.ownerId, ownerId: ownerId ?? this.ownerId,
ownerDisplayName: ownerDisplayName ?? this.ownerDisplayName,
trashbinFilename: trashbinFilename ?? this.trashbinFilename, trashbinFilename: trashbinFilename ?? this.trashbinFilename,
trashbinOriginalLocation: trashbinOriginalLocation:
trashbinOriginalLocation ?? this.trashbinOriginalLocation, trashbinOriginalLocation ?? this.trashbinOriginalLocation,
@ -430,6 +438,7 @@ class File with EquatableMixin {
fileId, fileId,
isFavorite, isFavorite,
ownerId, ownerId,
ownerDisplayName,
trashbinFilename, trashbinFilename,
trashbinOriginalLocation, trashbinOriginalLocation,
trashbinDeletionTime, trashbinDeletionTime,
@ -449,6 +458,7 @@ class File with EquatableMixin {
final int? fileId; final int? fileId;
final bool? isFavorite; final bool? isFavorite;
final CiString? ownerId; final CiString? ownerId;
final String? ownerDisplayName;
final String? trashbinFilename; final String? trashbinFilename;
final String? trashbinOriginalLocation; final String? trashbinOriginalLocation;
final DateTime? trashbinDeletionTime; final DateTime? trashbinDeletionTime;

View file

@ -45,6 +45,7 @@ class FileWebdavDataSource implements FileDataSource {
fileid: 1, fileid: 1,
favorite: 1, favorite: 1,
ownerId: 1, ownerId: 1,
ownerDisplayName: 1,
trashbinFilename: 1, trashbinFilename: 1,
trashbinOriginalLocation: 1, trashbinOriginalLocation: 1,
trashbinDeletionTime: 1, trashbinDeletionTime: 1,

View file

@ -36,6 +36,7 @@ class Files extends Table {
IntColumn get usedBytes => integer().nullable()(); IntColumn get usedBytes => integer().nullable()();
BoolColumn get hasPreview => boolean().nullable()(); BoolColumn get hasPreview => boolean().nullable()();
TextColumn get ownerId => text().nullable()(); TextColumn get ownerId => text().nullable()();
TextColumn get ownerDisplayName => text().nullable()();
@override @override
get uniqueKeys => [ get uniqueKeys => [

View file

@ -406,6 +406,7 @@ class File extends DataClass implements Insertable<File> {
final int? usedBytes; final int? usedBytes;
final bool? hasPreview; final bool? hasPreview;
final String? ownerId; final String? ownerId;
final String? ownerDisplayName;
File( File(
{required this.rowId, {required this.rowId,
required this.server, required this.server,
@ -417,7 +418,8 @@ class File extends DataClass implements Insertable<File> {
this.isCollection, this.isCollection,
this.usedBytes, this.usedBytes,
this.hasPreview, this.hasPreview,
this.ownerId}); this.ownerId,
this.ownerDisplayName});
factory File.fromData(Map<String, dynamic> data, {String? prefix}) { factory File.fromData(Map<String, dynamic> data, {String? prefix}) {
final effectivePrefix = prefix ?? ''; final effectivePrefix = prefix ?? '';
return File( return File(
@ -443,6 +445,8 @@ class File extends DataClass implements Insertable<File> {
.mapFromDatabaseResponse(data['${effectivePrefix}has_preview']), .mapFromDatabaseResponse(data['${effectivePrefix}has_preview']),
ownerId: const StringType() ownerId: const StringType()
.mapFromDatabaseResponse(data['${effectivePrefix}owner_id']), .mapFromDatabaseResponse(data['${effectivePrefix}owner_id']),
ownerDisplayName: const StringType().mapFromDatabaseResponse(
data['${effectivePrefix}owner_display_name']),
); );
} }
@override @override
@ -477,6 +481,9 @@ class File extends DataClass implements Insertable<File> {
if (!nullToAbsent || ownerId != null) { if (!nullToAbsent || ownerId != null) {
map['owner_id'] = Variable<String?>(ownerId); map['owner_id'] = Variable<String?>(ownerId);
} }
if (!nullToAbsent || ownerDisplayName != null) {
map['owner_display_name'] = Variable<String?>(ownerDisplayName);
}
return map; return map;
} }
@ -507,6 +514,9 @@ class File extends DataClass implements Insertable<File> {
ownerId: ownerId == null && nullToAbsent ownerId: ownerId == null && nullToAbsent
? const Value.absent() ? const Value.absent()
: Value(ownerId), : Value(ownerId),
ownerDisplayName: ownerDisplayName == null && nullToAbsent
? const Value.absent()
: Value(ownerDisplayName),
); );
} }
@ -525,6 +535,7 @@ class File extends DataClass implements Insertable<File> {
usedBytes: serializer.fromJson<int?>(json['usedBytes']), usedBytes: serializer.fromJson<int?>(json['usedBytes']),
hasPreview: serializer.fromJson<bool?>(json['hasPreview']), hasPreview: serializer.fromJson<bool?>(json['hasPreview']),
ownerId: serializer.fromJson<String?>(json['ownerId']), ownerId: serializer.fromJson<String?>(json['ownerId']),
ownerDisplayName: serializer.fromJson<String?>(json['ownerDisplayName']),
); );
} }
@override @override
@ -542,6 +553,7 @@ class File extends DataClass implements Insertable<File> {
'usedBytes': serializer.toJson<int?>(usedBytes), 'usedBytes': serializer.toJson<int?>(usedBytes),
'hasPreview': serializer.toJson<bool?>(hasPreview), 'hasPreview': serializer.toJson<bool?>(hasPreview),
'ownerId': serializer.toJson<String?>(ownerId), 'ownerId': serializer.toJson<String?>(ownerId),
'ownerDisplayName': serializer.toJson<String?>(ownerDisplayName),
}; };
} }
@ -556,7 +568,8 @@ class File extends DataClass implements Insertable<File> {
Value<bool?> isCollection = const Value.absent(), Value<bool?> isCollection = const Value.absent(),
Value<int?> usedBytes = const Value.absent(), Value<int?> usedBytes = const Value.absent(),
Value<bool?> hasPreview = const Value.absent(), Value<bool?> hasPreview = const Value.absent(),
Value<String?> ownerId = const Value.absent()}) => Value<String?> ownerId = const Value.absent(),
Value<String?> ownerDisplayName = const Value.absent()}) =>
File( File(
rowId: rowId ?? this.rowId, rowId: rowId ?? this.rowId,
server: server ?? this.server, server: server ?? this.server,
@ -572,6 +585,9 @@ class File extends DataClass implements Insertable<File> {
usedBytes: usedBytes.present ? usedBytes.value : this.usedBytes, usedBytes: usedBytes.present ? usedBytes.value : this.usedBytes,
hasPreview: hasPreview.present ? hasPreview.value : this.hasPreview, hasPreview: hasPreview.present ? hasPreview.value : this.hasPreview,
ownerId: ownerId.present ? ownerId.value : this.ownerId, ownerId: ownerId.present ? ownerId.value : this.ownerId,
ownerDisplayName: ownerDisplayName.present
? ownerDisplayName.value
: this.ownerDisplayName,
); );
@override @override
String toString() { String toString() {
@ -586,7 +602,8 @@ class File extends DataClass implements Insertable<File> {
..write('isCollection: $isCollection, ') ..write('isCollection: $isCollection, ')
..write('usedBytes: $usedBytes, ') ..write('usedBytes: $usedBytes, ')
..write('hasPreview: $hasPreview, ') ..write('hasPreview: $hasPreview, ')
..write('ownerId: $ownerId') ..write('ownerId: $ownerId, ')
..write('ownerDisplayName: $ownerDisplayName')
..write(')')) ..write(')'))
.toString(); .toString();
} }
@ -603,7 +620,8 @@ class File extends DataClass implements Insertable<File> {
isCollection, isCollection,
usedBytes, usedBytes,
hasPreview, hasPreview,
ownerId); ownerId,
ownerDisplayName);
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) ||
@ -618,7 +636,8 @@ class File extends DataClass implements Insertable<File> {
other.isCollection == this.isCollection && other.isCollection == this.isCollection &&
other.usedBytes == this.usedBytes && other.usedBytes == this.usedBytes &&
other.hasPreview == this.hasPreview && other.hasPreview == this.hasPreview &&
other.ownerId == this.ownerId); other.ownerId == this.ownerId &&
other.ownerDisplayName == this.ownerDisplayName);
} }
class FilesCompanion extends UpdateCompanion<File> { class FilesCompanion extends UpdateCompanion<File> {
@ -633,6 +652,7 @@ class FilesCompanion extends UpdateCompanion<File> {
final Value<int?> usedBytes; final Value<int?> usedBytes;
final Value<bool?> hasPreview; final Value<bool?> hasPreview;
final Value<String?> ownerId; final Value<String?> ownerId;
final Value<String?> ownerDisplayName;
const FilesCompanion({ const FilesCompanion({
this.rowId = const Value.absent(), this.rowId = const Value.absent(),
this.server = const Value.absent(), this.server = const Value.absent(),
@ -645,6 +665,7 @@ class FilesCompanion extends UpdateCompanion<File> {
this.usedBytes = const Value.absent(), this.usedBytes = const Value.absent(),
this.hasPreview = const Value.absent(), this.hasPreview = const Value.absent(),
this.ownerId = const Value.absent(), this.ownerId = const Value.absent(),
this.ownerDisplayName = const Value.absent(),
}); });
FilesCompanion.insert({ FilesCompanion.insert({
this.rowId = const Value.absent(), this.rowId = const Value.absent(),
@ -658,6 +679,7 @@ class FilesCompanion extends UpdateCompanion<File> {
this.usedBytes = const Value.absent(), this.usedBytes = const Value.absent(),
this.hasPreview = const Value.absent(), this.hasPreview = const Value.absent(),
this.ownerId = const Value.absent(), this.ownerId = const Value.absent(),
this.ownerDisplayName = const Value.absent(),
}) : server = Value(server), }) : server = Value(server),
fileId = Value(fileId); fileId = Value(fileId);
static Insertable<File> custom({ static Insertable<File> custom({
@ -672,6 +694,7 @@ class FilesCompanion extends UpdateCompanion<File> {
Expression<int?>? usedBytes, Expression<int?>? usedBytes,
Expression<bool?>? hasPreview, Expression<bool?>? hasPreview,
Expression<String?>? ownerId, Expression<String?>? ownerId,
Expression<String?>? ownerDisplayName,
}) { }) {
return RawValuesInsertable({ return RawValuesInsertable({
if (rowId != null) 'row_id': rowId, if (rowId != null) 'row_id': rowId,
@ -685,6 +708,7 @@ class FilesCompanion extends UpdateCompanion<File> {
if (usedBytes != null) 'used_bytes': usedBytes, if (usedBytes != null) 'used_bytes': usedBytes,
if (hasPreview != null) 'has_preview': hasPreview, if (hasPreview != null) 'has_preview': hasPreview,
if (ownerId != null) 'owner_id': ownerId, if (ownerId != null) 'owner_id': ownerId,
if (ownerDisplayName != null) 'owner_display_name': ownerDisplayName,
}); });
} }
@ -699,7 +723,8 @@ class FilesCompanion extends UpdateCompanion<File> {
Value<bool?>? isCollection, Value<bool?>? isCollection,
Value<int?>? usedBytes, Value<int?>? usedBytes,
Value<bool?>? hasPreview, Value<bool?>? hasPreview,
Value<String?>? ownerId}) { Value<String?>? ownerId,
Value<String?>? ownerDisplayName}) {
return FilesCompanion( return FilesCompanion(
rowId: rowId ?? this.rowId, rowId: rowId ?? this.rowId,
server: server ?? this.server, server: server ?? this.server,
@ -712,6 +737,7 @@ class FilesCompanion extends UpdateCompanion<File> {
usedBytes: usedBytes ?? this.usedBytes, usedBytes: usedBytes ?? this.usedBytes,
hasPreview: hasPreview ?? this.hasPreview, hasPreview: hasPreview ?? this.hasPreview,
ownerId: ownerId ?? this.ownerId, ownerId: ownerId ?? this.ownerId,
ownerDisplayName: ownerDisplayName ?? this.ownerDisplayName,
); );
} }
@ -753,6 +779,9 @@ class FilesCompanion extends UpdateCompanion<File> {
if (ownerId.present) { if (ownerId.present) {
map['owner_id'] = Variable<String?>(ownerId.value); map['owner_id'] = Variable<String?>(ownerId.value);
} }
if (ownerDisplayName.present) {
map['owner_display_name'] = Variable<String?>(ownerDisplayName.value);
}
return map; return map;
} }
@ -769,7 +798,8 @@ class FilesCompanion extends UpdateCompanion<File> {
..write('isCollection: $isCollection, ') ..write('isCollection: $isCollection, ')
..write('usedBytes: $usedBytes, ') ..write('usedBytes: $usedBytes, ')
..write('hasPreview: $hasPreview, ') ..write('hasPreview: $hasPreview, ')
..write('ownerId: $ownerId') ..write('ownerId: $ownerId, ')
..write('ownerDisplayName: $ownerDisplayName')
..write(')')) ..write(')'))
.toString(); .toString();
} }
@ -849,6 +879,12 @@ class $FilesTable extends Files with TableInfo<$FilesTable, File> {
late final GeneratedColumn<String?> ownerId = GeneratedColumn<String?>( late final GeneratedColumn<String?> ownerId = GeneratedColumn<String?>(
'owner_id', aliasedName, true, 'owner_id', aliasedName, true,
type: const StringType(), requiredDuringInsert: false); type: const StringType(), requiredDuringInsert: false);
final VerificationMeta _ownerDisplayNameMeta =
const VerificationMeta('ownerDisplayName');
@override
late final GeneratedColumn<String?> ownerDisplayName =
GeneratedColumn<String?>('owner_display_name', aliasedName, true,
type: const StringType(), requiredDuringInsert: false);
@override @override
List<GeneratedColumn> get $columns => [ List<GeneratedColumn> get $columns => [
rowId, rowId,
@ -861,7 +897,8 @@ class $FilesTable extends Files with TableInfo<$FilesTable, File> {
isCollection, isCollection,
usedBytes, usedBytes,
hasPreview, hasPreview,
ownerId ownerId,
ownerDisplayName
]; ];
@override @override
String get aliasedName => _alias ?? 'files'; String get aliasedName => _alias ?? 'files';
@ -925,6 +962,12 @@ class $FilesTable extends Files with TableInfo<$FilesTable, File> {
context.handle(_ownerIdMeta, context.handle(_ownerIdMeta,
ownerId.isAcceptableOrUnknown(data['owner_id']!, _ownerIdMeta)); ownerId.isAcceptableOrUnknown(data['owner_id']!, _ownerIdMeta));
} }
if (data.containsKey('owner_display_name')) {
context.handle(
_ownerDisplayNameMeta,
ownerDisplayName.isAcceptableOrUnknown(
data['owner_display_name']!, _ownerDisplayNameMeta));
}
return context; return context;
} }

View file

@ -92,6 +92,7 @@ class SqliteFileConverter {
fileId: f.file.fileId, fileId: f.file.fileId,
isFavorite: f.accountFile.isFavorite, isFavorite: f.accountFile.isFavorite,
ownerId: f.file.ownerId?.toCi(), ownerId: f.file.ownerId?.toCi(),
ownerDisplayName: f.file.ownerDisplayName,
trashbinFilename: f.trash?.filename, trashbinFilename: f.trash?.filename,
trashbinOriginalLocation: f.trash?.originalLocation, trashbinOriginalLocation: f.trash?.originalLocation,
trashbinDeletionTime: f.trash?.deletionTime, trashbinDeletionTime: f.trash?.deletionTime,
@ -113,6 +114,7 @@ class SqliteFileConverter {
usedBytes: Value(file.usedBytes), usedBytes: Value(file.usedBytes),
hasPreview: Value(file.hasPreview), hasPreview: Value(file.hasPreview),
ownerId: Value(file.ownerId!.toCaseInsensitiveString()), ownerId: Value(file.ownerId!.toCaseInsensitiveString()),
ownerDisplayName: Value(file.ownerDisplayName),
); );
final dbAccountFile = sql.AccountFilesCompanion( final dbAccountFile = sql.AccountFilesCompanion(
account: account == null ? const Value.absent() : Value(account.rowId), account: account == null ? const Value.absent() : Value(account.rowId),

View file

@ -94,6 +94,7 @@ class WebdavResponseParser {
int? fileId; int? fileId;
bool? isFavorite; bool? isFavorite;
CiString? ownerId; CiString? ownerId;
String? ownerDisplayName;
Metadata? metadata; Metadata? metadata;
bool? isArchived; bool? isArchived;
DateTime? overrideDateTime; DateTime? overrideDateTime;
@ -131,6 +132,7 @@ class WebdavResponseParser {
fileId = propParser.fileId; fileId = propParser.fileId;
isFavorite = propParser.isFavorite; isFavorite = propParser.isFavorite;
ownerId = propParser.ownerId; ownerId = propParser.ownerId;
ownerDisplayName = propParser.ownerDisplayName;
metadata = propParser.metadata; metadata = propParser.metadata;
isArchived = propParser.isArchived; isArchived = propParser.isArchived;
overrideDateTime = propParser.overrideDateTime; overrideDateTime = propParser.overrideDateTime;
@ -152,6 +154,7 @@ class WebdavResponseParser {
fileId: fileId, fileId: fileId,
isFavorite: isFavorite, isFavorite: isFavorite,
ownerId: ownerId, ownerId: ownerId,
ownerDisplayName: ownerDisplayName,
metadata: metadata, metadata: metadata,
isArchived: isArchived, isArchived: isArchived,
overrideDateTime: overrideDateTime, overrideDateTime: overrideDateTime,
@ -338,6 +341,9 @@ class _FilePropParser {
} 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.toCi(); _ownerId = child.innerText.toCi();
} else if (child.matchQualifiedName("owner-display-name",
prefix: "http://owncloud.org/ns", namespaces: namespaces)) {
_ownerDisplayName = child.innerText;
} else if (child.matchQualifiedName("trashbin-filename", } else if (child.matchQualifiedName("trashbin-filename",
prefix: "http://nextcloud.org/ns", namespaces: namespaces)) { prefix: "http://nextcloud.org/ns", namespaces: namespaces)) {
_trashbinFilename = child.innerText; _trashbinFilename = child.innerText;
@ -385,6 +391,7 @@ class _FilePropParser {
int? get fileId => _fileId; int? get fileId => _fileId;
bool? get isFavorite => _isFavorite; bool? get isFavorite => _isFavorite;
CiString? get ownerId => _ownerId; CiString? get ownerId => _ownerId;
String? get ownerDisplayName => _ownerDisplayName;
Metadata? get metadata => _metadata; Metadata? get metadata => _metadata;
bool? get isArchived => _isArchived; bool? get isArchived => _isArchived;
DateTime? get overrideDateTime => _overrideDateTime; DateTime? get overrideDateTime => _overrideDateTime;
@ -407,6 +414,7 @@ class _FilePropParser {
int? _fileId; int? _fileId;
bool? _isFavorite; bool? _isFavorite;
CiString? _ownerId; CiString? _ownerId;
String? _ownerDisplayName;
Metadata? _metadata; Metadata? _metadata;
bool? _isArchived; bool? _isArchived;
DateTime? _overrideDateTime; DateTime? _overrideDateTime;

View file

@ -203,7 +203,8 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
color: AppTheme.getSecondaryTextColor(context), color: AppTheme.getSecondaryTextColor(context),
), ),
), ),
title: Text(widget.file.ownerId!.toString()), title: Text(widget.file.ownerDisplayName ??
widget.file.ownerId!.toString()),
subtitle: Text(L10n.global().fileSharedByDescription), subtitle: Text(L10n.global().fileSharedByDescription),
), ),
if (_tags.isNotEmpty) if (_tags.isNotEmpty)

View file

@ -39,6 +39,7 @@ class FilesBuilder {
bool isCollection = false, bool isCollection = false,
bool hasPreview = true, bool hasPreview = true,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
Metadata? metadata, Metadata? metadata,
}) { }) {
files.add(File( files.add(File(
@ -52,6 +53,7 @@ class FilesBuilder {
hasPreview: hasPreview, hasPreview: hasPreview,
fileId: fileId++, fileId: fileId++,
ownerId: ownerId.toCi(), ownerId: ownerId.toCi(),
ownerDisplayName: ownerDisplayName ?? ownerId.toString(),
metadata: metadata, metadata: metadata,
)); ));
} }
@ -64,6 +66,7 @@ class FilesBuilder {
DateTime? lastModified, DateTime? lastModified,
bool hasPreview = true, bool hasPreview = true,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
}) => }) =>
add( add(
relativePath, relativePath,
@ -73,6 +76,7 @@ class FilesBuilder {
lastModified: lastModified, lastModified: lastModified,
hasPreview: hasPreview, hasPreview: hasPreview,
ownerId: ownerId, ownerId: ownerId,
ownerDisplayName: ownerDisplayName,
); );
void addJpeg( void addJpeg(
@ -82,6 +86,7 @@ class FilesBuilder {
DateTime? lastModified, DateTime? lastModified,
bool hasPreview = true, bool hasPreview = true,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
OrNull<Metadata>? metadata, OrNull<Metadata>? metadata,
}) => }) =>
add( add(
@ -92,6 +97,7 @@ class FilesBuilder {
lastModified: lastModified, lastModified: lastModified,
hasPreview: hasPreview, hasPreview: hasPreview,
ownerId: ownerId, ownerId: ownerId,
ownerDisplayName: ownerDisplayName,
metadata: metadata?.obj ?? metadata: metadata?.obj ??
Metadata( Metadata(
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5), lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5),
@ -106,6 +112,7 @@ class FilesBuilder {
String? etag, String? etag,
DateTime? lastModified, DateTime? lastModified,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
}) => }) =>
add( add(
relativePath, relativePath,
@ -114,6 +121,7 @@ class FilesBuilder {
isCollection: true, isCollection: true,
hasPreview: false, hasPreview: false,
ownerId: ownerId, ownerId: ownerId,
ownerDisplayName: ownerDisplayName,
); );
void addAlbumJson( void addAlbumJson(
@ -123,6 +131,7 @@ class FilesBuilder {
String? etag, String? etag,
DateTime? lastModified, DateTime? lastModified,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
}) => }) =>
add( add(
"$homeDir/.com.nkming.nc_photos/albums/$filename.nc_album.json", "$homeDir/.com.nkming.nc_photos/albums/$filename.nc_album.json",
@ -132,6 +141,7 @@ class FilesBuilder {
lastModified: lastModified, lastModified: lastModified,
hasPreview: false, hasPreview: false,
ownerId: ownerId, ownerId: ownerId,
ownerDisplayName: ownerDisplayName,
); );
final files = <File>[]; final files = <File>[];
@ -302,6 +312,7 @@ File buildAlbumFile({
DateTime? lastModified, DateTime? lastModified,
required int fileId, required int fileId,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
}) => }) =>
File( File(
path: path, path: path,
@ -312,6 +323,7 @@ File buildAlbumFile({
hasPreview: false, hasPreview: false,
fileId: fileId, fileId: fileId,
ownerId: ownerId.toCi(), ownerId: ownerId.toCi(),
ownerDisplayName: ownerDisplayName ?? ownerId.toString(),
); );
String buildAlbumFilePath( String buildAlbumFilePath(
@ -341,6 +353,7 @@ File buildJpegFile({
bool hasPreview = true, bool hasPreview = true,
required int fileId, required int fileId,
String ownerId = "admin", String ownerId = "admin",
String? ownerDisplayName,
}) => }) =>
File( File(
path: path, path: path,
@ -351,6 +364,7 @@ File buildJpegFile({
hasPreview: hasPreview, hasPreview: hasPreview,
fileId: fileId, fileId: fileId,
ownerId: ownerId.toCi(), ownerId: ownerId.toCi(),
ownerDisplayName: ownerDisplayName ?? ownerId.toString(),
); );
Share buildShare({ Share buildShare({