mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
Generic fixes (#1716)
* reset brightness after using * set default qr to auto detect * minor safety enhancement * close socket after checking connectivity * fix incorrect parent exception class * pump medium and fast priorities even if they are equal to slow * Add Ton to exchange * fix silent payments add Seth bitcoin node * deselect quantex add seth node for existing users * fix node uri
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io' show Directory, File, Platform;
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/core/secure_storage.dart';
|
||||
@@ -234,7 +235,8 @@ Future<void> defaultSettingsMigration(
|
||||
break;
|
||||
case 36:
|
||||
await addWowneroNodeList(nodes: nodes);
|
||||
await changeWowneroCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
||||
await changeWowneroCurrentNodeToDefault(
|
||||
sharedPreferences: sharedPreferences, nodes: nodes);
|
||||
break;
|
||||
case 37:
|
||||
await replaceTronDefaultNode(sharedPreferences: sharedPreferences, nodes: nodes);
|
||||
@@ -249,6 +251,10 @@ Future<void> defaultSettingsMigration(
|
||||
case 40:
|
||||
await removeMoneroWorld(sharedPreferences: sharedPreferences, nodes: nodes);
|
||||
break;
|
||||
case 41:
|
||||
_deselectQuantex(sharedPreferences);
|
||||
await _addSethNode(nodes, sharedPreferences);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -263,6 +269,19 @@ Future<void> defaultSettingsMigration(
|
||||
await sharedPreferences.setInt(PreferencesKey.currentDefaultSettingsMigrationVersion, version);
|
||||
}
|
||||
|
||||
void _deselectQuantex(SharedPreferences sharedPreferences) {
|
||||
final Map<String, dynamic> exchangeProvidersSelection =
|
||||
json.decode(sharedPreferences.getString(PreferencesKey.exchangeProvidersSelection) ?? "{}")
|
||||
as Map<String, dynamic>;
|
||||
|
||||
exchangeProvidersSelection['Quantex'] = false;
|
||||
|
||||
sharedPreferences.setString(
|
||||
PreferencesKey.exchangeProvidersSelection,
|
||||
json.encode(exchangeProvidersSelection),
|
||||
);
|
||||
}
|
||||
|
||||
void _fixNodesUseSSLFlag(Box<Node> nodes) {
|
||||
for (Node node in nodes.values) {
|
||||
switch (node.uriRaw) {
|
||||
@@ -887,7 +906,30 @@ Future<void> changeDefaultBitcoinNode(
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _addSethNode(Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
||||
_addBitcoinNode(
|
||||
nodeSource: nodeSource,
|
||||
sharedPreferences: sharedPreferences,
|
||||
nodeUri: "fulcrum.sethforprivacy.com:50002",
|
||||
useSSL: false,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _addElectRsNode(Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
||||
_addBitcoinNode(
|
||||
nodeSource: nodeSource,
|
||||
sharedPreferences: sharedPreferences,
|
||||
nodeUri: cakeWalletSilentPaymentsElectrsUri,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _addBitcoinNode({
|
||||
required Box<Node> nodeSource,
|
||||
required SharedPreferences sharedPreferences,
|
||||
required String nodeUri,
|
||||
bool replaceExisting = false,
|
||||
bool useSSL = false,
|
||||
}) async {
|
||||
const cakeWalletBitcoinNodeUriPattern = '.cakewallet.com';
|
||||
final currentBitcoinNodeId =
|
||||
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
|
||||
@@ -896,12 +938,11 @@ Future<void> _addElectRsNode(Box<Node> nodeSource, SharedPreferences sharedPrefe
|
||||
final needToReplaceCurrentBitcoinNode =
|
||||
currentBitcoinNode.uri.toString().contains(cakeWalletBitcoinNodeUriPattern);
|
||||
|
||||
final newElectRsBitcoinNode =
|
||||
Node(uri: cakeWalletSilentPaymentsElectrsUri, type: WalletType.bitcoin, useSSL: false);
|
||||
final newElectRsBitcoinNode = Node(uri: nodeUri, type: WalletType.bitcoin, useSSL: useSSL);
|
||||
|
||||
await nodeSource.add(newElectRsBitcoinNode);
|
||||
|
||||
if (needToReplaceCurrentBitcoinNode) {
|
||||
if (needToReplaceCurrentBitcoinNode && replaceExisting) {
|
||||
await sharedPreferences.setInt(
|
||||
PreferencesKey.currentBitcoinElectrumSererIdKey, newElectRsBitcoinNode.key as int);
|
||||
}
|
||||
@@ -1262,7 +1303,8 @@ Future<void> removeMoneroWorld(
|
||||
const cakeWalletMoneroNodeUriPattern = '.moneroworld.com';
|
||||
final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
|
||||
final currentMoneroNode = nodes.values.firstWhere((node) => node.key == currentMoneroNodeId);
|
||||
final needToReplaceCurrentMoneroNode = currentMoneroNode.uri.toString().contains(cakeWalletMoneroNodeUriPattern);
|
||||
final needToReplaceCurrentMoneroNode =
|
||||
currentMoneroNode.uri.toString().contains(cakeWalletMoneroNodeUriPattern);
|
||||
|
||||
nodes.values.forEach((node) async {
|
||||
if (node.type == WalletType.monero &&
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ Future<void> initializeAppConfigs() async {
|
||||
transactionDescriptions: transactionDescriptions,
|
||||
secureStorage: secureStorage,
|
||||
anonpayInvoiceInfo: anonpayInvoiceInfo,
|
||||
initialMigrationVersion: 40,
|
||||
initialMigrationVersion: 41,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ Timer? _checkConnectionTimer;
|
||||
void startCheckConnectionReaction(WalletBase wallet, SettingsStore settingsStore,
|
||||
{int timeInterval = 5}) {
|
||||
_checkConnectionTimer?.cancel();
|
||||
// TODO: check the validity of this code, and if it's working fine, then no need for
|
||||
// having the connect function in electrum.dart when the syncstatus is lost or failed and add the not connected state
|
||||
_checkConnectionTimer = Timer.periodic(Duration(seconds: timeInterval), (_) async {
|
||||
if (wallet.type == WalletType.bitcoin && wallet.syncStatus is SyncingSyncStatus) {
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,7 @@ class QrImage extends StatelessWidget {
|
||||
return qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? 9, // Previous value: 7 something happened after flutter upgrade monero wallets addresses are longer than ver. 7 ???
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: size,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
|
||||
@@ -9,15 +9,12 @@ class BrightnessUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current brightness:
|
||||
final brightness = await DeviceDisplayBrightness.getBrightness();
|
||||
|
||||
// ignore: unawaited_futures
|
||||
DeviceDisplayBrightness.setBrightness(1.0);
|
||||
|
||||
await func();
|
||||
|
||||
// ignore: unawaited_futures
|
||||
DeviceDisplayBrightness.setBrightness(brightness);
|
||||
DeviceDisplayBrightness.resetBrightness();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user