Skip to content

Commit 32abda7

Browse files
committed
feat(flipcash): add amount modal during specific context-aware onramp flows
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 3fa351a commit 32abda7

File tree

56 files changed

+1267
-449
lines changed

Some content is hidden

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

56 files changed

+1267
-449
lines changed

apps/flipcash/app/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ dependencies {
147147
implementation(project(":apps:flipcash:shared:currency-selection:core"))
148148
implementation(project(":apps:flipcash:shared:currency-selection:ui"))
149149
implementation(project(":apps:flipcash:shared:notifications"))
150-
implementation(project(":apps:flipcash:shared:coinbase-onramp"))
151-
implementation(project(":apps:flipcash:shared:phantom-onramp"))
150+
implementation(project(":apps:flipcash:shared:onramp:common"))
151+
implementation(project(":apps:flipcash:shared:onramp:coinbase"))
152+
implementation(project(":apps:flipcash:shared:onramp:phantom"))
152153
implementation(project(":apps:flipcash:shared:payments"))
153154
implementation(project(":apps:flipcash:shared:permissions"))
154155
implementation(project(":apps:flipcash:shared:phone"))

apps/flipcash/app/src/main/kotlin/com/flipcash/app/MainActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import com.flipcash.app.core.LocalUserManager
1818
import com.flipcash.app.featureflags.FeatureFlagController
1919
import com.flipcash.app.featureflags.LocalFeatureFlags
2020
import com.flipcash.app.internal.ui.App
21+
import com.flipcash.app.onramp.LocalOnRampAmountController
22+
import com.flipcash.app.onramp.OnRampAmountController
2123
import com.flipcash.app.payments.LocalPaymentController
2224
import com.flipcash.app.payments.PaymentController
2325
import com.flipcash.app.phone.LocalPhoneUtils
@@ -113,6 +115,9 @@ class MainActivity : FragmentActivity() {
113115
@Inject
114116
lateinit var phoneUtils: PhoneUtils
115117

118+
@Inject
119+
lateinit var onRampAmountController: OnRampAmountController
120+
116121
override fun onCreate(savedInstanceState: Bundle?) {
117122
super.onCreate(savedInstanceState)
118123
handleUncaughtException()
@@ -136,6 +141,7 @@ class MainActivity : FragmentActivity() {
136141
LocalAppSettings provides appSettingsCoordinator,
137142
LocalFeatureFlags provides featureFlagController,
138143
LocalPaymentController provides paymentController,
144+
LocalOnRampAmountController provides onRampAmountController,
139145
LocalPhoneUtils provides phoneUtils,
140146
) {
141147
Rinku {

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

Lines changed: 94 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import com.flipcash.app.core.navigation.DeeplinkType
3030
import com.flipcash.app.internal.ui.navigation.AppScreenContent
3131
import com.flipcash.app.internal.ui.navigation.MainRoot
3232
import com.flipcash.app.onramp.LocalPhantomDepositState
33+
import com.flipcash.app.onramp.OnRampAmountScaffold
3334
import com.flipcash.app.onramp.PhantomOnRampHandler
3435
import com.flipcash.app.onramp.rememberPhantomDepositState
3536
import com.flipcash.app.payments.PaymentScaffold
@@ -123,118 +124,120 @@ internal fun App(
123124
) {
124125
AppScreenContent {
125126
PaymentScaffold {
126-
TipScaffold(tipsEngine = tipsEngine) {
127-
AppNavHost(biometricsState) {
128-
val codeNavigator = LocalCodeNavigator.current
129-
PhantomOnRampHandler(
130-
state = LocalPhantomDepositState.current,
131-
router = router,
132-
deepLink = deepLink
133-
) {
134-
CodeScaffold { innerPaddingModifier ->
135-
Navigator(
136-
screen = MainRoot { deepLink },
137-
) { navigator ->
138-
LaunchedEffect(navigator.lastItemOrNull) {
139-
// update global navigator for platform access to support push/pop from a single
140-
// navigator current
141-
codeNavigator.screensNavigator = navigator
142-
}
127+
OnRampAmountScaffold {
128+
TipScaffold(tipsEngine = tipsEngine) {
129+
AppNavHost(biometricsState) {
130+
val codeNavigator = LocalCodeNavigator.current
131+
PhantomOnRampHandler(
132+
state = LocalPhantomDepositState.current,
133+
router = router,
134+
deepLink = deepLink
135+
) {
136+
CodeScaffold { innerPaddingModifier ->
137+
Navigator(
138+
screen = MainRoot { deepLink },
139+
) { navigator ->
140+
LaunchedEffect(navigator.lastItemOrNull) {
141+
// update global navigator for platform access to support push/pop from a single
142+
// navigator current
143+
codeNavigator.screensNavigator = navigator
144+
}
143145

144-
Box(
145-
modifier = Modifier
146-
.padding(innerPaddingModifier)
147-
) {
146+
Box(
147+
modifier = Modifier
148+
.padding(innerPaddingModifier)
149+
) {
148150

149-
when (navigator.lastEvent) {
150-
StackEvent.Push,
151-
StackEvent.Pop -> {
152-
when (navigator.lastItemOrNull) {
153-
ScreenRegistry.get(NavScreenProvider.Login.SeedInput),
154-
ScreenRegistry.get(NavScreenProvider.Permissions.Camera()),
155-
is MainRoot -> {
156-
CrossfadeTransition(navigator = navigator)
157-
}
151+
when (navigator.lastEvent) {
152+
StackEvent.Push,
153+
StackEvent.Pop -> {
154+
when (navigator.lastItemOrNull) {
155+
ScreenRegistry.get(NavScreenProvider.Login.SeedInput),
156+
ScreenRegistry.get(NavScreenProvider.Permissions.Camera()),
157+
is MainRoot -> {
158+
CrossfadeTransition(navigator = navigator)
159+
}
158160

159-
else -> SlideTransition(navigator = navigator)
161+
else -> SlideTransition(navigator = navigator)
162+
}
160163
}
161-
}
162164

163-
StackEvent.Idle,
164-
StackEvent.Replace -> CurrentScreen()
165+
StackEvent.Idle,
166+
StackEvent.Replace -> CurrentScreen()
167+
}
165168
}
166-
}
167169

168-
LaunchedEffect(deepLink) {
169-
if (codeNavigator.lastItem !is MainRoot) {
170-
if (deepLink != null) {
171-
val screenSet =
172-
router.processDestination(deepLink)
173-
if (screenSet.isNotEmpty()) {
174-
codeNavigator.replaceAll(screenSet)
175-
}
170+
LaunchedEffect(deepLink) {
171+
if (codeNavigator.lastItem !is MainRoot) {
172+
if (deepLink != null) {
173+
val screenSet =
174+
router.processDestination(deepLink)
175+
if (screenSet.isNotEmpty()) {
176+
codeNavigator.replaceAll(screenSet)
177+
}
176178

177-
deepLink = null
179+
deepLink = null
180+
}
178181
}
179182
}
180-
}
181183

182-
LaunchedEffect(
183-
loginRequest,
184-
codeNavigator.lastItem,
185-
userManager.authState
186-
) {
187-
if (codeNavigator.lastItem is MainRoot) return@LaunchedEffect
188-
if (userManager.authState !is AuthState.LoggedInWithUser) {
189-
// reset login request here
190-
// if we are not currently logged in, then the deeplink
191-
// is most likely being processed in [MainRoot] during launch
192-
loginRequest = null
193-
return@LaunchedEffect
194-
}
195-
loginRequest?.let { entropy ->
196-
viewModel.handleLoginEntropy(
197-
entropy,
198-
onSwitchAccount = {
199-
loginRequest = null
200-
codeNavigator.replaceAll(
201-
ScreenRegistry.get(
202-
NavScreenProvider.Login.Home(
203-
entropy,
204-
fromDeeplink = true
184+
LaunchedEffect(
185+
loginRequest,
186+
codeNavigator.lastItem,
187+
userManager.authState
188+
) {
189+
if (codeNavigator.lastItem is MainRoot) return@LaunchedEffect
190+
if (userManager.authState !is AuthState.LoggedInWithUser) {
191+
// reset login request here
192+
// if we are not currently logged in, then the deeplink
193+
// is most likely being processed in [MainRoot] during launch
194+
loginRequest = null
195+
return@LaunchedEffect
196+
}
197+
loginRequest?.let { entropy ->
198+
viewModel.handleLoginEntropy(
199+
entropy,
200+
onSwitchAccount = {
201+
loginRequest = null
202+
codeNavigator.replaceAll(
203+
ScreenRegistry.get(
204+
NavScreenProvider.Login.Home(
205+
entropy,
206+
fromDeeplink = true
207+
)
205208
)
206209
)
207-
)
208-
},
209-
onDismissed = { loginRequest = null }
210-
)
210+
},
211+
onDismissed = { loginRequest = null }
212+
)
213+
}
211214
}
212-
}
213215

214-
LaunchedEffect(userState.isTimelockUnlocked) {
215-
if (userState.isTimelockUnlocked) {
216-
codeNavigator.replaceAll(
217-
ScreenRegistry.get(
218-
NavScreenProvider.AppRestricted(
219-
RestrictionType.TIMELOCK_UNLOCKED
216+
LaunchedEffect(userState.isTimelockUnlocked) {
217+
if (userState.isTimelockUnlocked) {
218+
codeNavigator.replaceAll(
219+
ScreenRegistry.get(
220+
NavScreenProvider.AppRestricted(
221+
RestrictionType.TIMELOCK_UNLOCKED
222+
)
220223
)
221224
)
222-
)
225+
}
223226
}
224-
}
225227

226-
OnLifecycleEvent { _, event ->
227-
when (event) {
228-
Lifecycle.Event.ON_RESUME -> {
229-
session.onAppInForeground()
230-
}
228+
OnLifecycleEvent { _, event ->
229+
when (event) {
230+
Lifecycle.Event.ON_RESUME -> {
231+
session.onAppInForeground()
232+
}
231233

232-
Lifecycle.Event.ON_STOP,
233-
Lifecycle.Event.ON_DESTROY -> {
234-
session.onAppInBackground()
235-
}
234+
Lifecycle.Event.ON_STOP,
235+
Lifecycle.Event.ON_DESTROY -> {
236+
session.onAppInBackground()
237+
}
236238

237-
else -> Unit
239+
else -> Unit
240+
}
238241
}
239242
}
240243
}

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ import com.flipcash.app.backupkey.BackupKeyScreen
88
import com.flipcash.app.balance.BalanceScreen
99
import com.flipcash.app.balance.PreloadBalance
1010
import com.flipcash.app.cash.CashScreen
11-
import com.flipcash.app.contact.verification.EmailVerificationFlow
12-
import com.flipcash.app.contact.verification.PhoneVerificationFlow
1311
import com.flipcash.app.contact.verification.VerificationFlowScreen
1412
import com.flipcash.app.core.NavScreenProvider
15-
import com.flipcash.app.core.verification.email.EmailDeeplinkOrigin
1613
import com.flipcash.app.currency.CurrencySelectionModal
1714
import com.flipcash.app.deposit.DepositScreen
1815
import com.flipcash.app.lab.LabsModal
@@ -22,10 +19,9 @@ import com.flipcash.app.login.router.LoginRouter
2219
import com.flipcash.app.login.seed.SeedInputScreen
2320
import com.flipcash.app.menu.MenuScreen
2421
import com.flipcash.app.myaccount.MyAccountScreen
25-
import com.flipcash.app.onramp.OnRampAmountScreen
22+
import com.flipcash.app.onramp.OnRampCustomAmountScreen
2623
import com.flipcash.app.onramp.OnRampFlowTracker
2724
import com.flipcash.app.onramp.OnRampProviderListScreen
28-
import com.flipcash.app.onramp.OnRampSuccessScreen
2925
import com.flipcash.app.permissions.CameraPermissionScreen
3026
import com.flipcash.app.permissions.NotificationPermissionScreen
3127
import com.flipcash.app.pools.PoolBettingScreen
@@ -168,11 +164,7 @@ internal fun AppScreenContent(content: @Composable () -> Unit) {
168164
}
169165

170166
register<NavScreenProvider.HomeScreen.OnRamp.Amount> {
171-
OnRampAmountScreen()
172-
}
173-
174-
register<NavScreenProvider.HomeScreen.OnRamp.Success> {
175-
OnRampSuccessScreen()
167+
OnRampCustomAmountScreen()
176168
}
177169

178170
register<NavScreenProvider.HomeScreen.Menu.Root> {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ sealed class NavScreenProvider : ScreenProvider, Parcelable {
8585
) : NavScreenProvider()
8686

8787
data object Amount : NavScreenProvider()
88-
data object Success : NavScreenProvider()
8988
}
9089

9190
sealed interface Menu {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string translatable="false" name="app_name_without_variant">Flipcash</string>
44
<string translatable="false" name="app_name">Flipcash</string>
55
<string translatable="false" name="handle">\@flipcashapp</string>
@@ -13,4 +13,8 @@
1313
<string translatable="false" name="app_download_link_with_ref">https://flipcash.com/download?r=%1$s</string>
1414
<string translatable="false" name="app_download_link_qr_ref">aqr</string>
1515
<string translatable="false" name="app_download_link_share_ref">as</string>
16+
17+
<string translatable="false" name="external_url_withdraw" tools:ignore="TypographyDashes">https://chatgpt.com/share/68431512-cdf8-8002-b944-7538e90dfa48</string>
18+
<string translatable="false" name="external_url_deposit" tools:ignore="TypographyDashes">https://chatgpt.com/share/68431710-5824-8002-af0a-c4948970b626</string>
19+
1620
</resources>

0 commit comments

Comments
 (0)