diff --git a/lib/ui/collections/album/row_item.dart b/lib/ui/collections/album/row_item.dart index 45ec984bf..58e412710 100644 --- a/lib/ui/collections/album/row_item.dart +++ b/lib/ui/collections/album/row_item.dart @@ -195,11 +195,6 @@ class AlbumRowItemWidget extends StatelessWidget { CollectionPage( CollectionWithThumbnail(c, thumbnail), tagPrefix: tagPrefix, - appBarType: isOwner - ? (c.type == CollectionType.favorites - ? GalleryType.favorite - : GalleryType.ownedCollection) - : GalleryType.sharedCollection, hasVerifiedLock: hasVerifiedLock, ), ); diff --git a/lib/ui/tabs/shared/quick_link_album_item.dart b/lib/ui/tabs/shared/quick_link_album_item.dart index d993680e8..8e7a222c6 100644 --- a/lib/ui/tabs/shared/quick_link_album_item.dart +++ b/lib/ui/tabs/shared/quick_link_album_item.dart @@ -121,7 +121,7 @@ class QuickLinkAlbumItem extends StatelessWidget { c, thumbnail, ), - appBarType: GalleryType.ownedCollection, + galleryType: GalleryType.ownedCollection, tagPrefix: heroTagPrefix, ); routeToPage(context, page); diff --git a/lib/ui/viewer/file_details/albums_item_widget.dart b/lib/ui/viewer/file_details/albums_item_widget.dart index 142af8cd9..1c5343bfc 100644 --- a/lib/ui/viewer/file_details/albums_item_widget.dart +++ b/lib/ui/viewer/file_details/albums_item_widget.dart @@ -92,9 +92,6 @@ class AlbumsItemWidget extends StatelessWidget { context, CollectionPage( CollectionWithThumbnail(c, null), - appBarType: c.isOwner(currentUserID) - ? GalleryType.ownedCollection - : GalleryType.sharedCollection, ), ); }, diff --git a/lib/ui/viewer/gallery/collection_page.dart b/lib/ui/viewer/gallery/collection_page.dart index 7f8c00be8..f68acd9e2 100644 --- a/lib/ui/viewer/gallery/collection_page.dart +++ b/lib/ui/viewer/gallery/collection_page.dart @@ -21,13 +21,11 @@ import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart'; class CollectionPage extends StatelessWidget { final CollectionWithThumbnail c; final String tagPrefix; - final GalleryType appBarType; final bool? hasVerifiedLock; CollectionPage( this.c, { this.tagPrefix = "collection", - this.appBarType = GalleryType.ownedCollection, this.hasVerifiedLock = false, Key? key, }) : super(key: key); @@ -42,7 +40,8 @@ class CollectionPage extends StatelessWidget { return const EmptyState(); } - final galleryType = _getGalleryType(c.collection); + final galleryType = + _getGalleryType(c.collection, Configuration.instance.getUserID()!); final List? initialFiles = c.thumbnail != null ? [c.thumbnail!] : null; final gallery = Gallery( @@ -113,9 +112,8 @@ class CollectionPage extends StatelessWidget { ); } - GalleryType _getGalleryType(Collection c) { - final currentUserID = Configuration.instance.getUserID()!; - if (!c.isOwner(currentUserID)) { + GalleryType _getGalleryType(Collection c, int userID) { + if (!c.isOwner(userID)) { return GalleryType.sharedCollection; } if (c.isDefaultHidden()) { @@ -127,6 +125,8 @@ class CollectionPage extends StatelessWidget { } else if (c.isQuickLinkCollection()) { return GalleryType.quickLink; } - return appBarType; + debugPrint("Unknown gallery type for collection ${c.id}, falling back to " + "default"); + return GalleryType.ownedCollection; } }