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.81k stars 1.61k forks source link

sonicSession.refresh() 异常 #212

Closed xoptimal closed 6 years ago

xoptimal commented 6 years ago

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

if (sonicSession != null) sonicSession.refresh();

What is the expected output? What do you see instead? 你期待的结果是什么?实际看到的又是什么?

没有走刷新, 执行完refresh()后, WebViewClient的 onPageStarted / onPageFinished 并没有触发 ~

What version of the product are you using? On what operating system? 你正在使用产品的哪个版本?在什么操作系统上? version: 3.0-beta / andorid 6.0

Please provide any additional information below. 如果有的话,请在下面提供更多信息。

marlonlu commented 6 years ago

SonicSession.refresh 是用来再次请求sonic相关数据,这里存在三种情况 1 如果页面内容一致,客户端不会做任何操作 2 如果只有动态数据变化,更新动态部分,不会触发onPageStarted / onPageFinished 2 如果模板发生变化,重新加载整个页面,这个时候要看具体逻辑顺序,不一定触发onPageStarted / onPageFinished

xoptimal commented 6 years ago

那怎么监听refresh执行完毕 ? 因为除了正常的刷新, 也要网络异常的情况, 这个时候我的界面会切换到错误界面, .... 如果重新执行, onPageStarted / onPageFinished 会有相应的操作~ 这个我不用担心 ... 但是我要做调用 SonicSession.refresh , 则它不一定会走 上面的两个方法, 即使重新加载成功, 还是停留在错误界面! @marlonlu

marlonlu commented 6 years ago

refresh是指重新执行sonic流程,这里面遇到错误的http请求,可以监听com.tencent.sonic.sdk.SonicSessionCallback#onSessionHttpError ,其他函数监听也在com.tencent.sonic.sdk.SonicSessionCallback里面

muyi-yang commented 6 years ago

遇到同样的问题,需求是这样的,在无网状态下访问一个网页,页面显示加载错误页面,但之后已链接上网络,且网络畅通,此时监听到网络已链接上,想重新刷新界面,但是调用SonicSession.refresh并不会重新刷新,依然显示错误页面,有没有什么办法能够在不重启页面的情况下重新刷新页面数据? @marlonlu