update branch

This commit is contained in:
julian 2023-05-17 12:16:38 -06:00
parent 0d7a0a8fb9
commit 23a6236b4c
4 changed files with 60 additions and 44 deletions

View file

@ -30,11 +30,9 @@ import 'package:stackwallet/services/mixins/wallet_cache.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/mixins/xpubable.dart'; import 'package:stackwallet/services/mixins/xpubable.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/default_nodes.dart';
@ -44,6 +42,7 @@ import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'; import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/prefs.dart'; import 'package:stackwallet/utilities/prefs.dart';
import 'package:stackwallet/widgets/crypto_notifications.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
@ -2798,32 +2797,34 @@ class ECashWallet extends CoinServiceAPI
final confirmations = tx.getConfirmations(currentChainHeight); final confirmations = tx.getConfirmations(currentChainHeight);
if (tx.type == isar_models.TransactionType.incoming) { if (tx.type == isar_models.TransactionType.incoming) {
unawaited(NotificationApi.showNotification( CryptoNotificationsEventBus.instance.fire(
CryptoNotificationEvent(
title: "Incoming transaction", title: "Incoming transaction",
body: walletName,
walletId: walletId, walletId: walletId,
iconAssetName: Assets.svg.iconFor(coin: coin), walletName: walletName,
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS, shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS,
coinName: coin.name, coin: coin,
txid: tx.txid, txid: tx.txid,
confirmations: confirmations, confirmations: confirmations,
requiredConfirmations: MINIMUM_CONFIRMATIONS, requiredConfirmations: MINIMUM_CONFIRMATIONS,
)); ),
);
await txTracker.addNotifiedPending(tx.txid); await txTracker.addNotifiedPending(tx.txid);
} else if (tx.type == isar_models.TransactionType.outgoing) { } else if (tx.type == isar_models.TransactionType.outgoing) {
unawaited(NotificationApi.showNotification( CryptoNotificationsEventBus.instance.fire(
CryptoNotificationEvent(
title: "Sending transaction", title: "Sending transaction",
body: walletName,
walletId: walletId, walletId: walletId,
iconAssetName: Assets.svg.iconFor(coin: coin),
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS, shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS,
coinName: coin.name,
txid: tx.txid, txid: tx.txid,
confirmations: confirmations, confirmations: confirmations,
requiredConfirmations: MINIMUM_CONFIRMATIONS, requiredConfirmations: MINIMUM_CONFIRMATIONS,
)); walletName: walletName,
coin: coin,
),
);
await txTracker.addNotifiedPending(tx.txid); await txTracker.addNotifiedPending(tx.txid);
} }
} }
@ -2831,26 +2832,32 @@ class ECashWallet extends CoinServiceAPI
// notify on confirmed // notify on confirmed
for (final tx in unconfirmedTxnsToNotifyConfirmed) { for (final tx in unconfirmedTxnsToNotifyConfirmed) {
if (tx.type == isar_models.TransactionType.incoming) { if (tx.type == isar_models.TransactionType.incoming) {
unawaited(NotificationApi.showNotification( CryptoNotificationsEventBus.instance.fire(
CryptoNotificationEvent(
title: "Incoming transaction confirmed", title: "Incoming transaction confirmed",
body: walletName,
walletId: walletId, walletId: walletId,
iconAssetName: Assets.svg.iconFor(coin: coin),
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
shouldWatchForUpdates: false, shouldWatchForUpdates: false,
coinName: coin.name, txid: tx.txid,
)); requiredConfirmations: MINIMUM_CONFIRMATIONS,
walletName: walletName,
coin: coin,
),
);
await txTracker.addNotifiedConfirmed(tx.txid); await txTracker.addNotifiedConfirmed(tx.txid);
} else if (tx.type == isar_models.TransactionType.outgoing) { } else if (tx.type == isar_models.TransactionType.outgoing) {
unawaited(NotificationApi.showNotification( CryptoNotificationsEventBus.instance.fire(
CryptoNotificationEvent(
title: "Outgoing transaction confirmed", title: "Outgoing transaction confirmed",
body: walletName,
walletId: walletId, walletId: walletId,
iconAssetName: Assets.svg.iconFor(coin: coin),
date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000),
shouldWatchForUpdates: false, shouldWatchForUpdates: false,
coinName: coin.name, txid: tx.txid,
)); requiredConfirmations: MINIMUM_CONFIRMATIONS,
walletName: walletName,
coin: coin,
),
);
await txTracker.addNotifiedConfirmed(tx.txid); await txTracker.addNotifiedConfirmed(tx.txid);
} }
} }

View file

@ -17,6 +17,8 @@ final coinIconProvider = Provider.family<String, Coin>((ref, coin) {
case Coin.dogecoin: case Coin.dogecoin:
case Coin.dogecoinTestNet: case Coin.dogecoinTestNet:
return assets.dogecoin; return assets.dogecoin;
case Coin.eCash:
return assets.epicCash;
case Coin.epicCash: case Coin.epicCash:
return assets.epicCash; return assets.epicCash;
case Coin.firo: case Coin.firo:

View file

@ -14,6 +14,8 @@ final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
return assets.bitcoincashImage; return assets.bitcoincashImage;
case Coin.dogecoin: case Coin.dogecoin:
return assets.dogecoinImage; return assets.dogecoinImage;
case Coin.eCash:
return assets.epicCashImage;
case Coin.epicCash: case Coin.epicCash:
return assets.epicCashImage; return assets.epicCashImage;
case Coin.firo: case Coin.firo:
@ -51,6 +53,8 @@ final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
return assets.bitcoincashImageSecondary; return assets.bitcoincashImageSecondary;
case Coin.dogecoin: case Coin.dogecoin:
return assets.dogecoinImageSecondary; return assets.dogecoinImageSecondary;
case Coin.eCash:
return assets.epicCashImageSecondary;
case Coin.epicCash: case Coin.epicCash:
return assets.epicCashImageSecondary; return assets.epicCashImageSecondary;
case Coin.firo: case Coin.firo:

View file

@ -12,6 +12,7 @@ class CoinThemeColorDefault {
Color get firo => const Color(0xFFFF897A); Color get firo => const Color(0xFFFF897A);
Color get dogecoin => const Color(0xFFFFE079); Color get dogecoin => const Color(0xFFFFE079);
Color get epicCash => const Color(0xFFC5C7CB); Color get epicCash => const Color(0xFFC5C7CB);
Color get eCash => const Color(0xFFC5C7CB);
Color get ethereum => const Color(0xFFA7ADE9); Color get ethereum => const Color(0xFFA7ADE9);
Color get monero => const Color(0xFFFF9E6B); Color get monero => const Color(0xFFFF9E6B);
Color get namecoin => const Color(0xFF91B1E1); Color get namecoin => const Color(0xFF91B1E1);
@ -32,6 +33,8 @@ class CoinThemeColorDefault {
case Coin.dogecoin: case Coin.dogecoin:
case Coin.dogecoinTestNet: case Coin.dogecoinTestNet:
return dogecoin; return dogecoin;
case Coin.eCash:
return epicCash;
case Coin.epicCash: case Coin.epicCash:
return epicCash; return epicCash;
case Coin.ethereum: case Coin.ethereum: