Skip to content
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

Move zero balances filter #1698

Open
wants to merge 2 commits into
base: feature/portfolio-view-data
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
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,6 @@ class Navigator(
navController?.navigate(R.id.action_open_receive, ReceiveFragment.getBundle(assetPayload))
}

override fun openAssetFilters() {
navController?.navigate(R.id.action_mainFragment_to_assetFiltersFragment)
}

override fun openAssetSearch() {
navController?.navigate(R.id.action_mainFragment_to_assetSearchFragment)
}
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,6 @@
app:popEnterAnim="@anim/fragment_close_enter"
app:popExitAnim="@anim/fragment_close_exit" />

<action
android:id="@+id/action_mainFragment_to_assetFiltersFragment"
app:destination="@id/assetFiltersFragment"
app:enterAnim="@anim/fragment_open_enter"
app:exitAnim="@anim/fragment_open_exit"
app:popEnterAnim="@anim/fragment_close_enter"
app:popExitAnim="@anim/fragment_close_exit" />

<action
android:id="@+id/action_mainFragment_to_nfts_nav_graph"
app:destination="@id/nfts_nav_graph"
Expand Down Expand Up @@ -847,11 +839,6 @@

<include app:graph="@navigation/nfts_nav_graph" />

<dialog
android:id="@+id/assetFiltersFragment"
android:name="io.novafoundation.nova.feature_assets.presentation.balance.filters.AssetFiltersBottomSheetFragment"
android:label="AssetFiltersFragment" />

