Skip to content

fix(EWM-374): amount format #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions lib/app/service/balance_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class BalanceService {
/// Calculate balance in fiat currency for TonWallet, specified by [address],
/// and all existed TokenWallets for this [address]. This is quite complicated
/// logic and uses already created subscriptions for Ton/TokenWallets.
///
/// If you need to get amount without subscriptions, use [getKeyBalance] or
/// [getAccountBalance].
// ignore: long-method
Stream<Fixed?> accountOverallBalance(Address address) {
return Rx.combineLatest3<TonWalletState?, TransportStrategy, KeyAccount?,
(TonWalletState?, TransportStrategy, KeyAccount?)>(
Expand Down Expand Up @@ -234,18 +230,4 @@ class BalanceService {
return Fixed.zero;
});
}

/// Get balance of public key and all related Ton/Token wallets of it without
/// creating subscriptions.
// TODO(alex-a4): implement later
Future<Fixed> getKeyBalance(PublicKey _) async {
return Fixed.zero;
}

/// Get balance of account and all tokens of wallet without
/// creating subscriptions.
// TODO(alex-a4): implement later
Future<Fixed> getAccountBalance(KeyAccount _) async {
return Fixed.zero;
}
}
12 changes: 0 additions & 12 deletions lib/bootstrap/connection_service.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import 'package:app/app/service/connection/connection_service.dart';
import 'package:app/di/di.dart';
import 'package:flutter/widgets.dart';
import 'package:logging/logging.dart';
import 'package:nekoton_repository/nekoton_repository.dart';

Future<void> configureConnectionService() async {
final log = Logger('bootstrap')
..finest('ConnectionService initializating...');

// TODO(nesquikm): Theoretically, this should be called every time after app
// returns from background.
await _configureProxy();

/// Было тут
final service = inject<ConnectionService>();
await service.setUp();
Expand All @@ -23,10 +18,3 @@ Future<void> configureConnectionService() async {
..setupWalletsSubscriptions();
log.finest('ConnectionService initialized');
}

/// Configure proxy for http requests
Future<void> _configureProxy() async {
WidgetsFlutterBinding.ensureInitialized();
// final httpProxy = await HttpProxy.createHttpProxy();
// HttpOverrides.global = httpProxy;
}
1 change: 0 additions & 1 deletion lib/core/wm/notifier_subscriptions_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ mixin NotifierSubscriptionsMixin<W extends ElementaryWidget,
final initialValue = isMounted ? reader(widget) : null;
final notifier = createNotifier<T>(initialValue);
_widgetPropsReaders[notifier] = reader;
_subscriptionsCollection.add(notifier);
return notifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ class WalletPrepareTransferPageWidgetModel extends CustomWidgetModel<
(w) => w.tokenSymbol,
);

StreamSubscription<dynamic>? _currencySubscription;

WalletPrepareTransferData? get _data => screenState.value.data;

WalletPrepareTransferAsset? get _selectedAsset => _data?.selectedAsset;
Expand All @@ -119,12 +117,6 @@ class WalletPrepareTransferPageWidgetModel extends CustomWidgetModel<
_initListeners();
}

@override
void dispose() {
_currencySubscription?.cancel();
super.dispose();
}

String? getSeedName(PublicKey custodian) => model.getSeedName(custodian);

void onChangeAsset(AmountInputAsset newAsset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class TokenTransferInfoWidget
amount: amount,
icon: icon,
includeSymbol: false,
useDefaultFormat: false,
);
},
),
Expand Down
4 changes: 3 additions & 1 deletion packages/ui_components_lib/lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ extension MoneyFormat on Money {
);
}

if (d < 1) {
if (d < 0.00000001) {
return formatImproved(pattern: _moneyPattern(decimalDigits));
} else if (d < 1) {
return formatImproved(pattern: _moneyPattern(8));
} else if (d < 1000) {
return formatImproved(pattern: _moneyPattern(4));
Expand Down