Hide the sharer part of a shared nc album

This commit is contained in:
Ming Ming 2023-09-10 02:37:48 +08:00
parent 51b9d26e31
commit 85623d7588
2 changed files with 19 additions and 1 deletions

View file

@ -34,7 +34,7 @@ class CollectionBuilder {
static Collection byNcAlbum(Account account, NcAlbum album) { static Collection byNcAlbum(Account account, NcAlbum album) {
return Collection( return Collection(
name: album.strippedPath, name: album.name,
contentProvider: CollectionNcAlbumProvider( contentProvider: CollectionNcAlbumProvider(
account: account, account: account,
album: album, album: album,

View file

@ -75,6 +75,24 @@ extension NcAlbumExtension on NcAlbum {
return p.startsWith("albums/"); return p.startsWith("albums/");
} }
/// Return the name of this album
///
/// Normally this is identical to [strippedPath], except for those shared by
/// others
String get name {
if (isOwned) {
return strippedPath;
}
final p = strippedPath;
final found = p.lastIndexOf(" (");
if (found == -1) {
// ?
return p;
} else {
return p.slice(0, found);
}
}
/// Return the path of this file with the DAV part stripped /// Return the path of this file with the DAV part stripped
/// ///
/// WebDAV file path: remote.php/dav/photos/{userId}/albums/{strippedPath}. /// WebDAV file path: remote.php/dav/photos/{userId}/albums/{strippedPath}.