CW-532-DFX-buy-provider (#1209)

* dfx buy provider ui

* fix signing flow

* fixed provider determination based on wallet type and app settings

* update localization files

* minor fix

* Fix BTC, LTC und BCH signMessages

* Add signMessage to monero

* open dfx in webview

* Update dfx_buy_provider.dart

* Revert merge conflict

* Update bitcoin_flutter ref

---------

Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
This commit is contained in:
Serhii
2023-12-08 16:05:52 +02:00
committed by GitHub
co-authored by Konstantin Ullrich
parent d370c754c5
commit 2138c35e38
50 changed files with 456 additions and 109 deletions
@@ -282,10 +282,14 @@ abstract class DashboardViewModelBase with Store {
Map<String, List<FilterItem>> filterItems;
BuyProviderType get defaultBuyProvider => settingsStore.defaultBuyProvider;
BuyProviderType get defaultBuyProvider =>
settingsStore.defaultBuyProviders[wallet.type] ??
BuyProviderType.AskEachTime;
bool get isBuyEnabled => settingsStore.isBitcoinBuyEnabled;
List<BuyProviderType> get availableProviders => BuyProviderType.getAvailableProviders(wallet.type);
bool get shouldShowYatPopup => settingsStore.shouldShowYatPopup;
@action
@@ -13,14 +13,15 @@ import 'package:package_info/package_info.dart';
part 'other_settings_view_model.g.dart';
class OtherSettingsViewModel = OtherSettingsViewModelBase with _$OtherSettingsViewModel;
class OtherSettingsViewModel = OtherSettingsViewModelBase
with _$OtherSettingsViewModel;
abstract class OtherSettingsViewModelBase with Store {
OtherSettingsViewModelBase(this._settingsStore, this._wallet)
: walletType = _wallet.type,
currentVersion = '' {
PackageInfo.fromPlatform()
.then((PackageInfo packageInfo) => currentVersion = packageInfo.version);
PackageInfo.fromPlatform().then(
(PackageInfo packageInfo) => currentVersion = packageInfo.version);
final priority = _settingsStore.priority[_wallet.type];
final priorities = priorityForWalletType(_wallet.type);
@@ -31,7 +32,8 @@ abstract class OtherSettingsViewModelBase with Store {
}
final WalletType walletType;
final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> _wallet;
final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>,
TransactionInfo> _wallet;
@observable
String currentVersion;
@@ -50,15 +52,19 @@ abstract class OtherSettingsViewModelBase with Store {
}
@computed
bool get changeRepresentativeEnabled {
if (_wallet.type == WalletType.nano || _wallet.type == WalletType.banano) {
return true;
}
bool get changeRepresentativeEnabled =>
_wallet.type == WalletType.nano || _wallet.type == WalletType.banano;
return false;
}
BuyProviderType get buyProviderType { return _settingsStore.defaultBuyProvider; }
@computed
bool get isEnabledBuyAction =>
!_settingsStore.disableBuy && _wallet.type != WalletType.haven;
List<BuyProviderType> get availableBuyProviders =>
BuyProviderType.getAvailableProviders(walletType);
BuyProviderType get buyProviderType =>
_settingsStore.defaultBuyProviders[walletType] ??
BuyProviderType.AskEachTime;
String getDisplayPriority(dynamic priority) {
final _priority = priority as TransactionPriority;
@@ -73,7 +79,7 @@ abstract class OtherSettingsViewModelBase with Store {
return priority.toString();
}
String getBuyProviderType (dynamic buyProviderType) {
String getBuyProviderType(dynamic buyProviderType) {
final _buyProviderType = buyProviderType as BuyProviderType;
return _buyProviderType.toString();
@@ -83,6 +89,5 @@ abstract class OtherSettingsViewModelBase with Store {
_settingsStore.priority[_wallet.type] = priority;
void onBuyProviderTypeSelected(BuyProviderType buyProviderType) =>
_settingsStore.defaultBuyProvider = buyProviderType;
_settingsStore.defaultBuyProviders[walletType] = buyProviderType;
}