Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Fix discovery tab behaviour

laurenspriemb7c35503c6cd
diff --git a/mobile/apps/photos/lib/services/wrapped/wrapped_service.dart b/mobile/apps/photos/lib/services/wrapped/wrapped_service.dart
index aa4089b52c..9141c997ab 100644
--- a/mobile/apps/photos/lib/services/wrapped/wrapped_service.dart
+++ b/mobile/apps/photos/lib/services/wrapped/wrapped_service.dart
@@ -211,6 +211,12 @@ class WrappedService {
return;
}
+ final bool wasComplete = localSettings.wrapped2025Complete();
+ if (!isComplete && wasComplete) {
+ // Preserve completion once it has been reached so discovery entry persists.
+ return;
+ }
+
unawaited(localSettings.setWrapped2025Complete(isComplete));
_state.value = WrappedEntryState(
result: state.result,
diff --git a/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart b/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
index 51d4c81f06..3e1edd6725 100644
--- a/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
@@ -90,17 +90,23 @@ class WrappedDiscoverySection extends StatelessWidget {
}
void _handleTap(BuildContext context) {
- final WrappedEntryState currentState = wrappedService.state;
+ WrappedEntryState currentState = wrappedService.state;
final WrappedResult? result = currentState.result;
if (result == null || result.cards.isEmpty) {
showShortToast(context, "Wrapped isn’t ready yet");
return;
}
+ final int cardCount = result.cards.length;
+ if (cardCount > 1 &&
+ currentState.resumeIndex >= cardCount - 1 &&
+ currentState.resumeIndex != 0) {
+ wrappedService.updateResumeIndex(0);
+ currentState = wrappedService.state;
+ }
Navigator.of(context).push(
MaterialPageRoute<void>(
- builder: (BuildContext context) => WrappedViewerPage(
- initialState: currentState,
- ),
+ builder: (BuildContext context) =>
+ WrappedViewerPage(initialState: currentState),
),
);
}