Merge branch 'main' of https://github.com/cake-tech/cake_wallet into CW-223-settings-reorganization

wow-support
Godwin Asuquo 2 years ago
commit 63df8c6b6f

@ -46,7 +46,7 @@ android {
defaultConfig {
applicationId appProperties['id']
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

@ -21,7 +21,8 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true">
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"

@ -11,6 +11,7 @@ class PreferencesKey {
static const shouldSaveRecipientAddressKey = 'save_recipient_address';
static const allowBiometricalAuthenticationKey =
'allow_biometrical_authentication';
static const disableExchangeKey = 'disable_exchange';
static const currentTheme = 'current_theme';
static const isDarkThemeLegacy = 'dark_theme';
static const displayActionListModeKey = 'display_list_mode';

@ -315,6 +315,8 @@ class DashboardPage extends BasePage {
}
Future<void> _onClickExchangeButton(BuildContext context) async {
await Navigator.of(context).pushNamed(Routes.exchange);
if (walletViewModel.isEnabledExchangeAction) {
await Navigator.of(context).pushNamed(Routes.exchange);
}
}
}

@ -9,7 +9,6 @@ class QrPainter extends CustomPainter {
this.errorCorrectionLevel,
) : this._qr = QrCode(version, errorCorrectionLevel)..addData(data) {
_p.color = this.color;
_qr.addData(data);
_qrImage = QrImage(_qr);
}

@ -30,6 +30,7 @@ abstract class SettingsStoreBase with Store {
required BalanceDisplayMode initialBalanceDisplayMode,
required bool initialSaveRecipientAddress,
required bool initialAllowBiometricalAuthentication,
required bool initialExchangeEnabled,
required ThemeBase initialTheme,
required int initialPinLength,
required String initialLanguageCode,
@ -47,6 +48,7 @@ abstract class SettingsStoreBase with Store {
balanceDisplayMode = initialBalanceDisplayMode,
shouldSaveRecipientAddress = initialSaveRecipientAddress,
allowBiometricalAuthentication = initialAllowBiometricalAuthentication,
disableExchange = initialExchangeEnabled,
currentTheme = initialTheme,
pinCodeLength = initialPinLength,
languageCode = initialLanguageCode,
@ -143,6 +145,9 @@ abstract class SettingsStoreBase with Store {
@observable
bool allowBiometricalAuthentication;
@observable
bool disableExchange;
@observable
ThemeBase currentTheme;
@ -221,6 +226,8 @@ abstract class SettingsStoreBase with Store {
final allowBiometricalAuthentication = sharedPreferences
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
false;
final disableExchange = sharedPreferences
.getBool(PreferencesKey.disableExchangeKey) ?? false;
final legacyTheme =
(sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy) ?? false)
? ThemeType.dark.index
@ -284,6 +291,7 @@ abstract class SettingsStoreBase with Store {
initialBalanceDisplayMode: currentBalanceDisplayMode,
initialSaveRecipientAddress: shouldSaveRecipientAddress,
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
initialExchangeEnabled: disableExchange,
initialTheme: savedTheme,
actionlistDisplayMode: actionListDisplayMode,
initialPinLength: pinLength,

@ -53,7 +53,6 @@ abstract class DashboardViewModelBase with Store {
hasBuyAction = false,
isEnabledBuyAction = false,
hasExchangeAction = false,
isEnabledExchangeAction = false,
isShowFirstYatIntroduction = false,
isShowSecondYatIntroduction = false,
isShowThirdYatIntroduction = false,
@ -249,8 +248,8 @@ abstract class DashboardViewModelBase with Store {
void furtherShowYatPopup(bool shouldShow) =>
settingsStore.shouldShowYatPopup = shouldShow;
@observable
bool isEnabledExchangeAction;
@computed
bool get isEnabledExchangeAction => !settingsStore.disableExchange;
@observable
bool hasExchangeAction;
@ -365,7 +364,6 @@ abstract class DashboardViewModelBase with Store {
}
void updateActions() {
isEnabledExchangeAction = true;
hasExchangeAction = !isHaven;
isEnabledBuyAction = wallet.type != WalletType.haven
&& wallet.type != WalletType.monero;

@ -7,7 +7,6 @@ import 'package:cake_wallet/exchange/sideshift/sideshift_exchange_provider.dart'
import 'package:cake_wallet/exchange/sideshift/sideshift_request.dart';
import 'package:cake_wallet/exchange/simpleswap/simpleswap_exchange_provider.dart';
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
import 'package:cw_core/transaction_priority.dart';
import 'package:cake_wallet/exchange/simpleswap/simpleswap_request.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/crypto_currency.dart';
@ -375,96 +374,105 @@ abstract class ExchangeViewModelBase with Store {
TradeRequest? request;
String amount = '';
for (var provider in _sortedAvailableProviders.values) {
if (!(await provider.checkIsAvailable())) {
continue;
}
if (provider is SideShiftExchangeProvider) {
request = SideShiftRequest(
depositMethod: depositCurrency,
settleMethod: receiveCurrency,
depositAmount: depositAmount.replaceAll(',', '.'),
settleAddress: receiveAddress,
refundAddress: depositAddress,
);
amount = depositAmount;
}
try {
for (var provider in _sortedAvailableProviders.values) {
if (!(await provider.checkIsAvailable())) {
continue;
}
if (provider is SimpleSwapExchangeProvider) {
request = SimpleSwapRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount.replaceAll(',', '.'),
address: receiveAddress,
refundAddress: depositAddress,
);
amount = depositAmount;
}
if (provider is SideShiftExchangeProvider) {
request = SideShiftRequest(
depositMethod: depositCurrency,
settleMethod: receiveCurrency,
depositAmount: depositAmount.replaceAll(',', '.'),
settleAddress: receiveAddress,
refundAddress: depositAddress,
);
amount = depositAmount;
}
if (provider is XMRTOExchangeProvider) {
request = XMRTOTradeRequest(
if (provider is SimpleSwapExchangeProvider) {
request = SimpleSwapRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount.replaceAll(',', '.'),
receiveAmount: receiveAmount.replaceAll(',', '.'),
address: receiveAddress,
refundAddress: depositAddress,
isBTCRequest: isReceiveAmountEntered);
amount = depositAmount;
}
);
amount = depositAmount;
}
if (provider is ChangeNowExchangeProvider) {
request = ChangeNowRequest(
from: depositCurrency,
to: receiveCurrency,
fromAmount: depositAmount.replaceAll(',', '.'),
toAmount: receiveAmount.replaceAll(',', '.'),
refundAddress: depositAddress,
address: receiveAddress,
isReverse: isReverse);
amount = isReverse ? receiveAmount : depositAmount;
}
if (provider is XMRTOExchangeProvider) {
request = XMRTOTradeRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount.replaceAll(',', '.'),
receiveAmount: receiveAmount.replaceAll(',', '.'),
address: receiveAddress,
refundAddress: depositAddress,
isBTCRequest: isReceiveAmountEntered);
amount = depositAmount;
}
if (provider is MorphTokenExchangeProvider) {
request = MorphTokenRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount.replaceAll(',', '.'),
refundAddress: depositAddress,
address: receiveAddress);
amount = depositAmount;
}
if (provider is ChangeNowExchangeProvider) {
request = ChangeNowRequest(
from: depositCurrency,
to: receiveCurrency,
fromAmount: depositAmount.replaceAll(',', '.'),
toAmount: receiveAmount.replaceAll(',', '.'),
refundAddress: depositAddress,
address: receiveAddress,
isReverse: isReverse);
amount = isReverse ? receiveAmount : depositAmount;
}
amount = amount.replaceAll(',', '.');
if (provider is MorphTokenExchangeProvider) {
request = MorphTokenRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount.replaceAll(',', '.'),
refundAddress: depositAddress,
address: receiveAddress);
amount = depositAmount;
}
if (limitsState is LimitsLoadedSuccessfully) {
if (double.parse(amount) < limits.min!) {
continue;
} else if (limits.max != null && double.parse(amount) > limits.max!) {
continue;
} else {
try {
tradeState = TradeIsCreating();
final trade = await provider.createTrade(
request: request!, isFixedRateMode: isFixedRateMode);
trade.walletId = wallet.id;
tradesStore.setTrade(trade);
await trades.add(trade);
tradeState = TradeIsCreatedSuccessfully(trade: trade);
/// return after the first successful trade
return;
} catch (e) {
amount = amount.replaceAll(',', '.');
if (limitsState is LimitsLoadedSuccessfully) {
if (double.parse(amount) < limits.min!) {
continue;
} else if (limits.max != null && double.parse(amount) > limits.max!) {
continue;
} else {
try {
tradeState = TradeIsCreating();
final trade = await provider.createTrade(
request: request!, isFixedRateMode: isFixedRateMode);
trade.walletId = wallet.id;
tradesStore.setTrade(trade);
await trades.add(trade);
tradeState = TradeIsCreatedSuccessfully(trade: trade);
/// return after the first successful trade
return;
} catch (e) {
continue;
}
}
}
}
}
/// if the code reached here then none of the providers succeeded
tradeState = TradeIsCreatedFailure(
title: S.current.trade_not_created,
error: S.current.none_of_selected_providers_can_exchange);
/// if the code reached here then none of the providers succeeded
tradeState = TradeIsCreatedFailure(
title: S.current.trade_not_created,
error: S.current.none_of_selected_providers_can_exchange);
} on ConcurrentModificationError {
/// if create trade happened at the exact same time of the scheduled rate update
/// then delay the create trade a bit and try again
///
/// this is because the limitation of the SplayTreeMap that
/// you can't modify it while iterating through it
Future.delayed(Duration(milliseconds: 500), createTrade);
}
}
@action

@ -3,15 +3,9 @@ import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:mobx/mobx.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/entities/biometric_auth.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cw_core/node.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/haven/haven.dart';
import 'package:cake_wallet/entities/action_list_display_mode.dart';
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cw_core/transaction_history.dart';
import 'package:cw_core/balance.dart';
import 'package:cw_core/transaction_info.dart';

@ -655,5 +655,6 @@
"privacy_settings": "Datenschutzeinstellungen",
"privacy": "Datenschutz",
"display_settings": "Anzeigeeinstellungen",
"other_settings": "Andere Einstellungen"
"other_settings": "Andere Einstellungen",
"disable_exchange": "Exchange deaktivieren"
}

@ -658,5 +658,6 @@
"privacy_settings": "Privacy settings",
"privacy": "Privacy",
"display_settings": "Display settings",
"other_settings": "Other settings"
"other_settings": "Other settings",
"disable_exchange": "Disable exchange"
}

@ -655,5 +655,6 @@
"privacy_settings": "Configuración de privacidad",
"privacy": "Privacidad",
"display_settings": "Configuración de pantalla",
"other_settings": "Otras configuraciones"
"other_settings": "Otras configuraciones",
"disable_exchange": "Deshabilitar intercambio"
}

@ -653,5 +653,6 @@
"privacy_settings": "Paramètres de confidentialité",
"privacy": "Confidentialité",
"display_settings": "Paramètres d'affichage",
"other_settings": "Autres paramètres"
"other_settings": "Autres paramètres",
"disable_exchange": "Désactiver l'échange"
}

@ -655,5 +655,6 @@
"privacy_settings": "गोपनीयता सेटिंग्स",
"privacy": "गोपनीयता",
"display_settings": "प्रदर्शन सेटिंग्स",
"other_settings": "अन्य सेटिंग्स"
"other_settings": "अन्य सेटिंग्स",
"disable_exchange": "एक्सचेंज अक्षम करें"
}

@ -655,5 +655,6 @@
"privacy_settings": "Postavke privatnosti",
"privacy": "Privatnost",
"display_settings": "Postavke zaslona",
"other_settings": "Ostale postavke"
"other_settings": "Ostale postavke",
"disable_exchange": "Onemogući exchange"
}

@ -655,5 +655,6 @@
"privacy_settings": "Impostazioni privacy",
"privacy": "Privacy",
"display_settings": "Impostazioni di visualizzazione",
"other_settings": "Altre impostazioni"
"other_settings": "Altre impostazioni",
"disable_exchange": "Disabilita scambio"
}

