tor ffi package optional import config
What changed, and why it matters
This commit makes the Tor privacy feature optional and configurable across the Stack Wallet app. It adds feature-gating so that Tor-related code, UI elements, and network routing are only active when the app configuration explicitly enables Tor. Most of the visible changes are formatting and minor refactorings; the substantive change is architectural, not a direct security fix.
Review the new `AppConfig` and `AppFeature.tor` definitions to ensure the feature flag cannot be toggled at runtime by a malicious or compromised component, and verify that builds intended to include Tor cannot accidentally ship with it disabled. No immediate patching is indicated by the diff alone.
Security signals we found
Feature-gating of Tor functionality via AppConfig/AppFeature
Conditional Tor proxy usage in HTTP clients
Removal/hiding of Tor UI when feature disabled
No direct vulnerability fix or memory-safety change visible
Evidence from the diff
The patch introduces AppConfig.hasFeature(AppFeature.tor) checks throughout the Dart codebase. When Tor is not configured, the app skips Tor initialization, hides Tor icons/settings, disables Tor proxying for HTTP requests, and removes the Fusion feature entry point. It also renames some Tor-related widgets to private names (e.g., TorButton → _TorButton) and applies extensive code formatting. There is no evidence of a vulnerability being patched; rather, this is a build-time feature toggle to support builds without the Tor FFI package.
Changed components
lib/main.dartlib/electrumx_rpc/electrumx_client.dartlib/services/tor_service.dartlib/services/fusion_tor_service.dartlib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dartlib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dartlib/pages/home_view/home_view.dartlib/pages/wallet_view/wallet_view.dartlib/pages/buy_view/buy_view.dartlib/pages_desktop_specific/desktop_buy/desktop_buy_view.dartlib/pages_desktop_specific/desktop_menu.darttool/wl_templates/TOR_tor_service_impl.template.dartInspect captured patch +1961 / −2064
diff --git a/lib/electrumx_rpc/electrumx_client.dart b/lib/electrumx_rpc/electrumx_client.dart
index c0d497a..2ef2791 100644
--- a/lib/electrumx_rpc/electrumx_client.dart
+++ b/lib/electrumx_rpc/electrumx_client.dart
@@ -20,6 +20,7 @@ import 'package:event_bus/event_bus.dart';
import 'package:mutex/mutex.dart';
import 'package:stream_channel/stream_channel.dart';
+import '../app_config.dart';
import '../exceptions/electrumx/no_such_transaction.dart';
import '../models/electrumx_response/spark_models.dart';
import '../services/event_bus/events/global/tor_connection_status_changed_event.dart';
@@ -220,46 +221,47 @@ class ElectrumXClient {
Future<void> checkElectrumAdapter() async {
({InternetAddress host, int port})? proxyInfo;
- // If we're supposed to use Tor...
- if (_prefs.useTor) {
- // But Tor isn't running...
- if (_torService.status != TorConnectionStatus.connected) {
- // And the killswitch isn't set...
- if (!_prefs.torKillSwitch) {
- // Then we'll just proceed and connect to ElectrumX through
- // clearnet at the bottom of this function.
- Logging.instance.w(
- "Tor preference set but Tor is not enabled, killswitch not set,"
- " connecting to Electrum adapter through clearnet",
- );
+ if (AppConfig.hasFeature(AppFeature.tor)) {
+ // If we're supposed to use Tor...
+ if (_prefs.useTor) {
+ // But Tor isn't running...
+ if (_torService.status != TorConnectionStatus.connected) {
+ // And the killswitch isn't set...
+ if (!_prefs.torKillSwitch) {
+ // Then we'll just proceed and connect to ElectrumX through
+ // clearnet at the bottom of this function.
+ Logging.instance.w(
+ "Tor preference set but Tor is not enabled, killswitch not set,"
+ " connecting to Electrum adapter through clearnet",
+ );
+ } else {
+ // ... But if the killswitch is set, then we throw an exception.
+ throw Exception(
+ "Tor preference and killswitch set but Tor is not enabled, "
+ "not connecting to Electrum adapter",
+ );
+ // TODO [prio=low]: Try to start Tor.
+ }
} else {
- // ... But if the killswitch is set, then we throw an exception.
- throw Exception(
- "Tor preference and killswitch set but Tor is not enabled, "
- "not connecting to Electrum adapter",
+ // Get the proxy info from the TorService.
+ proxyInfo = _torService.getProxyInfo();
+ }
+
+ if (netType == TorPlainNetworkOption.clear) {
+ _electrumAdapterChannel = null;
+ await ClientManager.sharedInstance.remove(
+ cryptoCurrency: cryptoCurrency,
);
- // TODO [prio=low]: Try to start Tor.
}
} else {
- // Get the proxy info from the TorService.
- proxyInfo = _torService.getProxyInfo();
- }
-
- if (netType == TorPlainNetworkOption.clear) {
- _electrumAdapterChannel = null;
- await ClientManager.sharedInstance.remove(
- cryptoCurrency: cryptoCurrency,
- );
- }
- } else {
- if (netType == TorPlainNetworkOption.tor) {
- _electrumAdapterChannel = null;
- await ClientManager.sharedInstance.remove(
- cryptoCurrency: cryptoCurrency,
- );
+ if (netType == TorPlainNetworkOption.tor) {
+ _electrumAdapterChannel = null;
+ await ClientManager.sharedInstance.remove(
+ cryptoCurrency: cryptoCurrency,
+ );
+ }
}
}
-
// If the current ElectrumAdapterClient is closed, create a new one.
if (getElectrumAdapter() != null && getElectrumAdapter()!.peer.isClosed) {
_electrumAdapterChannel = null;
@@ -847,9 +849,9 @@ class ElectrumXClient {
}) async {
Logging.instance.d("attempting to fetch lelantus.getanonymityset...");
await checkElectrumAdapter();
- final Map<String, dynamic> response = await (getElectrumAdapter()
- as FiroElectrumClient)
- .getLelantusAnonymitySet(groupId: groupId, blockHash: blockhash);
+ final Map<String, dynamic> response =
+ await (getElectrumAdapter() as FiroElectrumClient)
+ .getLelantusAnonymitySet(groupId: groupId, blockHash: blockhash);
Logging.instance.d("Fetching lelantus.getanonymityset finished");
return response;
}
@@ -900,8 +902,8 @@ class ElectrumXClient {
Future<int> getLelantusLatestCoinId({String? requestID}) async {
Logging.instance.d("attempting to fetch lelantus.getlatestcoinid...");
await checkElectrumAdapter();
- final int response =
- await (getElectrumAdapter() as FiroElectrumClient).getLatestCoinId();
+ final int response = await (getElectrumAdapter() as FiroElectrumClient)
+ .getLatestCoinId();
Logging.instance.d("Fetching lelantus.getlatestcoinid finished");
return response;
}
@@ -929,12 +931,12 @@ class ElectrumXClient {
try {
final start = DateTime.now();
await checkElectrumAdapter();
- final Map<String, dynamic> response = await (getElectrumAdapter()
- as FiroElectrumClient)
- .getSparkAnonymitySet(
- coinGroupId: coinGroupId,
- startBlockHash: startBlockHash,
- );
+ final Map<String, dynamic> response =
+ await (getElectrumAdapter() as FiroElectrumClient)
+ .getSparkAnonymitySet(
+ coinGroupId: coinGroupId,
+ startBlockHash: startBlockHash,
+ );
Logging.instance.d(
"Finished ElectrumXClient.getSparkAnonymitySet(coinGroupId"
"=$coinGroupId, startBlockHash=$startBlockHash). "
@@ -1025,9 +1027,8 @@ class ElectrumXClient {
try {
Logging.instance.d("attempting to fetch spark.getsparklatestcoinid...");
await checkElectrumAdapter();
- final int response =
- await (getElectrumAdapter() as FiroElectrumClient)
- .getSparkLatestCoinId();
+ final int response = await (getElectrumAdapter() as FiroElectrumClient)
+ .getSparkLatestCoinId();
Logging.instance.d("Fetching spark.getsparklatestcoinid finished");
return response;
} catch (e, s) {
@@ -1045,10 +1046,9 @@ class ElectrumXClient {
command: "spark.getmempoolsparktxids",
);
- final txids =
- List<String>.from(
- response as List,
- ).map((e) => e.toHexReversedFromBase64).toSet();
+ final txids = List<String>.from(
+ response as List,
+ ).map((e) => e.toHexReversedFromBase64).toSet();
Logging.instance.d(
"Finished ElectrumXClient.getMempoolTxids(). "
@@ -1158,10 +1158,8 @@ class ElectrumXClient {
return response
.map(
- (e) => (
- name: e["name"] as String,
- address: e["address"] as String,
- ),
+ (e) =>
+ (name: e["name"] as String, address: e["address"] as String),
)
.toList();
} else if (response["error"] != null) {
diff --git a/lib/main.dart b/lib/main.dart
index 481e398..4de7217 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -206,18 +206,19 @@ void main(List<String> args) async {
);
}
- // TODO:
- // This should be moved to happen during the loading animation instead of
- // showing a blank screen for 4-10 seconds.
- // Some refactoring will need to be done here to make sure we don't make any
- // network calls before starting up tor
- if (Prefs.instance.useTor) {
- TorService.sharedInstance.init(
- torDataDirPath: (await StackFileSystem.applicationTorDirectory()).path,
- );
- await TorService.sharedInstance.start();
+ if (AppConfig.hasFeature(AppFeature.tor)) {
+ // TODO:
+ // This should be moved to happen during the loading animation instead of
+ // showing a blank screen for 4-10 seconds.
+ // Some refactoring will need to be done here to make sure we don't make any
+ // network calls before starting up tor
+ if (Prefs.instance.useTor) {
+ TorService.sharedInstance.init(
+ torDataDirPath: (await StackFileSystem.applicationTorDirectory()).path,
+ );
+ await TorService.sharedInstance.start();
+ }
}
-
await StackFileSystem.initThemesDir();
await FiroCacheCoordinator.init();
diff --git a/lib/pages/buy_view/buy_view.dart b/lib/pages/buy_view/buy_view.dart
index 9589621..552a845 100644
--- a/lib/pages/buy_view/buy_view.dart
+++ b/lib/pages/buy_view/buy_view.dart
@@ -10,21 +10,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../app_config.dart';
import '../../models/isar/models/ethereum/eth_contract.dart';
-import 'buy_form.dart';
import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
import '../../services/tor_service.dart';
import '../../themes/stack_colors.dart';
import '../../wallets/crypto_currency/crypto_currency.dart';
import '../../widgets/stack_dialog.dart';
import '../../widgets/tor_subscription.dart';
+import 'buy_form.dart';
class BuyView extends ConsumerStatefulWidget {
- const BuyView({
- super.key,
- this.coin,
- this.tokenContract,
- });
+ const BuyView({super.key, this.coin, this.tokenContract});
final CryptoCurrency? coin;
final EthContract? tokenContract;
@@ -46,8 +44,9 @@ class _BuyViewState extends ConsumerState<BuyView> {
coin = widget.coin;
tokenContract = widget.tokenContract;
- torEnabled =
- ref.read(pTorService).status != TorConnectionStatus.disconnected;
+ torEnabled = AppConfig.hasFeature(AppFeature.tor)
+ ? ref.read(pTorService).status != TorConnectionStatus.disconnected
+ : false;
super.initState();
}
@@ -66,23 +65,15 @@ class _BuyViewState extends ConsumerState<BuyView> {
children: [
SafeArea(
child: Padding(
- padding: const EdgeInsets.only(
- left: 16,
- right: 16,
- top: 16,
- ),
- child: BuyForm(
- coin: coin,
- tokenContract: tokenContract,
- ),
+ padding: const EdgeInsets.only(left: 16, right: 16, top: 16),
+ child: BuyForm(coin: coin, tokenContract: tokenContract),
),
),
if (torEnabled)
Container(
- color: Theme.of(context)
- .extension<StackColors>()!
- .overlay
- .withOpacity(0.7),
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.overlay.withOpacity(0.7),
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: const StackDialog(
diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart
index 223c3d9..9c5af13 100644
--- a/lib/pages/home_view/home_view.dart
+++ b/lib/pages/home_view/home_view.dart
@@ -80,17 +80,16 @@ class _HomeViewState extends ConsumerState<HomeView> {
context,
RouteGenerator.getRoute(
shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute,
- builder:
- (_) => const LockscreenView(
- showBackButton: false,
- popOnSuccess: true,
- routeOnSuccessArguments: true,
- routeOnSuccess: "",
- biometricsCancelButtonString: "CANCEL",
- biometricsLocalizedReason:
- "Authenticate to unlock ${AppConfig.appName}",
- biometricsAuthenticationTitle: "Unlock ${AppConfig.appName}",
- ),
+ builder: (_) => const LockscreenView(
+ showBackButton: false,
+ popOnSuccess: true,
+ routeOnSuccessArguments: true,
+ routeOnSuccess: "",
+ biometricsCancelButtonString: "CANCEL",
+ biometricsLocalizedReason:
+ "Authenticate to unlock ${AppConfig.appName}",
+ biometricsAuthenticationTitle: "Unlock ${AppConfig.appName}",
+ ),
settings: const RouteSettings(name: "/unlockTimedOutAppScreen"),
),
);
@@ -136,14 +135,13 @@ class _HomeViewState extends ConsumerState<HomeView> {
await showDialog<dynamic>(
context: context,
barrierDismissible: false,
- builder:
- (_) => WillPopScope(
- onWillPop: () async {
- _exitEnabled = true;
- return true;
- },
- child: const StackDialog(title: "Tap back again to exit"),
- ),
+ builder: (_) => WillPopScope(
+ onWillPop: () async {
+ _exitEnabled = true;
+ return true;
+ },
+ child: const StackDialog(title: "Tap back again to exit"),
+ ),
).timeout(
timeout,
onTimeout: () {
@@ -300,8 +298,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
key: _key,
appBar: AppBar(
automaticallyImplyLeading: false,
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.backgroundAppBar,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.backgroundAppBar,
title: Row(
children: [
GestureDetector(
@@ -321,10 +320,11 @@ class _HomeViewState extends ConsumerState<HomeView> {
],
),
actions: [
- const Padding(
- padding: EdgeInsets.only(top: 10, bottom: 10, right: 10),
- child: AspectRatio(aspectRatio: 1, child: SmallTorIcon()),
- ),
+ if (AppConfig.hasFeature(AppFeature.tor))
+ const Padding(
+ padding: EdgeInsets.only(top: 10, bottom: 10, right: 10),
+ child: AspectRatio(aspectRatio: 1, child: SmallTorIcon()),
+ ),
Padding(
padding: const EdgeInsets.only(top: 10, bottom: 10, right: 10),
child: AspectRatio(
@@ -335,54 +335,51 @@ class _HomeViewState extends ConsumerState<HomeView> {
key: const Key("walletsViewAlertsButton"),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.backgroundAppBar,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.backgroundAppBar,
icon:
ref.watch(
- notificationsProvider.select(
- (value) => value.hasUnreadNotifications,
- ),
- )
- ? SvgPicture.file(
- File(
- ref.watch(
- themeProvider.select(
- (value) => value.assets.bellNew,
- ),
+ notificationsProvider.select(
+ (value) => value.hasUnreadNotifications,
+ ),
+ )
+ ? SvgPicture.file(
+ File(
+ ref.watch(
+ themeProvider.select(
+ (value) => value.assets.bellNew,
),
),
- width: 20,
- height: 20,
- color:
- ref.watch(
- notificationsProvider.select(
- (value) =>
- value.hasUnreadNotifications,
- ),
- )
- ? null
- : Theme.of(context)
- .extension<StackColors>()!
- .topNavIconPrimary,
- )
- : SvgPicture.asset(
- Assets.svg.bell,
- width: 20,
- height: 20,
- color:
- ref.watch(
- notificationsProvider.select(
- (value) =>
- value.hasUnreadNotifications,
- ),
- )
- ? null
- : Theme.of(context)
- .extension<StackColors>()!
- .topNavIconPrimary,
),
+ width: 20,
+ height: 20,
+ color:
+ ref.watch(
+ notificationsProvider.select(
+ (value) => value.hasUnreadNotifications,
+ ),
+ )
+ ? null
+ : Theme.of(
+ context,
+ ).extension<StackColors>()!.topNavIconPrimary,
+ )
+ : SvgPicture.asset(
+ Assets.svg.bell,
+ width: 20,
+ height: 20,
+ color:
+ ref.watch(
+ notificationsProvider.select(
+ (value) => value.hasUnreadNotifications,
+ ),
+ )
+ ? null
+ : Theme.of(
+ context,
+ ).extension<StackColors>()!.topNavIconPrimary,
+ ),
onPressed: () {
// reset unread state
ref.refresh(unreadNotificationsStateProvider);
@@ -390,10 +387,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
Navigator.of(
context,
).pushNamed(NotificationsView.routeName).then((_) {
- final Set<int> unreadNotificationIds =
- ref
- .read(unreadNotificationsStateProvider.state)
- .state;
+ final Set<int> unreadNotificationIds = ref
+ .read(unreadNotificationsStateProvider.state)
+ .state;
if (unreadNotificationIds.isEmpty) return;
final List<Future<void>> futures = [];
@@ -433,16 +429,14 @@ class _HomeViewState extends ConsumerState<HomeView> {
key: const Key("walletsViewSettingsButton"),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.backgroundAppBar,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.backgroundAppBar,
icon: SvgPicture.asset(
Assets.svg.gear,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.topNavIconPrimary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.topNavIconPrimary,
width: 20,
height: 20,
),
@@ -465,21 +459,20 @@ class _HomeViewState extends ConsumerState<HomeView> {
ref.watch(prefsChangeNotifierProvider).enableExchange)
Container(
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.backgroundAppBar,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.backgroundAppBar,
boxShadow:
Theme.of(context)
- .extension<StackColors>()!
- .homeViewButtonBarBoxShadow !=
- null
- ? [
- Theme.of(context)
- .extension<StackColors>()!
- .homeViewButtonBarBoxShadow!,
- ]
- : null,
+ .extension<StackColors>()!
+ .homeViewButtonBarBoxShadow !=
+ null
+ ? [
+ Theme.of(context)
+ .extension<StackColors>()!
+ .homeViewButtonBarBoxShadow!,
+ ]
+ : null,
),
child: const Padding(
padding: EdgeInsets.only(
@@ -516,8 +509,9 @@ class _HomeViewState extends ConsumerState<HomeView> {
onPageChanged: (pageIndex) {
if (!_lock) {
ref
- .read(homeViewPageIndexStateProvider.state)
- .state = pageIndex;
+ .read(homeViewPageIndexStateProvider.state)
+ .state =
+ pageIndex;
}
},
);
diff --git a/lib/pages/ordinals/ordinal_details_view.dart b/lib/pages/ordinals/ordinal_details_view.dart
index 05d7eb2..996f20d 100644
--- a/lib/pages/ordinals/ordinal_details_view.dart
+++ b/lib/pages/ordinals/ordinal_details_view.dart
@@ -8,6 +8,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
+import '../../app_config.dart';
import '../../models/isar/models/blockchain_data/utxo.dart';
import '../../models/isar/ordinal.dart';
import '../../networking/http.dart';
@@ -64,8 +65,9 @@ class _OrdinalDetailsViewState extends ConsumerState<OrdinalDetailsView> {
child: Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
leading: const AppBarBackButton(),
title: Text(
"Ordinal details",
@@ -104,17 +106,16 @@ class _OrdinalDetailsViewState extends ConsumerState<OrdinalDetailsView> {
const SizedBox(height: _spacing),
_DetailsItemWCopy(
title: "Amount",
- data:
- utxo == null
- ? "ERROR"
- : ref
- .watch(pAmountFormatter(coin))
- .format(
- Amount(
- rawValue: BigInt.from(utxo!.value),
- fractionDigits: coin.fractionDigits,
- ),
+ data: utxo == null
+ ? "ERROR"
+ : ref
+ .watch(pAmountFormatter(coin))
+ .format(
+ Amount(
+ rawValue: BigInt.from(utxo!.value),
+ fractionDigits: coin.fractionDigits,
),
+ ),
),
const SizedBox(height: _spacing),
_DetailsItemWCopy(
@@ -170,20 +171,18 @@ class _DetailsItemWCopy extends StatelessWidget {
children: [
SvgPicture.asset(
Assets.svg.copy,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.infoItemIcons,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.infoItemIcons,
width: 12,
),
const SizedBox(width: 6),
Text(
"Copy",
style: STextStyles.infoSmall(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.infoItemIcons,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.infoItemIcons,
),
),
],
@@ -216,10 +215,11 @@ class _OrdinalImageGroup extends ConsumerWidget {
final response = await client.get(
url: Uri.parse(ordinal.content),
- proxyInfo:
- ref.read(prefsChangeNotifierProvider).useTor
- ? ref.read(pTorService).getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : ref.read(prefsChangeNotifierProvider).useTor
+ ? ref.read(pTorService).getProxyInfo()
+ : null,
);
if (response.code != 200) {
@@ -230,10 +230,9 @@ class _OrdinalImageGroup extends ConsumerWidget {
final bytes = response.bodyBytes;
- final dir =
- Platform.isAndroid
- ? await StackFileSystem.wtfAndroidDocumentsPath()
- : await getApplicationDocumentsDirectory();
+ final dir = Platform.isAndroid
+ ? await StackFileSystem.wtfAndroidDocumentsPath()
+ : await getApplicationDocumentsDirectory();
final filePath = path.join(
dir.path,
"ordinal_${ordinal.inscriptionNumber}.png",
@@ -289,10 +288,9 @@ class _OrdinalImageGroup extends ConsumerWidget {
Assets.svg.arrowDown,
width: 10,
height: 12,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonTextSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextSecondary,
),
buttonHeight: ButtonHeight.l,
iconSpacing: 4,
diff --git a/lib/pages/paynym/subwidgets/paynym_bot.dart b/lib/pages/paynym/subwidgets/paynym_bot.dart
index 384e471..3307665 100644
--- a/lib/pages/paynym/subwidgets/paynym_bot.dart
+++ b/lib/pages/paynym/subwidgets/paynym_bot.dart
@@ -12,6 +12,7 @@ import 'dart:typed_data';
import 'package:flutter/material.dart';
+import '../../../app_config.dart';
import '../../../networking/http.dart';
import '../../../services/tor_service.dart';
import '../../../utilities/paynym_is_api.dart';
@@ -52,12 +53,15 @@ class PayNymBot extends StatelessWidget {
Future<Uint8List> _fetchImage() async {
final HTTP client = HTTP();
- final Uri uri =
- Uri.parse("${PaynymIsApi.baseURL}/$paymentCodeString/avatar");
+ final Uri uri = Uri.parse(
+ "${PaynymIsApi.baseURL}/$paymentCodeString/avatar",
+ );
final response = await client.get(
url: uri,
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
diff --git a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart
index 2480093..ea8461b 100644
--- a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart
+++ b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart
@@ -50,8 +50,9 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
backgroundColor: Colors.transparent,
appBar: AppBar(
automaticallyImplyLeading: false,
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.backgroundAppBar,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.backgroundAppBar,
leading: AppBarBackButton(
onPressed: () {
Navigator.of(context).pop();
@@ -98,12 +99,12 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
children: [
Padding(
padding: EdgeInsets.all(10.0),
- child: TorAnimatedButton(),
+ child: _TorAnimatedButton(),
),
],
),
const SizedBox(height: 30),
- const TorButton(),
+ const _TorButton(),
const SizedBox(height: 8),
RoundedWhiteContainer(
child: Consumer(
@@ -144,8 +145,9 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
" connection is disrupted or compromised.",
rightButton: SecondaryButton(
label: "Close",
- onPressed:
- Navigator.of(context).pop,
+ onPressed: Navigator.of(
+ context,
+ ).pop,
),
);
},
@@ -155,10 +157,9 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
Assets.svg.circleInfo,
height: 16,
width: 16,
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .infoItemLabel,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.infoItemLabel,
),
),
],
@@ -174,8 +175,9 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
),
onValueChanged: (newValue) {
ref
- .read(prefsChangeNotifierProvider)
- .torKillSwitch = newValue;
+ .read(prefsChangeNotifierProvider)
+ .torKillSwitch =
+ newValue;
},
),
),
@@ -195,14 +197,14 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
}
}
-class TorAnimatedButton extends ConsumerStatefulWidget {
- const TorAnimatedButton({super.key});
+class _TorAnimatedButton extends ConsumerStatefulWidget {
+ const _TorAnimatedButton({super.key});
@override
- ConsumerState<TorAnimatedButton> createState() => _TorAnimatedButtonState();
+ ConsumerState<_TorAnimatedButton> createState() => _TorAnimatedButtonState();
}
-class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
+class _TorAnimatedButtonState extends ConsumerState<_TorAnimatedButton>
with SingleTickerProviderStateMixin {
late final AnimationController controller1;
@@ -224,7 +226,6 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
case TorConnectionStatus.connected:
await disconnectTor(ref, context);
-
break;
case TorConnectionStatus.connecting:
@@ -365,7 +366,7 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
},
),
),
- const UpperCaseTorText(),
+ const _UpperCaseTorText(),
],
),
),
@@ -373,14 +374,14 @@ class _TorAnimatedButtonState extends ConsumerState<TorAnimatedButton>
}
}
-class TorButton extends ConsumerStatefulWidget {
- const TorButton({super.key});
+class _TorButton extends ConsumerStatefulWidget {
+ const _TorButton({super.key});
@override
- ConsumerState<TorButton> createState() => _TorButtonState();
+ ConsumerState<_TorButton> createState() => _TorButtonState();
}
-class _TorButtonState extends ConsumerState<TorButton> {
+class _TorButtonState extends ConsumerState<_TorButton> {
late TorConnectionStatus _status;
Color _color(TorConnectionStatus status, StackColors colors) {
@@ -483,14 +484,14 @@ class _TorButtonState extends ConsumerState<TorButton> {
}
}
-class UpperCaseTorText extends ConsumerStatefulWidget {
- const UpperCaseTorText({super.key});
+class _UpperCaseTorText extends ConsumerStatefulWidget {
+ const _UpperCaseTorText({super.key});
@override
- ConsumerState<UpperCaseTorText> createState() => _UpperCaseTorTextState();
+ ConsumerState<_UpperCaseTorText> createState() => _UpperCaseTorTextState();
}
-class _UpperCaseTorTextState extends ConsumerState<UpperCaseTorText> {
+class _UpperCaseTorTextState extends ConsumerState<_UpperCaseTorText> {
late TorConnectionStatus _status;
Color _color(TorConnectionStatus status, StackColors colors) {
diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart
index 75b121f..2e3ffbb 100644
--- a/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart
+++ b/lib/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart
@@ -18,6 +18,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:tuple/tuple.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
+import '../../../../app_config.dart';
import '../../../../providers/providers.dart';
import '../../../../route_generator.dart';
import '../../../../services/event_bus/events/global/blocks_remaining_event.dart';
@@ -158,31 +159,26 @@ class _WalletNetworkSettingsViewState
context: context,
useSafeArea: false,
barrierDismissible: true,
- builder:
- (context) => ConditionalParent(
- condition: isDesktop,
- builder:
- (child) => DesktopDialog(
- maxHeight: 150,
- maxWidth: 500,
- child: child,
- ),
- child: StackDialog(
- title: "Rescan completed",
- rightButton: TextButton(
- style: Theme.of(context)
- .extension<StackColors>()!
- .getSecondaryEnabledButtonStyle(context),
- child: Text(
- "Ok",
- style: STextStyles.itemSubtitle12(context),
- ),
- onPressed: () {
- Navigator.of(context, rootNavigator: isDesktop).pop();
- },
- ),
+ builder: (context) => ConditionalParent(
+ condition: isDesktop,
+ builder: (child) =>
+ DesktopDialog(maxHeight: 150, maxWidth: 500, child: child),
+ child: StackDialog(
+ title: "Rescan completed",
+ rightButton: TextButton(
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getSecondaryEnabledButtonStyle(context),
+ child: Text(
+ "Ok",
+ style: STextStyles.itemSubtitle12(context),
),
+ onPressed: () {
+ Navigator.of(context, rootNavigator: isDesktop).pop();
+ },
),
+ ),
+ ),
);
}
} catch (e) {
@@ -197,23 +193,19 @@ class _WalletNetworkSettingsViewState
context: context,
useSafeArea: false,
barrierDismissible: true,
- builder:
- (context) => StackDialog(
- title: "Rescan failed",
- message: e.toString(),
- rightButton: TextButton(
- style: Theme.of(context)
- .extension<StackColors>()!
- .getSecondaryEnabledButtonStyle(context),
- child: Text(
- "Ok",
- style: STextStyles.itemSubtitle12(context),
- ),
- onPressed: () {
- Navigator.of(context, rootNavigator: isDesktop).pop();
- },
- ),
- ),
+ builder: (context) => StackDialog(
+ title: "Rescan failed",
+ message: e.toString(),
+ rightButton: TextButton(
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getSecondaryEnabledButtonStyle(context),
+ child: Text("Ok", style: STextStyles.itemSubtitle12(context)),
+ onPressed: () {
+ Navigator.of(context, rootNavigator: isDesktop).pop();
+ },
+ ),
+ ),
);
}
}
@@ -249,8 +241,9 @@ class _WalletNetworkSettingsViewState
_blocksRemaining = -1;
}
- eventBus =
- widget.eventBus != null ? widget.eventBus! : GlobalEventBus.instance;
+ eventBus = widget.eventBus != null
+ ? widget.eventBus!
+ : GlobalEventBus.instance;
_syncStatusSubscription = eventBus
.on<WalletSyncStatusChangedEvent>()
@@ -334,10 +327,9 @@ class _WalletNetworkSettingsViewState
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
- final progressLength =
- isDesktop
- ? 430.0
- : screenWidth - (_padding * 2) - (_boxPadding * 3) - _iconSize;
+ final progressLength = isDesktop
+ ? 430.0
+ : screenWidth - (_padding * 2) - (_boxPadding * 3) - _iconSize;
final coin = ref.watch(pWalletCoin(widget.walletId));
@@ -384,8 +376,9 @@ class _WalletNetworkSettingsViewState
builder: (child) {
return Background(
child: Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
@@ -413,16 +406,14 @@ class _WalletNetworkSettingsViewState
),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
icon: SvgPicture.asset(
Assets.svg.verticalEllipsis,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
width: 20,
height: 20,
),
@@ -439,10 +430,9 @@ class _WalletNetworkSettingsViewState
right: 10,
child: Container(
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.popupBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
@@ -520,10 +510,9 @@ class _WalletNetworkSettingsViewState
Text(
"Blockchain status",
textAlign: TextAlign.left,
- style:
- isDesktop
- ? STextStyles.desktopTextExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
CustomTextButton(
text: "Resync",
@@ -536,14 +525,12 @@ class _WalletNetworkSettingsViewState
SizedBox(height: isDesktop ? 12 : 9),
if (_currentSyncStatus == WalletSyncStatus.synced)
RoundedWhiteContainer(
- borderColor:
- isDesktop
- ? Theme.of(context).extension<StackColors>()!.background
- : null,
- padding:
- isDesktop
- ? const EdgeInsets.all(16)
- : const EdgeInsets.all(12),
+ borderColor: isDesktop
+ ? Theme.of(context).extension<StackColors>()!.background
+ : null,
+ padding: isDesktop
+ ? const EdgeInsets.all(16)
+ : const EdgeInsets.all(12),
child: Row(
children: [
Container(
@@ -561,10 +548,9 @@ class _WalletNetworkSettingsViewState
Assets.svg.radio,
height: isDesktop ? 19 : 14,
width: isDesktop ? 19 : 14,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorGreen,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorGreen,
),
),
),
@@ -587,14 +573,12 @@ class _WalletNetworkSettingsViewState
ProgressBar(
width: progressLength,
height: 5,
- fillColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorGreen,
- backgroundColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ fillColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorGreen,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
percent: 1,
),
],
@@ -604,14 +588,12 @@ class _WalletNetworkSettingsViewState
),
if (_currentSyncStatus == WalletSyncStatus.syncing)
RoundedWhiteContainer(
- borderColor:
- isDesktop
- ? Theme.of(context).extension<StackColors>()!.background
- : null,
- padding:
- isDesktop
- ? const EdgeInsets.all(16)
- : const EdgeInsets.all(12),
+ borderColor: isDesktop
+ ? Theme.of(context).extension<StackColors>()!.background
+ : null,
+ padding: isDesktop
+ ? const EdgeInsets.all(16)
+ : const EdgeInsets.all(12),
child: Row(
children: [
Container(
@@ -629,10 +611,9 @@ class _WalletNetworkSettingsViewState
Assets.svg.radioSyncing,
height: 14,
width: 14,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorYellow,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorYellow,
),
),
),
@@ -657,14 +638,12 @@ class _WalletNetworkSettingsViewState
children: [
Text(
_percentString(_percent),
- style: STextStyles.syncPercent(
- context,
- ).copyWith(
- color:
- Theme.of(context)
+ style: STextStyles.syncPercent(context)
+ .copyWith(
+ color: Theme.of(context)
.extension<StackColors>()!
.accentColorYellow,
- ),
+ ),
),
if (coin is Monero ||
coin is Wownero ||
@@ -679,14 +658,12 @@ class _WalletNetworkSettingsViewState
)))
Text(
" (Blocks to go: ${_blocksRemaining == -1 ? "?" : _blocksRemaining})",
- style: STextStyles.syncPercent(
- context,
- ).copyWith(
- color:
- Theme.of(context)
+ style: STextStyles.syncPercent(context)
+ .copyWith(
+ color: Theme.of(context)
.extension<StackColors>()!
.accentColorYellow,
- ),
+ ),
),
],
),
@@ -697,14 +674,12 @@ class _WalletNetworkSettingsViewState
ProgressBar(
width: progressLength,
height: 5,
- fillColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorYellow,
- backgroundColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ fillColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorYellow,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
percent: _percent,
),
],
@@ -714,14 +689,12 @@ class _WalletNetworkSettingsViewState
),
if (_currentSyncStatus == WalletSyncStatus.unableToSync)
RoundedWhiteContainer(
- borderColor:
- isDesktop
- ? Theme.of(context).extension<StackColors>()!.background
- : null,
- padding:
- isDesktop
- ? const EdgeInsets.all(16)
- : const EdgeInsets.all(12),
+ borderColor: isDesktop
+ ? Theme.of(context).extension<StackColors>()!.background
+ : null,
+ padding: isDesktop
+ ? const EdgeInsets.all(16)
+ : const EdgeInsets.all(12),
child: Row(
children: [
Container(
@@ -739,10 +712,9 @@ class _WalletNetworkSettingsViewState
Assets.svg.radioProblem,
height: 14,
width: 14,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorRed,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorRed,
),
),
),
@@ -757,19 +729,17 @@ class _WalletNetworkSettingsViewState
Text(
"Unable to synchronize",
style: STextStyles.w600_12(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorRed,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorRed,
),
),
Text(
"0%",
style: STextStyles.syncPercent(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorRed,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorRed,
),
),
],
@@ -779,14 +749,12 @@ class _WalletNetworkSettingsViewState
ProgressBar(
width: progressLength,
height: 5,
- fillColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorRed,
- backgroundColor:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ fillColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorRed,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
percent: 0,
),
],
@@ -798,39 +766,36 @@ class _WalletNetworkSettingsViewState
Padding(
padding: const EdgeInsets.only(top: 12),
child: RoundedContainer(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.warningBackground,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.warningBackground,
child: Text(
"Please check your internet connection and make sure your current node is not having issues.",
style: STextStyles.baseXS(context).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.warningForeground,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.warningForeground,
),
),
),
),
SizedBox(height: isDesktop ? 12 : 9),
RoundedWhiteContainer(
- borderColor:
- isDesktop
- ? Theme.of(context).extension<StackColors>()!.background
- : null,
- padding:
- isDesktop ? const EdgeInsets.all(16) : const EdgeInsets.all(12),
+ borderColor: isDesktop
+ ? Theme.of(context).extension<StackColors>()!.background
+ : null,
+ padding: isDesktop
+ ? const EdgeInsets.all(16)
+ : const EdgeInsets.all(12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Current height",
textAlign: TextAlign.left,
- style:
- isDesktop
- ? STextStyles.desktopTextExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
Text(
ref.watch(pWalletChainHeight(widget.walletId)).toString(),
@@ -839,140 +804,140 @@ class _WalletNetworkSettingsViewState
],
),
),
- SizedBox(height: isDesktop ? 32 : 20),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- "Tor status",
- textAlign: TextAlign.left,
- style:
- isDesktop
- ? STextStyles.desktopTextExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
- ),
- CustomTextButton(
- text:
- ref.watch(
- prefsChangeNotifierProvider.select(
- (value) => value.useTor,
- ),
- )
- ? "Disconnect"
- : "Connect",
- onTap: onTorTapped,
- ),
- ],
- ),
- SizedBox(height: isDesktop ? 12 : 9),
- RoundedWhiteContainer(
- borderColor:
- isDesktop
- ? Theme.of(context).extension<StackColors>()!.background
- : null,
- padding:
- isDesktop ? const EdgeInsets.all(16) : const EdgeInsets.all(12),
- child: Row(
+ if (AppConfig.hasFeature(AppFeature.tor))
+ SizedBox(height: isDesktop ? 32 : 20),
+ if (AppConfig.hasFeature(AppFeature.tor))
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- if (ref.watch(
- prefsChangeNotifierProvider.select((value) => value.useTor),
- ))
- Container(
- width: _iconSize,
- height: _iconSize,
- decoration: BoxDecoration(
- color: Theme.of(context)
- .extension<StackColors>()!
- .accentColorGreen
- .withOpacity(0.2),
- borderRadius: BorderRadius.circular(_iconSize),
- ),
- child: Center(
- child: SvgPicture.asset(
- Assets.svg.tor,
- height: isDesktop ? 19 : 14,
- width: isDesktop ? 19 : 14,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorGreen,
+ Text(
+ "Tor status",
+ textAlign: TextAlign.left,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
+ ),
+ CustomTextButton(
+ text:
+ ref.watch(
+ prefsChangeNotifierProvider.select(
+ (value) => value.useTor,
+ ),
+ )
+ ? "Disconnect"
+ : "Connect",
+ onTap: onTorTapped,
+ ),
+ ],
+ ),
+ if (AppConfig.hasFeature(AppFeature.tor))
+ SizedBox(height: isDesktop ? 12 : 9),
+ if (AppConfig.hasFeature(AppFeature.tor))
+ RoundedWhiteContainer(
+ borderColor: isDesktop
+ ? Theme.of(context).extension<StackColors>()!.background
+ : null,
+ padding: isDesktop
+ ? const EdgeInsets.all(16)
+ : const EdgeInsets.all(12),
+ child: Row(
+ children: [
+ if (ref.watch(
+ prefsChangeNotifierProvider.select((value) => value.useTor),
+ ))
+ Container(
+ width: _iconSize,
+ height: _iconSize,
+ decoration: BoxDecoration(
+ color: Theme.of(context)
+ .extension<StackColors>()!
+ .accentColorGreen
+ .withOpacity(0.2),
+ borderRadius: BorderRadius.circular(_iconSize),
),
- ),
- ),
- if (!ref.watch(
- prefsChangeNotifierProvider.select((value) => value.useTor),
- ))
- Container(
- width: _iconSize,
- height: _iconSize,
- decoration: BoxDecoration(
- color: Theme.of(
- context,
- ).extension<StackColors>()!.textDark.withOpacity(0.08),
- borderRadius: BorderRadius.circular(_iconSize),
- ),
- child: Center(
- child: SvgPicture.asset(
- Assets.svg.tor,
- height: isDesktop ? 19 : 14,
- width: isDesktop ? 19 : 14,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
+ child: Center(
+ child: SvgPicture.asset(
+ Assets.svg.tor,
+ height: isDesktop ? 19 : 14,
+ width: isDesktop ? 19 : 14,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorGreen,
+ ),
),
),
- ),
- SizedBox(width: _boxPadding),
- TorSubscription(
- onTorStatusChanged: (status) {
- setState(() {
- _torConnectionStatus = status;
- });
- },
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "Tor status",
- style: STextStyles.desktopTextExtraExtraSmall(
+ if (!ref.watch(
+ prefsChangeNotifierProvider.select((value) => value.useTor),
+ ))
+ Container(
+ width: _iconSize,
+ height: _iconSize,
+ decoration: BoxDecoration(
+ color: Theme.of(
context,
- ).copyWith(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
- ),
+ ).extension<StackColors>()!.textDark.withOpacity(0.08),
+ borderRadius: BorderRadius.circular(_iconSize),
),
- if (_torConnectionStatus == TorConnectionStatus.connected)
- Text(
- "Connected",
- style: STextStyles.desktopTextExtraExtraSmall(
+ child: Center(
+ child: SvgPicture.asset(
+ Assets.svg.tor,
+ height: isDesktop ? 19 : 14,
+ width: isDesktop ? 19 : 14,
+ color: Theme.of(
context,
- ),
+ ).extension<StackColors>()!.textDark,
),
- if (_torConnectionStatus ==
- TorConnectionStatus.connecting)
+ ),
+ ),
+ SizedBox(width: _boxPadding),
+ TorSubscription(
+ onTorStatusChanged: (status) {
+ setState(() {
+ _torConnectionStatus = status;
+ });
+ },
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
Text(
- "Connecting...",
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ),
+ "Tor status",
+ style: STextStyles.desktopTextExtraExtraSmall(context)
+ .copyWith(
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
+ ),
),
- if (_torConnectionStatus ==
- TorConnectionStatus.disconnected)
- Text(
- "Disconnected",
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
+ if (_torConnectionStatus ==
+ TorConnectionStatus.connected)
+ Text(
+ "Connected",
+ style: STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ),
),
- ),
- ],
+ if (_torConnectionStatus ==
+ TorConnectionStatus.connecting)
+ Text(
+ "Connecting...",
+ style: STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ),
+ ),
+ if (_torConnectionStatus ==
+ TorConnectionStatus.disconnected)
+ Text(
+ "Disconnected",
+ style: STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ),
+ ),
+ ],
+ ),
),
- ),
- ],
+ ],
+ ),
),
- ),
SizedBox(height: isDesktop ? 32 : 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -980,10 +945,9 @@ class _WalletNetworkSettingsViewState
Text(
"${ref.watch(pWalletCoin(widget.walletId)).prettyName} nodes",
textAlign: TextAlign.left,
- style:
- isDesktop
- ? STextStyles.desktopTextExtraExtraSmall(context)
- : STextStyles.smallMed12(context),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraExtraSmall(context)
+ : STextStyles.smallMed12(context),
),
CustomTextButton(
text: "Add new node",
@@ -1030,14 +994,12 @@ class _WalletNetworkSettingsViewState
ref.watch(pWalletCoin(widget.walletId)) is! Epiccash &&
ref.watch(pWalletCoin(widget.walletId)) is! Mimblewimblecoin)
RoundedWhiteContainer(
- borderColor:
- isDesktop
- ? Theme.of(context).extension<StackColors>()!.background
- : null,
- padding:
- isDesktop
- ? const EdgeInsets.all(16)
- : const EdgeInsets.all(12),
+ borderColor: isDesktop
+ ? Theme.of(context).extension<StackColors>()!.background
+ : null,
+ padding: isDesktop
+ ? const EdgeInsets.all(16)
+ : const EdgeInsets.all(12),
child: Expandable(
onExpandChanged: (state) {
setState(() {
@@ -1053,20 +1015,18 @@ class _WalletNetworkSettingsViewState
width: _iconSize,
height: _iconSize,
decoration: BoxDecoration(
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
borderRadius: BorderRadius.circular(_iconSize),
),
child: Center(
child: SvgPicture.asset(
Assets.svg.networkWired,
width: 24,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
),
),
),
@@ -1077,14 +1037,14 @@ class _WalletNetworkSettingsViewState
children: [
Text(
"Advanced",
- style: STextStyles.desktopTextExtraExtraSmall(
- context,
- ).copyWith(
- color:
- Theme.of(
+ style:
+ STextStyles.desktopTextExtraExtraSmall(
+ context,
+ ).copyWith(
+ color: Theme.of(
context,
).extension<StackColors>()!.textDark,
- ),
+ ),
),
Text(
"Rescan blockchain",
@@ -1102,10 +1062,9 @@ class _WalletNetworkSettingsViewState
: Assets.svg.chevronDown,
width: 12,
height: 6,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textSubtitle1,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textSubtitle1,
),
],
),
diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart
index 32c565e..c8971e6 100644
--- a/lib/pages/wallet_view/wallet_view.dart
+++ b/lib/pages/wallet_view/wallet_view.dart
@@ -183,8 +183,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
}
}
- eventBus =
- widget.eventBus != null ? widget.eventBus! : GlobalEventBus.instance;
+ eventBus = widget.eventBus != null
+ ? widget.eventBus!
+ : GlobalEventBus.instance;
_syncStatusSubscription = eventBus
.on<WalletSyncStatusChangedEvent>()
@@ -354,27 +355,24 @@ class _WalletViewState extends ConsumerState<WalletView> {
if (coin.network.isTestNet) {
await showDialog<void>(
context: context,
- builder:
- (_) => const StackOkDialog(
- title: "Exchange not available for test net coins",
- ),
+ builder: (_) => const StackOkDialog(
+ title: "Exchange not available for test net coins",
+ ),
);
} else {
Future<Currency?> _future;
final isar = await ExchangeDataLoadingService.instance.isar;
try {
- _future =
- isar.currencies
- .where()
- .tickerEqualToAnyExchangeNameName(coin.ticker)
- .findFirst();
+ _future = isar.currencies
+ .where()
+ .tickerEqualToAnyExchangeNameName(coin.ticker)
+ .findFirst();
} catch (_) {
_future = ExchangeDataLoadingService.instance.loadAll().then(
- (_) =>
- isar.currencies
- .where()
- .tickerEqualToAnyExchangeNameName(coin.ticker)
- .findFirst(),
+ (_) => isar.currencies
+ .where()
+ .tickerEqualToAnyExchangeNameName(coin.ticker)
+ .findFirst(),
);
}
@@ -404,18 +402,17 @@ class _WalletViewState extends ConsumerState<WalletView> {
if (coin.network.isTestNet) {
await showDialog<void>(
context: context,
- builder:
- (_) => const StackOkDialog(
- title: "Buy not available for test net coins",
- ),
+ builder: (_) =>
+ const StackOkDialog(title: "Buy not available for test net coins"),
);
} else {
if (mounted) {
unawaited(
Navigator.of(context).pushNamed(
BuyInWalletView.routeName,
- arguments:
- coin.hasBuySupport ? coin : Bitcoin(CryptoCurrencyNetwork.main),
+ arguments: coin.hasBuySupport
+ ? coin
+ : Bitcoin(CryptoCurrencyNetwork.main),
),
);
}
@@ -427,14 +424,13 @@ class _WalletViewState extends ConsumerState<WalletView> {
unawaited(
showDialog(
context: context,
- builder:
- (context) => WillPopScope(
- child: const CustomLoadingOverlay(
- message: "Anonymizing balance",
- eventBus: null,
- ),
- onWillPop: () async => shouldPop,
- ),
+ builder: (context) => WillPopScope(
+ child: const CustomLoadingOverlay(
+ message: "Anonymizing balance",
+ eventBus: null,
+ ),
+ onWillPop: () async => shouldPop,
+ ),
),
);
final wallet = ref.read(pWallets).getWallet(walletId);
@@ -484,11 +480,10 @@ class _WalletViewState extends ConsumerState<WalletView> {
).popUntil(ModalRoute.withName(WalletView.routeName));
await showDialog<dynamic>(
context: context,
- builder:
- (_) => StackOkDialog(
- title: "Privatize all failed",
- message: "Reason: $e",
- ),
+ builder: (_) => StackOkDialog(
+ title: "Privatize all failed",
+ message: "Reason: $e",
+ ),
);
}
}
@@ -521,40 +516,36 @@ class _WalletViewState extends ConsumerState<WalletView> {
"Migration in progress\nThis could take a while\nPlease don't leave this screen",
subMessage: "This only needs to run once per wallet",
eventBus: null,
- textColor:
- Theme.of(context).extension<StackColors>()!.textDark,
+ textColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.textDark,
actionButton: SecondaryButton(
label: "Cancel",
onPressed: () async {
await showDialog<void>(
context: context,
- builder:
- (context) => StackDialog(
- title: "Warning!",
- message:
- "Skipping this process can completely"
- " break your wallet. It is only meant to be done in"
- " emergency situations where the migration fails"
- " and will not let you continue. Still skip?",
- leftButton: SecondaryButton(
- label: "Cancel",
- onPressed:
- Navigator.of(
- context,
- rootNavigator: true,
- ).pop,
- ),
- rightButton: SecondaryButton(
- label: "Ok",
- onPressed: () {
- Navigator.of(
- context,
- rootNavigator: true,
- ).pop();
- setState(() => _rescanningOnOpen = false);
- },
- ),
- ),
+ builder: (context) => StackDialog(
+ title: "Warning!",
+ message:
+ "Skipping this process can completely"
+ " break your wallet. It is only meant to be done in"
+ " emergency situations where the migration fails"
+ " and will not let you continue. Still skip?",
+ leftButton: SecondaryButton(
+ label: "Cancel",
+ onPressed: Navigator.of(
+ context,
+ rootNavigator: true,
+ ).pop,
+ ),
+ rightButton: SecondaryButton(
+ label: "Ok",
+ onPressed: () {
+ Navigator.of(context, rootNavigator: true).pop();
+ setState(() => _rescanningOnOpen = false);
+ },
+ ),
+ ),
);
},
),
@@ -570,8 +561,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: Stack(
children: [
Scaffold(
- backgroundColor:
- Theme.of(context).extension<StackColors>()!.background,
+ backgroundColor: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
@@ -598,10 +590,18 @@ class _WalletViewState extends ConsumerState<WalletView> {
],
),
actions: [
- const Padding(
- padding: EdgeInsets.only(top: 10, bottom: 10, right: 10),
- child: AspectRatio(aspectRatio: 1, child: SmallTorIcon()),
- ),
+ if (AppConfig.hasFeature(AppFeature.tor))
+ const Padding(
+ padding: EdgeInsets.only(
+ top: 10,
+ bottom: 10,
+ right: 10,
+ ),
+ child: AspectRatio(
+ aspectRatio: 1,
+ child: SmallTorIcon(),
+ ),
+ ),
Padding(
padding: const EdgeInsets.only(
top: 10,
@@ -616,10 +616,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
key: const Key("walletViewRadioButton"),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
icon: _buildNetworkIcon(_currentSyncStatus),
onPressed: () {
Navigator.of(context).pushNamed(
@@ -648,59 +647,58 @@ class _WalletViewState extends ConsumerState<WalletView> {
key: const Key("walletViewAlertsButton"),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
icon:
ref.watch(
- notificationsProvider.select(
- (value) => value
- .hasUnreadNotificationsFor(walletId),
- ),
- )
- ? SvgPicture.file(
- File(
- ref.watch(
- themeProvider.select(
- (value) => value.assets.bellNew,
- ),
+ notificationsProvider.select(
+ (value) =>
+ value.hasUnreadNotificationsFor(walletId),
+ ),
+ )
+ ? SvgPicture.file(
+ File(
+ ref.watch(
+ themeProvider.select(
+ (value) => value.assets.bellNew,
),
),
- width: 20,
- height: 20,
- color:
- ref.watch(
- notificationsProvider.select(
- (value) => value
- .hasUnreadNotificationsFor(
- walletId,
- ),
+ ),
+ width: 20,
+ height: 20,
+ color:
+ ref.watch(
+ notificationsProvider.select(
+ (value) =>
+ value.hasUnreadNotificationsFor(
+ walletId,
),
- )
- ? null
- : Theme.of(context)
- .extension<StackColors>()!
- .topNavIconPrimary,
- )
- : SvgPicture.asset(
- Assets.svg.bell,
- width: 20,
- height: 20,
- color:
- ref.watch(
- notificationsProvider.select(
- (value) => value
- .hasUnreadNotificationsFor(
- walletId,
- ),
+ ),
+ )
+ ? null
+ : Theme.of(context)
+ .extension<StackColors>()!
+ .topNavIconPrimary,
+ )
+ : SvgPicture.asset(
+ Assets.svg.bell,
+ width: 20,
+ height: 20,
+ color:
+ ref.watch(
+ notificationsProvider.select(
+ (value) =>
+ value.hasUnreadNotificationsFor(
+ walletId,
),
- )
- ? null
- : Theme.of(context)
- .extension<StackColors>()!
- .topNavIconPrimary,
- ),
+ ),
+ )
+ ? null
+ : Theme.of(context)
+ .extension<StackColors>()!
+ .topNavIconPrimary,
+ ),
onPressed: () {
// reset unread state
ref.refresh(unreadNotificationsStateProvider);
@@ -711,13 +709,11 @@ class _WalletViewState extends ConsumerState<WalletView> {
arguments: walletId,
)
.then((_) {
- final Set<int> unreadNotificationIds =
- ref
- .read(
- unreadNotificationsStateProvider
- .state,
- )
- .state;
+ final Set<int> unreadNotificationIds = ref
+ .read(
+ unreadNotificationsStateProvider.state,
+ )
+ .state;
if (unreadNotificationIds.isEmpty) return;
final List<Future<dynamic>> futures = [];
@@ -765,16 +761,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
key: const Key("walletViewSettingsButton"),
size: 36,
shadows: const [],
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.background,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
icon: SvgPicture.asset(
Assets.svg.bars,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.accentColorDark,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.accentColorDark,
width: 20,
height: 20,
),
@@ -798,8 +792,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
),
body: SafeArea(
child: Container(
- color:
- Theme.of(context).extension<StackColors>()!.background,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.background,
child: Column(
children: [
const SizedBox(height: 10),
@@ -811,12 +806,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
aspectRatio: 1.75,
initialSyncStatus:
ref
- .watch(pWallets)
- .getWallet(walletId)
- .refreshMutex
- .isLocked
- ? WalletSyncStatus.syncing
- : WalletSyncStatus.synced,
+ .watch(pWallets)
+ .getWallet(walletId)
+ .refreshMutex
+ .isLocked
+ ? WalletSyncStatus.syncing
+ : WalletSyncStatus.synced,
),
),
),
@@ -839,60 +834,55 @@ class _WalletViewState extends ConsumerState<WalletView> {
onPressed: () async {
await showDialog<void>(
context: context,
- builder:
- (context) => StackDialog(
- title: "Attention!",
- message:
- "You're about to privatize all of your public funds.",
- leftButton: TextButton(
- onPressed: () {
- Navigator.of(context).pop();
- },
- child: Text(
- "Cancel",
- style: STextStyles.button(
- context,
- ).copyWith(
- color:
- Theme.of(context)
- .extension<
- StackColors
- >()!
- .accentColorDark,
+ builder: (context) => StackDialog(
+ title: "Attention!",
+ message:
+ "You're about to privatize all of your public funds.",
+ leftButton: TextButton(
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ child: Text(
+ "Cancel",
+ style: STextStyles.button(context)
+ .copyWith(
+ color: Theme.of(context)
+ .extension<
+ StackColors
+ >()!
+ .accentColorDark,
),
- ),
- ),
- rightButton: TextButton(
- onPressed: () async {
- Navigator.of(context).pop();
+ ),
+ ),
+ rightButton: TextButton(
+ onPressed: () async {
+ Navigator.of(context).pop();
- unawaited(attemptAnonymize());
- },
- style: Theme.of(context)
- .extension<StackColors>()!
- .getPrimaryEnabledButtonStyle(
- context,
- ),
- child: Text(
- "Continue",
- style: STextStyles.button(
- context,
- ),
+ unawaited(attemptAnonymize());
+ },
+ style: Theme.of(context)
+ .extension<StackColors>()!
+ .getPrimaryEnabledButtonStyle(
+ context,
),
+ child: Text(
+ "Continue",
+ style: STextStyles.button(
+ context,
),
),
+ ),
+ ),
);
},
child: Text(
"Privatize funds",
- style: STextStyles.button(
- context,
- ).copyWith(
- color:
- Theme.of(context)
+ style: STextStyles.button(context)
+ .copyWith(
+ color: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondary,
- ),
+ ),
),
),
),
@@ -907,14 +897,12 @@ class _WalletViewState extends ConsumerState<WalletView> {
children: [
Text(
"Transactions",
- style: STextStyles.itemSubtitle(
- context,
- ).copyWith(
- color:
- Theme.of(
+ style: STextStyles.itemSubtitle(context)
+ .copyWith(
+ color: Theme.of(
context,
).extension<StackColors>()!.textDark3,
- ),
+ ),
),
CustomTextButton(
text: "See all",
@@ -976,18 +964,16 @@ class _WalletViewState extends ConsumerState<WalletView> {
Expanded(
child:
ref
- .read(pWallets)
- .getWallet(
- widget.walletId,
- )
- .isarTransactionVersion ==
- 2
- ? TransactionsV2List(
- walletId: widget.walletId,
- )
- : TransactionsList(
- walletId: walletId,
- ),
+ .read(pWallets)
+ .getWallet(widget.walletId)
+ .isarTransactionVersion ==
+ 2
+ ? TransactionsV2List(
+ walletId: widget.walletId,
+ )
+ : TransactionsList(
+ walletId: walletId,
+ ),
),
],
),
@@ -1102,11 +1088,10 @@ class _WalletViewState extends ConsumerState<WalletView> {
moreItems: [
if (ref.watch(
pWallets.select(
- (value) =>
- value
- .getWallet(widget.walletId)
- .cryptoCurrency
- .hasTokenSupport,
+ (value) => value
+ .getWallet(widget.walletId)
+ .cryptoCurrency
+ .hasTokenSupport,
),
))
WalletNavigationBarItemData(
@@ -1125,10 +1110,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
Assets.svg.monkey,
height: 20,
width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.bottomNavIconIcon,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.bottomNavIconIcon,
),
label: "MonKey",
onTap: () {
@@ -1192,9 +1176,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
unawaited(
showDialog(
context: context,
- builder:
- (context) =>
- const LoadingIndicator(width: 100),
+ builder: (context) =>
+ const LoadingIndicator(width: 100),
),
);
@@ -1224,8 +1207,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
// account.value!.segwit
) {
ref
- .read(myPaynymAccountStateProvider.state)
- .state = account.value!;
+ .read(myPaynymAccountStateProvider.state)
+ .state =
+ account.value!;
await Navigator.of(context).pushNamed(
PaynymHomeView.routeName,
@@ -1257,7 +1241,9 @@ class _WalletViewState extends ConsumerState<WalletView> {
);
},
),
- if (wallet is CashFusionInterface && !viewOnly)
+ if (AppConfig.hasFeature(AppFeature.tor) &&
+ wallet is CashFusionInterface &&
+ !viewOnly)
WalletNavigationBarItemData(
label: "Fusion",
icon: const FusionNavIcon(),
diff --git a/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart b/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart
index 6c5d2dc..7778139 100644
--- a/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart
+++ b/lib/pages_desktop_specific/desktop_buy/desktop_buy_view.dart
@@ -10,6 +10,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../app_config.dart';
import '../../pages/buy_view/buy_form.dart';
import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
import '../../services/tor_service.dart';
@@ -35,8 +37,9 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
@override
void initState() {
- torEnabled =
- ref.read(pTorService).status != TorConnectionStatus.disconnected;
+ torEnabled = AppConfig.hasFeature(AppFeature.tor)
+ ? ref.read(pTorService).status != TorConnectionStatus.disconnected
+ : false;
super.initState();
}
@@ -54,9 +57,7 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
appBar: DesktopAppBar(
isCompactHeight: true,
leading: Padding(
- padding: const EdgeInsets.only(
- left: 24,
- ),
+ padding: const EdgeInsets.only(left: 24),
child: Text(
"Buy crypto",
style: STextStyles.desktopH3(context),
@@ -64,11 +65,7 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
),
),
body: const Padding(
- padding: EdgeInsets.only(
- left: 24,
- right: 24,
- bottom: 24,
- ),
+ padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -77,9 +74,7 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- SizedBox(
- height: 16,
- ),
+ SizedBox(height: 16),
RoundedWhiteContainer(
padding: EdgeInsets.all(24),
child: BuyForm(),
@@ -87,9 +82,7 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
],
),
),
- SizedBox(
- width: 16,
- ),
+ SizedBox(width: 16),
// Expanded(
// child: Row(
// children: const [
@@ -105,19 +98,16 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
),
if (torEnabled)
Container(
- color: Theme.of(context)
- .extension<StackColors>()!
- .overlay
- .withOpacity(0.7),
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.overlay.withOpacity(0.7),
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: DesktopDialog(
maxHeight: 200,
maxWidth: 350,
child: Padding(
- padding: const EdgeInsets.all(
- 15.0,
- ),
+ padding: const EdgeInsets.all(15.0),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
@@ -127,16 +117,14 @@ class _DesktopBuyViewState extends ConsumerState<DesktopBuyView> {
textAlign: TextAlign.center,
style: STextStyles.pageTitleH1(context),
),
- const SizedBox(
- height: 30,
- ),
+ const SizedBox(height: 30),
Text(
"Purchasing not available while Tor is enabled",
textAlign: TextAlign.center,
style: STextStyles.desktopTextMedium(context).copyWith(
- color: Theme.of(context)
- .extension<StackColors>()!
- .infoItemLabel,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.infoItemLabel,
),
),
],
diff --git a/lib/pages_desktop_specific/desktop_menu.dart b/lib/pages_desktop_specific/desktop_menu.dart
index 9c9b9cc..c0cbf10 100644
--- a/lib/pages_desktop_specific/desktop_menu.dart
+++ b/lib/pages_desktop_specific/desktop_menu.dart
@@ -126,19 +126,13 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- const SizedBox(
- height: 25,
- ),
+ const SizedBox(height: 25),
AnimatedContainer(
duration: duration,
width: _width == expandedWidth ? 70 : 32,
- child: LivingStackIcon(
- onPressed: toggleMinimize,
- ),
- ),
- const SizedBox(
- height: 10,
+ child: LivingStackIcon(onPressed: toggleMinimize),
),
+ const SizedBox(height: 10),
AnimatedOpacity(
duration: duration,
opacity: _width == expandedWidth ? 1 : 0,
@@ -146,40 +140,40 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
height: 28,
child: Text(
AppConfig.appName,
- style: STextStyles.desktopH2(context).copyWith(
- fontSize: 18,
- height: 23.4 / 18,
- ),
+ style: STextStyles.desktopH2(
+ context,
+ ).copyWith(fontSize: 18, height: 23.4 / 18),
),
),
),
- const SizedBox(
- height: 5,
- ),
- AnimatedContainer(
- duration: duration,
- width: _width == expandedWidth
- ? _width - 32 // 16 padding on either side
- : _width - 16, // 8 padding on either side
- child: DesktopTorStatusButton(
- transitionDuration: duration,
- controller: torButtonController,
- onPressed: () {
- ref.read(currentDesktopMenuItemProvider.state).state =
- DesktopMenuItemId.settings;
- ref.read(selectedSettingsMenuItemStateProvider.state).state =
- 4;
- },
+ if (AppConfig.hasFeature(AppFeature.tor)) const SizedBox(height: 5),
+ if (AppConfig.hasFeature(AppFeature.tor))
+ AnimatedContainer(
+ duration: duration,
+ width: _width == expandedWidth
+ ? _width -
+ 32 // 16 padding on either side
+ : _width - 16, // 8 padding on either side
+ child: DesktopTorStatusButton(
+ transitionDuration: duration,
+ controller: torButtonController,
+ onPressed: () {
+ ref.read(currentDesktopMenuItemProvider.state).state =
+ DesktopMenuItemId.settings;
+ ref
+ .read(selectedSettingsMenuItemStateProvider.state)
+ .state =
+ 4;
+ },
+ ),
),
- ),
- const SizedBox(
- height: 40,
- ),
+ const SizedBox(height: 40),
Expanded(
child: AnimatedContainer(
duration: duration,
width: _width == expandedWidth
- ? _width - 32 // 16 padding on either side
+ ? _width -
+ 32 // 16 padding on either side
: _width - 16, // 8 padding on either side
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -196,9 +190,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
),
if (AppConfig.hasFeature(AppFeature.swap) &&
showExchange) ...[
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('swap'),
duration: duration,
@@ -212,9 +204,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
],
if (AppConfig.hasFeature(AppFeature.buy) &&
showExchange) ...[
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('buy'),
duration: duration,
@@ -226,9 +216,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
isExpandedInitially: !_isMinimized,
),
],
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('notifications'),
duration: duration,
@@ -239,9 +227,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
controller: controllers[3],
isExpandedInitially: !_isMinimized,
),
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('addressBook'),
duration: duration,
@@ -252,9 +238,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
controller: controllers[4],
isExpandedInitially: !_isMinimized,
),
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('settings'),
duration: duration,
@@ -265,9 +249,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
controller: controllers[5],
isExpandedInitially: !_isMinimized,
),
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('support'),
duration: duration,
@@ -278,9 +260,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
controller: controllers[6],
isExpandedInitially: !_isMinimized,
),
- const SizedBox(
- height: 2,
- ),
+ const SizedBox(height: 2),
DesktopMenuItem(
key: const ValueKey('about'),
duration: duration,
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart
index e5b0527..c5e5428 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart
@@ -126,9 +126,8 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
) async {
await showDialog<void>(
context: context,
- builder:
- (_) =>
- MoreFeaturesDialog(walletId: widget.walletId, options: options),
+ builder: (_) =>
+ MoreFeaturesDialog(walletId: widget.walletId, options: options),
);
}
@@ -154,49 +153,48 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
await showDialog<void>(
context: context,
barrierDismissible: false,
- builder:
- (context) => DesktopDialog(
- maxWidth: 500,
- maxHeight: double.infinity,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 20),
- child: Column(
+ builder: (context) => DesktopDialog(
+ maxWidth: 500,
+ maxHeight: double.infinity,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 20),
+ child: Column(
+ children: [
+ Text("Attention!", style: STextStyles.desktopH2(context)),
+ const SizedBox(height: 16),
+ Text(
+ "You're about to privatize all of your public funds.",
+ style: STextStyles.desktopTextSmall(context),
+ ),
+ const SizedBox(height: 32),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
- Text("Attention!", style: STextStyles.desktopH2(context)),
- const SizedBox(height: 16),
- Text(
- "You're about to privatize all of your public funds.",
- style: STextStyles.desktopTextSmall(context),
+ SecondaryButton(
+ width: 200,
+ buttonHeight: ButtonHeight.l,
+ label: "Cancel",
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
),
- const SizedBox(height: 32),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- SecondaryButton(
- width: 200,
- buttonHeight: ButtonHeight.l,
- label: "Cancel",
- onPressed: () {
- Navigator.of(context).pop();
- },
- ),
- const SizedBox(width: 20),
- PrimaryButton(
- width: 200,
- buttonHeight: ButtonHeight.l,
- label: "Continue",
- onPressed: () {
- Navigator.of(context).pop();
-
- unawaited(_attemptAnonymize());
- },
- ),
- ],
+ const SizedBox(width: 20),
+ PrimaryButton(
+ width: 200,
+ buttonHeight: ButtonHeight.l,
+ label: "Continue",
+ onPressed: () {
+ Navigator.of(context).pop();
+
+ unawaited(_attemptAnonymize());
+ },
),
],
),
- ),
+ ],
),
+ ),
+ ),
);
}
@@ -205,14 +203,13 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
unawaited(
showDialog(
context: context,
- builder:
- (context) => WillPopScope(
- child: const CustomLoadingOverlay(
- message: "Privatizing balance",
- eventBus: null,
- ),
- onWillPop: () async => shouldPop,
- ),
+ builder: (context) => WillPopScope(
+ child: const CustomLoadingOverlay(
+ message: "Privatizing balance",
+ eventBus: null,
+ ),
+ onWillPop: () async => shouldPop,
+ ),
),
);
@@ -265,46 +262,44 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
).popUntil(ModalRoute.withName(DesktopWalletView.routeName));
await showDialog<dynamic>(
context: context,
- builder:
- (_) => DesktopDialog(
- maxWidth: 400,
- maxHeight: 300,
- child: Padding(
- padding: const EdgeInsets.all(24),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ builder: (_) => DesktopDialog(
+ maxWidth: 400,
+ maxHeight: 300,
+ child: Padding(
+ padding: const EdgeInsets.all(24),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "Privatize all failed",
+ style: STextStyles.desktopH3(context),
+ ),
+ const Spacer(flex: 1),
+ Text(
+ "Reason: $e",
+ style: STextStyles.desktopTextSmall(context),
+ ),
+ const Spacer(flex: 2),
+ Row(
children: [
- Text(
- "Privatize all failed",
- style: STextStyles.desktopH3(context),
- ),
- const Spacer(flex: 1),
- Text(
- "Reason: $e",
- style: STextStyles.desktopTextSmall(context),
- ),
- const Spacer(flex: 2),
- Row(
- children: [
- const Spacer(),
- const SizedBox(width: 16),
- Expanded(
- child: PrimaryButton(
- label: "Ok",
- buttonHeight: ButtonHeight.l,
- onPressed:
- Navigator.of(
- context,
- rootNavigator: true,
- ).pop,
- ),
- ),
- ],
+ const Spacer(),
+ const SizedBox(width: 16),
+ Expanded(
+ child: PrimaryButton(
+ label: "Ok",
+ buttonHeight: ButtonHeight.l,
+ onPressed: Navigator.of(
+ context,
+ rootNavigator: true,
+ ).pop,
+ ),
),
],
),
- ),
+ ],
),
+ ),
+ ),
);
}
}
@@ -447,7 +442,9 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
if (wallet.info.coin is Banano)
(WalletFeature.monkey, Assets.svg.monkey, _onMonkeyPressed),
- if (!isViewOnly && wallet is CashFusionInterface)
+ if (AppConfig.hasFeature(AppFeature.tor) &&
+ !isViewOnly &&
+ wallet is CashFusionInterface)
(WalletFeature.fusion, Assets.svg.cashFusion, _onFusionPressed),
if (!isViewOnly &&
@@ -493,8 +490,8 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
canGen =
(wallet is MultiAddressInterface ||
- wallet is SparkInterface ||
- supportsMweb);
+ wallet is SparkInterface ||
+ supportsMweb);
}
final showMwebOption = wallet is MwebInterface && !wallet.isViewOnly;
@@ -523,16 +520,14 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
Assets.svg.bars,
height: 20,
width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonTextSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextSecondary,
),
- onPressed:
- () => _onMorePressed([
- ...options.sublist(options.length - count),
- ...extraOptions,
- ]),
+ onPressed: () => _onMorePressed([
+ ...options.sublist(options.length - count),
+ ...extraOptions,
+ ]),
),
);
},
@@ -545,30 +540,27 @@ class _DesktopWalletFeaturesState extends ConsumerState<DesktopWalletFeatures> {
label: option.$1.label,
padding: const EdgeInsets.symmetric(horizontal: 16),
buttonHeight: ButtonHeight.l,
- icon:
- option.$1 == WalletFeature.buy
- ? SvgPicture.file(
- File(
- ref.watch(
- themeProvider.select((value) => value.assets.buy),
- ),
+ icon: option.$1 == WalletFeature.buy
+ ? SvgPicture.file(
+ File(
+ ref.watch(
+ themeProvider.select((value) => value.assets.buy),
),
- height: 20,
- width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonTextSecondary,
- )
- : SvgPicture.asset(
- option.$2,
- height: 20,
- width: 20,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.buttonTextSecondary,
),
+ height: 20,
+ width: 20,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextSecondary,
+ )
+ : SvgPicture.asset(
+ option.$2,
+ height: 20,
+ width: 20,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextSecondary,
+ ),
onPressed: () => option.$3(),
),
),
diff --git a/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart b/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart
index aea4a8f..6c2a12e 100644
--- a/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart
+++ b/lib/pages_desktop_specific/ordinals/desktop_ordinal_details_view.dart
@@ -6,6 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
+import '../../app_config.dart';
import '../../models/isar/models/blockchain_data/utxo.dart';
import '../../models/isar/ordinal.dart';
import '../../networking/http.dart';
@@ -57,10 +58,11 @@ class _DesktopOrdinalDetailsViewState
final response = await client.get(
url: Uri.parse(widget.ordinal.content),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code != 200) {
@@ -71,10 +73,9 @@ class _DesktopOrdinalDetailsViewState
final bytes = response.bodyBytes;
- final dir =
- Platform.isAndroid
- ? await StackFileSystem.wtfAndroidDocumentsPath()
- : await getApplicationDocumentsDirectory();
+ final dir = Platform.isAndroid
+ ? await StackFileSystem.wtfAndroidDocumentsPath()
+ : await getApplicationDocumentsDirectory();
final filePath = path.join(
dir.path,
@@ -109,19 +110,17 @@ class _DesktopOrdinalDetailsViewState
const SizedBox(width: 32),
AppBarIconButton(
size: 32,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.textFieldDefaultBG,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.textFieldDefaultBG,
shadows: const [],
icon: SvgPicture.asset(
Assets.svg.arrowLeft,
width: 18,
height: 18,
- color:
- Theme.of(
- context,
- ).extension<StackColors>()!.topNavIconPrimary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.topNavIconPrimary,
),
onPressed: Navigator.of(context).pop,
),
@@ -213,10 +212,9 @@ class _DesktopOrdinalDetailsViewState
Assets.svg.arrowDown,
width: 13,
height: 18,
- color:
- Theme.of(context)
- .extension<StackColors>()!
- .buttonTextSecondary,
+ color: Theme.of(
+ context,
+ ).extension<StackColors>()!.buttonTextSecondary,
),
buttonHeight: ButtonHeight.l,
iconSpacing: 8,
@@ -276,28 +274,26 @@ class _DesktopOrdinalDetailsViewState
const _Divider(),
Consumer(
builder: (context, ref, _) {
- final coin =
- ref
- .watch(pWallets)
- .getWallet(widget.walletId)
- .info
- .coin;
+ final coin = ref
+ .watch(pWallets)
+ .getWallet(widget.walletId)
+ .info
+ .coin;
return _DetailsItemWCopy(
title: "Amount",
- data:
- utxo == null
- ? "ERROR"
- : ref
- .watch(pAmountFormatter(coin))
- .format(
- Amount(
- rawValue: BigInt.from(
- utxo!.value,
- ),
- fractionDigits:
- coin.fractionDigits,
+ data: utxo == null
+ ? "ERROR"
+ : ref
+ .watch(pAmountFormatter(coin))
+ .format(
+ Amount(
+ rawValue: BigInt.from(
+ utxo!.value,
),
+ fractionDigits:
+ coin.fractionDigits,
),
+ ),
);
},
),
diff --git a/lib/route_generator.dart b/lib/route_generator.dart
index 79c7ec4..4775dad 100644
--- a/lib/route_generator.dart
+++ b/lib/route_generator.dart
@@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:isar_community/isar.dart';
import 'package:tuple/tuple.dart';
+import 'app_config.dart';
import 'db/drift/database.dart';
import 'models/add_wallet_list_entity/add_wallet_list_entity.dart';
import 'models/add_wallet_list_entity/sub_classes/eth_token_entity.dart';
@@ -289,12 +290,11 @@ class RouteGenerator {
if (args is Tuple3<String, String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => ChooseCoinView(
- title: args.item1,
- coinAdditional: args.item2,
- nextRouteName: args.item3,
- ),
+ builder: (_) => ChooseCoinView(
+ title: args.item1,
+ coinAdditional: args.item2,
+ nextRouteName: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -344,11 +344,10 @@ class RouteGenerator {
} else if (args is Tuple2<String, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => EditWalletTokensView(
- walletId: args.item1,
- contractsToMarkSelected: args.item2,
- ),
+ builder: (_) => EditWalletTokensView(
+ walletId: args.item1,
+ contractsToMarkSelected: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -395,11 +394,10 @@ class RouteGenerator {
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => TokenContractDetailsView(
- contractAddress: args.item1,
- walletId: args.item2,
- ),
+ builder: (_) => TokenContractDetailsView(
+ contractAddress: args.item1,
+ walletId: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -409,11 +407,10 @@ class RouteGenerator {
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => SingleFieldEditView(
- initialValue: args.item1,
- label: args.item2,
- ),
+ builder: (_) => SingleFieldEditView(
+ initialValue: args.item1,
+ label: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -433,11 +430,10 @@ class RouteGenerator {
if (args is ({String walletName, FrostCurrency frostCurrency})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => CreateNewFrostMsWalletView(
- walletName: args.walletName,
- frostCurrency: args.frostCurrency,
- ),
+ builder: (_) => CreateNewFrostMsWalletView(
+ walletName: args.walletName,
+ frostCurrency: args.frostCurrency,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -447,11 +443,10 @@ class RouteGenerator {
if (args is ({String walletName, FrostCurrency frostCurrency})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => RestoreFrostMsWalletView(
- walletName: args.walletName,
- frostCurrency: args.frostCurrency,
- ),
+ builder: (_) => RestoreFrostMsWalletView(
+ walletName: args.walletName,
+ frostCurrency: args.frostCurrency,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -461,11 +456,10 @@ class RouteGenerator {
if (args is ({String walletName, FrostCurrency frostCurrency})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => SelectNewFrostImportTypeView(
- walletName: args.walletName,
- frostCurrency: args.frostCurrency,
- ),
+ builder: (_) => SelectNewFrostImportTypeView(
+ walletName: args.walletName,
+ frostCurrency: args.frostCurrency,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -512,11 +506,10 @@ class RouteGenerator {
if (args is ({String walletId, Map<String, int> resharers})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => CompleteReshareConfigView(
- walletId: args.walletId,
- resharers: args.resharers,
- ),
+ builder: (_) => CompleteReshareConfigView(
+ walletId: args.walletId,
+ resharers: args.resharers,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -526,8 +519,8 @@ class RouteGenerator {
if (args is ({String walletId, CryptoCurrency coin})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => FrostSendView(walletId: args.walletId, coin: args.coin),
+ builder: (_) =>
+ FrostSendView(walletId: args.walletId, coin: args.coin),
settings: RouteSettings(name: settings.name),
);
}
@@ -552,21 +545,20 @@ class RouteGenerator {
if (args is Tuple2<String, CoinControlViewType>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => CoinControlView(walletId: args.item1, type: args.item2),
+ builder: (_) =>
+ CoinControlView(walletId: args.item1, type: args.item2),
settings: RouteSettings(name: settings.name),
);
} else if (args
is Tuple4<String, CoinControlViewType, Amount?, Set<UTXO>?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => CoinControlView(
- walletId: args.item1,
- type: args.item2,
- requestedTotal: args.item3,
- selectedUTXOs: args.item4,
- ),
+ builder: (_) => CoinControlView(
+ walletId: args.item1,
+ type: args.item2,
+ requestedTotal: args.item3,
+ selectedUTXOs: args.item4,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -596,11 +588,10 @@ class RouteGenerator {
if (args is ({Ordinal ordinal, String walletId})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => OrdinalDetailsView(
- walletId: args.walletId,
- ordinal: args.ordinal,
- ),
+ builder: (_) => OrdinalDetailsView(
+ walletId: args.walletId,
+ ordinal: args.ordinal,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -610,11 +601,10 @@ class RouteGenerator {
if (args is ({Ordinal ordinal, String walletId})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => DesktopOrdinalDetailsView(
- walletId: args.walletId,
- ordinal: args.ordinal,
- ),
+ builder: (_) => DesktopOrdinalDetailsView(
+ walletId: args.walletId,
+ ordinal: args.ordinal,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -631,9 +621,8 @@ class RouteGenerator {
if (args is Tuple2<Id, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) =>
- UtxoDetailsView(walletId: args.item2, utxoId: args.item1),
+ builder: (_) =>
+ UtxoDetailsView(walletId: args.item2, utxoId: args.item1),
settings: RouteSettings(name: settings.name),
);
}
@@ -683,7 +672,9 @@ class RouteGenerator {
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder: (_) => CashFusionView(walletId: args),
+ builder: (_) => AppConfig.hasFeature(AppFeature.tor)
+ ? CashFusionView(walletId: args)
+ : throw Exception("Tor not configured in prebuild setup"),
settings: RouteSettings(name: settings.name),
);
}
@@ -703,9 +694,8 @@ class RouteGenerator {
if (args is ({String walletId, UTXO utxo})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) =>
- ManageDomainView(walletId: args.walletId, utxo: args.utxo),
+ builder: (_) =>
+ ManageDomainView(walletId: args.walletId, utxo: args.utxo),
settings: RouteSettings(name: settings.name),
);
}
@@ -825,21 +815,19 @@ class RouteGenerator {
if (args is ({String walletId, String name})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) =>
- BuySparkNameView(walletId: args.walletId, name: args.name),
+ builder: (_) =>
+ BuySparkNameView(walletId: args.walletId, name: args.name),
settings: RouteSettings(name: settings.name),
);
} else if (args
is ({String walletId, String name, SparkName? nameToRenew})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => BuySparkNameView(
- walletId: args.walletId,
- name: args.name,
- nameToRenew: args.nameToRenew,
- ),
+ builder: (_) => BuySparkNameView(
+ walletId: args.walletId,
+ name: args.name,
+ nameToRenew: args.nameToRenew,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -849,11 +837,10 @@ class RouteGenerator {
if (args is ({String walletId, TxData txData})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => ConfirmSparkNameTransactionView(
- walletId: args.walletId,
- txData: args.txData,
- ),
+ builder: (_) => ConfirmSparkNameTransactionView(
+ walletId: args.walletId,
+ txData: args.txData,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -863,11 +850,8 @@ class RouteGenerator {
if (args is ({String walletId, SparkName name})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => SparkNameDetailsView(
- walletId: args.walletId,
- name: args.name,
- ),
+ builder: (_) =>
+ SparkNameDetailsView(walletId: args.walletId, name: args.name),
settings: RouteSettings(name: settings.name),
);
}
@@ -877,7 +861,9 @@ class RouteGenerator {
if (args is String) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder: (_) => FusionProgressView(walletId: args),
+ builder: (_) => AppConfig.hasFeature(AppFeature.tor)
+ ? FusionProgressView(walletId: args)
+ : throw Exception("Tor not configured in prebuild setup"),
settings: RouteSettings(name: settings.name),
);
}
@@ -1024,14 +1010,18 @@ class RouteGenerator {
case TorSettingsView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder: (_) => const TorSettingsView(),
+ builder: (_) => AppConfig.hasFeature(AppFeature.tor)
+ ? const TorSettingsView()
+ : throw Exception("Tor not configured in prebuild setup"),
settings: RouteSettings(name: settings.name),
);
case TorSettings.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder: (_) => const TorSettings(),
+ builder: (_) => AppConfig.hasFeature(AppFeature.tor)
+ ? const TorSettings()
+ : throw Exception("Tor not configured in prebuild setup"),
settings: RouteSettings(name: settings.name),
);
@@ -1208,12 +1198,11 @@ class RouteGenerator {
if (args is Tuple3<CryptoCurrency, String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => NodeDetailsView(
- coin: args.item1,
- nodeId: args.item2,
- popRouteName: args.item3,
- ),
+ builder: (_) => NodeDetailsView(
+ coin: args.item1,
+ nodeId: args.item2,
+ popRouteName: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1223,8 +1212,8 @@ class RouteGenerator {
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => EditNoteView(txid: args.item1, walletId: args.item2),
+ builder: (_) =>
+ EditNoteView(txid: args.item1, walletId: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1244,8 +1233,8 @@ class RouteGenerator {
if (args is Tuple2<String, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => EditTradeNoteView(tradeId: args.item1, note: args.item2),
+ builder: (_) =>
+ EditTradeNoteView(tradeId: args.item1, note: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1256,13 +1245,12 @@ class RouteGenerator {
is Tuple4<AddEditNodeViewType, CryptoCurrency, String?, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => AddEditNodeView(
- viewType: args.item1,
- coin: args.item2,
- nodeId: args.item3,
- routeOnSuccessOrDelete: args.item4,
- ),
+ builder: (_) => AddEditNodeView(
+ viewType: args.item1,
+ coin: args.item2,
+ nodeId: args.item3,
+ routeOnSuccessOrDelete: args.item4,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1302,11 +1290,10 @@ class RouteGenerator {
if (args is Tuple2<String, ContactAddressEntry>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => EditContactAddressView(
- contactId: args.item1,
- addressEntry: args.item2,
- ),
+ builder: (_) => EditContactAddressView(
+ contactId: args.item1,
+ addressEntry: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1323,12 +1310,11 @@ class RouteGenerator {
if (args is Tuple3<String, WalletSyncStatus, NodeConnectionStatus>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => WalletNetworkSettingsView(
- walletId: args.item1,
- initialSyncStatus: args.item2,
- initialNodeStatus: args.item3,
- ),
+ builder: (_) => WalletNetworkSettingsView(
+ walletId: args.item1,
+ initialSyncStatus: args.item2,
+ initialNodeStatus: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1338,11 +1324,10 @@ class RouteGenerator {
if (args is ({String walletId, List<String> mnemonic})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => WalletBackupView(
- walletId: args.walletId,
- mnemonic: args.mnemonic,
- ),
+ builder: (_) => WalletBackupView(
+ walletId: args.walletId,
+ mnemonic: args.mnemonic,
+ ),
settings: RouteSettings(name: settings.name),
);
} else if (args
@@ -1359,12 +1344,11 @@ class RouteGenerator {
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => WalletBackupView(
- walletId: args.walletId,
- mnemonic: args.mnemonic,
- frostWalletData: args.frostWalletData,
- ),
+ builder: (_) => WalletBackupView(
+ walletId: args.walletId,
+ mnemonic: args.mnemonic,
+ frostWalletData: args.frostWalletData,
+ ),
settings: RouteSettings(name: settings.name),
);
} else if (args
@@ -1375,12 +1359,11 @@ class RouteGenerator {
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => WalletBackupView(
- walletId: args.walletId,
- mnemonic: args.mnemonic,
- keyData: args.keyData,
- ),
+ builder: (_) => WalletBackupView(
+ walletId: args.walletId,
+ mnemonic: args.mnemonic,
+ keyData: args.keyData,
+ ),
settings: RouteSettings(name: settings.name),
);
} else if (args
@@ -1398,13 +1381,12 @@ class RouteGenerator {
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => WalletBackupView(
- walletId: args.walletId,
- mnemonic: args.mnemonic,
- frostWalletData: args.frostWalletData,
- keyData: args.keyData,
- ),
+ builder: (_) => WalletBackupView(
+ walletId: args.walletId,
+ mnemonic: args.mnemonic,
+ frostWalletData: args.frostWalletData,
+ keyData: args.keyData,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1414,11 +1396,10 @@ class RouteGenerator {
if (args is ({String walletId, KeyDataInterface keyData})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => MobileKeyDataView(
- walletId: args.walletId,
- keyData: args.keyData,
- ),
+ builder: (_) => MobileKeyDataView(
+ walletId: args.walletId,
+ keyData: args.keyData,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1468,11 +1449,8 @@ class RouteGenerator {
if (args is Tuple2<AddWalletType, CryptoCurrency>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => NameYourWalletView(
- addWalletType: args.item1,
- coin: args.item2,
- ),
+ builder: (_) =>
+ NameYourWalletView(addWalletType: args.item1, coin: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1482,11 +1460,10 @@ class RouteGenerator {
if (args is Tuple2<String, CryptoCurrency>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => NewWalletRecoveryPhraseWarningView(
- walletName: args.item1,
- coin: args.item2,
- ),
+ builder: (_) => NewWalletRecoveryPhraseWarningView(
+ walletName: args.item1,
+ coin: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1496,11 +1473,8 @@ class RouteGenerator {
if (args is Tuple2<String, CryptoCurrency>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => RestoreOptionsView(
- walletName: args.item1,
- coin: args.item2,
- ),
+ builder: (_) =>
+ RestoreOptionsView(walletName: args.item1, coin: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1510,11 +1484,8 @@ class RouteGenerator {
if (args is Tuple2<String, CryptoCurrency>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => NewWalletOptionsView(
- walletName: args.item1,
- coin: args.item2,
- ),
+ builder: (_) =>
+ NewWalletOptionsView(walletName: args.item1, coin: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1524,14 +1495,13 @@ class RouteGenerator {
if (args is Tuple5<String, CryptoCurrency, int, int, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => RestoreWalletView(
- walletName: args.item1,
- coin: args.item2,
- seedWordsLength: args.item3,
- restoreBlockHeight: args.item4,
- mnemonicPassphrase: args.item5,
- ),
+ builder: (_) => RestoreWalletView(
+ walletName: args.item1,
+ coin: args.item2,
+ seedWordsLength: args.item3,
+ restoreBlockHeight: args.item4,
+ mnemonicPassphrase: args.item5,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1546,12 +1516,11 @@ class RouteGenerator {
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => RestoreViewOnlyWalletView(
- walletName: args.walletName,
- coin: args.coin,
- restoreBlockHeight: args.restoreBlockHeight,
- ),
+ builder: (_) => RestoreViewOnlyWalletView(
+ walletName: args.walletName,
+ coin: args.coin,
+ restoreBlockHeight: args.restoreBlockHeight,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1561,11 +1530,10 @@ class RouteGenerator {
if (args is Tuple2<Wallet, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => NewWalletRecoveryPhraseView(
- wallet: args.item1,
- mnemonic: args.item2,
- ),
+ builder: (_) => NewWalletRecoveryPhraseView(
+ wallet: args.item1,
+ mnemonic: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1575,11 +1543,10 @@ class RouteGenerator {
if (args is Tuple2<Wallet, List<String>>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => VerifyRecoveryPhraseView(
- wallet: args.item1,
- mnemonic: args.item2,
- ),
+ builder: (_) => VerifyRecoveryPhraseView(
+ wallet: args.item1,
+ mnemonic: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1605,12 +1572,11 @@ class RouteGenerator {
if (args is Tuple3<Transaction, CryptoCurrency, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => TransactionDetailsView(
- transaction: args.item1,
- coin: args.item2,
- walletId: args.item3,
- ),
+ builder: (_) => TransactionDetailsView(
+ transaction: args.item1,
+ coin: args.item2,
+ walletId: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1621,12 +1587,11 @@ class RouteGenerator {
is ({TransactionV2 tx, CryptoCurrency coin, String walletId})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => tvd.TransactionV2DetailsView(
- transaction: args.tx,
- coin: args.coin,
- walletId: args.walletId,
- ),
+ builder: (_) => tvd.TransactionV2DetailsView(
+ transaction: args.tx,
+ coin: args.coin,
+ walletId: args.walletId,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1641,12 +1606,11 @@ class RouteGenerator {
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => FusionGroupDetailsView(
- transactions: args.transactions,
- coin: args.coin,
- walletId: args.walletId,
- ),
+ builder: (_) => FusionGroupDetailsView(
+ transactions: args.transactions,
+ coin: args.coin,
+ walletId: args.walletId,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1673,11 +1637,10 @@ class RouteGenerator {
if (args is ({String walletId, String contractAddress})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => AllTransactionsV2View(
- walletId: args.walletId,
- contractAddress: args.contractAddress,
- ),
+ builder: (_) => AllTransactionsV2View(
+ walletId: args.walletId,
+ contractAddress: args.contractAddress,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1703,11 +1666,8 @@ class RouteGenerator {
} else if (args is Tuple2<String, EthContract?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => ReceiveView(
- walletId: args.item1,
- tokenContract: args.item2,
- ),
+ builder: (_) =>
+ ReceiveView(walletId: args.item1, tokenContract: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1737,11 +1697,8 @@ class RouteGenerator {
if (args is Tuple2<Id, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => AddressDetailsView(
- walletId: args.item2,
- addressId: args.item1,
- ),
+ builder: (_) =>
+ AddressDetailsView(walletId: args.item2, addressId: args.item1),
settings: RouteSettings(name: settings.name),
);
}
@@ -1758,23 +1715,21 @@ class RouteGenerator {
is Tuple3<String, CryptoCurrency, SendViewAutoFillData>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => SendView(
- walletId: args.item1,
- coin: args.item2,
- autoFillData: args.item3,
- ),
+ builder: (_) => SendView(
+ walletId: args.item1,
+ coin: args.item2,
+ autoFillData: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
} else if (args is Tuple3<String, CryptoCurrency, PaynymAccountLite>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => SendView(
- walletId: args.item1,
- coin: args.item2,
- accountLite: args.item3,
- ),
+ builder: (_) => SendView(
+ walletId: args.item1,
+ coin: args.item2,
+ accountLite: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
} else if (args is ({CryptoCurrency coin, String walletId})) {
@@ -1791,12 +1746,11 @@ class RouteGenerator {
if (args is Tuple3<String, CryptoCurrency, EthContract>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => TokenSendView(
- walletId: args.item1,
- coin: args.item2,
- tokenContract: args.item3,
- ),
+ builder: (_) => TokenSendView(
+ walletId: args.item1,
+ coin: args.item2,
+ tokenContract: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1806,12 +1760,11 @@ class RouteGenerator {
if (args is (TxData, String, VoidCallback)) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => ConfirmTransactionView(
- txData: args.$1,
- walletId: args.$2,
- onSuccess: args.$3,
- ),
+ builder: (_) => ConfirmTransactionView(
+ txData: args.$1,
+ walletId: args.$2,
+ onSuccess: args.$3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1821,11 +1774,8 @@ class RouteGenerator {
if (args is (TxData, String)) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => ConfirmNameTransactionView(
- txData: args.$1,
- walletId: args.$2,
- ),
+ builder: (_) =>
+ ConfirmNameTransactionView(txData: args.$1, walletId: args.$2),
settings: RouteSettings(name: settings.name),
);
}
@@ -1835,37 +1785,35 @@ class RouteGenerator {
if (args is Tuple2<String, CryptoCurrency>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => Stack(
- children: [
- WalletInitiatedExchangeView(
- walletId: args.item1,
- coin: args.item2,
- ),
- // ExchangeLoadingOverlayView(
- // unawaitedLoad: args.item3,
- // ),
- ],
+ builder: (_) => Stack(
+ children: [
+ WalletInitiatedExchangeView(
+ walletId: args.item1,
+ coin: args.item2,
),
+ // ExchangeLoadingOverlayView(
+ // unawaitedLoad: args.item3,
+ // ),
+ ],
+ ),
settings: RouteSettings(name: settings.name),
);
}
if (args is Tuple3<String, CryptoCurrency, EthContract?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => Stack(
- children: [
- WalletInitiatedExchangeView(
- walletId: args.item1,
- coin: args.item2,
- contract: args.item3,
- ),
- // ExchangeLoadingOverlayView(
- // unawaitedLoad: args.item3,
- // ),
- ],
+ builder: (_) => Stack(
+ children: [
+ WalletInitiatedExchangeView(
+ walletId: args.item1,
+ coin: args.item2,
+ contract: args.item3,
),
+ // ExchangeLoadingOverlayView(
+ // unawaitedLoad: args.item3,
+ // ),
+ ],
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1891,13 +1839,12 @@ class RouteGenerator {
>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => WalletSettingsView(
- walletId: args.item1,
- coin: args.item2,
- initialSyncStatus: args.item3,
- initialNodeStatus: args.item4,
- ),
+ builder: (_) => WalletSettingsView(
+ walletId: args.item1,
+ coin: args.item2,
+ initialSyncStatus: args.item3,
+ initialNodeStatus: args.item4,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1907,11 +1854,10 @@ class RouteGenerator {
if (args is ({String walletId, List<String> mnemonicWords})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => DeleteWalletRecoveryPhraseView(
- mnemonic: args.mnemonicWords,
- walletId: args.walletId,
- ),
+ builder: (_) => DeleteWalletRecoveryPhraseView(
+ mnemonic: args.mnemonicWords,
+ walletId: args.walletId,
+ ),
settings: RouteSettings(name: settings.name),
);
} else if (args
@@ -1928,12 +1874,11 @@ class RouteGenerator {
})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => DeleteWalletRecoveryPhraseView(
- mnemonic: args.mnemonicWords,
- walletId: args.walletId,
- frostWalletData: args.frostWalletData,
- ),
+ builder: (_) => DeleteWalletRecoveryPhraseView(
+ mnemonic: args.mnemonicWords,
+ walletId: args.walletId,
+ frostWalletData: args.frostWalletData,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1943,11 +1888,10 @@ class RouteGenerator {
if (args is ({String walletId, ViewOnlyWalletData data})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => DeleteViewOnlyWalletKeysView(
- data: args.data,
- walletId: args.walletId,
- ),
+ builder: (_) => DeleteViewOnlyWalletKeysView(
+ data: args.data,
+ walletId: args.walletId,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -1999,13 +1943,12 @@ class RouteGenerator {
if (args is Tuple4<String, Transaction?, String?, String?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => TradeDetailsView(
- tradeId: args.item1,
- transactionIfSentFromStack: args.item2,
- walletId: args.item3,
- walletName: args.item4,
- ),
+ builder: (_) => TradeDetailsView(
+ tradeId: args.item1,
+ transactionIfSentFromStack: args.item2,
+ walletId: args.item3,
+ walletName: args.item4,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -2025,13 +1968,12 @@ class RouteGenerator {
if (args is Tuple4<CryptoCurrency, Amount, String, Trade>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => SendFromView(
- coin: args.item1,
- amount: args.item2,
- trade: args.item4,
- address: args.item3,
- ),
+ builder: (_) => SendFromView(
+ coin: args.item1,
+ amount: args.item2,
+ trade: args.item4,
+ address: args.item3,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -2041,11 +1983,10 @@ class RouteGenerator {
if (args is Tuple2<CryptoCurrency, String>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => GenerateUriQrCodeView(
- coin: args.item1,
- receivingAddress: args.item2,
- ),
+ builder: (_) => GenerateUriQrCodeView(
+ coin: args.item1,
+ receivingAddress: args.item2,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -2095,11 +2036,10 @@ class RouteGenerator {
if (args is ({String walletId, String domainName})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => BuyDomainView(
- walletId: args.walletId,
- domainName: args.domainName,
- ),
+ builder: (_) => BuyDomainView(
+ walletId: args.walletId,
+ domainName: args.domainName,
+ ),
settings: RouteSettings(name: settings.name),
);
}
@@ -2183,8 +2123,8 @@ class RouteGenerator {
if (args is Tuple2<CryptoCurrency, EthContract?>) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => BuyInWalletView(coin: args.item1, contract: args.item2),
+ builder: (_) =>
+ BuyInWalletView(coin: args.item1, contract: args.item2),
settings: RouteSettings(name: settings.name),
);
}
@@ -2546,11 +2486,10 @@ class RouteGenerator {
} else if (args is ({String walletId, bool popPrevious})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
- builder:
- (_) => TokenView(
- walletId: args.walletId,
- popPrevious: args.popPrevious,
- ),
+ builder: (_) => TokenView(
+ walletId: args.walletId,
+ popPrevious: args.popPrevious,
+ ),
settings: RouteSettings(name: settings.name),
);
}
diff --git a/lib/services/buy/simplex/simplex_api.dart b/lib/services/buy/simplex/simplex_api.dart
index eed33ea..8fff497 100644
--- a/lib/services/buy/simplex/simplex_api.dart
+++ b/lib/services/buy/simplex/simplex_api.dart
@@ -51,15 +51,15 @@ class SimplexAPI {
final Map<String, String> headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
- final Map<String, String> data = {
- 'ROUTE': 'supported_cryptos',
- };
+ final Map<String, String> data = {'ROUTE': 'supported_cryptos'};
final Uri url = _buildUri('api.php', data);
final res = await client.post(
url: url,
headers: headers,
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -78,10 +78,7 @@ class SimplexAPI {
stackTrace: s,
);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -107,16 +104,9 @@ class SimplexAPI {
return BuyResponse(value: cryptos);
} catch (e, s) {
- Logging.instance.e(
- "_parseSupported exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("_parseSupported exception", error: e, stackTrace: s);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -126,15 +116,15 @@ class SimplexAPI {
final Map<String, String> headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
- final Map<String, String> data = {
- 'ROUTE': 'supported_fiats',
- };
+ final Map<String, String> data = {'ROUTE': 'supported_fiats'};
final Uri url = _buildUri('api.php', data);
final res = await client.post(
url: url,
headers: headers,
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -147,13 +137,13 @@ class SimplexAPI {
return _parseSupportedFiats(jsonArray);
} catch (e, s) {
- Logging.instance
- .e("getAvailableCurrencies exception: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "getAvailableCurrencies exception: ",
+ error: e,
+ stackTrace: s,
+ );
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -169,8 +159,9 @@ class SimplexAPI {
fiats.add(
Fiat.fromJson({
'ticker': "${fiat['ticker_symbol']}",
- 'name': fiatFromTickerCaseInsensitive("${fiat['ticker_symbol']}")
- .prettyName,
+ 'name': fiatFromTickerCaseInsensitive(
+ "${fiat['ticker_symbol']}",
+ ).prettyName,
'minAmount': "${fiat['min_amount']}",
'maxAmount': "${fiat['max_amount']}",
'image': "",
@@ -181,16 +172,9 @@ class SimplexAPI {
return BuyResponse(value: fiats);
} catch (e, s) {
- Logging.instance.e(
- "_parseSupported exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("_parseSupported exception", error: e, stackTrace: s);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -222,7 +206,9 @@ class SimplexAPI {
final res = await client.get(
url: url,
headers: headers,
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -241,16 +227,9 @@ class SimplexAPI {
return _parseQuote(jsonArray);
} catch (e, s) {
- Logging.instance.e(
- "getQuote exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("getQuote exception", error: e, stackTrace: s);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -280,8 +259,9 @@ class SimplexAPI {
youPayFiatPrice: quote.buyWithFiat
? quote.youPayFiatPrice
: Decimal.parse("${jsonArray['fiat_money']['base_amount']}"),
- youReceiveCryptoAmount:
- Decimal.parse("${jsonArray['digital_money']['amount']}"),
+ youReceiveCryptoAmount: Decimal.parse(
+ "${jsonArray['digital_money']['amount']}",
+ ),
id: jsonArray['quote_id'] as String,
receivingAddress: quote.receivingAddress,
buyWithFiat: quote.buyWithFiat,
@@ -289,16 +269,9 @@ class SimplexAPI {
return BuyResponse(value: _quote);
} catch (e, s) {
- Logging.instance.e(
- "_parseQuote exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("_parseQuote exception", error: e, stackTrace: s);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -329,8 +302,9 @@ class SimplexAPI {
data['USER_ID'] = userID;
}
if (signupEpoch != null && signupEpoch != 0) {
- final DateTime date =
- DateTime.fromMillisecondsSinceEpoch(signupEpoch * 1000);
+ final DateTime date = DateTime.fromMillisecondsSinceEpoch(
+ signupEpoch * 1000,
+ );
data['SIGNUP_TIMESTAMP'] =
date.toIso8601String() + timeZoneFormatter(date.timeZoneOffset);
}
@@ -339,7 +313,9 @@ class SimplexAPI {
final res = await client.get(
url: url,
headers: headers,
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -362,16 +338,9 @@ class SimplexAPI {
return BuyResponse(value: _order);
} catch (e, s) {
- Logging.instance.e(
- "newOrder exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("newOrder exception", error: e, stackTrace: s);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
@@ -394,16 +363,9 @@ class SimplexAPI {
return BuyResponse(value: status);
} catch (e, s) {
- Logging.instance.e(
- "newOrder exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("newOrder exception", error: e, stackTrace: s);
return BuyResponse(
- exception: BuyException(
- e.toString(),
- BuyExceptionType.generic,
- ),
+ exception: BuyException(e.toString(), BuyExceptionType.generic),
);
}
}
diff --git a/lib/services/coins/tezos/api/tezos_api.dart b/lib/services/coins/tezos/api/tezos_api.dart
index 6c21935..a85e6b2 100644
--- a/lib/services/coins/tezos/api/tezos_api.dart
+++ b/lib/services/coins/tezos/api/tezos_api.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import '../../../../app_config.dart';
import '../../../../networking/http.dart';
import '../../../../utilities/logger.dart';
import '../../../../utilities/prefs.dart';
@@ -17,7 +18,9 @@ abstract final class TezosAPI {
final response = await _client.get(
url: Uri.parse(uriString),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -25,7 +28,11 @@ abstract final class TezosAPI {
final result = jsonDecode(response.body);
return result as int;
} catch (e, s) {
- Logging.instance.e("Error occurred in TezosAPI while getting counter for $address: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Error occurred in TezosAPI while getting counter for $address: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
@@ -39,7 +46,9 @@ abstract final class TezosAPI {
final response = await _client.get(
url: Uri.parse(uriString),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -50,7 +59,11 @@ abstract final class TezosAPI {
return account;
} catch (e, s) {
- Logging.instance.e("Error occurred in TezosAPI while getting account for $address: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Error occurred in TezosAPI while getting account for $address: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
@@ -63,7 +76,9 @@ abstract final class TezosAPI {
final response = await _client.get(
url: Uri.parse(transactionsCall),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -78,9 +93,10 @@ abstract final class TezosAPI {
hash: tx["hash"] as String,
type: tx["type"] as String,
height: tx["level"] as int,
- timestamp: DateTime.parse(tx["timestamp"].toString())
- .toUtc()
- .millisecondsSinceEpoch ~/
+ timestamp:
+ DateTime.parse(
+ tx["timestamp"].toString(),
+ ).toUtc().millisecondsSinceEpoch ~/
1000,
cycle: tx["cycle"] as int?,
counter: tx["counter"] as int,
@@ -91,7 +107,8 @@ abstract final class TezosAPI {
gasUsed: tx["gasUsed"] as int,
storageLimit: tx["storageLimit"] as int?,
amountInMicroTez: tx["amount"] as int,
- feeInMicroTez: (tx["bakerFee"] as int? ?? 0) +
+ feeInMicroTez:
+ (tx["bakerFee"] as int? ?? 0) +
(tx["storageFee"] as int? ?? 0) +
(tx["allocationFee"] as int? ?? 0),
burnedAmountInMicroTez: tx["burned"] as int?,
@@ -103,7 +120,11 @@ abstract final class TezosAPI {
}
return txs;
} catch (e, s) {
- Logging.instance.e("Error occurred in TezosAPI while getting transactions for $address: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Error occurred in TezosAPI while getting transactions for $address: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
diff --git a/lib/services/coins/tezos/api/tezos_rpc_api.dart b/lib/services/coins/tezos/api/tezos_rpc_api.dart
index 688d9f6..67316c2 100644
--- a/lib/services/coins/tezos/api/tezos_rpc_api.dart
+++ b/lib/services/coins/tezos/api/tezos_rpc_api.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import '../../../../app_config.dart';
import '../../../../networking/http.dart';
import '../../../../utilities/logger.dart';
import '../../../../utilities/prefs.dart';
@@ -19,13 +20,16 @@ abstract final class TezosRpcAPI {
final response = await _client.get(
url: Uri.parse(balanceCall),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
- final balance =
- BigInt.parse(response.body.substring(1, response.body.length - 2));
+ final balance = BigInt.parse(
+ response.body.substring(1, response.body.length - 2),
+ );
return balance;
} catch (e, s) {
Logging.instance.e(
@@ -47,7 +51,9 @@ abstract final class TezosRpcAPI {
final response = await _client.get(
url: Uri.parse(api),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
diff --git a/lib/services/ethereum/ethereum_api.dart b/lib/services/ethereum/ethereum_api.dart
index fd64494..efffc51 100644
--- a/lib/services/ethereum/ethereum_api.dart
+++ b/lib/services/ethereum/ethereum_api.dart
@@ -10,6 +10,7 @@
import 'dart:convert';
+import '../../app_config.dart';
import '../../dto/ethereum/eth_token_tx_dto.dart';
import '../../dto/ethereum/eth_tx_dto.dart';
import '../../models/isar/models/ethereum/eth_contract.dart';
@@ -57,10 +58,11 @@ abstract class EthereumAPI {
url: Uri.parse(
"$stackBaseServer/export?addrs=$address&firstBlock=$firstBlock&unripe=true",
),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
@@ -110,10 +112,11 @@ abstract class EthereumAPI {
url: Uri.parse(
"$stackBaseServer/export?addrs=$address&emitter=$tokenContractAddress&logs=true",
),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
@@ -164,10 +167,11 @@ abstract class EthereumAPI {
);
final response = await client.get(
url: uri,
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
@@ -203,10 +207,11 @@ abstract class EthereumAPI {
try {
final response = await client.get(
url: Uri.parse("$stackBaseServer/gas-prices"),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
@@ -267,10 +272,11 @@ abstract class EthereumAPI {
url: Uri.parse(
"$stackBaseServer/names?terms=$contractAddress&autoname=$contractAddress&all",
),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
}
@@ -284,10 +290,11 @@ abstract class EthereumAPI {
// "$stackBaseServer/tokens?addrs=$contractAddress&parts=all",
"$stackBaseServer/names?terms=$contractAddress&all",
),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
@@ -371,10 +378,11 @@ abstract class EthereumAPI {
url: Uri.parse(
"$stackBaseServer/abis?addrs=$contractAddress&verbose=true",
),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
@@ -408,10 +416,11 @@ abstract class EthereumAPI {
url: Uri.parse(
"$stackBaseServer/state?addrs=$contractAddress&parts=proxy",
),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
if (response.code == 200) {
final json = jsonDecode(response.body);
diff --git a/lib/services/exchange/change_now/change_now_api.dart b/lib/services/exchange/change_now/change_now_api.dart
index 7b5cd07..8702874 100644
--- a/lib/services/exchange/change_now/change_now_api.dart
+++ b/lib/services/exchange/change_now/change_now_api.dart
@@ -13,6 +13,7 @@ import 'dart:convert';
import 'package:decimal/decimal.dart';
import 'package:flutter/foundation.dart';
+import '../../../app_config.dart';
import '../../../exceptions/exchange/exchange_exception.dart';
import '../../../exceptions/exchange/pair_unavailable_exception.dart';
import '../../../external_api_keys.dart';
@@ -73,10 +74,11 @@ class ChangeNowAPI {
"Content-Type": "application/json",
"x-changenow-api-key": apiKey,
},
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
final data = response.body;
@@ -103,10 +105,11 @@ class ChangeNowAPI {
"x-changenow-api-key": apiKey,
},
body: jsonEncode(body),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
String? data;
@@ -209,10 +212,9 @@ class ChangeNowAPI {
currencies.add(
Currency.fromJson(
map,
- rateType:
- (map["supportsFixedRate"] as bool)
- ? SupportedRateType.both
- : SupportedRateType.estimated,
+ rateType: (map["supportsFixedRate"] as bool)
+ ? SupportedRateType.both
+ : SupportedRateType.estimated,
exchangeName: ChangeNowExchange.exchangeName,
),
);
diff --git a/lib/services/exchange/nanswap/nanswap_api.dart b/lib/services/exchange/nanswap/nanswap_api.dart
index 6e28485..00aea8d 100644
--- a/lib/services/exchange/nanswap/nanswap_api.dart
+++ b/lib/services/exchange/nanswap/nanswap_api.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
+import '../../../app_config.dart';
import '../../../exceptions/exchange/exchange_exception.dart';
import '../../../external_api_keys.dart';
import '../../../networking/http.dart';
@@ -34,10 +35,11 @@ class NanswapAPI {
final response = await _client.get(
url: uri,
headers: {'Accept': 'application/json'},
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
code = response.code;
@@ -66,10 +68,11 @@ class NanswapAPI {
'Accept': 'application/json',
},
body: jsonEncode(body),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
code = response.code;
diff --git a/lib/services/exchange/simpleswap/simpleswap_api.dart b/lib/services/exchange/simpleswap/simpleswap_api.dart
index 0a53282..d744012 100644
--- a/lib/services/exchange/simpleswap/simpleswap_api.dart
+++ b/lib/services/exchange/simpleswap/simpleswap_api.dart
@@ -15,6 +15,7 @@ import 'package:flutter/foundation.dart';
import 'package:tuple/tuple.dart';
import 'package:uuid/uuid.dart';
+import '../../../app_config.dart';
import '../../../exceptions/exchange/exchange_exception.dart';
import '../../../external_api_keys.dart';
import '../../../models/exchange/response_objects/fixed_rate_market.dart';
@@ -48,7 +49,9 @@ class SimpleSwapAPI {
try {
final response = await client.get(
url: uri,
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -59,22 +62,24 @@ class SimpleSwapAPI {
return parsed;
} catch (e, s) {
- Logging.instance
- .e("_makeRequest($uri) HTTP:$code threw: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "_makeRequest($uri) HTTP:$code threw: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
- Future<dynamic> _makePostRequest(
- Uri uri,
- Map<String, dynamic> body,
- ) async {
+ Future<dynamic> _makePostRequest(Uri uri, Map<String, dynamic> body) async {
try {
final response = await client.post(
url: uri,
headers: {'Content-Type': 'application/json'},
body: jsonEncode(body),
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -86,11 +91,7 @@ class SimpleSwapAPI {
throw Exception("response: ${response.body}");
} catch (e, s) {
- Logging.instance.e(
- "_makeRequest($uri) threw",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("_makeRequest($uri) threw", error: e, stackTrace: s);
rethrow;
}
}
@@ -117,8 +118,9 @@ class SimpleSwapAPI {
"extraIdTo": extraIdTo,
};
- final uri =
- _buildUri("/create_exchange", {"api_key": apiKey ?? kSimpleSwapApiKey});
+ final uri = _buildUri("/create_exchange", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ });
try {
final jsonObject = await _makePostRequest(uri, body);
@@ -150,8 +152,11 @@ class SimpleSwapAPI {
);
return ExchangeResponse(value: trade, exception: null);
} catch (e, s) {
- Logging.instance
- .e("getAvailableCurrencies exception: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "getAvailableCurrencies exception: ",
+ error: e,
+ stackTrace: s,
+ );
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
@@ -166,18 +171,20 @@ class SimpleSwapAPI {
String? apiKey,
required bool fixedRate,
}) async {
- final uri = _buildUri(
- "/get_all_currencies",
- {"api_key": apiKey ?? kSimpleSwapApiKey},
- );
+ final uri = _buildUri("/get_all_currencies", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ });
try {
final jsonArray = await _makeGetRequest(uri);
return await compute(_parseAvailableCurrenciesJson, jsonArray as List);
} catch (e, s) {
- Logging.instance
- .e("getAvailableCurrencies exception: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "getAvailableCurrencies exception: ",
+ error: e,
+ stackTrace: s,
+ );
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
@@ -195,8 +202,9 @@ class SimpleSwapAPI {
for (final json in jsonArray) {
try {
- currencies
- .add(SPCurrency.fromJson(Map<String, dynamic>.from(json as Map)));
+ currencies.add(
+ SPCurrency.fromJson(Map<String, dynamic>.from(json as Map)),
+ );
} catch (_) {
return ExchangeResponse(
exception: ExchangeException(
@@ -227,13 +235,10 @@ class SimpleSwapAPI {
required String symbol,
String? apiKey,
}) async {
- final uri = _buildUri(
- "/get_currency",
- {
- "api_key": apiKey ?? kSimpleSwapApiKey,
- "symbol": symbol,
- },
- );
+ final uri = _buildUri("/get_currency", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ "symbol": symbol,
+ });
try {
final jsonObject = await _makeGetRequest(uri);
@@ -244,11 +249,7 @@ class SimpleSwapAPI {
),
);
} catch (e, s) {
- Logging.instance.e(
- "getCurrency exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("getCurrency exception", error: e, stackTrace: s);
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
@@ -264,13 +265,10 @@ class SimpleSwapAPI {
required bool isFixedRate,
String? apiKey,
}) async {
- final uri = _buildUri(
- "/get_all_pairs",
- {
- "api_key": apiKey ?? kSimpleSwapApiKey,
- "fixed": isFixedRate.toString(),
- },
- );
+ final uri = _buildUri("/get_all_pairs", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ "fixed": isFixedRate.toString(),
+ });
try {
final jsonObject = await _makeGetRequest(uri);
@@ -280,11 +278,7 @@ class SimpleSwapAPI {
);
return result;
} catch (e, s) {
- Logging.instance.e(
- "getAllPairs exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("getAllPairs exception", error: e, stackTrace: s);
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
@@ -347,27 +341,20 @@ class SimpleSwapAPI {
required String amount,
String? apiKey,
}) async {
- final uri = _buildUri(
- "/get_estimated",
- {
- "api_key": apiKey ?? kSimpleSwapApiKey,
- "fixed": isFixedRate.toString(),
- "currency_from": currencyFrom,
- "currency_to": currencyTo,
- "amount": amount,
- },
- );
+ final uri = _buildUri("/get_estimated", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ "fixed": isFixedRate.toString(),
+ "currency_from": currencyFrom,
+ "currency_to": currencyTo,
+ "amount": amount,
+ });
try {
final jsonObject = await _makeGetRequest(uri);
return ExchangeResponse(value: jsonObject as String);
} catch (e, s) {
- Logging.instance.e(
- "getEstimated exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("getEstimated exception", error: e, stackTrace: s);
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
@@ -383,13 +370,10 @@ class SimpleSwapAPI {
String? apiKey,
Trade? oldTrade,
}) async {
- final uri = _buildUri(
- "/get_exchange",
- {
- "api_key": apiKey ?? kSimpleSwapApiKey,
- "id": exchangeId,
- },
- );
+ final uri = _buildUri("/get_exchange", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ "id": exchangeId,
+ });
try {
final jsonObject = await _makeGetRequest(uri);
@@ -423,11 +407,7 @@ class SimpleSwapAPI {
return ExchangeResponse(value: trade);
} catch (e, s) {
- Logging.instance.e(
- "getExchange exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("getExchange exception", error: e, stackTrace: s);
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
@@ -444,15 +424,12 @@ class SimpleSwapAPI {
required String currencyTo,
String? apiKey,
}) async {
- final uri = _buildUri(
- "/get_ranges",
- {
- "api_key": apiKey ?? kSimpleSwapApiKey,
- "fixed": isFixedRate.toString(),
- "currency_from": currencyFrom,
- "currency_to": currencyTo,
- },
- );
+ final uri = _buildUri("/get_ranges", {
+ "api_key": apiKey ?? kSimpleSwapApiKey,
+ "fixed": isFixedRate.toString(),
+ "currency_from": currencyFrom,
+ "currency_to": currencyTo,
+ });
try {
final jsonObject = await _makeGetRequest(uri);
@@ -465,11 +442,7 @@ class SimpleSwapAPI {
),
);
} catch (e, s) {
- Logging.instance.e(
- "getRange exception",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("getRange exception", error: e, stackTrace: s);
return ExchangeResponse(
exception: ExchangeException(
e.toString(),
diff --git a/lib/services/exchange/trocador/trocador_api.dart b/lib/services/exchange/trocador/trocador_api.dart
index 917fee3..2869cef 100644
--- a/lib/services/exchange/trocador/trocador_api.dart
+++ b/lib/services/exchange/trocador/trocador_api.dart
@@ -12,6 +12,7 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
+import '../../../app_config.dart';
import '../../../exceptions/exchange/exchange_exception.dart';
import '../../../networking/http.dart';
import '../../../utilities/extensions/extensions.dart';
@@ -56,10 +57,11 @@ abstract class TrocadorAPI {
"Content-Type": "application/json",
"API-KEY": kTrocadorApiKey,
},
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
code = response.code;
@@ -99,8 +101,9 @@ abstract class TrocadorAPI {
if (json is List) {
final list = List<Map<String, dynamic>>.from(json);
- final List<TrocadorCoin> coins =
- list.map((e) => TrocadorCoin.fromMap(e)).toList();
+ final List<TrocadorCoin> coins = list
+ .map((e) => TrocadorCoin.fromMap(e))
+ .toList();
return ExchangeResponse(value: coins);
} else {
diff --git a/lib/services/fusion_tor_service.dart b/lib/services/fusion_tor_service.dart
index caa0ec2..1ad9beb 100644
--- a/lib/services/fusion_tor_service.dart
+++ b/lib/services/fusion_tor_service.dart
@@ -1,49 +1,18 @@
import 'dart:io';
-import 'package:tor_ffi_plugin/tor_ffi_plugin.dart';
+import '../wl_gen/generated/tor_service_impl.dart';
-import '../utilities/logger.dart';
-
-class FusionTorService {
- Tor? _tor;
- String? _torDataDirPath;
-
- TorStatus get status => _tor!.status;
-
- /// Singleton instance of the TorService.
- ///
- /// Use this to access the TorService and its properties.
- static final sharedInstance = FusionTorService._();
-
- // private constructor for singleton
- FusionTorService._();
+abstract class FusionTorService {
+ static FusionTorService get sharedInstance => fusionTorService;
/// Getter for the proxyInfo.
///
/// Throws if Tor is not connected.
- ({
- InternetAddress host,
- int port,
- }) getProxyInfo() {
- try {
- return (
- host: InternetAddress.loopbackIPv4,
- port: _tor!.port,
- );
- } catch (_) {
- throw Exception("Tor proxy info fetched while not connected!");
- }
- }
+ ({InternetAddress host, int port}) getProxyInfo();
/// Initialize the tor ffi lib instance if it hasn't already been set. Nothing
/// changes if _tor is already been set.
- void init({
- required String torDataDirPath,
- Tor? mockableOverride,
- }) {
- _tor ??= mockableOverride ?? Tor.instance;
- _torDataDirPath ??= torDataDirPath;
- }
+ void init({required String torDataDirPath});
/// Start the Tor service.
///
@@ -53,17 +22,5 @@ class FusionTorService {
/// service fails to start.
///
/// Returns a Future that completes when the Tor service has started.
- Future<void> start() async {
- if (_tor == null || _torDataDirPath == null) {
- throw Exception("FusionTorService.init has not been called!");
- }
-
- // Start the Tor service.
- try {
- await _tor!.start(torDataDirPath: _torDataDirPath!);
- } catch (e, s) {
- Logging.instance.w("FusionTorService.start failed: ", error: e, stackTrace: s);
- rethrow;
- }
- }
+ Future<void> start();
}
diff --git a/lib/services/litescribe_api.dart b/lib/services/litescribe_api.dart
index 9a41f4f..244043f 100644
--- a/lib/services/litescribe_api.dart
+++ b/lib/services/litescribe_api.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import '../app_config.dart';
import '../dto/ordinals/inscription_data.dart';
import '../dto/ordinals/litescribe_response.dart';
import '../networking/http.dart';
@@ -22,7 +23,9 @@ class LitescribeAPI {
Future<LitescribeResponse> _getResponse(String endpoint) async {
final response = await client.get(
url: Uri.parse('$baseUrl$endpoint'),
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
diff --git a/lib/services/monkey_service.dart b/lib/services/monkey_service.dart
index 0ae745d..bbdd49a 100644
--- a/lib/services/monkey_service.dart
+++ b/lib/services/monkey_service.dart
@@ -2,6 +2,7 @@ import 'dart:typed_data';
import 'package:flutter_riverpod/flutter_riverpod.dart';
+import '../app_config.dart';
import '../networking/http.dart';
import '../utilities/logger.dart';
import '../utilities/prefs.dart';
@@ -26,7 +27,9 @@ class MonKeyService {
final response = await client.get(
url: Uri.parse(url),
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -34,12 +37,14 @@ class MonKeyService {
if (response.code == 200) {
return Uint8List.fromList(response.bodyBytes);
} else {
- throw Exception(
- "statusCode=${response.code} body=${response.body}",
- );
+ throw Exception("statusCode=${response.code} body=${response.body}");
}
} catch (e, s) {
- Logging.instance.e("Failed fetchMonKey($address): ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Failed fetchMonKey($address): ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
diff --git a/lib/services/nano_api.dart b/lib/services/nano_api.dart
index 8627b67..9e425dd 100644
--- a/lib/services/nano_api.dart
+++ b/lib/services/nano_api.dart
@@ -2,16 +2,14 @@ import 'dart:convert';
import 'package:nanodart/nanodart.dart';
+import '../app_config.dart';
import '../networking/http.dart';
import '../utilities/prefs.dart';
import 'tor_service.dart';
class NanoAPI {
- static Future<
- ({
- NAccountInfo? accountInfo,
- Exception? exception,
- })> getAccountInfo({
+ static Future<({NAccountInfo? accountInfo, Exception? exception})>
+ getAccountInfo({
required Uri server,
required bool representative,
required String account,
@@ -31,7 +29,9 @@ class NanoAPI {
"representative": "true",
"account": account,
}),
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -99,11 +99,7 @@ class NanoAPI {
block["signature"] = signature;
- final map = await postBlock(
- server: server,
- block: block,
- headers: headers,
- );
+ final map = await postBlock(server: server, block: block, headers: headers);
if (map is Map && map["error"] != null) {
throw Exception(map["error"].toString());
@@ -129,7 +125,9 @@ class NanoAPI {
"subtype": "change",
"block": block,
}),
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
diff --git a/lib/services/price.dart b/lib/services/price.dart
index 7748271..ee08952 100644
--- a/lib/services/price.dart
+++ b/lib/services/price.dart
@@ -148,10 +148,11 @@ class PriceAPI {
final coinGeckoResponse = await client.get(
url: uri,
headers: {'Content-Type': 'application/json'},
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
final coinGeckoData = jsonDecode(coinGeckoResponse.body) as List<dynamic>;
@@ -162,10 +163,9 @@ class PriceAPI {
try {
final price = Decimal.parse(map["current_price"].toString());
- final change24h =
- map["price_change_percentage_24h"] != null
- ? double.parse(map["price_change_percentage_24h"].toString())
- : 0.0;
+ final change24h = map["price_change_percentage_24h"] != null
+ ? double.parse(map["price_change_percentage_24h"].toString())
+ : 0.0;
result[coin] = (value: price, change24h: change24h);
} catch (_) {
@@ -204,10 +204,11 @@ class PriceAPI {
final response = await client.get(
url: uri,
headers: {'Content-Type': 'application/json'},
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
final json = jsonDecode(response.body) as List<dynamic>;
diff --git a/lib/services/tor_service.dart b/lib/services/tor_service.dart
index 542032d..a4d43c1 100644
--- a/lib/services/tor_service.dart
+++ b/lib/services/tor_service.dart
@@ -1,56 +1,26 @@
import 'dart:io';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:tor_ffi_plugin/tor_ffi_plugin.dart';
-import '../utilities/logger.dart';
+import '../wl_gen/generated/tor_service_impl.dart';
import 'event_bus/events/global/tor_connection_status_changed_event.dart';
-import 'event_bus/global_event_bus.dart';
-final pTorService = Provider((_) => TorService.sharedInstance);
+final pTorService = Provider<TorService>((_) => torService);
-class TorService {
- Tor? _tor;
- String? _torDataDirPath;
+abstract class TorService {
+ static TorService get sharedInstance => torService;
/// Current status. Same as that fired on the event bus.
- TorConnectionStatus get status => _status;
- TorConnectionStatus _status = TorConnectionStatus.disconnected;
-
- /// Singleton instance of the TorService.
- ///
- /// Use this to access the TorService and its properties.
- static final sharedInstance = TorService._();
-
- // private constructor for singleton
- TorService._();
+ TorConnectionStatus get status;
/// Getter for the proxyInfo.
///
/// Throws if Tor is not connected.
- ({
- InternetAddress host,
- int port,
- }) getProxyInfo() {
- if (status == TorConnectionStatus.connected) {
- return (
- host: InternetAddress.loopbackIPv4,
- port: _tor!.port,
- );
- } else {
- throw Exception("Tor proxy info fetched while not connected!");
- }
- }
+ ({InternetAddress host, int port}) getProxyInfo();
/// Initialize the tor ffi lib instance if it hasn't already been set. Nothing
/// changes if _tor is already been set.
- void init({
- required String torDataDirPath,
- Tor? mockableOverride,
- }) {
- _tor ??= mockableOverride ?? Tor.instance;
- _torDataDirPath ??= torDataDirPath;
- }
+ void init({required String torDataDirPath});
/// Start the Tor service.
///
@@ -60,75 +30,8 @@ class TorService {
/// service fails to start.
///
/// Returns a Future that completes when the Tor service has started.
- Future<void> start() async {
- if (_tor == null || _torDataDirPath == null) {
- throw Exception("TorService.init has not been called!");
- }
-
- // Start the Tor service.
- try {
- _updateStatusAndFireEvent(
- status: TorConnectionStatus.connecting,
- message: "TorService.start call in progress",
- );
-
- await _tor!.start(torDataDirPath: _torDataDirPath!);
-
- // no exception or error so we can (probably?) assume tor
- // has started successfully
- // Fire a TorConnectionStatusChangedEvent on the event bus.
- _updateStatusAndFireEvent(
- status: TorConnectionStatus.connected,
- message: "TorService.start call success",
- );
-
- // Complete the future.
- return;
- } catch (e, s) {
- Logging.instance.w("TorService.start failed: ", error: e, stackTrace: s);
- // _enabled should already be false
-
- // Fire a TorConnectionStatusChangedEvent on the event bus.
- _updateStatusAndFireEvent(
- status: TorConnectionStatus.disconnected,
- message: "TorService.start call failed",
- );
- rethrow;
- }
- }
+ Future<void> start();
/// Disable Tor.
- Future<void> disable() async {
- if (_tor == null) {
- throw Exception("TorService.init has not been called!");
- }
-
- // No need to update status and fire event if status won't change.
- if (_status == TorConnectionStatus.disconnected) {
- return;
- }
-
- _tor!.disable();
- await _tor?.stop();
-
- _updateStatusAndFireEvent(
- status: TorConnectionStatus.disconnected,
- message: "TorService.disable call success",
- );
-
- return;
- }
-
- void _updateStatusAndFireEvent({
- required TorConnectionStatus status,
- required String message,
- }) {
- _status = status;
- GlobalEventBus.instance.fire(
- TorConnectionStatusChangedEvent(
- _status,
- message,
- ),
- );
- }
+ Future<void> disable();
}
diff --git a/lib/themes/theme_service.dart b/lib/themes/theme_service.dart
index 47d25a0..04e32f6 100644
--- a/lib/themes/theme_service.dart
+++ b/lib/themes/theme_service.dart
@@ -92,12 +92,11 @@ class ThemeService {
Future<void> remove({required String themeId}) async {
final themesDir = StackFileSystem.themesDir!;
- final isarId =
- await db.isar.stackThemes
- .where()
- .themeIdEqualTo(themeId)
- .idProperty()
- .findFirst();
+ final isarId = await db.isar.stackThemes
+ .where()
+ .themeIdEqualTo(themeId)
+ .idProperty()
+ .findFirst();
if (isarId != null) {
await db.isar.writeTxn(() async {
await db.isar.stackThemes.delete(isarId);
@@ -149,8 +148,10 @@ class ThemeService {
// TODO more thorough check/verification of theme
Future<bool> verifyInstalled({required String themeId}) async {
- final theme =
- await db.isar.stackThemes.where().themeIdEqualTo(themeId).findFirst();
+ final theme = await db.isar.stackThemes
+ .where()
+ .themeIdEqualTo(themeId)
+ .findFirst();
if (theme != null) {
try {
theme.assets;
@@ -159,10 +160,12 @@ class ThemeService {
}
final themesDir = StackFileSystem.themesDir!;
- final jsonFileExists =
- await File("${themesDir.path}/$themeId/theme.json").exists();
- final assetsDirExists =
- await Directory("${themesDir.path}/$themeId/assets").exists();
+ final jsonFileExists = await File(
+ "${themesDir.path}/$themeId/theme.json",
+ ).exists();
+ final assetsDirExists = await Directory(
+ "${themesDir.path}/$themeId/assets",
+ ).exists();
if (!jsonFileExists || !assetsDirExists) {
Logging.instance.w(
@@ -181,19 +184,19 @@ class ThemeService {
try {
final response = await client.get(
url: Uri.parse("$baseServerUrl/themes"),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
final jsonList = jsonDecode(response.body) as List;
- final result =
- List<Map<String, dynamic>>.from(jsonList)
- .map((e) => StackThemeMetaData.fromMap(e))
- .where((e) => e.id != "light" && e.id != "dark")
- .toList();
+ final result = List<Map<String, dynamic>>.from(jsonList)
+ .map((e) => StackThemeMetaData.fromMap(e))
+ .where((e) => e.id != "light" && e.id != "dark")
+ .toList();
return result;
} catch (e, s) {
@@ -212,10 +215,11 @@ class ThemeService {
try {
final response = await client.get(
url: Uri.parse("$baseServerUrl/theme/${themeMetaData.id}"),
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
);
final bytes = Uint8List.fromList(response.bodyBytes);
diff --git a/lib/utilities/connection_check/electrum_connection_check.dart b/lib/utilities/connection_check/electrum_connection_check.dart
index 325cfa0..478d5e5 100644
--- a/lib/utilities/connection_check/electrum_connection_check.dart
+++ b/lib/utilities/connection_check/electrum_connection_check.dart
@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:electrum_adapter/electrum_adapter.dart';
+import '../../app_config.dart';
import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
import '../../services/tor_service.dart';
import '../logger.dart';
@@ -15,13 +16,12 @@ Future<bool> checkElectrumServer({
TorService? overrideTorService,
}) async {
final _prefs = overridePrefs ?? Prefs.instance;
- final _torService = overrideTorService ?? TorService.sharedInstance;
({InternetAddress host, int port})? proxyInfo;
try {
- // If we're supposed to use Tor...
- if (_prefs.useTor) {
+ if (AppConfig.hasFeature(AppFeature.tor) && _prefs.useTor) {
+ final _torService = overrideTorService ?? TorService.sharedInstance;
// But Tor isn't running...
if (_torService.status != TorConnectionStatus.connected) {
// And the killswitch isn't set...
@@ -43,29 +43,26 @@ Future<bool> checkElectrumServer({
}
}
- final client = await ElectrumClient.connect(
- host: host,
- port: port,
- useSSL: useSSL && !host.endsWith('.onion'),
- proxyInfo: proxyInfo,
- ).timeout(
+ final client =
+ await ElectrumClient.connect(
+ host: host,
+ port: port,
+ useSSL: useSSL && !host.endsWith('.onion'),
+ proxyInfo: proxyInfo,
+ ).timeout(
+ Duration(seconds: (proxyInfo == null ? 5 : 30)),
+ onTimeout: () => throw Exception(
+ "The checkElectrumServer connect() call timed out.",
+ ),
+ );
+
+ await client.ping().timeout(
Duration(seconds: (proxyInfo == null ? 5 : 30)),
- onTimeout: () => throw Exception(
- "The checkElectrumServer connect() call timed out.",
- ),
);
- await client
- .ping()
- .timeout(Duration(seconds: (proxyInfo == null ? 5 : 30)));
-
return true;
} catch (e, s) {
- Logging.instance.e(
- "$e\n$s",
- error: e,
- stackTrace: s,
- );
+ Logging.instance.e("$e\n$s", error: e, stackTrace: s);
return false;
}
}
diff --git a/lib/utilities/paynym_is_api.dart b/lib/utilities/paynym_is_api.dart
index f81fc85..9285fef 100644
--- a/lib/utilities/paynym_is_api.dart
+++ b/lib/utilities/paynym_is_api.dart
@@ -12,6 +12,7 @@ import 'dart:convert';
import 'package:tuple/tuple.dart';
+import '../app_config.dart';
import '../models/paynym/created_paynym.dart';
import '../models/paynym/paynym_account.dart';
import '../models/paynym/paynym_claim.dart';
@@ -44,14 +45,16 @@ class PaynymIsApi {
final headers = {
'Content-Type': 'application/json; charset=UTF-8',
- 'content-length':
- contentLength.toString(), // Set the Content-Length header.
+ 'content-length': contentLength
+ .toString(), // Set the Content-Length header.
}..addAll(additionalHeaders);
final response = await client.post(
url: uri,
headers: headers,
body: jsonEncode(body),
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -414,13 +417,8 @@ class PaynymIsApi {
) async {
final result = await _post(
"/follow",
- {
- "target": target,
- "signature": signature,
- },
- {
- "auth-token": token,
- },
+ {"target": target, "signature": signature},
+ {"auth-token": token},
);
String message;
@@ -495,13 +493,8 @@ class PaynymIsApi {
) async {
final result = await _post(
"/unfollow",
- {
- "target": target,
- "signature": signature,
- },
- {
- "auth-token": token,
- },
+ {"target": target, "signature": signature},
+ {"auth-token": token},
);
String message;
@@ -579,14 +572,8 @@ class PaynymIsApi {
) async {
final result = await _post(
"/nym/add",
- {
- "nym": nym,
- "code": code,
- "signature": signature,
- },
- {
- "auth-token": token,
- },
+ {"nym": nym, "code": code, "signature": signature},
+ {"auth-token": token},
);
String message;
diff --git a/lib/utilities/test_epic_box_connection.dart b/lib/utilities/test_epic_box_connection.dart
index 1c39390..89eefd4 100644
--- a/lib/utilities/test_epic_box_connection.dart
+++ b/lib/utilities/test_epic_box_connection.dart
@@ -10,6 +10,7 @@
import 'dart:convert';
+import '../app_config.dart';
import '../networking/http.dart';
import '../pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import '../services/tor_service.dart';
@@ -24,7 +25,9 @@ Future<bool> _testEpicBoxNodeConnection(Uri uri) async {
.get(
url: uri,
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
)
@@ -41,7 +44,7 @@ Future<bool> _testEpicBoxNodeConnection(Uri uri) async {
return false;
}
} catch (e, s) {
- Logging.instance.w("$e\n$s", error: e, stackTrace: s,);
+ Logging.instance.w("$e\n$s", error: e, stackTrace: s);
return false;
}
}
@@ -87,7 +90,7 @@ Future<NodeFormData?> testEpicNodeConnection(NodeFormData data) async {
return null;
}
} catch (e, s) {
- Logging.instance.w("$e\n$s", error: e, stackTrace: s,);
+ Logging.instance.w("$e\n$s", error: e, stackTrace: s);
return null;
}
}
diff --git a/lib/utilities/test_mwcmqs_connection.dart b/lib/utilities/test_mwcmqs_connection.dart
index c0615b2..c199afc 100644
--- a/lib/utilities/test_mwcmqs_connection.dart
+++ b/lib/utilities/test_mwcmqs_connection.dart
@@ -10,6 +10,7 @@
import 'dart:convert';
+import '../app_config.dart';
import '../networking/http.dart';
import '../pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import '../services/tor_service.dart';
@@ -31,10 +32,11 @@ Future<bool> _testMwcMqsNodeConnection(Uri uri) async {
.get(
url: uri,
headers: headers,
- proxyInfo:
- Prefs.instance.useTor
- ? TorService.sharedInstance.getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null,
)
.timeout(
const Duration(milliseconds: 2000),
diff --git a/lib/utilities/test_node_connection.dart b/lib/utilities/test_node_connection.dart
index 8491ca3..b849d2d 100644
--- a/lib/utilities/test_node_connection.dart
+++ b/lib/utilities/test_node_connection.dart
@@ -8,6 +8,7 @@ import 'package:on_chain/ada/ada.dart';
import 'package:socks5_proxy/socks.dart';
import 'package:xelis_dart_sdk/xelis_dart_sdk.dart' as xelis_sdk;
+import '../app_config.dart';
import '../networking/http.dart';
import '../pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart';
import '../providers/global/prefs_provider.dart';
@@ -144,10 +145,11 @@ Future<bool> testNodeConnection({
case CryptonoteCurrency():
try {
- final proxyInfo =
- ref.read(prefsChangeNotifierProvider).useTor
- ? ref.read(pTorService).getProxyInfo()
- : null;
+ final proxyInfo = !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : ref.read(prefsChangeNotifierProvider).useTor
+ ? ref.read(pTorService).getProxyInfo()
+ : null;
final url = formData.host!;
final uri = Uri.tryParse(url);
@@ -232,10 +234,11 @@ Future<bool> testNodeConnection({
url: uri,
headers: {"Content-Type": "application/json"},
body: jsonEncode({"action": "version"}),
- proxyInfo:
- ref.read(prefsChangeNotifierProvider).useTor
- ? ref.read(pTorService).getProxyInfo()
- : null,
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : ref.read(prefsChangeNotifierProvider).useTor
+ ? ref.read(pTorService).getProxyInfo()
+ : null,
);
testPassed = response.code == 200;
@@ -271,7 +274,8 @@ Future<bool> testNodeConnection({
case Cardano():
try {
final client = HttpClient();
- if (ref.read(prefsChangeNotifierProvider).useTor) {
+ if (AppConfig.hasFeature(AppFeature.tor) &&
+ ref.read(prefsChangeNotifierProvider).useTor) {
final proxyInfo = TorService.sharedInstance.getProxyInfo();
final proxySettings = ProxySettings(proxyInfo.host, proxyInfo.port);
SocksTCPClient.assignToHttpClient(client, [proxySettings]);
diff --git a/lib/utilities/test_stellar_node_connection.dart b/lib/utilities/test_stellar_node_connection.dart
index 2fd2f9f..3af380f 100644
--- a/lib/utilities/test_stellar_node_connection.dart
+++ b/lib/utilities/test_stellar_node_connection.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';
+import '../app_config.dart';
import '../networking/http.dart' as http;
import '../services/tor_service.dart';
import 'prefs.dart';
@@ -14,7 +15,9 @@ Future<bool> testStellarNodeConnection(String host, int port) async {
.get(
url: uri,
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
)
diff --git a/lib/wallets/api/tezos/tezos_api.dart b/lib/wallets/api/tezos/tezos_api.dart
index 4906543..6bd7496 100644
--- a/lib/wallets/api/tezos/tezos_api.dart
+++ b/lib/wallets/api/tezos/tezos_api.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import '../../../app_config.dart';
import '../../../networking/http.dart';
import '../../../services/tor_service.dart';
import '../../../utilities/logger.dart';
@@ -17,7 +18,9 @@ abstract final class TezosAPI {
final response = await _client.get(
url: Uri.parse(uriString),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -25,7 +28,11 @@ abstract final class TezosAPI {
final result = jsonDecode(response.body);
return result as int;
} catch (e, s) {
- Logging.instance.e("Error occurred in TezosAPI while getting counter for $address: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Error occurred in TezosAPI while getting counter for $address: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
@@ -39,7 +46,9 @@ abstract final class TezosAPI {
final response = await _client.get(
url: Uri.parse(uriString),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -50,7 +59,11 @@ abstract final class TezosAPI {
return account;
} catch (e, s) {
- Logging.instance.e("Error occurred in TezosAPI while getting account for $address: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Error occurred in TezosAPI while getting account for $address: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
@@ -63,7 +76,9 @@ abstract final class TezosAPI {
final response = await _client.get(
url: Uri.parse(transactionsCall),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
@@ -78,9 +93,10 @@ abstract final class TezosAPI {
hash: tx["hash"] as String,
type: tx["type"] as String,
height: tx["level"] as int,
- timestamp: DateTime.parse(tx["timestamp"].toString())
- .toUtc()
- .millisecondsSinceEpoch ~/
+ timestamp:
+ DateTime.parse(
+ tx["timestamp"].toString(),
+ ).toUtc().millisecondsSinceEpoch ~/
1000,
cycle: tx["cycle"] as int?,
counter: tx["counter"] as int,
@@ -91,7 +107,8 @@ abstract final class TezosAPI {
gasUsed: tx["gasUsed"] as int,
storageLimit: tx["storageLimit"] as int?,
amountInMicroTez: tx["amount"] as int,
- feeInMicroTez: (tx["bakerFee"] as int? ?? 0) +
+ feeInMicroTez:
+ (tx["bakerFee"] as int? ?? 0) +
(tx["storageFee"] as int? ?? 0) +
(tx["allocationFee"] as int? ?? 0),
burnedAmountInMicroTez: tx["burned"] as int?,
@@ -103,7 +120,11 @@ abstract final class TezosAPI {
}
return txs;
} catch (e, s) {
- Logging.instance.e("Error occurred in TezosAPI while getting transactions for $address: ", error: e, stackTrace: s);
+ Logging.instance.e(
+ "Error occurred in TezosAPI while getting transactions for $address: ",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
diff --git a/lib/wallets/api/tezos/tezos_rpc_api.dart b/lib/wallets/api/tezos/tezos_rpc_api.dart
index 4f9c71f..721d8b0 100644
--- a/lib/wallets/api/tezos/tezos_rpc_api.dart
+++ b/lib/wallets/api/tezos/tezos_rpc_api.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import '../../../app_config.dart';
import '../../../networking/http.dart';
import '../../../services/tor_service.dart';
import '../../../utilities/logger.dart';
@@ -19,13 +20,16 @@ abstract final class TezosRpcAPI {
final response = await _client.get(
url: Uri.parse(balanceCall),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
- final balance =
- BigInt.parse(response.body.substring(1, response.body.length - 2));
+ final balance = BigInt.parse(
+ response.body.substring(1, response.body.length - 2),
+ );
return balance;
} catch (e, s) {
Logging.instance.e(
@@ -47,7 +51,9 @@ abstract final class TezosRpcAPI {
final response = await _client.get(
url: Uri.parse(api),
headers: {'Content-Type': 'application/json'},
- proxyInfo: Prefs.instance.useTor
+ proxyInfo: !AppConfig.hasFeature(AppFeature.tor)
+ ? null
+ : Prefs.instance.useTor
? TorService.sharedInstance.getProxyInfo()
: null,
);
diff --git a/lib/wallets/wallet/impl/cardano_wallet.dart b/lib/wallets/wallet/impl/cardano_wallet.dart
index 93430b7..1583123 100644
--- a/lib/wallets/wallet/impl/cardano_wallet.dart
+++ b/lib/wallets/wallet/impl/cardano_wallet.dart
@@ -11,6 +11,7 @@ import 'package:on_chain/ada/ada.dart';
import 'package:socks5_proxy/socks.dart';
import 'package:tuple/tuple.dart';
+import '../../../app_config.dart';
import '../../../exceptions/wallet/node_tor_mismatch_config_exception.dart';
import '../../../models/balance.dart';
import '../../../models/isar/models/blockchain_data/address.dart';
@@ -50,11 +51,10 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
).change(Bip44Changes.chainExt).addressIndex(0);
final paymentPublicKey = shelley.bip44.publicKey.compressed;
final stakePublicKey = shelley.bip44Sk.publicKey.compressed;
- final addressStr =
- ADABaseAddress.fromPublicKey(
- basePubkeyBytes: paymentPublicKey,
- stakePubkeyBytes: stakePublicKey,
- ).address;
+ final addressStr = ADABaseAddress.fromPublicKey(
+ basePubkeyBytes: paymentPublicKey,
+ stakePubkeyBytes: stakePublicKey,
+ ).address;
return Address(
walletId: walletId,
value: addressStr,
@@ -214,15 +214,14 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
}
final body = TransactionBody(
- inputs:
- listOfUtxosToBeUsed
- .map(
- (e) => TransactionInput(
- transactionId: TransactionHash.fromHex(e.txHash),
- index: e.outputIndex,
- ),
- )
- .toList(),
+ inputs: listOfUtxosToBeUsed
+ .map(
+ (e) => TransactionInput(
+ transactionId: TransactionHash.fromHex(e.txHash),
+ index: e.outputIndex,
+ ),
+ )
+ .toList(),
outputs: [
change,
TransactionOutput(
@@ -363,15 +362,14 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
];
}
final body = TransactionBody(
- inputs:
- listOfUtxosToBeUsed
- .map(
- (e) => TransactionInput(
- transactionId: TransactionHash.fromHex(e.txHash),
- index: e.outputIndex,
- ),
- )
- .toList(),
+ inputs: listOfUtxosToBeUsed
+ .map(
+ (e) => TransactionInput(
+ transactionId: TransactionHash.fromHex(e.txHash),
+ index: e.outputIndex,
+ ),
+ )
+ .toList(),
outputs: outputs,
fee: txData.fee!.raw,
);
@@ -582,11 +580,10 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
type: txType,
subType: isar.TransactionSubType.none,
amount: amount,
- amountString:
- Amount(
- rawValue: BigInt.from(amount),
- fractionDigits: cryptoCurrency.fractionDigits,
- ).toJsonString(),
+ amountString: Amount(
+ rawValue: BigInt.from(amount),
+ fractionDigits: cryptoCurrency.fractionDigits,
+ ).toJsonString(),
fee: int.parse(txInfo.fees),
height: txInfo.blockHeight,
isCancelled: false,
@@ -606,10 +603,9 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
derivationIndex: 0,
derivationPath: DerivationPath()..value = _addressDerivationPath,
type: AddressType.cardanoShelley,
- subType:
- txType == isar.TransactionType.outgoing
- ? AddressSubType.unknown
- : AddressSubType.receiving,
+ subType: txType == isar.TransactionType.outgoing
+ ? AddressSubType.unknown
+ : AddressSubType.receiving,
);
parsedTxsList.add(Tuple2(transaction, txAddress));
@@ -637,7 +633,7 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
final currentNode = getCurrentNode();
final client = HttpClient();
- if (prefs.useTor) {
+ if (AppConfig.hasFeature(AppFeature.tor) && prefs.useTor) {
final proxyInfo = TorService.sharedInstance.getProxyInfo();
final proxySettings = ProxySettings(proxyInfo.host, proxyInfo.port);
SocksTCPClient.assignToHttpClient(client, [proxySettings]);
@@ -667,17 +663,19 @@ class CustomBlockForestProvider extends BlockforestProvider {
BlockforestRequestParam<T, E> request, [
Duration? timeout,
]) async {
- if (prefs.useTor) {
- if (netOption == TorPlainNetworkOption.clear) {
- throw NodeTorMismatchConfigException(
- message: "TOR enabled but node set to clearnet only",
- );
- }
- } else {
- if (netOption == TorPlainNetworkOption.tor) {
- throw NodeTorMismatchConfigException(
- message: "TOR off but node set to TOR only",
- );
+ if (AppConfig.hasFeature(AppFeature.tor)) {
+ if (prefs.useTor) {
+ if (netOption == TorPlainNetworkOption.clear) {
+ throw NodeTorMismatchConfigException(
+ message: "TOR enabled but node set to clearnet only",
+ );
+ }
+ } else {
+ if (netOption == TorPlainNetworkOption.tor) {
+ throw NodeTorMismatchConfigException(
+ message: "TOR off but node set to TOR only",
+ );
+ }
}
}
diff --git a/lib/wallets/wallet/impl/solana_wallet.dart b/lib/wallets/wallet/impl/solana_wallet.dart
index ad88d57..c88d995 100644
--- a/lib/wallets/wallet/impl/solana_wallet.dart
+++ b/lib/wallets/wallet/impl/solana_wallet.dart
@@ -9,6 +9,7 @@ import 'package:solana/dto.dart';
import 'package:solana/solana.dart';
import 'package:tuple/tuple.dart';
+import '../../../app_config.dart';
import '../../../exceptions/wallet/node_tor_mismatch_config_exception.dart';
import '../../../models/balance.dart';
import '../../../models/isar/models/blockchain_data/transaction.dart' as isar;
@@ -66,18 +67,19 @@ class SolanaWallet extends Bip39Wallet<Solana> {
final latestBlockhash = await _rpcClient?.getLatestBlockhash();
final pubKey = (await _getKeyPair()).publicKey;
- final compiledMessage = Message(
- instructions: [
- SystemInstruction.transfer(
- fundingAccount: pubKey,
- recipientAccount: pubKey,
- lamports: transferAmount.raw.toInt(),
- ),
- ],
- ).compile(
- recentBlockhash: latestBlockhash!.value.blockhash,
- feePayer: pubKey,
- );
+ final compiledMessage =
+ Message(
+ instructions: [
+ SystemInstruction.transfer(
+ fundingAccount: pubKey,
+ recipientAccount: pubKey,
+ lamports: transferAmount.raw.toInt(),
+ ),
+ ],
+ ).compile(
+ recentBlockhash: latestBlockhash!.value.blockhash,
+ feePayer: pubKey,
+ );
final estimate = await _rpcClient?.getFeeForMessage(
base64Encode(compiledMessage.toByteArray().toList()),
@@ -456,10 +458,9 @@ class SolanaWallet extends Bip39Wallet<Solana> {
derivationIndex: 0,
derivationPath: DerivationPath()..value = _addressDerivationPath,
type: AddressType.solana,
- subType:
- txType == isar.TransactionType.outgoing
- ? AddressSubType.unknown
- : AddressSubType.receiving,
+ subType: txType == isar.TransactionType.outgoing
+ ? AddressSubType.unknown
+ : AddressSubType.receiving,
);
txsList.add(Tuple2(transaction, txAddress));
@@ -526,7 +527,7 @@ class SolanaWallet extends Bip39Wallet<Solana> {
) {
HttpClient? httpClient;
- if (prefs.useTor) {
+ if (AppConfig.hasFeature(AppFeature.tor) && prefs.useTor) {
// Make proxied HttpClient.
final proxyInfo = torService.getProxyInfo();
diff --git a/lib/wallets/wallet/impl/stellar_wallet.dart b/lib/wallets/wallet/impl/stellar_wallet.dart
index dbfda5e..86cc1aa 100644
--- a/lib/wallets/wallet/impl/stellar_wallet.dart
+++ b/lib/wallets/wallet/impl/stellar_wallet.dart
@@ -7,6 +7,7 @@ import 'package:mutex/mutex.dart';
import 'package:socks5_proxy/socks.dart';
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart' as stellar;
+import '../../../app_config.dart';
import '../../../exceptions/wallet/node_tor_mismatch_config_exception.dart';
import '../../../models/balance.dart';
import '../../../models/isar/models/blockchain_data/address.dart';
@@ -138,7 +139,7 @@ class StellarWallet extends Bip39Wallet<Stellar> {
final currentNode = getCurrentNode();
HttpClient? _httpClient;
- if (prefs.useTor) {
+ if (AppConfig.hasFeature(AppFeature.tor) && prefs.useTor) {
final ({InternetAddress host, int port}) proxyInfo =
TorService.sharedInstance.getProxyInfo();
diff --git a/lib/wallets/wallet/impl/tezos_wallet.dart b/lib/wallets/wallet/impl/tezos_wallet.dart
index 129ade3..5ce5bef 100644
--- a/lib/wallets/wallet/impl/tezos_wallet.dart
+++ b/lib/wallets/wallet/impl/tezos_wallet.dart
@@ -5,6 +5,7 @@ import 'package:isar_community/isar.dart';
import 'package:tezart/tezart.dart' as tezart;
import 'package:tuple/tuple.dart';
+import '../../../app_config.dart';
import '../../../exceptions/wallet/node_tor_mismatch_config_exception.dart';
import '../../../models/balance.dart';
import '../../../models/isar/models/blockchain_data/address.dart';
@@ -51,8 +52,9 @@ class TezosWallet extends Bip39Wallet<Tezos> {
// TODO: some kind of better check to see if the address has been used
- final hasHistory =
- (await TezosAPI.getTransactions(ks.address)).isNotEmpty;
+ final hasHistory = (await TezosAPI.getTransactions(
+ ks.address,
+ )).isNotEmpty;
if (hasHistory) {
return path;
@@ -113,13 +115,14 @@ class TezosWallet extends Bip39Wallet<Tezos> {
// print("customFee: $customFee");
// }
final ({InternetAddress host, int port})? proxyInfo =
- prefs.useTor ? TorService.sharedInstance.getProxyInfo() : null;
+ AppConfig.hasFeature(AppFeature.tor) && prefs.useTor
+ ? TorService.sharedInstance.getProxyInfo()
+ : null;
final tezartClient = tezart.TezartClient(
server,
- proxy:
- proxyInfo != null
- ? "socks5://${proxyInfo.host}:${proxyInfo.port};"
- : null,
+ proxy: proxyInfo != null
+ ? "socks5://${proxyInfo.host}:${proxyInfo.port};"Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.