From cf10b21f140ae450c7108b6492b15e950c0445ea Mon Sep 17 00:00:00 2001 From: Andrey Molochko <36672245+AndreyMolochko@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:45:26 +0300 Subject: [PATCH] fix: empty state for new tokens (#633) * fix empty state for new tokens * use lambda --------- Co-authored-by: Andrey Malochka --- assets/translations/en.json | 4 ++-- assets/translations/ko.json | 4 ++-- .../account_asset_tab/account_asset_tab.dart | 2 +- .../account_asset_tab_cubit.dart | 18 ++++++++---------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 6c3e2c3f..3d8c4d81 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -543,14 +543,14 @@ "manualBackupTitleDialog": "Manual backup", "manualBackupSubtitleDialog": "Save your secret recovery phrase in a secure place that only you control.", "createNewAccount": "Create new account", - "addExternalAccount": "Add an external account", + "addExternalAccount": "Add an external account (soon)", "confirmAction": "Confirm action", "enterYourPassword": "Enter your password", "useFaceID": "Use Face ID", "useFingerprint": "Use Fingerprint", "accountName": "Account name", "defaultWord": "Default", - "multisignatureWord": "Multi Signature", + "multisignatureWord": "Multi-Signature", "forExperiencedUsers": "For experienced users", "walletDescriptionSurfWallet": "Wallet contract used in Surf. Requires deployment.", "walletDescriptionWalletV3": "Small legacy contract with one custodian. Deploys automatically.", diff --git a/assets/translations/ko.json b/assets/translations/ko.json index 6ff28ff5..6157d5f3 100644 --- a/assets/translations/ko.json +++ b/assets/translations/ko.json @@ -543,14 +543,14 @@ "manualBackupTitleDialog": "Manual backup", "manualBackupSubtitleDialog": "Save your secret recovery phrase in a secure place that only you control.", "createNewAccount": "Create new account", - "addExternalAccount": "Add an external account", + "addExternalAccount": "Add an external account (soon)", "confirmAction": "Confirm action", "enterYourPassword": "Enter your password", "useFaceID": "Use Face ID", "useFingerprint": "Use Fingerprint", "accountName": "Account name", "defaultWord": "Default", - "multisignatureWord": "Multi Signature", + "multisignatureWord": "Multi-Signature", "forExperiencedUsers": "For experienced users", "walletDescriptionSurfWallet": "Wallet contract used in Surf. Requires deployment.", "walletDescriptionWalletV3": "Small legacy contract with one custodian. Deploys automatically.", diff --git a/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab.dart b/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab.dart index 450656e7..705fe848 100644 --- a/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab.dart +++ b/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab.dart @@ -72,7 +72,7 @@ class AccountAssetsTab extends StatelessWidget { isShowingNewTokens: isShowingNewTokens, confirmImportCallback: confirmImportCallback, numberNewTokens: state.when( - empty: () => 0, + empty: () => null, accounts: (_, __, newTokens) => newTokens, ), ); diff --git a/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab_cubit.dart b/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab_cubit.dart index 768f7318..06e8c7f1 100644 --- a/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab_cubit.dart +++ b/lib/feature/wallet/widgets/account_asset_tab/account_asset_tab_cubit.dart @@ -32,16 +32,14 @@ class AccountAssetTabCubit extends Cubit { ); }); - if (isShowingNewTokens) { - _searchSubscription = tokenWalletsService - .searchTokenWalletsForAddress(tonWallet.address) - .reduce((previous, element) => [...previous, ...element]) - .asStream() - .listen( - (value) => _updateAccounts(value.length), - onError: (_) => _updateAccounts(0), - ); - } + _searchSubscription = tokenWalletsService + .searchTokenWalletsForAddress(tonWallet.address) + .reduce((previous, element) => [...previous, ...element]) + .asStream() + .listen( + (value) => _updateAccounts(value.length), + onError: (_) => _updateAccounts(0), + ); } final AssetsService assetsService;