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

This commit is contained in:
Godwin Asuquo 2022-11-23 22:54:24 +02:00
commit 63df8c6b6f
26 changed files with 138 additions and 113 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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/sideshift/sideshift_request.dart';
import 'package:cake_wallet/exchange/simpleswap/simpleswap_exchange_provider.dart'; import 'package:cake_wallet/exchange/simpleswap/simpleswap_exchange_provider.dart';
import 'package:cake_wallet/view_model/settings/settings_view_model.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:cake_wallet/exchange/simpleswap/simpleswap_request.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
@ -375,6 +374,7 @@ abstract class ExchangeViewModelBase with Store {
TradeRequest? request; TradeRequest? request;
String amount = ''; String amount = '';
try {
for (var provider in _sortedAvailableProviders.values) { for (var provider in _sortedAvailableProviders.values) {
if (!(await provider.checkIsAvailable())) { if (!(await provider.checkIsAvailable())) {
continue; continue;
@ -465,6 +465,14 @@ abstract class ExchangeViewModelBase with Store {
tradeState = TradeIsCreatedFailure( tradeState = TradeIsCreatedFailure(
title: S.current.trade_not_created, title: S.current.trade_not_created,
error: S.current.none_of_selected_providers_can_exchange); 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 @action

View file

@ -3,15 +3,9 @@ import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cake_wallet/store/settings_store.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:cw_core/wallet_type.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/fiat_currency.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/entities/action_list_display_mode.dart';
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/transaction_history.dart';
import 'package:cw_core/balance.dart'; import 'package:cw_core/balance.dart';
import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/transaction_info.dart';

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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