diff --git a/lib/services/coins/ecash/ecash_wallet.dart b/lib/services/coins/ecash/ecash_wallet.dart index 6765ad33a..9c6e2dccf 100644 --- a/lib/services/coins/ecash/ecash_wallet.dart +++ b/lib/services/coins/ecash/ecash_wallet.dart @@ -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/xpubable.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/utilities/address_utils.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/constants.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/logger.dart'; import 'package:stackwallet/utilities/prefs.dart'; +import 'package:stackwallet/widgets/crypto_notifications.dart'; import 'package:tuple/tuple.dart'; import 'package:uuid/uuid.dart'; @@ -2798,32 +2797,34 @@ class ECashWallet extends CoinServiceAPI final confirmations = tx.getConfirmations(currentChainHeight); if (tx.type == isar_models.TransactionType.incoming) { - unawaited(NotificationApi.showNotification( - title: "Incoming transaction", - body: walletName, - walletId: walletId, - iconAssetName: Assets.svg.iconFor(coin: coin), - date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), - shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS, - coinName: coin.name, - txid: tx.txid, - confirmations: confirmations, - requiredConfirmations: MINIMUM_CONFIRMATIONS, - )); + CryptoNotificationsEventBus.instance.fire( + CryptoNotificationEvent( + title: "Incoming transaction", + walletId: walletId, + walletName: walletName, + date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), + shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS, + coin: coin, + txid: tx.txid, + confirmations: confirmations, + requiredConfirmations: MINIMUM_CONFIRMATIONS, + ), + ); await txTracker.addNotifiedPending(tx.txid); } else if (tx.type == isar_models.TransactionType.outgoing) { - unawaited(NotificationApi.showNotification( - title: "Sending transaction", - body: walletName, - walletId: walletId, - iconAssetName: Assets.svg.iconFor(coin: coin), - date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), - shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS, - coinName: coin.name, - txid: tx.txid, - confirmations: confirmations, - requiredConfirmations: MINIMUM_CONFIRMATIONS, - )); + CryptoNotificationsEventBus.instance.fire( + CryptoNotificationEvent( + title: "Sending transaction", + walletId: walletId, + date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), + shouldWatchForUpdates: confirmations < MINIMUM_CONFIRMATIONS, + txid: tx.txid, + confirmations: confirmations, + requiredConfirmations: MINIMUM_CONFIRMATIONS, + walletName: walletName, + coin: coin, + ), + ); await txTracker.addNotifiedPending(tx.txid); } } @@ -2831,26 +2832,32 @@ class ECashWallet extends CoinServiceAPI // notify on confirmed for (final tx in unconfirmedTxnsToNotifyConfirmed) { if (tx.type == isar_models.TransactionType.incoming) { - unawaited(NotificationApi.showNotification( - title: "Incoming transaction confirmed", - body: walletName, - walletId: walletId, - iconAssetName: Assets.svg.iconFor(coin: coin), - date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), - shouldWatchForUpdates: false, - coinName: coin.name, - )); + CryptoNotificationsEventBus.instance.fire( + CryptoNotificationEvent( + title: "Incoming transaction confirmed", + walletId: walletId, + date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), + shouldWatchForUpdates: false, + txid: tx.txid, + requiredConfirmations: MINIMUM_CONFIRMATIONS, + walletName: walletName, + coin: coin, + ), + ); await txTracker.addNotifiedConfirmed(tx.txid); } else if (tx.type == isar_models.TransactionType.outgoing) { - unawaited(NotificationApi.showNotification( - title: "Outgoing transaction confirmed", - body: walletName, - walletId: walletId, - iconAssetName: Assets.svg.iconFor(coin: coin), - date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), - shouldWatchForUpdates: false, - coinName: coin.name, - )); + CryptoNotificationsEventBus.instance.fire( + CryptoNotificationEvent( + title: "Outgoing transaction confirmed", + walletId: walletId, + date: DateTime.fromMillisecondsSinceEpoch(tx.timestamp * 1000), + shouldWatchForUpdates: false, + txid: tx.txid, + requiredConfirmations: MINIMUM_CONFIRMATIONS, + walletName: walletName, + coin: coin, + ), + ); await txTracker.addNotifiedConfirmed(tx.txid); } } diff --git a/lib/themes/coin_icon_provider.dart b/lib/themes/coin_icon_provider.dart index 75b8a3e11..41e344e6b 100644 --- a/lib/themes/coin_icon_provider.dart +++ b/lib/themes/coin_icon_provider.dart @@ -17,6 +17,8 @@ final coinIconProvider = Provider.family((ref, coin) { case Coin.dogecoin: case Coin.dogecoinTestNet: return assets.dogecoin; + case Coin.eCash: + return assets.epicCash; case Coin.epicCash: return assets.epicCash; case Coin.firo: diff --git a/lib/themes/coin_image_provider.dart b/lib/themes/coin_image_provider.dart index 60ef466a7..c8331356b 100644 --- a/lib/themes/coin_image_provider.dart +++ b/lib/themes/coin_image_provider.dart @@ -14,6 +14,8 @@ final coinImageProvider = Provider.family((ref, coin) { return assets.bitcoincashImage; case Coin.dogecoin: return assets.dogecoinImage; + case Coin.eCash: + return assets.epicCashImage; case Coin.epicCash: return assets.epicCashImage; case Coin.firo: @@ -51,6 +53,8 @@ final coinImageSecondaryProvider = Provider.family((ref, coin) { return assets.bitcoincashImageSecondary; case Coin.dogecoin: return assets.dogecoinImageSecondary; + case Coin.eCash: + return assets.epicCashImageSecondary; case Coin.epicCash: return assets.epicCashImageSecondary; case Coin.firo: diff --git a/lib/themes/color_theme.dart b/lib/themes/color_theme.dart index fe261456c..5f631ad75 100644 --- a/lib/themes/color_theme.dart +++ b/lib/themes/color_theme.dart @@ -12,6 +12,7 @@ class CoinThemeColorDefault { Color get firo => const Color(0xFFFF897A); Color get dogecoin => const Color(0xFFFFE079); Color get epicCash => const Color(0xFFC5C7CB); + Color get eCash => const Color(0xFFC5C7CB); Color get ethereum => const Color(0xFFA7ADE9); Color get monero => const Color(0xFFFF9E6B); Color get namecoin => const Color(0xFF91B1E1); @@ -32,6 +33,8 @@ class CoinThemeColorDefault { case Coin.dogecoin: case Coin.dogecoinTestNet: return dogecoin; + case Coin.eCash: + return epicCash; case Coin.epicCash: return epicCash; case Coin.ethereum: