fix dialog popping up too often on desktop

This commit is contained in:
Julian 2024-06-26 11:12:34 -06:00
parent 66661a3f90
commit 5b61744124
2 changed files with 20 additions and 5 deletions

View file

@ -399,7 +399,7 @@ class _SendViewState extends ConsumerState<SendView> {
);
ref.read(pIsExchangeAddress.state).state =
(coin as Firo).isExchangeAddress(_address ?? "");
(coin as Firo).isExchangeAddress(address ?? "");
if (ref.read(publicPrivateBalanceStateProvider) == FiroType.spark &&
ref.read(pIsExchangeAddress) &&

View file

@ -711,7 +711,17 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
);
ref.read(pIsExchangeAddress.state).state =
(coin as Firo).isExchangeAddress(_address ?? "");
(coin as Firo).isExchangeAddress(address ?? "");
if (ref.read(publicPrivateBalanceStateProvider) == FiroType.spark &&
ref.read(pIsExchangeAddress) &&
!_isFiroExWarningDisplayed) {
_isFiroExWarningDisplayed = true;
showFiroExchangeAddressWarning(
context,
() => _isFiroExWarningDisplayed = false,
);
}
}
ref.read(pValidSendToAddress.notifier).state =
@ -952,8 +962,13 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
}
final firoType = ref.watch(publicPrivateBalanceStateProvider);
if (coin is Firo && firoType == FiroType.spark) {
if (ref.watch(pIsExchangeAddress) && !_isFiroExWarningDisplayed) {
final isExchangeAddress = ref.watch(pIsExchangeAddress);
ref.listen(publicPrivateBalanceStateProvider, (previous, next) {
if (previous != next &&
next == FiroType.spark &&
isExchangeAddress &&
!_isFiroExWarningDisplayed) {
_isFiroExWarningDisplayed = true;
WidgetsBinding.instance.addPostFrameCallback(
(_) => showFiroExchangeAddressWarning(
@ -962,7 +977,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
),
);
}
}
});
final showCoinControl = ref.watch(
prefsChangeNotifierProvider.select(