Closed caprice closed 5 years ago
不知道问题理解的对不对,按照我的理解回答一下:
问题1:按照WMRouter的设计思路,所有Activity的IntentFilter都统一配置到UriProxyActivity。安卓中的一个Activity可以配置多个IntentFilter,只要其中一个匹配上即可。
问题2:UriProxyActivity调用WMRouter前判断一下URI是不是AppLink(http协议,且path不是/web
)。
如果是AppLink,则替换成特殊格式,例如http://example.com/redirect/searchPage
改成applink://example.com/searchPage
,然后可以由WMRouter打开相应页面(AppLink的path可以用RouterUri注解配置到Activity上)。
如果不是AppLink,就分发到WebViewHandler打开WebView。
谢谢回复。目前的方案也打算如此。只是不知道大家是否有更优的方案。也算放在这里讨论下。可能是国内google被墙了,导致app link用不起来,发现基本没有路由框架提及app link的
项目想使用app link, 就需要在某个activity中这样配置:
如果使用wmrouter,就产生两个问题: