Fix cover not displaying for NcAlbum if the file is shared

This commit is contained in:
Ming Ming 2023-05-08 01:33:11 +08:00
parent 4762ad02bd
commit 6b3600625b
2 changed files with 11 additions and 2 deletions

View file

@ -81,6 +81,16 @@ String getFilePreviewUrlByFileId(
return url;
}
/// Return the preview image URL for [fileId], using the new Photos API in
/// Nextcloud 25
String getPhotosApiFilePreviewUrlByFileId(
Account account,
int fileId, {
required int width,
required int height,
}) =>
"${account.url}/apps/photos/api/v1/preview/$fileId?x=$width&y=$height";
String getFileUrl(Account account, FileDescriptor file) {
return "${account.url}/${getFileUrlRelative(file)}";
}

View file

@ -64,12 +64,11 @@ class CollectionNcAlbumProvider
if (album.lastPhoto == null) {
return null;
} else {
return api_util.getFilePreviewUrlByFileId(
return api_util.getPhotosApiFilePreviewUrlByFileId(
account,
album.lastPhoto!,
width: width,
height: height,
isKeepAspectRatio: isKeepAspectRatio ?? false,
);
}
}