Add trocador exchange provider

This commit is contained in:
Godwin Asuquo
2023-02-06 21:20:43 +02:00
parent 61050ac715
commit 032a8c8c33
19 changed files with 453 additions and 108 deletions
+13 -3
View File
@@ -12,7 +12,8 @@ abstract class TradeFilterStoreBase with Store {
displayChangeNow = true,
displaySideShift = true,
displayMorphToken = true,
displaySimpleSwap = true;
displaySimpleSwap = true,
displayTrocador = true;
@observable
bool displayXMRTO;
@@ -29,8 +30,11 @@ abstract class TradeFilterStoreBase with Store {
@observable
bool displaySimpleSwap;
@observable
bool displayTrocador;
@computed
bool get displayAllTrades => displayChangeNow && displaySideShift && displaySimpleSwap;
bool get displayAllTrades => displayChangeNow && displaySideShift && displaySimpleSwap && displayTrocador;
@action
void toggleDisplayExchange(ExchangeProviderDescription provider) {
@@ -50,6 +54,9 @@ abstract class TradeFilterStoreBase with Store {
case ExchangeProviderDescription.morphToken:
displayMorphToken = !displayMorphToken;
break;
case ExchangeProviderDescription.trocador:
displayTrocador = !displayTrocador;
break;
case ExchangeProviderDescription.all:
if (displayAllTrades) {
displayChangeNow = false;
@@ -57,12 +64,14 @@ abstract class TradeFilterStoreBase with Store {
displayXMRTO = false;
displayMorphToken = false;
displaySimpleSwap = false;
displayTrocador = false;
} else {
displayChangeNow = true;
displaySideShift = true;
displayXMRTO = true;
displayMorphToken = true;
displaySimpleSwap = true;
displayTrocador = true;
}
break;
}
@@ -88,7 +97,8 @@ abstract class TradeFilterStoreBase with Store {
ExchangeProviderDescription.morphToken)
||(displaySimpleSwap &&
item.trade.provider ==
ExchangeProviderDescription.simpleSwap))
ExchangeProviderDescription.simpleSwap)
||(displayTrocador && item.trade.provider == ExchangeProviderDescription.trocador))
.toList()
: _trades;
}
+13 -10
View File
@@ -31,7 +31,7 @@ abstract class SettingsStoreBase with Store {
required bool initialSaveRecipientAddress,
required FiatApiMode initialFiatMode,
required bool initialAllowBiometricalAuthentication,
required bool initialExchangeEnabled,
required FiatApiMode initialExchangeStatus,
required ThemeBase initialTheme,
required int initialPinLength,
required String initialLanguageCode,
@@ -53,7 +53,7 @@ abstract class SettingsStoreBase with Store {
shouldSaveRecipientAddress = initialSaveRecipientAddress,
fiatApiMode = initialFiatMode,
allowBiometricalAuthentication = initialAllowBiometricalAuthentication,
disableExchange = initialExchangeEnabled,
exchangeStatus = initialExchangeStatus,
currentTheme = initialTheme,
pinCodeLength = initialPinLength,
languageCode = initialLanguageCode,
@@ -153,9 +153,9 @@ abstract class SettingsStoreBase with Store {
PreferencesKey.currentBalanceDisplayModeKey, mode.serialize()));
reaction(
(_) => disableExchange,
(bool disableExchange) => sharedPreferences.setBool(
PreferencesKey.disableExchangeKey, disableExchange));
(_) => exchangeStatus,
(FiatApiMode mode) => sharedPreferences.setInt(
PreferencesKey.exchangeStatusKey, mode.serialize()));
this
.nodes
@@ -192,7 +192,7 @@ abstract class SettingsStoreBase with Store {
bool allowBiometricalAuthentication;
@observable
bool disableExchange;
FiatApiMode exchangeStatus;
@observable
ThemeBase currentTheme;
@@ -284,8 +284,9 @@ abstract class SettingsStoreBase with Store {
final allowBiometricalAuthentication = sharedPreferences
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
false;
final disableExchange = sharedPreferences
.getBool(PreferencesKey.disableExchangeKey) ?? false;
final exchangeStatus = FiatApiMode.deserialize(
raw: sharedPreferences
.getInt(PreferencesKey.exchangeStatusKey) ?? FiatApiMode.enabled.raw);
final legacyTheme =
(sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy) ?? false)
? ThemeType.dark.index
@@ -354,7 +355,7 @@ abstract class SettingsStoreBase with Store {
initialSaveRecipientAddress: shouldSaveRecipientAddress,
initialFiatMode: currentFiatApiMode,
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
initialExchangeEnabled: disableExchange,
initialExchangeStatus: exchangeStatus,
initialTheme: savedTheme,
actionlistDisplayMode: actionListDisplayMode,
initialPinLength: pinLength,
@@ -400,7 +401,9 @@ abstract class SettingsStoreBase with Store {
allowBiometricalAuthentication = sharedPreferences
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
allowBiometricalAuthentication;
disableExchange = sharedPreferences.getBool(PreferencesKey.disableExchangeKey) ?? disableExchange;
exchangeStatus = FiatApiMode.deserialize(
raw: sharedPreferences
.getInt(PreferencesKey.exchangeStatusKey) ?? FiatApiMode.enabled.raw);
final legacyTheme =
(sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy) ?? false)
? ThemeType.dark.index