Skip to content

Commit

Permalink
fix(activation): skip coin activation if not signed in
Browse files Browse the repository at this point in the history
coin activation fails with an error message if there is no wallet/user signed in
  • Loading branch information
takenagain committed Feb 21, 2025
1 parent da22913 commit 9560437
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/bloc/coins_bloc/coins_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ class CoinsRepo {
}

Future<void> activateAssetsSync(List<Asset> assets) async {
final isSignedIn = await _kdfSdk.auth.isSignedIn();
if (!isSignedIn) {
final coinIdList = assets.map((e) => e.id.id).join(', ');
log('No wallet signed in. Skipping activation of [$coinIdList}]');
return;
}

for (final asset in assets) {
final coin = asset.toCoin();
try {
Expand Down Expand Up @@ -261,6 +268,13 @@ class CoinsRepo {
}

Future<void> activateCoinsSync(List<Coin> coins) async {
final isSignedIn = await _kdfSdk.auth.isSignedIn();
if (!isSignedIn) {
final coinIdList = coins.map((e) => e.abbr).join(', ');
log('No wallet signed in. Skipping activation of [$coinIdList}]');
return;
}

for (final coin in coins) {
try {
final asset = _kdfSdk.assets.available[coin.id];
Expand All @@ -286,6 +300,7 @@ class CoinsRepo {
'Error activating coin: ${coin.abbr} \n$e',
isError: true,
trace: s,
path: 'coins_repo->activateCoinsSync',
).ignore();
await _broadcastAsset(coin.copyWith(state: CoinState.suspended));
} finally {
Expand Down

0 comments on commit 9560437

Please sign in to comment.