app config swap field defaults

This commit is contained in:
julian 2024-10-01 12:55:50 -06:00
parent e0d2c8ec74
commit 44fbab715a
5 changed files with 11 additions and 2 deletions

View file

@ -27,6 +27,8 @@ abstract class AppConfig {
static List<CryptoCurrency> get coins => _supportedCoins;
static ({String from, String to}) get swapDefaults => _swapDefaults;
static bool get isSingleCoinApp => coins.length == 1;
static CryptoCurrency? getCryptoCurrencyFor(String coinIdentifier) {

View file

@ -12,6 +12,7 @@ import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart';
import 'package:tuple/tuple.dart';
import '../../app_config.dart';
import '../../db/hive/db.dart';
import '../../models/exchange/active_pair.dart';
import '../../models/exchange/aggregate_currency.dart';
@ -79,7 +80,7 @@ class ExchangeDataLoadingService {
if (await isar.currencies.count() > 0) {
pair?.setSend(
await getAggregateCurrency(
"BTC",
AppConfig.swapDefaults.from,
rateType,
null,
),
@ -88,7 +89,7 @@ class ExchangeDataLoadingService {
pair?.setReceive(
await getAggregateCurrency(
"XMR",
AppConfig.swapDefaults.to,
rateType,
null,
),

View file

@ -62,4 +62,6 @@ final List<CryptoCurrency> _supportedCoins = List.unmodifiable([
Firo(CryptoCurrencyNetwork.main),
]);
final ({String from, String to}) _swapDefaults = (from: "BTC", to: "FIRO");
EOF

View file

@ -64,4 +64,6 @@ final List<CryptoCurrency> _supportedCoins = List.unmodifiable([
BitcoinFrost(CryptoCurrencyNetwork.test4),
]);
final ({String from, String to}) _swapDefaults = (from: "BTC", to: "XMR");
EOF

View file

@ -85,4 +85,6 @@ final List<CryptoCurrency> _supportedCoins = List.unmodifiable([
Stellar(CryptoCurrencyNetwork.test),
]);
final ({String from, String to}) _swapDefaults = (from: "BTC", to: "XMR");
EOF