Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix fallback indicator showing on wrong page during swipe

ashilknd0965fa5cd78
diff --git a/mobile/apps/photos/lib/states/detail_page_state.dart b/mobile/apps/photos/lib/states/detail_page_state.dart
index 0b9b19ee66..8ac8c2ea47 100644
--- a/mobile/apps/photos/lib/states/detail_page_state.dart
+++ b/mobile/apps/photos/lib/states/detail_page_state.dart
@@ -14,7 +14,9 @@ typedef FullScreenRequestCallback = void Function(
class InheritedDetailPageState extends InheritedWidget {
final ValueNotifier<bool> enableFullScreenNotifier;
final ValueNotifier<bool> isInSharedCollectionNotifier;
- final ValueNotifier<bool> showingThumbnailFallbackNotifier;
+ /// Holds the generatedID of the file currently showing thumbnail fallback.
+ /// Only the file with matching ID should display the fallback indicator.
+ final ValueNotifier<int?> showingThumbnailFallbackNotifier;
// Cannot be const because we accept a ValueNotifier instance at runtime
// ignore: prefer_const_constructors_in_immutables
InheritedDetailPageState({
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
index 26e4a45764..016c9ee99e 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
@@ -86,7 +86,7 @@ class DetailPage extends StatefulWidget {
class _DetailPageState extends State<DetailPage> {
final _enableFullScreenNotifier = ValueNotifier(false);
final _isInSharedCollectionNotifier = ValueNotifier(false);
- final _showingThumbnailFallbackNotifier = ValueNotifier(false);
+ final _showingThumbnailFallbackNotifier = ValueNotifier<int?>(null);
@override
void dispose() {
@@ -374,10 +374,6 @@ class _BodyState extends State<_Body> {
}
Bus.instance.fire(GuestViewEvent(isGuestView, swipeLocked));
_updateSharedCollectionState(_files![index]);
- // Reset thumbnail fallback state for new photo
- InheritedDetailPageState.maybeOf(context)
- ?.showingThumbnailFallbackNotifier
- .value = false;
},
physics: _shouldDisableScroll || swipeLocked
? const NeverScrollableScrollPhysics()
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
index 98204eadf9..8eab0b5fcb 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
@@ -198,11 +198,11 @@ class FileAppBarState extends State<FileAppBar> {
List<Widget> _getActions() {
_actions.clear();
- // Show info icon when thumbnail fallback is active (leftmost position)
- final showingFallback = InheritedDetailPageState.maybeOf(context)
- ?.showingThumbnailFallbackNotifier
- .value ??
- false;
+ // Show info icon when thumbnail fallback is active for THIS file
+ final fallbackFileId = InheritedDetailPageState.maybeOf(context)
+ ?.showingThumbnailFallbackNotifier
+ .value;
+ final showingFallback = fallbackFileId == widget.file.generatedID;
if (showingFallback) {
_actions.add(
Tooltip(
diff --git a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
index 5f21a8b19b..358f726027 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
@@ -521,7 +521,7 @@ class _ZoomableImageState extends State<ZoomableImage> {
});
InheritedDetailPageState.maybeOf(context)
?.showingThumbnailFallbackNotifier
- .value = true;
+ .value = _photo.generatedID;
}
return;
}
@@ -575,7 +575,7 @@ class _ZoomableImageState extends State<ZoomableImage> {
});
InheritedDetailPageState.maybeOf(context)
?.showingThumbnailFallbackNotifier
- .value = true;
+ .value = _photo.generatedID;
}
}
}