Skip to content

Commit

Permalink
(android) Guard uri parsing in app view navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
dpad85 committed Dec 15, 2023
1 parent 59e0e9a commit fe17cfe
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ fun AppView(
navArgument("next") { type = NavType.StringType; nullable = true }
),
) {
val intent = it.arguments?.getParcelable<Intent>(NavController.KEY_DEEP_LINK_INTENT)
val intent = try {
it.arguments?.getParcelable<Intent>(NavController.KEY_DEEP_LINK_INTENT)
} catch (e: Exception) {
null
}
val nextScreenLink = intent?.data?.getQueryParameter("next")?.decodeURLPart()
StartupView(
appVM = appVM,
Expand Down Expand Up @@ -244,7 +248,11 @@ fun AppView(
navDeepLink { uriPattern = "scanview:{data}" },
)
) {
val intent = it.arguments?.getParcelable<Intent>(NavController.KEY_DEEP_LINK_INTENT)
val intent = try {
it.arguments?.getParcelable<Intent>(NavController.KEY_DEEP_LINK_INTENT)
} catch (e: Exception) {
null
}
RequireStarted(walletState, nextUri = "scanview:${intent?.data?.toString()}") {
val input = intent?.data?.toString()?.substringAfter("scanview:")?.takeIf {
// prevents forwarding an internal deeplink intent coming from androidx-navigation framework.
Expand Down

0 comments on commit fe17cfe

Please sign in to comment.