Merge remote-tracking branch 'origin_sw/ui-fixes' into ui-fixes

This commit is contained in:
Julian 2023-12-11 13:00:55 -06:00
commit 50a3e8e4da
3 changed files with 36 additions and 9 deletions

View file

@ -108,6 +108,7 @@ class _ExchangeCurrencySelectionViewState
if (widget.pairedTicker == null) {
return await _getCurrencies();
}
await ExchangeDataLoadingService.instance.initDB();
List<Currency> currencies = await ExchangeDataLoadingService
.instance.isar.currencies
.where()
@ -157,6 +158,7 @@ class _ExchangeCurrencySelectionViewState
}
Future<List<Currency>> _getCurrencies() async {
await ExchangeDataLoadingService.instance.initDB();
final currencies = await ExchangeDataLoadingService.instance.isar.currencies
.where()
.filter()

View file

@ -88,7 +88,10 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
bool isStackCoin(String ticker) {
try {
coinFromTickerCaseInsensitive(ticker);
try {
coinFromTickerCaseInsensitive(ticker);
} catch (_) {}
coinFromPrettyName(ticker);
return true;
} on ArgumentError catch (_) {
return false;
@ -272,10 +275,17 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
label: "Send from Stack",
buttonHeight: ButtonHeight.l,
onPressed: () {
final coin =
coinFromTickerCaseInsensitive(trade.payInCurrency);
final amount =
sendAmount.toAmount(fractionDigits: coin.decimals);
Coin coin;
try {
coin = coinFromTickerCaseInsensitive(
trade.payInCurrency);
} catch (_) {
coin = coinFromPrettyName(trade.payInCurrency);
}
final amount = Amount.fromDecimal(
sendAmount,
fractionDigits: coin.decimals,
);
final address = trade.payInAddress;
Navigator.of(context).pushNamed(
@ -1347,12 +1357,18 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
SecondaryButton(
label: "Send from Stack",
onPressed: () {
final amount = sendAmount;
Coin coin;
try {
coin = coinFromTickerCaseInsensitive(trade.payInCurrency);
} catch (_) {
coin = coinFromPrettyName(trade.payInCurrency);
}
final amount = Amount.fromDecimal(
sendAmount,
fractionDigits: coin.decimals,
);
final address = trade.payInAddress;
final coin =
coinFromTickerCaseInsensitive(trade.payInCurrency);
Navigator.of(context).pushNamed(
SendFromView.routeName,
arguments: Tuple4(

View file

@ -196,6 +196,9 @@ class ExchangeDataLoadingService {
}
Future<void> _loadChangeNowCurrencies() async {
if (_isar == null) {
await initDB();
}
final exchange = ChangeNowExchange.instance;
final responseCurrencies = await exchange.getAllCurrencies(false);
if (responseCurrencies.value != null) {
@ -325,6 +328,9 @@ class ExchangeDataLoadingService {
// }
Future<void> loadMajesticBankCurrencies() async {
if (_isar == null) {
await initDB();
}
final exchange = MajesticBankExchange.instance;
final responseCurrencies = await exchange.getAllCurrencies(false);
@ -347,6 +353,9 @@ class ExchangeDataLoadingService {
}
Future<void> loadTrocadorCurrencies() async {
if (_isar == null) {
await initDB();
}
final exchange = TrocadorExchange.instance;
final responseCurrencies = await exchange.getAllCurrencies(false);