@ -655,5 +655,6 @@
"privacy_settings": "プライバシー設定",
"privacy": "プライバシー",
"display_settings": "表示設定",
"other_settings": "その他の設定"
"other_settings": "その他の設定",
"disable_exchange": "交換を無効にする"
}

@ -655,5 +655,6 @@
"privacy_settings": "개인정보 설정",
"privacy": "프라이버시",
"display_settings": "디스플레이 설정",
"other_settings": "기타 설정"
"other_settings": "기타 설정",
"disable_exchange": "교환 비활성화"
}

@ -655,5 +655,6 @@
"privacy_settings": "Privacy-instellingen",
"privacy": "Privacy",
"display_settings": "Weergave-instellingen",
"other_settings": "Andere instellingen"
"other_settings": "Andere instellingen",
"disable_exchange": "Uitwisseling uitschakelen"
}

@ -655,5 +655,6 @@
"privacy_settings": "Ustawienia prywatności",
"privacy": "Prywatność",
"display_settings": "Ustawienia wyświetlania",
"other_settings": "Inne ustawienia"
"other_settings": "Inne ustawienia",
"disable_exchange": "Wyłącz wymianę"
}

@ -655,5 +655,6 @@
"privacy_settings": "Configurações de privacidade",
"privacy": "Privacidade",
"display_settings": "Configurações de exibição",
"other_settings": "Outras configurações"
"other_settings": "Outras configurações",
"disable_exchange": "Desativar troca"
}

