From 3d55f99950602c7a1fbfc3a39c7aaebe24af43d3 Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Wed, 15 Jan 2025 16:59:07 -0300 Subject: [PATCH] Always mark receipts as loaded after first attempt, update purplebase for sender fallback fix --- lib/widgets/zap_receipts.dart | 21 +++++++++++---------- pubspec.lock | 4 ++-- pubspec.yaml | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/widgets/zap_receipts.dart b/lib/widgets/zap_receipts.dart index 24a38e1..8a93858 100644 --- a/lib/widgets/zap_receipts.dart +++ b/lib/widgets/zap_receipts.dart @@ -175,19 +175,20 @@ class ZapReceiptsNotifier extends StateNotifier>> { data.map((r) => ZapReceipt.fromJson(r.toJson()).init().saveLocal()); await _loadZappers(zapReceipts); - // Mark loading done for this event - ref - .read(_zapsPreviouslyLoadedProvider(fileMetadata.event.id).notifier) - .state = true; - state = AsyncData({if (state.hasValue) ...state.value!, ...zapReceipts}); }); - // If after 10 seconds we receive no zaps, then change the state to empty - // (to prevent forever spinners) - Timer(Duration(seconds: 10), () { - if (mounted && state is AsyncLoading) { - state = AsyncData({}); + // If after 8 seconds we receive no zaps, then change the state to empty + // (to prevent forever spinners) and set to loading attempted + Timer(Duration(seconds: 8), () { + if (mounted) { + // Mark loading done for this event + ref + .read(_zapsPreviouslyLoadedProvider(fileMetadata.event.id).notifier) + .state = true; + if (state is AsyncLoading) { + state = AsyncData({}); + } } }); } diff --git a/pubspec.lock b/pubspec.lock index 74d59e3..8df2ca8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1018,8 +1018,8 @@ packages: dependency: "direct main" description: path: "." - ref: f45591e45abea0d4b39ad8aa2c54ee2c7e2c6b90 - resolved-ref: f45591e45abea0d4b39ad8aa2c54ee2c7e2c6b90 + ref: "6e7c86bc98a8a08b67b8fe8f70d3fcbd58d6476c" + resolved-ref: "6e7c86bc98a8a08b67b8fe8f70d3fcbd58d6476c" url: "https://github.com/purplebase/purplebase" source: git version: "0.2.0" diff --git a/pubspec.yaml b/pubspec.yaml index fa69562..1353c7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,10 +57,10 @@ dependencies: dependency_overrides: purplebase: - # path: ../purplebase + # path: ../../purplebase/purplebase git: url: https://github.com/purplebase/purplebase - ref: f45591e45abea0d4b39ad8aa2c54ee2c7e2c6b90 + ref: 6e7c86bc98a8a08b67b8fe8f70d3fcbd58d6476c flutter_data: git: url: https://github.com/zapstore/flutter_data