Add utility to extract owner id of a nc album

This commit is contained in:
Ming Ming 2023-09-13 00:29:59 +08:00
parent 65c614940b
commit 7c83b81810

View file

@ -75,6 +75,22 @@ extension NcAlbumExtension on NcAlbum {
return p.startsWith("albums/");
}
/// Return the owner of this shared album, or null if this album is owned by
/// you
String? get owner {
if (isOwned) {
return null;
}
final p = strippedPath;
final found = p.lastIndexOf("(");
if (found == -1) {
// ?
return null;
} else {
return p.slice(found + 1);
}
}
/// Return the name of this album
///
/// Normally this is identical to [strippedPath], except for those shared by