Skip to content
Merged
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
1 change: 1 addition & 0 deletions common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="buy_dash">Buy Dash</string>
<string name="copied">Copied</string>
<string name="staking_title">Staking</string>
<string name="spend_title">Spend</string>
<string name="email">Email</string>
<string name="email_placeholder">e.g. [email protected]</string>
<string name="error">Error</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ enum class ShortcutOption(
R.drawable.ic_shortcut_secure_now,
R.string.shortcut_secure_now
),
EXPLORE(
1,
R.drawable.ic_explore,
R.string.menu_explore_title
),

RECEIVE(
2,
R.drawable.ic_transaction_received,
Expand Down Expand Up @@ -69,7 +65,12 @@ enum class ShortcutOption(
WHERE_TO_SPEND(
8,
R.drawable.ic_where_to_spend,
R.string.explore_where_to_spend
R.string.spend_title
),
EXPLORE(
1,
R.drawable.ic_explore,
R.string.menu_explore_title
),
ATMS(
9,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,44 @@ class ShortcutProvider @Inject constructor(
}
.launchIn(scope)
}
/* Current Default Shortcuts
When they have a zero balance and have not verified their passphrase
Backup
Receive
Buy & Sell
Spend
When they have a zero balance and have verified their passphrase
Receive
Send
Buy & Sell
Spend
When they have a balance and have verified their passphrase
Receive
Send
Scan
Spend
When they have a balance and have not verified their passphrase
Backup
Receive
Send
Spend
*/

// Default logic before the user customizes shortcuts
fun getFilteredShortcuts(
isPassphraseVerified: Boolean = true,
userHasBalance: Boolean = true,
userHasContacts: Boolean = false
userHasContacts: Boolean = false,
prioritizeSpend: Boolean = true
): List<ShortcutOption> {
val shortcuts = ShortcutOption.entries.filter { shortcut ->
when (shortcut) {
ShortcutOption.SECURE_NOW -> !isPassphraseVerified
ShortcutOption.SCAN_QR -> userHasBalance
ShortcutOption.SEND -> !userHasBalance && isPassphraseVerified
ShortcutOption.SCAN_QR -> userHasBalance && isPassphraseVerified
ShortcutOption.SEND -> userHasBalance || isPassphraseVerified
ShortcutOption.BUY_SELL -> !userHasBalance
ShortcutOption.SEND_TO_ADDRESS -> userHasBalance
ShortcutOption.SEND_TO_CONTACT -> userHasBalance && userHasContacts
ShortcutOption.SEND_TO_ADDRESS -> userHasBalance && !prioritizeSpend
ShortcutOption.SEND_TO_CONTACT -> userHasBalance && userHasContacts && !prioritizeSpend
else -> true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class ShortcutsViewModel @Inject constructor(
return shortcutProvider.getFilteredShortcuts(
isPassphraseVerified = isPassphraseVerified,
userHasBalance = userHasBalance,
userHasContacts = userHasContacts
userHasContacts = userHasContacts,
prioritizeSpend = true
)
}

Expand Down
Loading