mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 10:45:08 +00:00
onionOnly updates
This commit is contained in:
parent
c8dcf49503
commit
e6fa2a58db
11 changed files with 132 additions and 114 deletions
|
@ -137,6 +137,7 @@ class AnonPayApi {
|
||||||
crypto: cryptoCurrency,
|
crypto: cryptoCurrency,
|
||||||
fiat: fiatCurrency,
|
fiat: fiatCurrency,
|
||||||
torOnly: useTorOnly,
|
torOnly: useTorOnly,
|
||||||
|
onionOnly: false,// TODO: CW-519
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ Future<double> _fetchPrice(Map<String, dynamic> args) async {
|
||||||
final crypto = args['crypto'] as String;
|
final crypto = args['crypto'] as String;
|
||||||
final fiat = args['fiat'] as String;
|
final fiat = args['fiat'] as String;
|
||||||
final torOnly = args['torOnly'] as bool;
|
final torOnly = args['torOnly'] as bool;
|
||||||
|
final onionOnly = args['onionOnly'] as bool;
|
||||||
final mainThreadProxyPort = args['port'] as int;
|
final mainThreadProxyPort = args['port'] as int;
|
||||||
|
|
||||||
final Map<String, String> queryParams = {
|
final Map<String, String> queryParams = {
|
||||||
|
@ -42,25 +43,31 @@ Future<double> _fetchPrice(Map<String, dynamic> args) async {
|
||||||
|
|
||||||
// we might have tor enabled (no way of knowing), so we try to use it first
|
// we might have tor enabled (no way of knowing), so we try to use it first
|
||||||
try {
|
try {
|
||||||
|
// connect through onion url first:
|
||||||
try {
|
try {
|
||||||
final request = await client.getUrl(onionUri);
|
final request = await client.getUrl(onionUri);
|
||||||
httpResponse = await request.close();
|
httpResponse = await request.close();
|
||||||
responseBody = await utf8.decodeStream(httpResponse);
|
responseBody = await utf8.decodeStream(httpResponse);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// if the onion url fails, and not set to tor only, try the clearnet url, (still using tor!):
|
// if the onion url fails, try the clearnet url, (still using tor!):
|
||||||
if (!torOnly) {
|
// only do this if we are not onionOnly, otherwise we will fail
|
||||||
|
if (!onionOnly) {
|
||||||
final request = await client.getUrl(clearnetUri);
|
final request = await client.getUrl(clearnetUri);
|
||||||
httpResponse = await request.close();
|
httpResponse = await request.close();
|
||||||
responseBody = await utf8.decodeStream(httpResponse);
|
responseBody = await utf8.decodeStream(httpResponse);
|
||||||
|
} else {
|
||||||
|
// we failed to connect through onionOnly
|
||||||
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statusCode = httpResponse.statusCode;
|
statusCode = httpResponse.statusCode;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// connections all failed / tor is not enabled, so we use the clearnet url directly as normal:
|
|
||||||
if (torOnly) {
|
if (torOnly) {
|
||||||
// we failed to connect through tor
|
// we failed to connect through torOnly
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// connections all failed / tor is not enabled, so we use the clearnet url directly as normal:
|
||||||
final response = await get(clearnetUri);
|
final response = await get(clearnetUri);
|
||||||
responseBody = response.body;
|
responseBody = response.body;
|
||||||
statusCode = response.statusCode;
|
statusCode = response.statusCode;
|
||||||
|
@ -83,12 +90,12 @@ Future<double> _fetchPrice(Map<String, dynamic> args) async {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<double> _fetchPriceAsync(
|
Future<double> _fetchPriceAsync(CryptoCurrency crypto, FiatCurrency fiat, bool torOnly, bool onionOnly) async =>
|
||||||
CryptoCurrency crypto, FiatCurrency fiat, bool torOnly) async =>
|
|
||||||
compute(_fetchPrice, {
|
compute(_fetchPrice, {
|
||||||
'fiat': fiat.toString(),
|
'fiat': fiat.toString(),
|
||||||
'crypto': crypto.toString(),
|
'crypto': crypto.toString(),
|
||||||
'torOnly': torOnly,
|
'torOnly': torOnly,
|
||||||
|
'onionOnly': onionOnly,
|
||||||
'port': ProxyWrapper.port,
|
'port': ProxyWrapper.port,
|
||||||
'torEnabled': ProxyWrapper.enabled,
|
'torEnabled': ProxyWrapper.enabled,
|
||||||
});
|
});
|
||||||
|
@ -98,6 +105,7 @@ class FiatConversionService {
|
||||||
required CryptoCurrency crypto,
|
required CryptoCurrency crypto,
|
||||||
required FiatCurrency fiat,
|
required FiatCurrency fiat,
|
||||||
required bool torOnly,
|
required bool torOnly,
|
||||||
|
required bool onionOnly,
|
||||||
}) async =>
|
}) async =>
|
||||||
await _fetchPriceAsync(crypto, fiat, torOnly);
|
await _fetchPriceAsync(crypto, fiat, torOnly, onionOnly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:cake_wallet/polygon/polygon.dart';
|
||||||
import 'package:cake_wallet/store/app_store.dart';
|
import 'package:cake_wallet/store/app_store.dart';
|
||||||
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||||
import 'package:cw_core/erc20_token.dart';
|
import 'package:cw_core/erc20_token.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
|
@ -33,6 +34,7 @@ Future<void> startFiatRateUpdate(
|
||||||
crypto: appStore.wallet!.currency,
|
crypto: appStore.wallet!.currency,
|
||||||
fiat: settingsStore.fiatCurrency,
|
fiat: settingsStore.fiatCurrency,
|
||||||
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ Future<void> startFiatRateUpdate(
|
||||||
crypto: currency,
|
crypto: currency,
|
||||||
fiat: settingsStore.fiatCurrency,
|
fiat: settingsStore.fiatCurrency,
|
||||||
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
);
|
);
|
||||||
}.call();
|
}.call();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||||
|
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/core/fiat_conversion_service.dart';
|
import 'package:cake_wallet/core/fiat_conversion_service.dart';
|
||||||
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||||
|
@ -7,19 +8,20 @@ import 'package:cake_wallet/store/app_store.dart';
|
||||||
|
|
||||||
ReactionDisposer? _onCurrentFiatCurrencyChangeDisposer;
|
ReactionDisposer? _onCurrentFiatCurrencyChangeDisposer;
|
||||||
|
|
||||||
void startCurrentFiatApiModeChangeReaction(AppStore appStore,
|
void startCurrentFiatApiModeChangeReaction(
|
||||||
SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
AppStore appStore, SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
||||||
_onCurrentFiatCurrencyChangeDisposer?.reaction.dispose();
|
_onCurrentFiatCurrencyChangeDisposer?.reaction.dispose();
|
||||||
_onCurrentFiatCurrencyChangeDisposer = reaction(
|
_onCurrentFiatCurrencyChangeDisposer =
|
||||||
(_) => settingsStore.fiatApiMode, (FiatApiMode fiatApiMode) async {
|
reaction((_) => settingsStore.fiatApiMode, (FiatApiMode fiatApiMode) async {
|
||||||
if (appStore.wallet == null || fiatApiMode == FiatApiMode.disabled) {
|
if (appStore.wallet == null || fiatApiMode == FiatApiMode.disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fiatConversionStore.prices[appStore.wallet!.currency] =
|
fiatConversionStore.prices[appStore.wallet!.currency] = await FiatConversionService.fetchPrice(
|
||||||
await FiatConversionService.fetchPrice(
|
|
||||||
crypto: appStore.wallet!.currency,
|
crypto: appStore.wallet!.currency,
|
||||||
fiat: settingsStore.fiatCurrency,
|
fiat: settingsStore.fiatCurrency,
|
||||||
torOnly: fiatApiMode == FiatApiMode.torOnly);
|
torOnly: fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||||
|
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/core/fiat_conversion_service.dart';
|
import 'package:cake_wallet/core/fiat_conversion_service.dart';
|
||||||
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
||||||
|
@ -8,20 +9,21 @@ import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||||
|
|
||||||
ReactionDisposer? _onCurrentFiatCurrencyChangeDisposer;
|
ReactionDisposer? _onCurrentFiatCurrencyChangeDisposer;
|
||||||
|
|
||||||
void startCurrentFiatChangeReaction(AppStore appStore,
|
void startCurrentFiatChangeReaction(
|
||||||
SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
AppStore appStore, SettingsStore settingsStore, FiatConversionStore fiatConversionStore) {
|
||||||
_onCurrentFiatCurrencyChangeDisposer?.reaction.dispose();
|
_onCurrentFiatCurrencyChangeDisposer?.reaction.dispose();
|
||||||
_onCurrentFiatCurrencyChangeDisposer = reaction(
|
_onCurrentFiatCurrencyChangeDisposer =
|
||||||
(_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
reaction((_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
||||||
if (appStore.wallet == null || settingsStore.fiatApiMode == FiatApiMode.disabled) {
|
if (appStore.wallet == null || settingsStore.fiatApiMode == FiatApiMode.disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final cryptoCurrency = appStore.wallet!.currency;
|
final cryptoCurrency = appStore.wallet!.currency;
|
||||||
fiatConversionStore.prices[cryptoCurrency] =
|
fiatConversionStore.prices[cryptoCurrency] = await FiatConversionService.fetchPrice(
|
||||||
await FiatConversionService.fetchPrice(
|
|
||||||
crypto: cryptoCurrency,
|
crypto: cryptoCurrency,
|
||||||
fiat: fiatCurrency,
|
fiat: fiatCurrency,
|
||||||
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly);
|
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||||
import 'package:cake_wallet/entities/update_haven_rate.dart';
|
import 'package:cake_wallet/entities/update_haven_rate.dart';
|
||||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||||
import 'package:cake_wallet/polygon/polygon.dart';
|
import 'package:cake_wallet/polygon/polygon.dart';
|
||||||
|
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||||
import 'package:cw_core/erc20_token.dart';
|
import 'package:cw_core/erc20_token.dart';
|
||||||
import 'package:cw_core/transaction_history.dart';
|
import 'package:cw_core/transaction_history.dart';
|
||||||
import 'package:cw_core/balance.dart';
|
import 'package:cw_core/balance.dart';
|
||||||
|
@ -94,7 +95,9 @@ void startCurrentWalletChangeReaction(
|
||||||
fiatConversionStore.prices[wallet.currency] = await FiatConversionService.fetchPrice(
|
fiatConversionStore.prices[wallet.currency] = await FiatConversionService.fetchPrice(
|
||||||
crypto: wallet.currency,
|
crypto: wallet.currency,
|
||||||
fiat: settingsStore.fiatCurrency,
|
fiat: settingsStore.fiatCurrency,
|
||||||
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly);
|
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
|
);
|
||||||
|
|
||||||
Iterable<Erc20Token>? currencies;
|
Iterable<Erc20Token>? currencies;
|
||||||
if (wallet.type == WalletType.ethereum) {
|
if (wallet.type == WalletType.ethereum) {
|
||||||
|
@ -111,7 +114,9 @@ void startCurrentWalletChangeReaction(
|
||||||
fiatConversionStore.prices[currency] = await FiatConversionService.fetchPrice(
|
fiatConversionStore.prices[currency] = await FiatConversionService.fetchPrice(
|
||||||
crypto: currency,
|
crypto: currency,
|
||||||
fiat: settingsStore.fiatCurrency,
|
fiat: settingsStore.fiatCurrency,
|
||||||
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly);
|
torOnly: settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
|
);
|
||||||
}.call();
|
}.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,8 @@ class NodeForm extends StatelessWidget {
|
||||||
_portController.addListener(() => nodeViewModel.port = _portController.text);
|
_portController.addListener(() => nodeViewModel.port = _portController.text);
|
||||||
_loginController.addListener(() => nodeViewModel.login = _loginController.text);
|
_loginController.addListener(() => nodeViewModel.login = _loginController.text);
|
||||||
_passwordController.addListener(() => nodeViewModel.password = _passwordController.text);
|
_passwordController.addListener(() => nodeViewModel.password = _passwordController.text);
|
||||||
_socksAddressController.addListener(() => nodeViewModel.socksProxyAddress = _socksAddressController.text);
|
_socksAddressController
|
||||||
|
.addListener(() => nodeViewModel.socksProxyAddress = _socksAddressController.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
final NodeCreateOrEditViewModel nodeViewModel;
|
final NodeCreateOrEditViewModel nodeViewModel;
|
||||||
|
@ -103,6 +104,26 @@ class NodeForm extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 20),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Observer(
|
||||||
|
builder: (_) => StandardCheckbox(
|
||||||
|
value: nodeViewModel.useSSL,
|
||||||
|
gradientBackground: true,
|
||||||
|
borderColor: Theme.of(context).dividerColor,
|
||||||
|
iconColor: Colors.white,
|
||||||
|
onChanged: (value) => nodeViewModel.useSSL = value,
|
||||||
|
caption: S.of(context).use_ssl,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.0),
|
||||||
if (nodeViewModel.hasAuthCredentials) ...[
|
if (nodeViewModel.hasAuthCredentials) ...[
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -123,25 +144,6 @@ class NodeForm extends StatelessWidget {
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 20),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Observer(
|
|
||||||
builder: (_) => StandardCheckbox(
|
|
||||||
value: nodeViewModel.useSSL,
|
|
||||||
gradientBackground: true,
|
|
||||||
borderColor: Theme.of(context).dividerColor,
|
|
||||||
iconColor: Colors.white,
|
|
||||||
onChanged: (value) => nodeViewModel.useSSL = value,
|
|
||||||
caption: S.of(context).use_ssl,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 20),
|
padding: EdgeInsets.only(top: 20),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|
|
@ -3,9 +3,10 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
|
|
||||||
class NodeIndicator extends StatelessWidget {
|
class NodeIndicator extends StatelessWidget {
|
||||||
NodeIndicator({this.isLive = false});
|
NodeIndicator({this.isLive = false, this.showText = false});
|
||||||
|
|
||||||
final bool isLive;
|
final bool isLive;
|
||||||
|
final bool showText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -17,12 +18,14 @@ class NodeIndicator extends StatelessWidget {
|
||||||
decoration:
|
decoration:
|
||||||
BoxDecoration(shape: BoxShape.circle, color: isLive ? Palette.green : Palette.red),
|
BoxDecoration(shape: BoxShape.circle, color: isLive ? Palette.green : Palette.red),
|
||||||
),
|
),
|
||||||
|
if (showText) ...[
|
||||||
const SizedBox(width: 8.0),
|
const SizedBox(width: 8.0),
|
||||||
Text(
|
Text(
|
||||||
isLive ? S.current.connected : S.current.disconnected,
|
isLive ? S.current.connected : S.current.disconnected,
|
||||||
style: TextStyle(fontSize: 14.0),
|
style: TextStyle(fontSize: 14.0),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ class ConnectionSyncPage extends BasePage {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
TorListRow(
|
TorStatus(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(25), bottomRight: Radius.circular(25)),
|
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(25), bottomRight: Radius.circular(25)),
|
||||||
color: const Color.fromARGB(255, 236, 244, 255),
|
color: const Color.fromARGB(255, 236, 244, 255),
|
||||||
|
|
|
@ -1,34 +1,23 @@
|
||||||
import 'package:cake_wallet/routes.dart';
|
|
||||||
import 'package:cake_wallet/src/screens/nodes/widgets/node_indicator.dart';
|
import 'package:cake_wallet/src/screens/nodes/widgets/node_indicator.dart';
|
||||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
|
|
||||||
import 'package:cw_core/node.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
||||||
import 'package:tor/tor.dart';
|
import 'package:tor/tor.dart';
|
||||||
|
|
||||||
class TorListRow extends StandardListRow {
|
class TorStatus extends StandardListRow {
|
||||||
TorListRow(
|
TorStatus(
|
||||||
{required String title,
|
{required String title,
|
||||||
required void Function(BuildContext context) onTap,
|
required void Function(BuildContext context) onTap,
|
||||||
required bool isSelected,
|
required bool isSelected,
|
||||||
BoxDecoration? decoration})
|
BoxDecoration? decoration})
|
||||||
: super(title: title, onTap: onTap, isSelected: isSelected, decoration: decoration);
|
: super(title: title, onTap: onTap, isSelected: isSelected, decoration: decoration);
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget buildTrailing(BuildContext context) {
|
Widget buildTrailing(BuildContext context) {
|
||||||
// return FutureBuilder(
|
return NodeIndicator(
|
||||||
// future: node.requestNode(),
|
isLive: Tor.instance.started && Tor.instance.enabled,
|
||||||
// builder: (context, snapshot) {
|
showText: true,
|
||||||
// switch (snapshot.connectionState) {
|
);
|
||||||
// case ConnectionState.done:
|
|
||||||
// return NodeIndicator(isLive: (snapshot.data as bool?) ?? false);
|
|
||||||
// default:
|
|
||||||
// return NodeIndicator(isLive: false);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
return NodeIndicator(isLive: Tor.instance.started);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
// @override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||||
import 'package:cake_wallet/polygon/polygon.dart';
|
import 'package:cake_wallet/polygon/polygon.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
||||||
|
import 'package:cake_wallet/view_model/settings/tor_connection.dart';
|
||||||
import 'package:cw_core/crypto_currency.dart';
|
import 'package:cw_core/crypto_currency.dart';
|
||||||
import 'package:cw_core/erc20_token.dart';
|
import 'package:cw_core/erc20_token.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
|
@ -88,7 +89,9 @@ abstract class HomeSettingsViewModelBase with Store {
|
||||||
await FiatConversionService.fetchPrice(
|
await FiatConversionService.fetchPrice(
|
||||||
crypto: token,
|
crypto: token,
|
||||||
fiat: _settingsStore.fiatCurrency,
|
fiat: _settingsStore.fiatCurrency,
|
||||||
torOnly: _settingsStore.fiatApiMode == FiatApiMode.torOnly);
|
torOnly: _settingsStore.fiatApiMode == FiatApiMode.torOnly,
|
||||||
|
onionOnly: _settingsStore.currentTorConnection == TorConnectionType.onionOnly,
|
||||||
|
);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue