Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] fallback on old memories

laurensprieme32b23409cbd
diff --git a/mobile/lib/ui/home/memories/memories_widget.dart b/mobile/lib/ui/home/memories/memories_widget.dart
index e15a0c88b2..19557fdebb 100644
--- a/mobile/lib/ui/home/memories/memories_widget.dart
+++ b/mobile/lib/ui/home/memories/memories_widget.dart
@@ -58,37 +58,45 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
return const SizedBox.shrink();
}
if (memoriesCacheService.enableSmartMemories) {
- return FutureBuilder<List<SmartMemory>>(
- future: memoriesCacheService.getMemories(
- null,
- ),
- builder: (context, snapshot) {
- if (snapshot.hasData && snapshot.data!.isEmpty) {
- return const SizedBox.shrink();
- }
- if (snapshot.hasError || !snapshot.hasData) {
- return SizedBox(
- height: _maxHeight + 12 + 10,
- child: const EnteLoadingWidget(),
- );
- } else {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(
- height: 12,
- ),
- _buildSmartMemories(snapshot.data!),
- const SizedBox(height: 10),
- ],
- ).animate().fadeIn(
- duration: const Duration(milliseconds: 250),
- curve: Curves.easeInOutCirc,
- );
- }
- },
- );
+ return _smartMemories();
}
+ return _oldMemories();
+ }
+
+ Widget _smartMemories() {
+ return FutureBuilder<List<SmartMemory>>(
+ future: memoriesCacheService.getMemories(
+ null,
+ ),
+ builder: (context, snapshot) {
+ if (snapshot.hasData && snapshot.data!.isEmpty) {
+ return _oldMemories();
+ }
+ if (snapshot.hasError || !snapshot.hasData) {
+ return SizedBox(
+ height: _maxHeight + 12 + 10,
+ child: const EnteLoadingWidget(),
+ );
+ } else {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(
+ height: 12,
+ ),
+ _buildSmartMemories(snapshot.data!),
+ const SizedBox(height: 10),
+ ],
+ ).animate().fadeIn(
+ duration: const Duration(milliseconds: 250),
+ curve: Curves.easeInOutCirc,
+ );
+ }
+ },
+ );
+ }
+
+ Widget _oldMemories() {
return FutureBuilder<List<Memory>>(
future: MemoriesService.instance.getMemories(),
builder: (context, snapshot) {