<fragment
android:id="@+id/authorizedDAppsFragment"
android:name="io.novafoundation.nova.feature_dapp_impl.presentation.authorizedDApps.AuthorizedDAppsFragment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import io.novafoundation.nova.feature_account_api.di.AccountFeatureApi
import io.novafoundation.nova.feature_account_api.presenatation.mixin.selectAddress.SelectAddressCommunicator
import io.novafoundation.nova.feature_assets.presentation.AssetsRouter
import io.novafoundation.nova.feature_assets.presentation.balance.detail.di.BalanceDetailComponent
import io.novafoundation.nova.feature_assets.presentation.balance.filters.di.AssetFiltersComponent
import io.novafoundation.nova.feature_assets.presentation.balance.list.di.BalanceListComponent
import io.novafoundation.nova.feature_assets.presentation.balance.list.view.GoToNftsView
import io.novafoundation.nova.feature_assets.presentation.balance.search.di.AssetSearchComponent
Expand Down Expand Up @@ -74,8 +73,6 @@ interface AssetsFeatureComponent : AssetsFeatureApi {

fun receiveComponentFactory(): ReceiveComponent.Factory

fun assetFiltersComponentFactory(): AssetFiltersComponent.Factory

fun assetSearchComponentFactory(): AssetSearchComponent.Factory

fun manageTokensComponentFactory(): ManageTokensComponent.Factory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ interface AssetsRouter {

fun openReceive(assetPayload: AssetPayload)

fun openAssetFilters()

fun openAssetSearch()

fun openManageTokens()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ class BalanceListFragment :
viewModel.searchClicked()
}

override fun filtersClicked() {
viewModel.filtersClicked()
}

override fun avatarClicked() {
viewModel.avatarClicked()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ class BalanceListViewModel(
router.openSwitchWallet()
}

fun filtersClicked() {
router.openAssetFilters()
}

fun manageClicked() {
router.openManageTokens()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import kotlinx.android.synthetic.main.item_asset_header.view.balanceListAssetPla
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListAssetTitle
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListAvatar
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListCrowdloansPromoBanner
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListFilters
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListManage
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListNfts
import kotlinx.android.synthetic.main.item_asset_header.view.balanceListSearch
Expand All @@ -29,7 +28,7 @@ class AssetsHeaderAdapter(private val handler: Handler) : RecyclerView.Adapter<H
fun totalBalanceClicked()

fun searchClicked()
fun filtersClicked()

fun manageClicked()

fun avatarClicked()
Expand Down Expand Up @@ -65,8 +64,6 @@ class AssetsHeaderAdapter(private val handler: Handler) : RecyclerView.Adapter<H

fun setFilterIconRes(filterIconRes: Int) {
this.filterIconRes = filterIconRes

notifyItemChanged(0, Payload.FILTER_ICON)
}

fun setCrowdloanBannerVisible(crowdloanBannerVisible: Boolean) {
Expand Down Expand Up @@ -133,7 +130,6 @@ class AssetsHeaderAdapter(private val handler: Handler) : RecyclerView.Adapter<H
Payload.NFT_PREVIEWS -> holder.bindNftPreviews(nftPreviews)
Payload.PLACEHOLDER -> holder.bindPlaceholder(shouldShowPlaceholder)
Payload.WALLET_CONNECT -> holder.bindWalletConnect(walletConnectModel)
Payload.FILTER_ICON -> holder.bindFilterIcon(filterIconRes)
Payload.CROWDLOAN_BANNER_VISIBLE -> holder.bindCrowdloanBanner(crowdloanBannerVisible)
Payload.ASSET_VIEW_MODE -> holder.bindAssetViewMode(assetViewModeModel)
}
Expand Down Expand Up @@ -161,7 +157,7 @@ class AssetsHeaderAdapter(private val handler: Handler) : RecyclerView.Adapter<H
}

private enum class Payload {
TOTAL_BALANCE, ADDRESS, NFT_COUNT, NFT_PREVIEWS, PLACEHOLDER, WALLET_CONNECT, FILTER_ICON,
TOTAL_BALANCE, ADDRESS, NFT_COUNT, NFT_PREVIEWS, PLACEHOLDER, WALLET_CONNECT,
CROWDLOAN_BANNER_VISIBLE, ASSET_VIEW_MODE
}

Expand All @@ -178,7 +174,6 @@ class HeaderHolder(
balanceListAvatar.setOnClickListener { handler.avatarClicked() }
balanceListNfts.setOnClickListener { handler.goToNftsClicked() }
balanceListSearch.setOnClickListener { handler.searchClicked() }
balanceListFilters.setOnClickListener { handler.filtersClicked() }
balanceListTotalBalance.onSendClick { handler.sendClicked() }
balanceListTotalBalance.onReceiveClick { handler.receiveClicked() }
balanceListTotalBalance.onBuyClick { handler.buyClicked() }
Expand Down Expand Up @@ -209,7 +204,6 @@ class HeaderHolder(
bindNftCount(nftCount)
bindPlaceholder(shouldShowPlaceholder)
bindWalletConnect(walletConnect)
bindFilterIcon(filterIconRes)
bindCrowdloanBanner(bannerVisible)
bindAssetViewMode(assetViewModeModel)
}
Expand Down Expand Up @@ -242,10 +236,6 @@ class HeaderHolder(
containerView.balanceListWalletConnect.setConnectionCount(it.connections)
}

fun bindFilterIcon(filterIconRes: Int?) {
filterIconRes?.let { containerView.balanceListFilters.setImageResource(it) }
}

fun bindCrowdloanBanner(bannerVisible: Boolean) = with(containerView) {
balanceListCrowdloansPromoBanner.setVisible(bannerVisible)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ import io.novafoundation.nova.common.utils.keyboard.hideSoftKeyboard
import io.novafoundation.nova.common.utils.setVisible
import io.novafoundation.nova.common.utils.keyboard.showSoftKeyboard
import io.novafoundation.nova.common.utils.submitListPreservingViewPoint
import io.novafoundation.nova.common.view.bindFromMap
import io.novafoundation.nova.feature_assets.R
import io.novafoundation.nova.feature_assets.di.AssetsFeatureApi
import io.novafoundation.nova.feature_assets.di.AssetsFeatureComponent
import io.novafoundation.nova.feature_assets.domain.assets.filters.NonZeroBalanceFilter
import kotlinx.android.synthetic.main.fragment_manage_tokens.manageTokensContainer
import kotlinx.android.synthetic.main.fragment_manage_tokens.manageTokensList
import kotlinx.android.synthetic.main.fragment_manage_tokens.manageTokensPlaceholder
import kotlinx.android.synthetic.main.fragment_manage_tokens.manageTokensSearch
import kotlinx.android.synthetic.main.fragment_manage_tokens.manageTokensToolbar
import javax.inject.Inject
import kotlinx.android.synthetic.main.fragment_manage_tokens.manageTokensSwitchZeroBalances

class ManageTokensFragment :
BaseFragment<ManageTokensViewModel>(),
Expand Down Expand Up @@ -62,6 +65,8 @@ class ManageTokensFragment :

manageTokensSearch.requestFocus()
manageTokensSearch.content.showSoftKeyboard()

manageTokensSwitchZeroBalances.bindFromMap(NonZeroBalanceFilter, viewModel.filtersEnabledMap, viewLifecycleOwner.lifecycleScope)
}

override fun inject() {
Expand Down
Loading
Loading