Fix fiat api warn icon showing up when api disabled
What changed, and why it matters
This commit fixes a minor user-interface bug in a cryptocurrency wallet app. When the user had disabled the fiat price API, a red warning icon was incorrectly shown as if the API had failed. The change simply hides that warning icon when the API is intentionally disabled. There is no security issue here.
No security action needed. Treat as a normal UI bug fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch updates FiatRateModel to clear the _hasFailed flag whenever the fiat API is disabled, and updates the wallet home screen widget so the warning icon is only shown when hasFailed is true AND isDisabled is false. This is a UI state correction, not a security fix.
Changed components
lib/models/fiat_rate_model.dartlib/screens/wallet_home.dartInspect captured patch +4 / −1
diff --git a/lib/models/fiat_rate_model.dart b/lib/models/fiat_rate_model.dart
index 38e47c7..acca4ad 100644
--- a/lib/models/fiat_rate_model.dart
+++ b/lib/models/fiat_rate_model.dart
@@ -45,7 +45,9 @@ class FiatRateModel with ChangeNotifier {
void _startRateFetchTimer() {
if (_fiatApiMode == FiatApiMode.disabled) {
_isDisabled = true;
+ _hasFailed = false; // a disabled API is not a failed one
log(LogLevel.info, 'Fiat API is disabled. Not starting rate fetch timer.');
+ notifyListeners();
return;
} else {
_isDisabled = false;
@@ -155,6 +157,7 @@ class FiatRateModel with ChangeNotifier {
_rateFetchTimer?.cancel();
_rateFetchTimer = null;
_isDisabled = true;
+ _hasFailed = false; // a disabled API is not a failed one
notifyListeners();
return;
}
diff --git a/lib/screens/wallet_home.dart b/lib/screens/wallet_home.dart
index 8ee7e40..da2e623 100644
--- a/lib/screens/wallet_home.dart
+++ b/lib/screens/wallet_home.dart
@@ -273,7 +273,7 @@ class _WalletHomeScreenState extends State<WalletHomeScreen> {
mainAxisAlignment: MainAxisAlignment.center,
spacing: 4,
children: [
- if (fiatRate.hasFailed)
+ if (fiatRate.hasFailed && !fiatRate.isDisabled)
Tooltip(
message: i18n.homeFiatApiError,
child: Icon(Icons.warning_rounded, size: 18, color: Colors.red),
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.