mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
V4.26.0 rc (#2198)
* v4.26.0 Release Candidate * Fix Wownero Creation issue * Add KES fiat currency * Adjust backup to default node selection if null Gracefully handle Decred failure Minor fixes
This commit is contained in:
parent
f574fa5e9b
commit
ca564bc2e6
8 changed files with 76 additions and 49 deletions
|
@ -222,7 +222,7 @@ abstract class DecredWalletBase
|
|||
|
||||
Future<bool> checkSync() async {
|
||||
final syncStatusJSON = await _libwallet.syncStatus(walletInfo.name);
|
||||
final decoded = json.decode(syncStatusJSON);
|
||||
final decoded = json.decode(syncStatusJSON.isEmpty ? "{}" : syncStatusJSON);
|
||||
|
||||
final syncStatusCode = decoded["syncstatuscode"] ?? 0;
|
||||
// final syncStatusStr = decoded["syncstatus"] ?? "";
|
||||
|
|
9
lib/core/utilities.dart
Normal file
9
lib/core/utilities.dart
Normal file
|
@ -0,0 +1,9 @@
|
|||
extension EnhancedList<T> on Iterable<T> {
|
||||
T? firstWhereOrNull(bool Function(T element) test) {
|
||||
try {
|
||||
return firstWhere(test);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,10 +3,9 @@ import 'package:cake_wallet/core/execution_state.dart';
|
|||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/trail_button.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/utils/clipboard_util.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cake_wallet/utils/share_util.dart';
|
||||
|
@ -76,7 +75,9 @@ class BackupPage extends BasePage {
|
|||
Navigator.of(context).pushNamed(Routes.editBackupPassword),
|
||||
text: S.of(context).change_password,
|
||||
color: Theme.of(context).cardColor,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context)
|
||||
.extension<CakeTextTheme>()!
|
||||
.buttonTextColor,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Observer(
|
||||
|
|
|
@ -104,7 +104,7 @@ class LoadingPrimaryButton extends StatelessWidget {
|
|||
),
|
||||
)),
|
||||
child: isLoading
|
||||
? CupertinoActivityIndicator(animating: true)
|
||||
? CupertinoActivityIndicator(animating: true, color: textColor)
|
||||
: Text(text,
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/core/utilities.dart';
|
||||
import 'package:cake_wallet/decred/decred.dart';
|
||||
import 'package:cake_wallet/bitcoin_cash/bitcoin_cash.dart';
|
||||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
|
@ -12,13 +13,13 @@ import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
|
|||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
import 'package:cake_wallet/entities/cake_2fa_preset_options.dart';
|
||||
import 'package:cake_wallet/entities/country.dart';
|
||||
import 'package:cake_wallet/entities/default_settings_migration.dart';
|
||||
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/entities/language_service.dart';
|
||||
import 'package:cake_wallet/entities/pin_code_required_duration.dart';
|
||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||
import 'package:cake_wallet/entities/provider_types.dart';
|
||||
import 'package:cake_wallet/entities/secret_store_key.dart';
|
||||
import 'package:cake_wallet/entities/seed_phrase_length.dart';
|
||||
import 'package:cake_wallet/entities/seed_type.dart';
|
||||
|
@ -37,11 +38,8 @@ import 'package:cake_wallet/themes/theme_list.dart';
|
|||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/package_info.dart';
|
||||
import 'package:cake_wallet/view_model/settings/sync_mode.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
import 'package:cake_wallet/wownero/wownero.dart';
|
||||
import 'package:cw_core/node.dart';
|
||||
import 'package:cw_core/set_app_secure_native.dart';
|
||||
import 'package:cw_core/transaction_priority.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
@ -1038,7 +1036,6 @@ abstract class SettingsStoreBase with Store {
|
|||
sharedPreferences.getInt(PreferencesKey.currentLitecoinElectrumSererIdKey);
|
||||
final bitcoinCashElectrumServerId =
|
||||
sharedPreferences.getInt(PreferencesKey.currentBitcoinCashNodeIdKey);
|
||||
final havenNodeId = sharedPreferences.getInt(PreferencesKey.currentHavenNodeIdKey);
|
||||
final ethereumNodeId = sharedPreferences.getInt(PreferencesKey.currentEthereumNodeIdKey);
|
||||
final polygonNodeId = sharedPreferences.getInt(PreferencesKey.currentPolygonNodeIdKey);
|
||||
final nanoNodeId = sharedPreferences.getInt(PreferencesKey.currentNanoNodeIdKey);
|
||||
|
@ -1048,20 +1045,35 @@ abstract class SettingsStoreBase with Store {
|
|||
final wowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey);
|
||||
final zanoNodeId = sharedPreferences.getInt(PreferencesKey.currentZanoNodeIdKey);
|
||||
final decredNodeId = sharedPreferences.getInt(PreferencesKey.currentDecredNodeIdKey);
|
||||
final moneroNode = nodeSource.get(nodeId);
|
||||
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId);
|
||||
final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId);
|
||||
final havenNode = nodeSource.get(havenNodeId);
|
||||
final ethereumNode = nodeSource.get(ethereumNodeId);
|
||||
final polygonNode = nodeSource.get(polygonNodeId);
|
||||
final bitcoinCashElectrumServer = nodeSource.get(bitcoinCashElectrumServerId);
|
||||
final nanoNode = nodeSource.get(nanoNodeId);
|
||||
final decredNode = nodeSource.get(decredNodeId);
|
||||
final nanoPowNode = powNodeSource.get(nanoPowNodeId);
|
||||
final solanaNode = nodeSource.get(solanaNodeId);
|
||||
final tronNode = nodeSource.get(tronNodeId);
|
||||
final wowneroNode = nodeSource.get(wowneroNodeId);
|
||||
final zanoNode = nodeSource.get(zanoNodeId);
|
||||
|
||||
/// get the selected node, if null, then use the default
|
||||
final moneroNode = nodeSource.get(nodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == newCakeWalletMoneroUri);
|
||||
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == newCakeWalletBitcoinUri);
|
||||
final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == cakeWalletLitecoinElectrumUri);
|
||||
final ethereumNode = nodeSource.get(ethereumNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == ethereumDefaultNodeUri);
|
||||
final polygonNode = nodeSource.get(polygonNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == polygonDefaultNodeUri);
|
||||
final bitcoinCashElectrumServer = nodeSource.get(bitcoinCashElectrumServerId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == cakeWalletBitcoinCashDefaultNodeUri);
|
||||
final nanoNode = nodeSource.get(nanoNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == nanoDefaultNodeUri);
|
||||
final decredNode = nodeSource.get(decredNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == decredDefaultUri);
|
||||
final nanoPowNode = powNodeSource.get(nanoPowNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == nanoDefaultPowNodeUri);
|
||||
final solanaNode = nodeSource.get(solanaNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == solanaDefaultNodeUri);
|
||||
final tronNode = nodeSource.get(tronNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == tronDefaultNodeUri);
|
||||
final wowneroNode = nodeSource.get(wowneroNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == wowneroDefaultNodeUri);
|
||||
final zanoNode = nodeSource.get(zanoNodeId) ??
|
||||
nodeSource.values.firstWhereOrNull((e) => e.uriRaw == zanoDefaultNodeUri);
|
||||
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
final deviceName = await _getDeviceName() ?? '';
|
||||
final shouldShowYatPopup = sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true;
|
||||
|
@ -1107,10 +1119,6 @@ abstract class SettingsStoreBase with Store {
|
|||
nodes[WalletType.litecoin] = litecoinElectrumServer;
|
||||
}
|
||||
|
||||
if (havenNode != null) {
|
||||
nodes[WalletType.haven] = havenNode;
|
||||
}
|
||||
|
||||
if (ethereumNode != null) {
|
||||
nodes[WalletType.ethereum] = ethereumNode;
|
||||
}
|
||||
|
|
|
@ -107,20 +107,24 @@ abstract class AnonInvoicePageViewModelBase with Store {
|
|||
return;
|
||||
}
|
||||
}
|
||||
final result = await anonPayApi.createInvoice(AnonPayRequest(
|
||||
cryptoCurrency: cryptoCurrency,
|
||||
address: address,
|
||||
amount: amount.isEmpty ? null : amount,
|
||||
description: description,
|
||||
email: receipientEmail,
|
||||
name: receipientName,
|
||||
fiatEquivalent:
|
||||
selectedCurrency is FiatCurrency ? (selectedCurrency as FiatCurrency).raw : null,
|
||||
));
|
||||
try {
|
||||
final result = await anonPayApi.createInvoice(AnonPayRequest(
|
||||
cryptoCurrency: cryptoCurrency,
|
||||
address: address,
|
||||
amount: amount.isEmpty ? null : amount,
|
||||
description: description,
|
||||
email: receipientEmail,
|
||||
name: receipientName,
|
||||
fiatEquivalent:
|
||||
selectedCurrency is FiatCurrency ? (selectedCurrency as FiatCurrency).raw : null,
|
||||
));
|
||||
|
||||
_anonpayInvoiceInfoSource.add(result);
|
||||
_anonpayInvoiceInfoSource.add(result);
|
||||
|
||||
state = ExecutedSuccessfullyState(payload: result);
|
||||
state = ExecutedSuccessfullyState(payload: result);
|
||||
} catch (e) {
|
||||
state = FailureState(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
|
@ -156,12 +160,16 @@ abstract class AnonInvoicePageViewModelBase with Store {
|
|||
}
|
||||
|
||||
Future<void> _fetchLimits() async {
|
||||
final limit = await anonPayApi.fetchLimits(
|
||||
cryptoCurrency: cryptoCurrency,
|
||||
fiatCurrency: selectedCurrency is FiatCurrency ? selectedCurrency as FiatCurrency : null,
|
||||
);
|
||||
minimum = limit.min;
|
||||
maximum = limit.max != null ? limit.max! / 4 : null;
|
||||
try {
|
||||
final limit = await anonPayApi.fetchLimits(
|
||||
cryptoCurrency: cryptoCurrency,
|
||||
fiatCurrency: selectedCurrency is FiatCurrency ? selectedCurrency as FiatCurrency : null,
|
||||
);
|
||||
minimum = limit.min;
|
||||
maximum = limit.max != null ? limit.max! / 4 : null;
|
||||
} catch (e) {
|
||||
state = FailureState(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@computed
|
||||
|
|
|
@ -137,7 +137,9 @@ abstract class LedgerViewModelBase with Store {
|
|||
allowChangeWallet: true,
|
||||
isReconnect: true,
|
||||
onConnectDevice: (context, ledgerVM) async {
|
||||
Navigator.of(context).pop();
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -216,7 +216,6 @@ abstract class WalletListViewModelBase with Store {
|
|||
await sortGroupByType();
|
||||
break;
|
||||
case FilterListOrderType.Custom:
|
||||
default:
|
||||
await reorderAccordingToWalletList();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue