Skip to content

Commit 0bf9e5a

Browse files
authored
Merge pull request #677 from code-payments/feat/add-discover-to-scanner-navigation
feat(scanner): add Discover tab to scanner navigation bar
2 parents 3f5fcba + 94d7906 commit 0bf9e5a

7 files changed

Lines changed: 75 additions & 0 deletions

File tree

apps/flipcash/app/src/main/kotlin/com/flipcash/app/internal/ui/navigation/AppScreenContent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import com.flipcash.app.core.AppRoute
3030
import com.flipcash.app.currency.RegionSelectionScreen
3131
import com.flipcash.app.deposit.DepositScreen
3232
import com.flipcash.app.discovery.TokenDiscoveryScreen
33+
import com.flipcash.app.discovery.TokenDiscoverySheet
3334
import com.flipcash.app.internal.ui.navigation.decorators.rememberNavMessagingEntryDecorator
3435
import com.flipcash.app.lab.LabsScreen
3536
import com.flipcash.app.lab.StandaloneLabsScreen
@@ -99,6 +100,7 @@ fun appEntryProvider(
99100
annotatedEntry<AppRoute.Sheets.ShareApp> { ShareAppScreen() }
100101
annotatedEntry<AppRoute.Sheets.Menu> { MenuScreen() }
101102
annotatedEntry<AppRoute.Sheets.Lab> { StandaloneLabsScreen() }
103+
annotatedEntry<AppRoute.Sheets.TokenDiscovery> { TokenDiscoverySheet() }
102104

103105
// Tokens
104106
annotatedEntry<AppRoute.Token.Info> { key ->

apps/flipcash/core/src/main/kotlin/com/flipcash/app/core/AppRoute.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ sealed interface AppRoute : NavKey, Parcelable {
111111
data object Menu : Sheets
112112
@Serializable
113113
data object Lab : Sheets
114+
115+
@Serializable
116+
data object TokenDiscovery: Sheets
117+
114118
@Serializable
115119
data object ShareApp : Sheets
116120
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
~ Copyright (C) 2026 The Android Open Source Project
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
17+
android:width="40dp"
18+
android:height="40dp"
19+
android:viewportWidth="40"
20+
android:viewportHeight="40">
21+
<path
22+
android:pathData="M14.216,27.712C7.827,27.712 2.648,22.533 2.648,16.144C2.648,9.755 7.827,4.576 14.216,4.576C18.958,4.576 23.034,7.43 24.82,11.514M37.352,23.856C37.352,30.245 32.173,35.424 25.784,35.424C20.74,35.424 16.451,32.197 14.868,27.694C14.446,26.493 14.216,25.202 14.216,23.856C14.216,17.686 19.047,12.644 25.132,12.306C25.348,12.294 25.565,12.288 25.784,12.288C32.173,12.288 37.352,17.467 37.352,23.856Z"
23+
android:strokeWidth="3"
24+
android:fillColor="#00000000"
25+
android:strokeColor="#ffffff"
26+
android:strokeLineCap="square"/>
27+
</vector>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,6 @@
635635
<string name="label_amountInToken">Amount in %1$s</string>
636636

637637
<string name="title_leaderboard">Leaderboard</string>
638+
639+
<string name="action_discover">Discover</string>
638640
</resources>

apps/flipcash/features/discovery/src/main/kotlin/com/flipcash/app/discovery/TokenDiscoveryScreen.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,40 @@ import com.flipcash.app.core.AppRoute
1212
import com.flipcash.app.discovery.internal.TokenDiscoveryScreen
1313
import com.flipcash.app.discovery.internal.TokenDiscoveryViewModel
1414
import com.flipcash.core.R
15+
import com.getcode.navigation.core.CodeNavigator
1516
import com.getcode.navigation.core.LocalCodeNavigator
1617
import com.getcode.opencode.model.ui.DiscoverCategory
18+
import com.getcode.ui.components.AppBarDefaults
1719
import com.getcode.ui.components.AppBarWithTitle
1820
import kotlinx.coroutines.flow.filterIsInstance
1921
import kotlinx.coroutines.flow.launchIn
2022
import kotlinx.coroutines.flow.map
2123
import kotlinx.coroutines.flow.onEach
2224

25+
26+
@Composable
27+
fun TokenDiscoverySheet() {
28+
val navigator = LocalCodeNavigator.current
29+
val viewModel = hiltViewModel<TokenDiscoveryViewModel>()
30+
31+
Column(
32+
modifier = Modifier.fillMaxSize(),
33+
horizontalAlignment = Alignment.CenterHorizontally,
34+
) {
35+
AppBarWithTitle(
36+
title = stringResource(R.string.title_discoverCurrencies),
37+
isInModal = true,
38+
titleAlignment = Alignment.CenterHorizontally,
39+
endContent = {
40+
AppBarDefaults.Close { navigator.hide() }
41+
},
42+
)
43+
TokenDiscoveryScreen(viewModel)
44+
}
45+
46+
TokenDiscoveryEventHandler(viewModel, navigator)
47+
}
48+
2349
@Composable
2450
fun TokenDiscoveryScreen() {
2551
val navigator = LocalCodeNavigator.current
@@ -39,6 +65,11 @@ fun TokenDiscoveryScreen() {
3965
TokenDiscoveryScreen(viewModel)
4066
}
4167

68+
TokenDiscoveryEventHandler(viewModel, navigator)
69+
}
70+
71+
@Composable
72+
private fun TokenDiscoveryEventHandler(viewModel: TokenDiscoveryViewModel, navigator: CodeNavigator) {
4273
LaunchedEffect(Unit) {
4374
if (viewModel.stateFlow.value.category == null) {
4475
viewModel.dispatchEvent(TokenDiscoveryViewModel.Event.OnCategorySelected(DiscoverCategory.Popular))

apps/flipcash/features/scanner/src/main/kotlin/com/flipcash/app/scanner/internal/ScannerDecorItem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ sealed class ScannerDecorItem(val screen: AppRoute) {
99
data object Wallet : ScannerDecorItem(AppRoute.Sheets.Wallet)
1010
data object Menu : ScannerDecorItem(AppRoute.Sheets.Menu)
1111
data object Logo: ScannerDecorItem(AppRoute.Sheets.ShareApp)
12+
data object Discover: ScannerDecorItem(AppRoute.Sheets.TokenDiscovery)
1213
}

apps/flipcash/features/scanner/src/main/kotlin/com/flipcash/app/scanner/internal/ui/components/ScannerNavigationBar.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ internal fun ScannerNavigationBar(
101101
}
102102
}
103103
)
104+
105+
BottomBarAction(
106+
modifier = Modifier.weight(1f),
107+
label = stringResource(R.string.action_discover),
108+
painter = painterResource(R.drawable.ic_coins),
109+
badgeCount = 0,
110+
onClick = { onAction(ScannerDecorItem.Discover) }
111+
)
104112
}
105113
}
106114

0 commit comments

Comments
 (0)