Skip to content

Commit d2eff17

Browse files
committed
Merge remote-tracking branch 'origin/code/cash' into feat/proto-validation
* origin/code/cash: feat(currencycreator): support required fees when creating a currency fix(navigation): add equals/hashCode to ModalBottomSheetScene to prevent duplicate sheets feat(services/ocp): support VM::TransferForSwapWithFee instruction for buy new currency flow chore: update protos; add fee amount to userflags feat(analytics): track Screen and callsite with each use of showError
2 parents a6106e0 + 3c88aed commit d2eff17

51 files changed

Lines changed: 573 additions & 120 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.navigation3.runtime.NavBackStack
77
import androidx.navigation3.runtime.NavEntryDecorator
88
import androidx.navigation3.runtime.NavKey
99
import com.flipcash.app.analytics.rememberAnalytics
10+
import com.flipcash.app.core.AppRoute
1011
import com.getcode.manager.BottomBarManager
1112
import com.getcode.navigation.NavMetadataKeys
1213
import com.getcode.ui.components.bars.BarManager
@@ -40,7 +41,13 @@ fun NavMessagingEntryDecorator(
4041
when (message.type) {
4142
BottomBarManager.BottomBarMessageType.DESTRUCTIVE -> Unit
4243
BottomBarManager.BottomBarMessageType.ERROR -> {
43-
analytics.displayedErrorModal(message.title, message.subtitle)
44+
val screen = backStack.lastOrNull()?.screenName()
45+
analytics.displayedErrorModal(
46+
title = message.title,
47+
message = message.subtitle,
48+
screen = screen,
49+
callSite = message.callSite,
50+
)
4451
}
4552
BottomBarManager.BottomBarMessageType.WARNING -> Unit
4653
BottomBarManager.BottomBarMessageType.INFO -> Unit
@@ -58,3 +65,9 @@ fun rememberNavMessagingEntryDecorator(
5865
backStack: NavBackStack<NavKey>,
5966
barManager: BarManager
6067
) = remember { NavMessagingEntryDecorator(backStack, barManager) }
68+
69+
private fun NavKey.screenName(): String? {
70+
val prefix = AppRoute::class.qualifiedName ?: return null
71+
val qualifiedName = this::class.qualifiedName ?: return null
72+
return qualifiedName.removePrefix("$prefix.").takeIf { it != qualifiedName }
73+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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="28dp"
18+
android:height="28dp"
19+
android:viewportWidth="28"
20+
android:viewportHeight="28">
21+
<path
22+
android:pathData="M7.292,5.153C7.292,3.596 8.554,2.333 10.111,2.333C11.717,2.333 13.137,3.128 14,4.345C14.863,3.128 16.283,2.333 17.889,2.333C19.446,2.333 20.708,3.596 20.708,5.153C20.708,6.296 20.306,7.346 19.634,8.167H24.5V13.125H14.875V8.167H15.944C17.609,8.167 18.958,6.817 18.958,5.153C18.958,4.562 18.479,4.083 17.889,4.083C16.224,4.083 14.875,5.433 14.875,7.097V8.167H13.125V7.097C13.125,5.433 11.776,4.083 10.111,4.083C9.52,4.083 9.042,4.562 9.042,5.153C9.042,6.817 10.391,8.167 12.056,8.167H13.125V13.125H3.5V8.167H8.366C7.695,7.346 7.292,6.296 7.292,5.153Z"
23+
android:fillColor="#ffffff"/>
24+
<path
25+
android:pathData="M14.875,14.875H23.333V24.5H14.875V14.875Z"
26+
android:fillColor="#ffffff"/>
27+
<path
28+
android:pathData="M13.125,14.875H4.667V24.5H13.125V14.875Z"
29+
android:fillColor="#ffffff"/>
30+
</vector>

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,10 @@
375375
<string name="subtitle_currencyCreatorStepDescription">Describe what your currency is about</string>
376376
<string name="title_currencyCreatorStepDesign">Cash Design</string>
377377
<string name="subtitle_currencyCreatorStepDesign">Customize the look of your cash</string>
378-
<string name="title_currencyCreatorStepPurchase">Purchase %1$s</string>
379-
<string name="subtitle_currencyCreatorStepPurchase">Pay for the first %1$s to create your currency</string>
378+
<string name="title_currencyCreatorStepPurchase">Pay %1$s Fee</string>
379+
<string name="subtitle_currencyCreatorStepPurchase">Pay to create your currency</string>
380+
<string name="title_currencyCreatorStepPurchaseFreeGift">Limited Time: Get %1$s Free</string>
381+
<string name="subtitle_currencyCreatorStepPurchaseFreeGift">Get the first %1$s of your currency</string>
380382
<string name="action_getStarted">Get Started</string>
381383
<string name="title_currencyCreatorNameSelection">What do you want to call your currency?</string>
382384
<string name="hint_currencyName">Currency Name</string>
@@ -390,7 +392,7 @@
390392
<string name="label_remaining">remaining</string>
391393
<string name="placeholder_currencyName">Currency Name</string>
392394
<string name="placeholder_currencyTicker">$BadBoys</string>
393-
<string name="action_buyFirstToCreate">Pay for the First %1$s to Create</string>
395+
<string name="action_buyFirstToCreate">Pay %1$s to Create</string>
394396
<string name="title_creatingCurrency">Creating %1$s</string>
395397
<string name="title_currencyIsLive">%1$s Is Live</string>
396398
<string name="subtitle_currencyIsLive">Your currency is ready to receive and use</string>
@@ -600,5 +602,5 @@
600602
<string name="error_description_buyNewCurrencyFailed">We couldn\'t complete your initial purchase. Your currency is on hold for the next 30 minutes.</string>
601603

602604
<string name="subtitle_processingYourNewCurrencyTransaction">This transaction typically takes a few minutes. You may leave the app while it completes</string>
603-
<string name="action_receiveNewCurrency">Receive My %1$s</string>
605+
<string name="action_receiveNewCurrency">Get the First %1$s of Your Currency Free</string>
604606
</resources>

apps/flipcash/features/currency-creator/src/main/kotlin/com/flipcash/app/currencycreator/CurrencyCreatorFlowScreen.kt

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ import com.getcode.navigation.flow.PreviewFlowNavigator
5858
import com.getcode.navigation.flow.deliverFlowResult
5959
import com.getcode.navigation.results.NavResultOrCanceled
6060
import com.getcode.navigation.results.NavResultStateRegistry
61+
import com.getcode.opencode.model.financial.Fiat
6162
import com.getcode.opencode.model.financial.LocalFiat
63+
import com.getcode.opencode.model.financial.toFiat
6264
import com.getcode.theme.CodeTheme
6365
import com.getcode.ui.core.unboundedClickable
6466

@@ -83,6 +85,15 @@ fun CurrencyCreatorFlowScreen(
8385
CurrencyCreatorTopBar(
8486
controller = topBarController,
8587
mainContent = when (state.currentStep) {
88+
is CurrencyCreatorStep.Info -> {
89+
{
90+
Text(
91+
text = stringResource(R.string.title_createYourCurrency),
92+
style = CodeTheme.typography.textLarge,
93+
color = CodeTheme.colors.textMain,
94+
)
95+
}
96+
}
8697
is CurrencyCreatorStep.Processing -> {
8798
{
8899
val text = if (state.processingState.success) {
@@ -97,7 +108,6 @@ fun CurrencyCreatorFlowScreen(
97108
}
98109

99110
Text(
100-
modifier = Modifier.fillMaxWidth(),
101111
text = text,
102112
style = CodeTheme.typography.textLarge,
103113
color = CodeTheme.colors.textMain,
@@ -143,15 +153,19 @@ fun CurrencyCreatorFlowScreen(
143153
)
144154

145155
if (result is CurrencyCreatorResult.Success) {
146-
val token = state.launchedToken
147-
if (token != null) {
148-
val bill = Bill.Cash(
149-
token = token,
150-
amount = LocalFiat(usdf = state.purchaseAmount),
151-
didReceive = true,
152-
)
153-
outerNavigator.hide()
154-
session?.showBill(bill)
156+
if (state.purchaseAmount > Fiat.Zero) {
157+
val token = state.launchedToken
158+
if (token != null) {
159+
val bill = Bill.Cash(
160+
token = token,
161+
amount = LocalFiat(usdf = state.purchaseAmount),
162+
didReceive = true,
163+
)
164+
outerNavigator.hide()
165+
session?.showBill(bill)
166+
}
167+
} else {
168+
outerNavigator.pop()
155169
}
156170
} else {
157171
outerNavigator.pop()
@@ -203,24 +217,39 @@ private fun SyncTopBar(step: CurrencyCreatorStep) {
203217
}
204218

205219
@Composable
206-
private fun CurrencyCreatorPreview(content: @Composable (state: CurrencyCreatorViewModel.State) -> Unit) {
220+
private fun CurrencyCreatorPreview(
221+
feeAmount: Fiat = 15.toFiat(),
222+
content: @Composable (state: CurrencyCreatorViewModel.State) -> Unit
223+
) {
207224
FlipcashPreview(showBackground = true) {
208225
CompositionLocalProvider(
209226
LocalFlowNavigator provides PreviewFlowNavigator<CurrencyCreatorStep, CurrencyCreatorResult>(),
210227
LocalCurrencyCreatorTopBar provides remember { CurrencyCreatorTopBarController() },
211228
) {
212-
val state = CurrencyCreatorViewModel.State()
229+
val state = CurrencyCreatorViewModel.State(feeAmount = feeAmount)
213230
content(state)
214231
}
215232
}
216233
}
217234

218235
@Preview
219236
@Composable
220-
private fun Preview_Info() {
237+
private fun Preview_Info_15Fee() {
221238
CurrencyCreatorPreview { InfoScreenContent(it) }
222239
}
223240

241+
@Preview
242+
@Composable
243+
private fun Preview_Info_NoFee() {
244+
CurrencyCreatorPreview(feeAmount = Fiat.Zero) { InfoScreenContent(it) }
245+
}
246+
247+
@Preview
248+
@Composable
249+
private fun Preview_Info_5Fee() {
250+
CurrencyCreatorPreview(feeAmount = 5.toFiat()) { InfoScreenContent(it) }
251+
}
252+
224253
@Preview
225254
@Composable
226255
private fun Preview_Name() {

0 commit comments

Comments
 (0)