Skip to content

High performance self-hosted photo and video management solution.

fix: button condition rendering (#23400)

Alexc69786b0395b
diff --git a/mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart
index 00e16fa870..9271c99ae9 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart
@@ -141,14 +141,28 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
}
Widget _buildAppearsInList(WidgetRef ref, BuildContext context) {
- final isRemote = ref.watch(currentAssetNotifier)?.hasRemote ?? false;
- if (!isRemote) {
+ final aseet = ref.watch(currentAssetNotifier);
+ if (aseet == null) {
+ return const SizedBox.shrink();
+ }
+
+ if (!aseet.hasRemote) {
+ return const SizedBox.shrink();
+ }
+
+ String? remoteAssetId;
+ if (aseet is RemoteAsset) {
+ remoteAssetId = aseet.id;
+ } else if (aseet is LocalAsset) {
+ remoteAssetId = aseet.remoteAssetId;
+ }
+
+ if (remoteAssetId == null) {
return const SizedBox.shrink();
}
- final remoteAsset = ref.watch(currentAssetNotifier) as RemoteAsset;
final userId = ref.watch(currentUserProvider)?.id;
- final assetAlbums = ref.watch(albumsContainingAssetProvider(remoteAsset.id));
+ final assetAlbums = ref.watch(albumsContainingAssetProvider(remoteAssetId));
return assetAlbums.when(
data: (albums) {
diff --git a/mobile/lib/utils/action_button.utils.dart b/mobile/lib/utils/action_button.utils.dart
index de606c83d3..42729becc9 100644
--- a/mobile/lib/utils/action_button.utils.dart
+++ b/mobile/lib/utils/action_button.utils.dart
@@ -127,7 +127,7 @@ enum ActionButtonType {
context.currentAlbum!.isShared,
ActionButtonType.similarPhotos =>
!context.isInLockedView && //
- context.asset.hasRemote,
+ context.asset is RemoteAsset,
};
}