Tencent / VasSonic

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.
Other
11.8k stars 1.61k forks source link

无网络情况下打开页面,显示空白页,可否替换? #273

Closed wenjianxue closed 5 years ago

wenjianxue commented 5 years ago

What steps will reproduce the problem? 该问题的重现步骤是什么?

  1. 无网络情况下打开页面,显示空白页

What is the expected output? What do you see instead? 你期待的结果是什么?实际看到的又是什么? 将空白页替换成自定义的页面

What version of the product are you using? On what operating system? 你正在使用产品的哪个版本?在什么操作系统上? 所有版本,android

Please provide any additional information below. 如果有的话,请在下面提供更多信息。 打开网页可能会出现各种异常比如404等,通过WebViewClient的onReceivedError可以自定义页面,但是配合VasSonic使用过程中发现,无网络情况下通过WebViewClient的onReceivedError设置自定义页面会覆盖VasSonic缓存的页面。实际上想达到的效果是无网络条件下有缓存使用缓存,无缓存显示自定义页面。 可能的方案: 1.VasSonic是否提供设置无缓存情况下自定义页面的接口(目前是直接显示空白页) 2.VasSonic是否提供判断url在本地有无缓存的接口,PS : SonicEngine中的isSessionAvailable方法是最为接近这个要求的,可惜是私有方法无法从外部调用

marlonlu commented 5 years ago

之前QQ群讨论后同步下 这里空白页面可通过项目中webview api shouldIntercept判断 当sonic返回空值时再去读取本地error页面