@ -655,5 +655,6 @@
"privacy_settings": "Настройки конфиденциальности",
"privacy": "Конфиденциальность",
"display_settings": "Настройки отображения",
"other_settings": "Другие настройки"
"other_settings": "Другие настройки",
"disable_exchange": "Отключить обмен"
}

@ -654,6 +654,6 @@
"privacy_settings": "Налаштування конфіденційності",
"privacy": "Конфіденційність",
"display_settings": "Налаштування дисплея",
"other_settings": "Інші налаштування"
"other_settings": "Інші налаштування",
"disable_exchange": "Вимкнути exchange"
}

@ -653,5 +653,6 @@
"privacy_settings": "隐私设置",
"privacy":"隐私",
"display_settings": "显示设置",
"other_settings": "其他设置"
"other_settings": "其他设置",
"disable_exchange": "禁用交换"
}

@ -14,14 +14,14 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_ANDROID_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.2.0"
MONERO_COM_BUILD_NUMBER=28
MONERO_COM_VERSION="1.2.1"
MONERO_COM_BUILD_NUMBER=32
MONERO_COM_BUNDLE_ID="com.monero.app"
MONERO_COM_PACKAGE="com.monero.app"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.5.0"
CAKEWALLET_BUILD_NUMBER=132
CAKEWALLET_VERSION="4.5.1"
CAKEWALLET_BUILD_NUMBER=136
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"

@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.2.0"
MONERO_COM_BUILD_NUMBER=28
MONERO_COM_VERSION="1.2.1"
MONERO_COM_BUILD_NUMBER=29
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.5.0"
CAKEWALLET_BUILD_NUMBER=132
CAKEWALLET_VERSION="4.5.1"
CAKEWALLET_BUILD_NUMBER=133
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven"

Loading…
Cancel
Save