send from xmr/wow disabled due to concurrent libmonero based wallets restriction

This commit is contained in:
julian 2024-07-22 12:35:06 -06:00 committed by julian-CStack
parent 7ccb403ed3
commit 0ed6f2689a
2 changed files with 25 additions and 20 deletions

View file

@ -28,12 +28,14 @@ import '../../utilities/amount/amount_formatter.dart';
import '../../utilities/assets.dart';
import '../../utilities/constants.dart';
import '../../utilities/enums/fee_rate_type_enum.dart';
import '../../utilities/logger.dart';
import '../../utilities/text_styles.dart';
import '../../utilities/util.dart';
import '../../wallets/crypto_currency/crypto_currency.dart';
import '../../wallets/isar/providers/wallet_info_provider.dart';
import '../../wallets/models/tx_data.dart';
import '../../wallets/wallet/impl/firo_wallet.dart';
import '../../wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart';
import '../../widgets/background.dart';
import '../../widgets/conditional_parent.dart';
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
@ -271,6 +273,15 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
),
);
// Currently CwBasedInterface wallets (xmr/wow) shouldn't even have
// access to this screen but this is needed to get past an error that
// would occur only to lead to another error which is why xmr/wow wallets
// don't have access to this screen currently
if (wallet is CwBasedInterface) {
await wallet.init();
await wallet.open();
}
final time = Future<dynamic>.delayed(
const Duration(
milliseconds: 2500,
@ -375,7 +386,8 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
);
}
}
} catch (e) {
} catch (e, s) {
Logging.instance.log("$e\n$s", level: LogLevel.Error);
if (mounted) {
// pop building dialog
Navigator.of(context).pop();

View file

@ -190,6 +190,15 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
final isDesktop = Util.isDesktop;
final showSendFromStackButton = !hasTx &&
!["xmr", "monero", "wow", "wownero"]
.contains(trade.payInCurrency.toLowerCase()) &&
AppConfig.isStackCoin(trade.payInCurrency) &&
(trade.status == "New" ||
trade.status == "new" ||
trade.status == "waiting" ||
trade.status == "Waiting");
return ConditionalParent(
condition: !isDesktop,
builder: (child) => Background(
@ -248,21 +257,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
children: children,
),
),
if (!hasTx &&
AppConfig.isStackCoin(trade.payInCurrency) &&
(trade.status == "New" ||
trade.status == "new" ||
trade.status == "waiting" ||
trade.status == "Waiting"))
if (showSendFromStackButton)
const SizedBox(
height: 32,
),
if (!hasTx &&
AppConfig.isStackCoin(trade.payInCurrency) &&
(trade.status == "New" ||
trade.status == "new" ||
trade.status == "waiting" ||
trade.status == "Waiting"))
if (showSendFromStackButton)
SecondaryButton(
label: "Send from ${AppConfig.prefix}",
buttonHeight: ButtonHeight.l,
@ -1371,13 +1370,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
const SizedBox(
height: 12,
),
if (!isDesktop &&
!hasTx &&
AppConfig.isStackCoin(trade.payInCurrency) &&
(trade.status == "New" ||
trade.status == "new" ||
trade.status == "waiting" ||
trade.status == "Waiting"))
if (!isDesktop && showSendFromStackButton)
SecondaryButton(
label: "Send from ${AppConfig.prefix}",
onPressed: () {