jasonelle-archive / jasonelle-v2

🛸 🏘️ Jasonelle issues, releases, discussions and wiki repository.
https://jasonelle.com
Mozilla Public License 2.0
422 stars 58 forks source link

$agent stops working after navigating away and returning #64

Closed rolloclarke closed 4 years ago

rolloclarke commented 5 years ago

Describe the bug Any/all agents in a view stop working after navigating to another view and back again. This will also occur after app is minimised (#33), or any kind of return to a view. This fundamentally breaks agents.

Example Jasonette Document URL http://rollo.dns-systems.net/files/jasonette/agent-stops-working/view1.json http://rollo.dns-systems.net/files/jasonette/agent-stops-working/view2.json http://rollo.dns-systems.net/files/jasonette/agent-stops-working/js.html

To Reproduce Steps to reproduce the behavior:

  1. Go to 'view1.json'
  2. Click on 'Talk to simple agent'. You should see an alert.
  3. Click on 'Go' to navigate away. Then go back.
  4. 'Talk to simple agent' does not work.

Expected behavior Agent working as normal after navigation.

The actual problem Briefly debugging stuff, I see that JasonAgentService.clear() is called when leaving a view. This calls agent.loadUrl("about:blank") and the original url is never reloaded.

It might be fixable in onPageFinished by something like:

if (url.equals("about:blank")) {
    view.goBack();
}

but my knowledge of android is scant and I'm not sure what is triggered when on what state changes.

clsource commented 5 years ago

thanks for reporting :)

clsource commented 4 years ago

I believe this would be solved using @kcorey fix :) so it will be merged.