New versions (#1334)

* Enable Exolix
Improve service updates indicator
New versions

* Add exolix Api token to limits api

* Ignore reporting network issues

* Change default bitcoin node
This commit is contained in:
Omar Hatem
2024-03-18 17:45:11 +02:00
committed by GitHub
parent 50b5ebc622
commit 27347779fa
11 changed files with 59 additions and 23 deletions
@@ -35,6 +35,7 @@ const cakeWalletBitcoinCashDefaultNodeUri = 'bitcoincash.stackwallet.com:50002';
const nanoDefaultNodeUri = 'rpc.nano.to';
const nanoDefaultPowNodeUri = 'rpc.nano.to';
const solanaDefaultNodeUri = 'rpc.ankr.com';
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
Future<void> defaultSettingsMigration(
{required int version,
@@ -201,9 +202,15 @@ Future<void> defaultSettingsMigration(
await changeSolanaCurrentNodeToDefault(
sharedPreferences: sharedPreferences, nodes: nodes);
break;
case 28:
await _updateMoneroPriority(sharedPreferences);
break;
case 29:
await changeDefaultBitcoinNode(nodes, sharedPreferences);
break;
default:
break;
}
@@ -702,6 +709,26 @@ Future<void> changeDefaultMoneroNode(
}
}
Future<void> changeDefaultBitcoinNode(
Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
const cakeWalletBitcoinNodeUriPattern = '.cakewallet.com';
final currentBitcoinNodeId =
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
final currentBitcoinNode =
nodeSource.values.firstWhere((node) => node.key == currentBitcoinNodeId);
final needToReplaceCurrentBitcoinNode =
currentBitcoinNode.uri.toString().contains(cakeWalletBitcoinNodeUriPattern);
final newCakeWalletBitcoinNode = Node(uri: newCakeWalletBitcoinUri, type: WalletType.bitcoin);
await nodeSource.add(newCakeWalletBitcoinNode);
if (needToReplaceCurrentBitcoinNode) {
await sharedPreferences.setInt(
PreferencesKey.currentBitcoinElectrumSererIdKey, newCakeWalletBitcoinNode.key as int);
}
}
Future<void> checkCurrentNodes(
Box<Node> nodeSource, Box<Node> powNodeSource, SharedPreferences sharedPreferences) async {
final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
@@ -66,6 +66,7 @@ class ExolixExchangeProvider extends ExchangeProvider {
final params = <String, String>{
'rateType': _getRateType(isFixedRateMode),
'amount': '1',
'apiToken': apiKey,
};
if (isFixedRateMode) {
params['coinFrom'] = _normalizeCurrency(to);
+1 -1
View File
@@ -163,7 +163,7 @@ Future<void> initializeAppConfigs() async {
transactionDescriptions: transactionDescriptions,
secureStorage: secureStorage,
anonpayInvoiceInfo: anonpayInvoiceInfo,
initialMigrationVersion: 28);
initialMigrationVersion: 29);
}
Future<void> initialSetup(
+11 -2
View File
@@ -10,17 +10,24 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
class ServicesUpdatesWidget extends StatelessWidget {
class ServicesUpdatesWidget extends StatefulWidget {
final Future<ServicesResponse> servicesResponse;
const ServicesUpdatesWidget(this.servicesResponse, {super.key});
@override
State<ServicesUpdatesWidget> createState() => _ServicesUpdatesWidgetState();
}
class _ServicesUpdatesWidgetState extends State<ServicesUpdatesWidget> {
bool wasOpened = false;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: FutureBuilder<ServicesResponse>(
future: servicesResponse,
future: widget.servicesResponse,
builder: (context, state) {
return InkWell(
onTap: state.hasData
@@ -30,6 +37,8 @@ class ServicesUpdatesWidget extends StatelessWidget {
.get<SharedPreferences>()
.setString(PreferencesKey.serviceStatusShaKey, state.data!.currentSha);
setState(() => wasOpened = true);
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
+1 -1
View File
@@ -1,5 +1,5 @@
class FeatureFlag {
static const bool isCakePayEnabled = false;
static const bool isExolixEnabled = false;
static const bool isExolixEnabled = true;
static const bool isInAppTorEnabled = false;
}