Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
- if returns null throw exception
- set as not failed when refreshing the balance
  • Loading branch information
thiagocarvalhodev committed Sep 10, 2024
1 parent ef606b3 commit 629ca5b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/authentication/ardrive_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,12 @@ class ArDriveAuthImpl implements ArDriveAuth {

@override
Future<void> refreshBalance() async {
_currentUser = _currentUser!.copyWith(
errorFetchingIOTokens: false,
);

_userStreamController.add(_currentUser);

_updateBalance();
}
}
Expand Down
8 changes: 6 additions & 2 deletions lib/components/profile_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,16 @@ class _ProfileCardState extends State<ProfileCard> {
),
if (state.errorFetchingIOTokens) ...[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Error fetching IO Tokens',
'Error fetching tIO balance',
style: typography.paragraphNormal(
fontWeight: ArFontWeight.semiBold,
color: colorTokens.textRed,
color: ArDriveTheme.of(context)
.themeData
.colors
.themeErrorDefault,
),
),
ArDriveIconButton(
Expand Down
3 changes: 3 additions & 0 deletions lib/user/repositories/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class _UserRepository implements UserRepository {

if (isArioSDKSupportedOnPlatform()) {
ioTokens = await _arioSDK.getIOTokens(await wallet.getAddress());
if (ioTokens == 'null') {
throw Exception('Error fetching IOTokens');
}
}

return ioTokens;
Expand Down

0 comments on commit 629ca5b

Please sign in to comment.