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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.flipcash.app.core.AppRoute
import com.flipcash.app.currency.RegionSelectionScreen
import com.flipcash.app.deposit.DepositScreen
import com.flipcash.app.discovery.TokenDiscoveryScreen
import com.flipcash.app.discovery.TokenDiscoverySheet
import com.flipcash.app.internal.ui.navigation.decorators.rememberNavMessagingEntryDecorator
import com.flipcash.app.lab.LabsScreen
import com.flipcash.app.lab.StandaloneLabsScreen
Expand Down Expand Up @@ -99,6 +100,7 @@ fun appEntryProvider(
annotatedEntry<AppRoute.Sheets.ShareApp> { ShareAppScreen() }
annotatedEntry<AppRoute.Sheets.Menu> { MenuScreen() }
annotatedEntry<AppRoute.Sheets.Lab> { StandaloneLabsScreen() }
annotatedEntry<AppRoute.Sheets.TokenDiscovery> { TokenDiscoverySheet() }

// Tokens
annotatedEntry<AppRoute.Token.Info> { key ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ sealed interface AppRoute : NavKey, Parcelable {
data object Menu : Sheets
@Serializable
data object Lab : Sheets

@Serializable
data object TokenDiscovery: Sheets

@Serializable
data object ShareApp : Sheets
}
Expand Down
27 changes: 27 additions & 0 deletions apps/flipcash/core/src/main/res/drawable/ic_coins.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
~ Copyright (C) 2026 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<path
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"
android:strokeWidth="3"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="square"/>
</vector>
2 changes: 2 additions & 0 deletions apps/flipcash/core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,6 @@
<string name="label_amountInToken">Amount in %1$s</string>

<string name="title_leaderboard">Leaderboard</string>

<string name="action_discover">Discover</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,40 @@ import com.flipcash.app.core.AppRoute
import com.flipcash.app.discovery.internal.TokenDiscoveryScreen
import com.flipcash.app.discovery.internal.TokenDiscoveryViewModel
import com.flipcash.core.R
import com.getcode.navigation.core.CodeNavigator
import com.getcode.navigation.core.LocalCodeNavigator
import com.getcode.opencode.model.ui.DiscoverCategory
import com.getcode.ui.components.AppBarDefaults
import com.getcode.ui.components.AppBarWithTitle
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach


@Composable
fun TokenDiscoverySheet() {
val navigator = LocalCodeNavigator.current
val viewModel = hiltViewModel<TokenDiscoveryViewModel>()

Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
AppBarWithTitle(
title = stringResource(R.string.title_discoverCurrencies),
isInModal = true,
titleAlignment = Alignment.CenterHorizontally,
endContent = {
AppBarDefaults.Close { navigator.hide() }
},
)
TokenDiscoveryScreen(viewModel)
}

TokenDiscoveryEventHandler(viewModel, navigator)
}

@Composable
fun TokenDiscoveryScreen() {
val navigator = LocalCodeNavigator.current
Expand All @@ -39,6 +65,11 @@ fun TokenDiscoveryScreen() {
TokenDiscoveryScreen(viewModel)
}

TokenDiscoveryEventHandler(viewModel, navigator)
}

@Composable
private fun TokenDiscoveryEventHandler(viewModel: TokenDiscoveryViewModel, navigator: CodeNavigator) {
LaunchedEffect(Unit) {
if (viewModel.stateFlow.value.category == null) {
viewModel.dispatchEvent(TokenDiscoveryViewModel.Event.OnCategorySelected(DiscoverCategory.Popular))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ sealed class ScannerDecorItem(val screen: AppRoute) {
data object Wallet : ScannerDecorItem(AppRoute.Sheets.Wallet)
data object Menu : ScannerDecorItem(AppRoute.Sheets.Menu)
data object Logo: ScannerDecorItem(AppRoute.Sheets.ShareApp)
data object Discover: ScannerDecorItem(AppRoute.Sheets.TokenDiscovery)
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ internal fun ScannerNavigationBar(
}
}
)

BottomBarAction(
modifier = Modifier.weight(1f),
label = stringResource(R.string.action_discover),
painter = painterResource(R.drawable.ic_coins),
badgeCount = 0,
onClick = { onAction(ScannerDecorItem.Discover) }
)
}
}

Expand Down
Loading