mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
Filter to use Tor only exchange
This commit is contained in:
parent
2c9f17e728
commit
dbfbadffda
2 changed files with 26 additions and 9 deletions
|
@ -38,7 +38,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (widget.title?.isNotEmpty ?? false)
|
if (widget.title.isNotEmpty)
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24),
|
padding: EdgeInsets.symmetric(horizontal: 24),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -58,7 +58,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
color: Theme.of(context).accentTextTheme.headline6!.color!,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxHeight: MediaQuery.of(context).size.height * 0.65,
|
maxHeight: MediaQuery.of(context).size.height * 0.65,
|
||||||
|
@ -70,7 +70,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
(items?.length ?? 0) > 3
|
(items.length) > 3
|
||||||
? Scrollbar(
|
? Scrollbar(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
child: itemsList(),
|
child: itemsList(),
|
||||||
|
@ -95,14 +95,14 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
|
|
||||||
Widget itemsList() {
|
Widget itemsList() {
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
separatorBuilder: (context, index) => widget.isSeparated
|
separatorBuilder: (context, index) => widget.isSeparated
|
||||||
? Divider(
|
? Divider(
|
||||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
color: Theme.of(context).accentTextTheme.headline6!.backgroundColor!,
|
||||||
height: 1,
|
height: 1,
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
|
@ -121,13 +121,13 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
color: Theme.of(context).accentTextTheme.headline6!.color!,
|
||||||
padding: EdgeInsets.only(left: 24, right: 24),
|
padding: EdgeInsets.only(left: 24, right: 24),
|
||||||
child: CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: item.value,
|
value: item.value,
|
||||||
activeColor: item.value
|
activeColor: item.value
|
||||||
? Palette.blueCraiola
|
? Palette.blueCraiola
|
||||||
: Theme.of(context).accentTextTheme!.subtitle1!.decorationColor!,
|
: Theme.of(context).accentTextTheme.subtitle1!.decorationColor!,
|
||||||
checkColor: Colors.white,
|
checkColor: Colors.white,
|
||||||
title: widget.displayItem?.call(item) ??
|
title: widget.displayItem?.call(item) ??
|
||||||
Text(
|
Text(
|
||||||
|
@ -138,7 +138,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: item.isDisabled
|
color: item.isDisabled
|
||||||
? Colors.grey.withOpacity(0.5)
|
? Colors.grey.withOpacity(0.5)
|
||||||
: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
: Theme.of(context).primaryTextTheme.headline6!.color!,
|
||||||
decoration: TextDecoration.none,
|
decoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
||||||
import 'package:cake_wallet/entities/preferences_key.dart';
|
import 'package:cake_wallet/entities/preferences_key.dart';
|
||||||
import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart';
|
import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/sideshift/sideshift_request.dart';
|
import 'package:cake_wallet/exchange/sideshift/sideshift_request.dart';
|
||||||
|
@ -62,8 +63,9 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
limitsState = LimitsInitialState(),
|
limitsState = LimitsInitialState(),
|
||||||
receiveCurrency = wallet.currency,
|
receiveCurrency = wallet.currency,
|
||||||
depositCurrency = wallet.currency,
|
depositCurrency = wallet.currency,
|
||||||
providerList = [ChangeNowExchangeProvider(), SideShiftExchangeProvider(), SimpleSwapExchangeProvider(), TrocadorExchangeProvider()],
|
providerList = [],
|
||||||
selectedProviders = ObservableList<ExchangeProvider>() {
|
selectedProviders = ObservableList<ExchangeProvider>() {
|
||||||
|
_setProviders();
|
||||||
const excludeDepositCurrencies = [CryptoCurrency.btt, CryptoCurrency.nano];
|
const excludeDepositCurrencies = [CryptoCurrency.btt, CryptoCurrency.nano];
|
||||||
const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp,
|
const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp,
|
||||||
CryptoCurrency.bnb, CryptoCurrency.btt, CryptoCurrency.nano];
|
CryptoCurrency.bnb, CryptoCurrency.btt, CryptoCurrency.nano];
|
||||||
|
@ -126,6 +128,13 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
final TradesStore tradesStore;
|
final TradesStore tradesStore;
|
||||||
final SharedPreferences sharedPreferences;
|
final SharedPreferences sharedPreferences;
|
||||||
|
|
||||||
|
final _allProviders = [
|
||||||
|
ChangeNowExchangeProvider(),
|
||||||
|
SideShiftExchangeProvider(),
|
||||||
|
SimpleSwapExchangeProvider(),
|
||||||
|
TrocadorExchangeProvider(),
|
||||||
|
];
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
ExchangeProvider? provider;
|
ExchangeProvider? provider;
|
||||||
|
|
||||||
|
@ -683,4 +692,12 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _setProviders(){
|
||||||
|
if (_settingsStore.exchangeStatus == FiatApiMode.torOnly) {
|
||||||
|
providerList = _allProviders.where((provider) => provider.shouldUseOnionAddress).toList();
|
||||||
|
} else {
|
||||||
|
providerList = _allProviders;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue