Skip to content

Commit f78447c

Browse files
committed
chore(menu): relocate deposit to advanced features; hide quick add and make withdraw menu item
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent ea300b1 commit f78447c

File tree

6 files changed

+33
-36
lines changed

6 files changed

+33
-36
lines changed

apps/flipcash/core/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<string name="title_withdrawUsdc">Withdraw Funds</string>
6565

6666
<string name="title_withdraw">Withdraw</string>
67+
<string name="title_withdrawFunds">Withdraw Funds</string>
6768

6869
<string name="subtitle_validAddress">Valid address</string>
6970

apps/flipcash/features/advanced/src/main/kotlin/com/flipcash/app/advanced/internal/AdvancedFeatureMenuItems.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,14 @@ internal data object BillCustomizer : FullMenuItem<AdvancedFeaturesScreenViewMod
2828
override val name: String
2929
@Composable get() = stringResource(R.string.title_billCustomizer)
3030
override val action: AdvancedFeaturesScreenViewModel.Event = AdvancedFeaturesScreenViewModel.Event.OpenBillPlayground
31+
}
32+
33+
internal data object Deposit : FullMenuItem<AdvancedFeaturesScreenViewModel.Event>() {
34+
override val icon: Painter
35+
@Composable get() = painterResource(R.drawable.ic_menu_deposit)
36+
override val name: String
37+
@Composable get() = stringResource(R.string.title_depositUsdc)
38+
override val action: AdvancedFeaturesScreenViewModel.Event = AdvancedFeaturesScreenViewModel.Event.OpenScreen(
39+
AppRoute.OnRamp.ProviderList(AppRoute.Sheets.Menu)
40+
)
3141
}

apps/flipcash/features/advanced/src/main/kotlin/com/flipcash/app/advanced/internal/AdvancedFeaturesScreenViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import javax.inject.Inject
1717

1818
private val FullMenuList = buildList {
1919
add(BillCustomizer)
20+
add(Deposit)
2021
}
2122

2223
@HiltViewModel

apps/flipcash/features/menu/src/main/kotlin/com/flipcash/app/menu/internal/MenuItems.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import androidx.compose.ui.res.painterResource
1010
import androidx.compose.ui.res.stringResource
1111
import cafe.adriel.voyager.core.registry.ScreenRegistry
1212
import com.flipcash.app.core.AppRoute
13+
import com.flipcash.app.core.tokens.TokenPurpose
1314
import com.flipcash.app.core.transfers.TransferDirection
1415
import com.flipcash.app.featureflags.FeatureFlag
1516
import com.flipcash.app.menu.FullMenuItem
@@ -27,13 +28,13 @@ internal data object MyAccount : FullMenuItem<MenuScreenViewModel.Event>() {
2728
)
2829
}
2930

30-
internal data object Deposit : FullMenuItem<MenuScreenViewModel.Event>() {
31+
internal data object Withdraw : FullMenuItem<MenuScreenViewModel.Event>() {
3132
override val icon: Painter
32-
@Composable get() = painterResource(R.drawable.ic_menu_deposit)
33+
@Composable get() = painterResource(R.drawable.ic_menu_withdraw)
3334
override val name: String
34-
@Composable get() = stringResource(R.string.title_depositUsdc)
35+
@Composable get() = stringResource(R.string.title_withdrawFunds)
3536
override val action: MenuScreenViewModel.Event = MenuScreenViewModel.Event.OpenScreen(
36-
AppRoute.OnRamp.ProviderList(AppRoute.Sheets.Menu)
37+
AppRoute.Sheets.TokenSelection(TokenPurpose.Withdraw)
3738
)
3839
}
3940

apps/flipcash/features/menu/src/main/kotlin/com/flipcash/app/menu/internal/MenuScreenContent.kt

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,27 @@
11
package com.flipcash.app.menu.internal
22

33
import androidx.compose.foundation.Image
4-
import androidx.compose.foundation.background
54
import androidx.compose.foundation.interaction.MutableInteractionSource
6-
import androidx.compose.foundation.layout.Arrangement
75
import androidx.compose.foundation.layout.Box
86
import androidx.compose.foundation.layout.PaddingValues
9-
import androidx.compose.foundation.layout.Row
10-
import androidx.compose.foundation.layout.Spacer
117
import androidx.compose.foundation.layout.fillMaxSize
128
import androidx.compose.foundation.layout.fillMaxWidth
13-
import androidx.compose.foundation.layout.height
149
import androidx.compose.foundation.layout.navigationBarsPadding
1510
import androidx.compose.foundation.layout.padding
1611
import androidx.compose.foundation.layout.requiredHeight
17-
import androidx.compose.foundation.layout.size
18-
import androidx.compose.foundation.layout.width
19-
import androidx.compose.foundation.layout.wrapContentHeight
2012
import androidx.compose.foundation.layout.wrapContentWidth
21-
import androidx.compose.foundation.lazy.LazyColumn
22-
import androidx.compose.foundation.lazy.items
23-
import androidx.compose.foundation.lazy.rememberLazyListState
24-
import androidx.compose.foundation.shape.CircleShape
25-
import androidx.compose.material.Divider
2613
import androidx.compose.material.Text
2714
import androidx.compose.runtime.Composable
2815
import androidx.compose.runtime.getValue
2916
import androidx.compose.runtime.remember
3017
import androidx.compose.runtime.rememberCoroutineScope
3118
import androidx.compose.ui.Alignment
32-
import androidx.compose.ui.Alignment.Companion.CenterVertically
3319
import androidx.compose.ui.Modifier
34-
import androidx.compose.ui.graphics.ColorFilter
3520
import androidx.compose.ui.res.painterResource
3621
import androidx.compose.ui.res.stringResource
37-
import androidx.compose.ui.text.font.FontWeight
3822
import androidx.compose.ui.text.style.TextAlign
39-
import androidx.compose.ui.unit.dp
4023
import androidx.lifecycle.compose.collectAsStateWithLifecycle
4124
import com.flipcash.app.menu.MenuList
42-
import com.flipcash.app.menu.internal.MenuScreenViewModel.Event
4325
import com.flipcash.app.onramp.AddCashRow
4426
import com.flipcash.app.updates.LocalAppUpdater
4527
import com.flipcash.features.menu.R
@@ -49,7 +31,6 @@ import com.getcode.ui.components.AppBarDefaults
4931
import com.getcode.ui.components.AppBarWithTitle
5032
import com.getcode.ui.core.noRippleClickable
5133
import com.getcode.ui.core.rememberedClickable
52-
import com.getcode.ui.core.verticalScrollStateGradient
5334
import com.getcode.ui.theme.CodeScaffold
5435
import com.getcode.ui.utils.plus
5536
import kotlinx.coroutines.launch
@@ -114,18 +95,20 @@ internal fun MenuScreenContent(viewModel: MenuScreenViewModel) {
11495
modifier = Modifier
11596
.fillMaxSize()
11697
.padding(padding),
117-
header = {
118-
AddCashRow(
119-
modifier = Modifier
120-
.fillMaxWidth()
121-
.padding(
122-
horizontal = CodeTheme.dimens.inset,
123-
vertical = CodeTheme.dimens.grid.x4,
124-
),
125-
onAddCash = { viewModel.dispatchEvent(MenuScreenViewModel.Event.OnAddCashClicked) },
126-
onWithdraw = { viewModel.dispatchEvent(MenuScreenViewModel.Event.OnWithdrawClicked) },
127-
)
128-
},
98+
header = if (state.showQuickActions) {
99+
{
100+
AddCashRow(
101+
modifier = Modifier
102+
.fillMaxWidth()
103+
.padding(
104+
horizontal = CodeTheme.dimens.inset,
105+
vertical = CodeTheme.dimens.grid.x4,
106+
),
107+
onAddCash = { viewModel.dispatchEvent(MenuScreenViewModel.Event.OnAddCashClicked) },
108+
onWithdraw = { viewModel.dispatchEvent(MenuScreenViewModel.Event.OnWithdrawClicked) },
109+
)
110+
}
111+
} else null,
129112
items = state.items,
130113
contentPadding = PaddingValues(top = CodeTheme.dimens.grid.x6),
131114
onItemClick = {

apps/flipcash/features/menu/src/main/kotlin/com/flipcash/app/menu/internal/MenuScreenViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ import javax.inject.Inject
4141

4242
private val FullMenuList = buildList {
4343
add(MyAccount)
44-
add(Deposit)
4544
add(AppSettings)
4645
add(AdvancedFeatures)
46+
add(Withdraw)
4747
add(SwitchAccount)
4848
add(Labs)
4949
add(LogOut)
@@ -69,6 +69,7 @@ internal class MenuScreenViewModel @Inject constructor(
6969
val logoTapCount: Int = 0,
7070
val isStaff: Boolean = false,
7171
val preferredOnRampProvider: OnRampProvider? = null,
72+
val showQuickActions: Boolean = false,
7273
val flags: List<BetaFeature> = emptyList(),
7374
val unlockedBetaFeaturesManually: Boolean = false,
7475
val appVersionInfo: VersionInfo = VersionInfo(),

0 commit comments

Comments
 (0)