swap from within wallet fix if started in incognito mode

This commit is contained in:
julian 2023-03-30 12:57:46 -06:00
parent f0d414bc86
commit 7e6f0f18cd

View file

@ -270,11 +270,26 @@ class _WalletViewState extends ConsumerState<WalletView> {
),
);
} else {
final currency = await showLoading(
whileFuture: ExchangeDataLoadingService.instance.isar.currencies
Future<Currency?> _future;
try {
_future = ExchangeDataLoadingService.instance.isar.currencies
.where()
.tickerEqualToAnyExchangeNameName(coin.ticker)
.findFirst(),
.findFirst();
} catch (_) {
_future = ExchangeDataLoadingService.instance
.init()
.then(
(_) => ExchangeDataLoadingService.instance.loadAll(),
)
.then((_) => ExchangeDataLoadingService.instance.isar.currencies
.where()
.tickerEqualToAnyExchangeNameName(coin.ticker)
.findFirst());
}
final currency = await showLoading(
whileFuture: _future,
context: context,
message: "Loading...",
);