From bdc4a9cce51520df44a4c5954883ae4bd23b85d9 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:08:17 -0300 Subject: [PATCH 1/2] Update arweave_service.dart --- lib/services/arweave/arweave_service.dart | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/services/arweave/arweave_service.dart b/lib/services/arweave/arweave_service.dart index 5802f3f9e..c27307447 100644 --- a/lib/services/arweave/arweave_service.dart +++ b/lib/services/arweave/arweave_service.dart @@ -444,19 +444,23 @@ class ArweaveService { required String driveId, required bool isPrivate, }) async { - final txId = entityId; + try { + final txId = entityId; - final cachedData = await _getCachedEntityDataFromSnapshot( - driveId: driveId, - txId: txId, - isPrivate: isPrivate, - ); + final cachedData = await _getCachedEntityDataFromSnapshot( + driveId: driveId, + txId: txId, + isPrivate: isPrivate, + ); - if (cachedData != null) { - return cachedData; - } + if (cachedData != null) { + return cachedData; + } - return getEntityDataFromNetwork(txId: txId); + return getEntityDataFromNetwork(txId: txId); + } catch (e) { + return Uint8List(0); + } } Future _getCachedEntityDataFromSnapshot({ From 1252767050c947c4945e342a48717551352c5883 Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:16:17 -0300 Subject: [PATCH 2/2] Update arweave_service.dart --- lib/services/arweave/arweave_service.dart | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/services/arweave/arweave_service.dart b/lib/services/arweave/arweave_service.dart index c27307447..0586bd88d 100644 --- a/lib/services/arweave/arweave_service.dart +++ b/lib/services/arweave/arweave_service.dart @@ -444,23 +444,22 @@ class ArweaveService { required String driveId, required bool isPrivate, }) async { - try { - final txId = entityId; + final txId = entityId; - final cachedData = await _getCachedEntityDataFromSnapshot( - driveId: driveId, - txId: txId, - isPrivate: isPrivate, - ); + final cachedData = await _getCachedEntityDataFromSnapshot( + driveId: driveId, + txId: txId, + isPrivate: isPrivate, + ); - if (cachedData != null) { - return cachedData; - } + if (cachedData != null) { + return cachedData; + } - return getEntityDataFromNetwork(txId: txId); - } catch (e) { + return getEntityDataFromNetwork(txId: txId).catchError((e) { + logger.e('Failed to get entity data from network', e); return Uint8List(0); - } + }); } Future _getCachedEntityDataFromSnapshot({