Skip to content

Commit

Permalink
🤲 [FEAT] Create accounts with the receive market quick action (#7635)
Browse files Browse the repository at this point in the history
* Create accounts with the receive market quick action

* Update change log

---------

Co-authored-by: Theophile Sandoz <Theophile Sandoz>
  • Loading branch information
thesan authored Aug 23, 2024
1 parent 93a4951 commit e85f65b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-carrots-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Create accounts with the receive market quick action
22 changes: 14 additions & 8 deletions apps/ledger-live-mobile/src/hooks/useQuickActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ function useQuickActions({ currency, accounts }: QuickActionProps = {}) {
const { isCurrencyAvailable } = useRampCatalog();

const readOnlyModeEnabled = useSelector(readOnlyModeEnabledSelector);
const hasAccounts = useSelector(accountsCountSelector) > 0;
const hasFunds = !useSelector(areAccountsEmptySelector) && hasAccounts;
const hasAnyAccounts = useSelector(accountsCountSelector) > 0;
const hasCurrencyAccounts = currency ? !!accounts?.length : hasAnyAccounts;
const hasFunds = !useSelector(areAccountsEmptySelector) && hasAnyAccounts;
const hasCurrency = currency ? !!accounts?.some(({ balance }) => balance.gt(0)) : hasFunds;

const recoverEntryPoint = useFeature("protectServicesMobile");
Expand Down Expand Up @@ -70,12 +71,16 @@ function useQuickActions({ currency, accounts }: QuickActionProps = {}) {
disabled: readOnlyModeEnabled,
route: [
NavigatorName.ReceiveFunds,
currency
? {
screen: ScreenName.ReceiveSelectAccount,
params: { currency },
}
: { screen: ScreenName.ReceiveSelectCrypto },
!currency
? { screen: ScreenName.ReceiveSelectCrypto }
: {
screen: hasCurrencyAccounts
? ScreenName.ReceiveSelectAccount
: ScreenName.ReceiveAddAccountSelectDevice,
params: {
currency: currency.type === "TokenCurrency" ? currency.parentCurrency : currency,
},
},
],
icon: IconsLegacy.ArrowBottomMedium,
},
Expand Down Expand Up @@ -166,6 +171,7 @@ function useQuickActions({ currency, accounts }: QuickActionProps = {}) {
return list;
}, [
currency,
hasCurrencyAccounts,
hasCurrency,
hasFunds,
isPtxServiceCtaExchangeDrawerDisabled,
Expand Down

0 comments on commit e85f65b

Please sign in to comment.