Generic fixes (#1154)

* Fix White screen issue
Bypass node certificate issue

* check on Fiat currency only with fiat templates

* Add possible missing cache file android error

* Dispose exchange state reaction when page is closed

* Fix minor chinese translation

* Temp remove BCH from robinhood

* Minor fixes
This commit is contained in:
Omar Hatem
2023-11-03 21:24:45 +02:00
committed by GitHub
parent ca6ccf1cf9
commit 37c2ee9e9e
10 changed files with 98 additions and 77 deletions
@@ -91,6 +91,8 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
bool _effectsInstalled = false;
ReactionDisposer? _exchangeStateReaction;
@override
void initState() {
super.initState();
@@ -103,8 +105,9 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
@override
void dispose() {
super.dispose();
widget.exchangeTradeViewModel.timer?.cancel();
_exchangeStateReaction?.reaction.dispose();
super.dispose();
}
@override
@@ -229,7 +232,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
return;
}
reaction((_) => this.widget.exchangeTradeViewModel.sendViewModel.state,
_exchangeStateReaction = reaction((_) => this.widget.exchangeTradeViewModel.sendViewModel.state,
(ExecutionState state) {
if (state is FailureState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
+1 -2
View File
@@ -13,8 +13,7 @@ import 'package:cake_wallet/store/authentication_store.dart';
import 'package:cake_wallet/entities/qr_scanner.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:uni_links/uni_links.dart';
import '../setup_2fa/setup_2fa_enter_code_page.dart';
import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_enter_code_page.dart';
class Root extends StatefulWidget {
Root({
+16 -16
View File
@@ -413,39 +413,39 @@ class SendPage extends BasePage {
if (context.mounted) {
showPopUp<void>(
context: context,
builder: (BuildContext context) {
builder: (BuildContext _dialogContext) {
return ConfirmSendingAlert(
alertTitle: S.of(context).confirm_sending,
amount: S.of(context).send_amount,
alertTitle: S.of(_dialogContext).confirm_sending,
amount: S.of(_dialogContext).send_amount,
amountValue: sendViewModel.pendingTransaction!.amountFormatted,
fiatAmountValue: sendViewModel.pendingTransactionFiatAmountFormatted,
fee: S.of(context).send_fee,
fee: S.of(_dialogContext).send_fee,
feeValue: sendViewModel.pendingTransaction!.feeFormatted,
feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmountFormatted,
outputs: sendViewModel.outputs,
rightButtonText: S.of(context).ok,
leftButtonText: S.of(context).cancel,
rightButtonText: S.of(_dialogContext).ok,
leftButtonText: S.of(_dialogContext).cancel,
actionRightButton: () {
Navigator.of(context).pop();
Navigator.of(_dialogContext).pop();
sendViewModel.commitTransaction();
showPopUp<void>(
context: context,
builder: (BuildContext context) {
builder: (BuildContext _dialogContext) {
return Observer(builder: (_) {
final state = sendViewModel.state;
if (state is FailureState) {
Navigator.of(context).pop();
Navigator.of(_dialogContext).pop();
}
if (state is TransactionCommitted) {
return AlertWithOneAction(
alertTitle: '',
alertContent: S.of(context).send_success(
alertContent: S.of(_dialogContext).send_success(
sendViewModel.selectedCryptoCurrency.toString()),
buttonText: S.of(context).ok,
buttonText: S.of(_dialogContext).ok,
buttonAction: () {
Navigator.of(context).pop();
Navigator.of(_dialogContext).pop();
RequestReviewHandler.requestReview();
});
}
@@ -454,7 +454,7 @@ class SendPage extends BasePage {
});
});
},
actionLeftButton: () => Navigator.of(context).pop());
actionLeftButton: () => Navigator.of(_dialogContext).pop());
});
}
});
@@ -472,15 +472,15 @@ class SendPage extends BasePage {
Future<void> _setInputsFromTemplate(BuildContext context,
{required Output output, required Template template}) async {
final fiatFromTemplate =
FiatCurrency.all.singleWhere((element) => element.title == template.fiatCurrency);
output.address = template.address;
if (template.isCurrencySelected) {
sendViewModel.setSelectedCryptoCurrency(template.cryptoCurrency);
output.setCryptoAmount(template.amount);
} else {
final fiatFromTemplate =
FiatCurrency.all.singleWhere((element) => element.title == template.fiatCurrency);
sendViewModel.setFiatCurrency(fiatFromTemplate);
output.setFiatAmount(template.amountFiat);
}