[英]auto_route redirect with declarative routes
I have an iOS app with auto_route which uses declarative routes as in this example for the root router: https://autoroute.vercel.app/advanced/authentication .我有一个带有 auto_route 的 iOS 应用程序,它使用声明性路由,如本例中的根路由器: https://autoroute.vercel.app/advanced/authentication 。 I use a custom protocol deep link to redirect to the app from an oAuth authentication.
我使用自定义协议深层链接从 oAuth 身份验证重定向到应用程序。
Problem is now that I cannot use a route guard to intercept the deep link coming in because route guards are not allowed with declarative routing.现在的问题是我不能使用路由守卫来拦截进入的深层链接,因为声明式路由不允许使用路由守卫。
The solution that I have found is to use the info in AppRouter().routeInfoProvider().value.location
in the code that I pass to the routes
parameter of AppRouterDelegate.declarative
as in the above mentioned example.我找到的解决方案是在我传递给
AppRouterDelegate.declarative
的routes
参数的代码中使用AppRouter().routeInfoProvider().value.location
中的信息,如上述示例所示。 Is that a sensible solution?这是一个明智的解决方案吗?
You can simply use route guards throughout(even for your oAuth flow), because I think using declarative and route guards can make your implementations inconsistent.你可以简单地在整个过程中使用路由守卫(即使是你的 oAuth 流),因为我认为使用声明式和路由守卫会使你的实现不一致。 The declarative example was provided as a simpler and easy-to-understand alternative to using route guards.
声明性示例是作为使用路由守卫的更简单且易于理解的替代方法提供的。 Thank you.
谢谢你。
https://autoroute.vercel.app/advanced/route_guards https://autoroute.vercel.app/advanced/route_guards
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.