fix zero initial fee rates in RBF rate picker (#1585)

* fix zero initial fee rates in RBF rate picker

* fix for other settings page[skip ci]
This commit is contained in:
Serhii 2024-08-10 01:18:55 +03:00 committed by GitHub
parent acadee6ed5
commit 9c29dbd6fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 7 deletions

View file

@ -759,8 +759,8 @@ Future<void> setup({
getIt.registerFactory(() => TrocadorProvidersViewModel(getIt.get<SettingsStore>()));
getIt.registerFactory(() {
return OtherSettingsViewModel(getIt.get<SettingsStore>(), getIt.get<AppStore>().wallet!);
});
return OtherSettingsViewModel(getIt.get<SettingsStore>(), getIt.get<AppStore>().wallet!,
getIt.get<SendViewModel>());});
getIt.registerFactory(() {
return SecuritySettingsViewModel(getIt.get<SettingsStore>());

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
@ -12,7 +13,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
class OtherSettingsPage extends BasePage {
OtherSettingsPage(this._otherSettingsViewModel);
OtherSettingsPage(this._otherSettingsViewModel) {
if (_otherSettingsViewModel.sendViewModel.isElectrumWallet) {
bitcoin!.updateFeeRates(_otherSettingsViewModel.sendViewModel.wallet);
}
}
@override
String get title => S.current.other_settings;

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
@ -15,7 +16,11 @@ import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
class TransactionDetailsPage extends BasePage {
TransactionDetailsPage({required this.transactionDetailsViewModel});
TransactionDetailsPage({required this.transactionDetailsViewModel}) {
if (transactionDetailsViewModel.sendViewModel.isElectrumWallet) {
bitcoin!.updateFeeRates(transactionDetailsViewModel.sendViewModel.wallet);
}
}
@override
String get title => S.current.transaction_details_title;

View file

@ -499,10 +499,10 @@ class _PickerState<Item> extends State<Picker<Item>> {
children: <Widget>[
Expanded(
child: Slider(
value: widget.sliderValue ?? 1,
value: widget.sliderValue == null || widget.sliderValue! < 1 ? 1 : widget.sliderValue!,
onChanged: isActivated ? widget.onSliderChanged : null,
min: widget.minValue ?? 1,
max: widget.maxValue ?? 100,
max: (widget.maxValue == null || widget.maxValue! < 1) ? 100 : widget.maxValue!,
divisions: 100,
),
),

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/entities/provider_types.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/package_info.dart';
import 'package:cake_wallet/view_model/send/send_view_model.dart';
// import 'package:package_info/package_info.dart';
import 'package:collection/collection.dart';
import 'package:cw_core/balance.dart';
@ -20,7 +21,7 @@ class OtherSettingsViewModel = OtherSettingsViewModelBase
with _$OtherSettingsViewModel;
abstract class OtherSettingsViewModelBase with Store {
OtherSettingsViewModelBase(this._settingsStore, this._wallet)
OtherSettingsViewModelBase(this._settingsStore, this._wallet, this.sendViewModel)
: walletType = _wallet.type,
currentVersion = '' {
PackageInfo.fromPlatform().then(
@ -42,6 +43,7 @@ abstract class OtherSettingsViewModelBase with Store {
String currentVersion;
final SettingsStore _settingsStore;
final SendViewModel sendViewModel;
@computed
TransactionPriority get transactionPriority {