Skip to content

Commit 3b753da

Browse files
committed
chore(onramp): differentiate between errors and alerts for phantom flow
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 0a3d8f1 commit 3b753da

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

apps/flipcash/shared/onramp/deeplinks/src/main/kotlin/com/flipcash/app/onramp/ExternalWalletOnRampHandler.kt

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,24 @@ fun ExternalWalletOnRampHandler(
283283
error = error
284284
)
285285

286-
BottomBarManager.showError(
287-
title = title,
288-
message = message,
289-
) {
286+
val onDismiss = {
290287
close(false)
291288
controller.reset()
292289
}
290+
291+
if (error.isAlert) {
292+
BottomBarManager.showAlert(
293+
title = title,
294+
message = message,
295+
onDismiss = { onDismiss() },
296+
)
297+
} else {
298+
BottomBarManager.showError(
299+
title = title,
300+
message = message,
301+
onDismiss = { onDismiss() },
302+
)
303+
}
293304
}
294305
}
295306
}
@@ -300,6 +311,13 @@ fun ExternalWalletOnRampHandler(
300311

301312
private const val TAG = "onramp::deeplinks"
302313

314+
private val DeeplinkOnRampError.isAlert: Boolean
315+
get() = this is DeeplinkOnRampError.WalletProvidedError && error in listOf(
316+
DeeplinkError.UserRejectedRequest,
317+
DeeplinkError.Disconnected,
318+
DeeplinkError.TransactionRejected,
319+
)
320+
303321
private typealias Title = String
304322
private typealias Message = String
305323

0 commit comments

Comments
 (0)