mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
CW-395-Trade-ID-status-not-updating-in-trade-details-screen (#957)
* fix ChangeNow trade status * formatting * fix hive saving * Revert SideShift changes This reverts commit
This commit is contained in:
parent
f88e150cd1
commit
f1904077d2
2 changed files with 15 additions and 8 deletions
|
@ -192,11 +192,11 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
|
|||
final expectedSendAmount = responseJSON['expectedAmountFrom'].toString();
|
||||
final status = responseJSON['status'] as String;
|
||||
final state = TradeState.deserialize(raw: status);
|
||||
final extraId = responseJSON['payinExtraId'] as String;
|
||||
final outputTransaction = responseJSON['payoutHash'] as String;
|
||||
final expiredAtRaw = responseJSON['validUntil'] as String;
|
||||
final extraId = responseJSON['payinExtraId'] as String?;
|
||||
final outputTransaction = responseJSON['payoutHash'] as String?;
|
||||
final expiredAtRaw = responseJSON['validUntil'] as String?;
|
||||
final payoutAddress = responseJSON['payoutAddress'] as String;
|
||||
final expiredAt = DateTime.tryParse(expiredAtRaw)?.toLocal();
|
||||
final expiredAt = DateTime.tryParse(expiredAtRaw ?? '')?.toLocal();
|
||||
|
||||
return Trade(
|
||||
id: id,
|
||||
|
|
|
@ -21,6 +21,7 @@ import 'package:cake_wallet/src/screens/trade_details/track_trade_list_item.dart
|
|||
import 'package:cake_wallet/src/screens/trade_details/trade_details_list_card.dart';
|
||||
import 'package:cake_wallet/src/screens/trade_details/trade_details_status_item.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
part 'trade_details_view_model.g.dart';
|
||||
|
||||
|
@ -32,7 +33,8 @@ abstract class TradeDetailsViewModelBase with Store {
|
|||
required this.trades,
|
||||
required this.settingsStore,
|
||||
}) : items = ObservableList<StandartListItem>(),
|
||||
trade = tradeForDetails {
|
||||
trade = trades.values.firstWhereOrNull((element) => element.id == tradeForDetails.id) ??
|
||||
tradeForDetails {
|
||||
switch (trade.provider) {
|
||||
case ExchangeProviderDescription.xmrto:
|
||||
_provider = XMRTOExchangeProvider();
|
||||
|
@ -54,8 +56,6 @@ abstract class TradeDetailsViewModelBase with Store {
|
|||
break;
|
||||
}
|
||||
|
||||
items = ObservableList<StandartListItem>();
|
||||
|
||||
_updateItems();
|
||||
|
||||
_updateTrade();
|
||||
|
@ -85,6 +85,12 @@ abstract class TradeDetailsViewModelBase with Store {
|
|||
if (updatedTrade.createdAt == null && trade.createdAt != null) {
|
||||
updatedTrade.createdAt = trade.createdAt;
|
||||
}
|
||||
Trade? foundElement = trades.values.firstWhereOrNull((element) => element.id == trade.id);
|
||||
if (foundElement != null) {
|
||||
final editedTrade = trades.get(foundElement.key);
|
||||
editedTrade?.stateRaw = updatedTrade.stateRaw;
|
||||
editedTrade?.save();
|
||||
}
|
||||
|
||||
trade = updatedTrade;
|
||||
|
||||
|
@ -154,8 +160,9 @@ abstract class TradeDetailsViewModelBase with Store {
|
|||
}
|
||||
|
||||
void _launchUrl(String url) {
|
||||
final uri = Uri.parse(url);
|
||||
try {
|
||||
launch(url);
|
||||
launchUrl(uri);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue