Fix Scam tokens handling and make it persistent (#2138)

* Fix Scam tokens handling and make it persistent

* Add potential scam text next to scam tokens

* change UI of potential scam text
This commit is contained in:
Omar Hatem 2025-04-03 03:32:00 +02:00 committed by GitHub
parent cbca4c9c77
commit 23a47ed561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 121 additions and 45 deletions

View file

@ -20,6 +20,8 @@ class Erc20Token extends CryptoCurrency with HiveObjectMixin {
final String? iconPath;
@HiveField(6)
final String? tag;
@HiveField(7, defaultValue: false)
final bool isPotentialScam;
bool get enabled => _enabled;
@ -33,14 +35,17 @@ class Erc20Token extends CryptoCurrency with HiveObjectMixin {
bool enabled = true,
this.iconPath,
this.tag,
this.isPotentialScam = false,
}) : _enabled = enabled,
super(
name: symbol.toLowerCase(),
title: symbol.toUpperCase(),
fullName: name,
tag: tag,
iconPath: iconPath,
decimals: decimal);
name: symbol.toLowerCase(),
title: symbol.toUpperCase(),
fullName: name,
tag: tag,
iconPath: iconPath,
decimals: decimal,
isPotentialScam: isPotentialScam,
);
Erc20Token.copyWith(Erc20Token other, String? icon, String? tag)
: this.name = other.name,
@ -50,6 +55,7 @@ class Erc20Token extends CryptoCurrency with HiveObjectMixin {
this._enabled = other.enabled,
this.tag = tag,
this.iconPath = icon,
this.isPotentialScam = other.isPotentialScam,
super(
name: other.name,
title: other.symbol.toUpperCase(),
@ -57,6 +63,7 @@ class Erc20Token extends CryptoCurrency with HiveObjectMixin {
tag: tag,
iconPath: icon,
decimals: other.decimal,
isPotentialScam: other.isPotentialScam,
);
static const typeId = ERC20_TOKEN_TYPE_ID;