Skip to content

Commit f67940a

Browse files
committed
auto format
1 parent f2460c3 commit f67940a

File tree

2 files changed

+57
-68
lines changed

2 files changed

+57
-68
lines changed

lib/app_config.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import 'wallets/crypto_currency/intermediate/frost_currency.dart';
33

44
part 'app_config.g.dart';
55

6-
enum AppFeature {
7-
themeSelection,
8-
buy,
9-
swap;
10-
}
6+
enum AppFeature { themeSelection, buy, swap }
117

128
abstract class AppConfig {
139
static const appName = _prefix + _separator + suffix;

lib/services/exchange/exchange_data_loading_service.dart

Lines changed: 56 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ class ExchangeDataLoadingService {
4343

4444
static int get currentCacheVersion =>
4545
DB.instance.get<dynamic>(
46-
boxName: DB.boxNameDBInfo,
47-
key: "exchange_data_cache_version",
48-
) as int? ??
46+
boxName: DB.boxNameDBInfo,
47+
key: "exchange_data_cache_version",
48+
)
49+
as int? ??
4950
0;
5051

5152
Future<void> _updateCurrentCacheVersion(int version) async {
@@ -88,11 +89,7 @@ class ExchangeDataLoadingService {
8889
);
8990

9091
pair?.setReceive(
91-
await getAggregateCurrency(
92-
AppConfig.swapDefaults.to,
93-
rateType,
94-
null,
95-
),
92+
await getAggregateCurrency(AppConfig.swapDefaults.to, rateType, null),
9693
notifyListeners: false,
9794
);
9895
}
@@ -104,27 +101,26 @@ class ExchangeDataLoadingService {
104101
ExchangeRateType rateType,
105102
String? contract,
106103
) async {
107-
final currencies = await ExchangeDataLoadingService.instance.isar.currencies
108-
.filter()
109-
.group(
110-
(q) => rateType == ExchangeRateType.fixed
111-
? q
112-
.rateTypeEqualTo(SupportedRateType.both)
113-
.or()
114-
.rateTypeEqualTo(SupportedRateType.fixed)
115-
: q
116-
.rateTypeEqualTo(SupportedRateType.both)
117-
.or()
118-
.rateTypeEqualTo(SupportedRateType.estimated),
119-
)
120-
.and()
121-
.tickerEqualTo(
122-
ticker,
123-
caseSensitive: false,
124-
)
125-
.and()
126-
.tokenContractEqualTo(contract)
127-
.findAll();
104+
final currencies =
105+
await ExchangeDataLoadingService.instance.isar.currencies
106+
.filter()
107+
.group(
108+
(q) =>
109+
rateType == ExchangeRateType.fixed
110+
? q
111+
.rateTypeEqualTo(SupportedRateType.both)
112+
.or()
113+
.rateTypeEqualTo(SupportedRateType.fixed)
114+
: q
115+
.rateTypeEqualTo(SupportedRateType.both)
116+
.or()
117+
.rateTypeEqualTo(SupportedRateType.estimated),
118+
)
119+
.and()
120+
.tickerEqualTo(ticker, caseSensitive: false)
121+
.and()
122+
.tokenContractEqualTo(contract)
123+
.findAll();
128124

129125
final items = currencies
130126
.map((e) => Tuple2(e.exchangeName, e))
@@ -145,9 +141,7 @@ class ExchangeDataLoadingService {
145141
if (_isar == null) {
146142
await initDB();
147143
}
148-
Logging.instance.d(
149-
"ExchangeDataLoadingService.loadAll starting...",
150-
);
144+
Logging.instance.d("ExchangeDataLoadingService.loadAll starting...");
151145
final start = DateTime.now();
152146
try {
153147
/*
@@ -209,11 +203,12 @@ class ExchangeDataLoadingService {
209203
final responseCurrencies = await exchange.getAllCurrencies(false);
210204
if (responseCurrencies.value != null) {
211205
await isar.writeTxn(() async {
212-
final idsToDelete = await isar.currencies
213-
.where()
214-
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
215-
.idProperty()
216-
.findAll();
206+
final idsToDelete =
207+
await isar.currencies
208+
.where()
209+
.exchangeNameEqualTo(ChangeNowExchange.exchangeName)
210+
.idProperty()
211+
.findAll();
217212
await isar.currencies.deleteAll(idsToDelete);
218213
await isar.currencies.putAll(responseCurrencies.value!);
219214
});
@@ -342,18 +337,17 @@ class ExchangeDataLoadingService {
342337

343338
if (responseCurrencies.value != null) {
344339
await isar.writeTxn(() async {
345-
final idsToDelete = await isar.currencies
346-
.where()
347-
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
348-
.idProperty()
349-
.findAll();
340+
final idsToDelete =
341+
await isar.currencies
342+
.where()
343+
.exchangeNameEqualTo(MajesticBankExchange.exchangeName)
344+
.idProperty()
345+
.findAll();
350346
await isar.currencies.deleteAll(idsToDelete);
351347
await isar.currencies.putAll(responseCurrencies.value!);
352348
});
353349
} else {
354-
Logging.instance.w(
355-
"loadMajesticBankCurrencies: $responseCurrencies",
356-
);
350+
Logging.instance.w("loadMajesticBankCurrencies: $responseCurrencies");
357351
}
358352
}
359353

@@ -366,42 +360,41 @@ class ExchangeDataLoadingService {
366360

367361
if (responseCurrencies.value != null) {
368362
await isar.writeTxn(() async {
369-
final idsToDelete = await isar.currencies
370-
.where()
371-
.exchangeNameEqualTo(TrocadorExchange.exchangeName)
372-
.idProperty()
373-
.findAll();
363+
final idsToDelete =
364+
await isar.currencies
365+
.where()
366+
.exchangeNameEqualTo(TrocadorExchange.exchangeName)
367+
.idProperty()
368+
.findAll();
374369
await isar.currencies.deleteAll(idsToDelete);
375370
await isar.currencies.putAll(responseCurrencies.value!);
376371
});
377372
} else {
378-
Logging.instance.w(
379-
"loadTrocadorCurrencies: $responseCurrencies",
380-
);
373+
Logging.instance.w("loadTrocadorCurrencies: $responseCurrencies");
381374
}
382375
}
383376

384377
Future<void> loadNanswapCurrencies() async {
385378
if (_isar == null) {
386379
await initDB();
387380
}
388-
final responseCurrencies =
389-
await NanswapExchange.instance.getAllCurrencies(false);
381+
final responseCurrencies = await NanswapExchange.instance.getAllCurrencies(
382+
false,
383+
);
390384

391385
if (responseCurrencies.value != null) {
392386
await isar.writeTxn(() async {
393-
final idsToDelete = await isar.currencies
394-
.where()
395-
.exchangeNameEqualTo(NanswapExchange.exchangeName)
396-
.idProperty()
397-
.findAll();
387+
final idsToDelete =
388+
await isar.currencies
389+
.where()
390+
.exchangeNameEqualTo(NanswapExchange.exchangeName)
391+
.idProperty()
392+
.findAll();
398393
await isar.currencies.deleteAll(idsToDelete);
399394
await isar.currencies.putAll(responseCurrencies.value!);
400395
});
401396
} else {
402-
Logging.instance.w(
403-
"loadNanswapCurrencies: $responseCurrencies",
404-
);
397+
Logging.instance.w("loadNanswapCurrencies: $responseCurrencies");
405398
}
406399
}
407400

0 commit comments

Comments
 (0)