diff --git a/app/lib/api/api_util.dart b/app/lib/api/api_util.dart index 82ca3a7e..b2e8f22b 100644 --- a/app/lib/api/api_util.dart +++ b/app/lib/api/api_util.dart @@ -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)}"; } diff --git a/app/lib/entity/collection/content_provider/nc_album.dart b/app/lib/entity/collection/content_provider/nc_album.dart index 044e9c00..609446e3 100644 --- a/app/lib/entity/collection/content_provider/nc_album.dart +++ b/app/lib/entity/collection/content_provider/nc_album.dart @@ -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, ); } }