Generic fixes and enhancements (#1083)

* Add exception handler to fiat APIs
Increase send card size for coin control
Fix Monero.com unspent coins hive box issue
minor bug fix

* Remove EIP-1559 parameters from Eth transaction
Enhance error reporting

* Throw error if not enough monero utx outputs are selected

* Fix Search text color

* Fix Ethereum sending EIP-1559 transactions

* Add transaction data to ERC20 transactions

* Add input check in single output transactions as well

* Fix Node deletion issue
Handle user input error in anonpay

* Remove exception handler from fiat conversion since it's not working with isolates

* Require enough utxo for amount and fees; More insightful Error messages

* Add cakewallet to applinks [skip ci]

* Add cakewallet app link for iOS [skip ci]

* Add applink depending on app scheme variable

* Add applink in iOS custom to the app getting built [skip ci]

* Handle normal app links without considering them as Payment URIs

* Minor fix [skip ci]

* Fixate encrypt package version as the recent update they made has some issues [skip ci]

---------

Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
This commit is contained in:
Omar Hatem
2023-09-14 22:14:16 +03:00
committed by GitHub
co-authored by Konstantin Ullrich
parent 4c9c6a1eae
commit ce4d375abf
18 changed files with 94 additions and 16 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ Future<void> initializeAppConfigs() async {
CakeHive.registerAdapter(OrderAdapter());
}
if (!isMoneroOnly && !CakeHive.isAdapterRegistered(UnspentCoinsInfo.typeId)) {
if (!CakeHive.isAdapterRegistered(UnspentCoinsInfo.typeId)) {
CakeHive.registerAdapter(UnspentCoinsInfoAdapter());
}
@@ -9,6 +9,7 @@ import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.da
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
import 'package:cake_wallet/themes/extensions/address_theme.dart';
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
import 'package:cake_wallet/themes/extensions/picker_theme.dart';
import 'package:cake_wallet/view_model/dashboard/home_settings_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@@ -55,7 +56,8 @@ class HomeSettingsPage extends BasePage {
padding: const EdgeInsetsDirectional.only(start: 16),
child: TextFormField(
controller: _searchController,
style: TextStyle(color: Theme.of(context).dialogTheme.backgroundColor),
style: TextStyle(
color: Theme.of(context).extension<PickerTheme>()!.searchHintColor),
decoration: InputDecoration(
hintText: S.of(context).search_add_token,
prefixIcon: Image.asset("assets/images/search_icon.png"),
+5 -3
View File
@@ -140,7 +140,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
}
_reset();
totpAuth.close(
route: launchUri != null ? Routes.send : null,
route: _isValidPaymentUri() ? Routes.send : null,
arguments: PaymentRequest.fromUri(launchUri),
);
launchUri = null;
@@ -152,7 +152,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
} else {
_reset();
auth.close(
route: launchUri != null ? Routes.send : null,
route: _isValidPaymentUri() ? Routes.send : null,
arguments: PaymentRequest.fromUri(launchUri),
);
launchUri = null;
@@ -161,7 +161,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
},
);
});
} else if (launchUri != null) {
} else if (_isValidPaymentUri()) {
widget.navigatorKey.currentState?.pushNamed(
Routes.send,
arguments: PaymentRequest.fromUri(launchUri),
@@ -183,4 +183,6 @@ class RootState extends State<Root> with WidgetsBindingObserver {
_isInactive = value;
_isInactiveController.add(value);
}
bool _isValidPaymentUri() => launchUri?.path.isNotEmpty ?? false;
}
+1 -1
View File
@@ -100,7 +100,7 @@ class SendPage extends BasePage {
AppBarStyle get appBarStyle => AppBarStyle.transparent;
double _sendCardHeight(BuildContext context) {
final double initialHeight = sendViewModel.hasCoinControl ? 490 : 465;
final double initialHeight = sendViewModel.hasCoinControl ? 500 : 465;
if (!ResponsiveLayoutUtil.instance.isMobile) {
return initialHeight - 66;
@@ -34,13 +34,12 @@ class ManageNodesPage extends BasePage {
SizedBox(height: 20),
Observer(
builder: (BuildContext context) {
int itemsCount = nodeListViewModel.nodes.length;
return Flexible(
child: SectionStandardList(
sectionCount: 1,
dividerPadding: EdgeInsets.symmetric(horizontal: 24),
itemCounter: (int sectionIndex) {
return nodeListViewModel.nodes.length;
},
itemCounter: (int sectionIndex) => itemsCount,
itemBuilder: (_, index) {
return Observer(
builder: (context) {
+12
View File
@@ -32,6 +32,14 @@ class ExceptionHandler {
const String separator = '''\n\n==========================================================
==========================================================\n\n''';
/// don't save existing errors
if (file.existsSync()) {
final String fileContent = await file.readAsString();
if (fileContent.contains("${exception.values.first}")) {
return;
}
}
file.writeAsStringSync(
"$exception $separator",
mode: FileMode.append,
@@ -83,6 +91,10 @@ class ExceptionHandler {
library: errorDetails.library,
);
if (errorDetails.silent) {
return;
}
final sharedPrefs = await SharedPreferences.getInstance();
final lastPopupDate =
@@ -93,7 +93,11 @@ abstract class AnonInvoicePageViewModelBase with Store {
Future<void> createInvoice() async {
state = IsExecutingState();
if (amount.isNotEmpty) {
final amountInCrypto = double.parse(amount);
final amountInCrypto = double.tryParse(amount);
if (amountInCrypto == null) {
state = FailureState('Amount is invalid');
return;
}
if (minimum != null && amountInCrypto < minimum!) {
state = FailureState('Amount is too small');
return;
@@ -225,7 +225,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
@computed
List<WalletContact> get walletContactsToShow => contactListViewModel.walletContacts
.where((element) => receiveCurrency == null || element.type == receiveCurrency)
.where((element) => element.type == receiveCurrency)
.toList();
@action
@@ -550,6 +550,9 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
amount = amount.replaceAll(',', '.');
if (limitsState is LimitsLoadedSuccessfully) {
if (double.tryParse(amount) == null) {
continue;
}
if (limits.max != null && double.parse(amount) < limits.min!) {
continue;
} else if (limits.max != null && double.parse(amount) > limits.max!) {