Replacing the top frame with a data-uri is forbidden since chromium-based-webview version 60.
With this commit we swap the body with an iframe when needed. Old webviews work as usual also with this approach.
No special treatment is needed for local storage as its usage is forbidden in data-uri iframes.
Fixes#758
This is a workaround for bugs in the javascript code of the configured watchfaces, that could fail to handle a returned failure properly and crash the webview / fill its stack.
This is not needed as long as one GB instance is used to manage a single pebble device, if multiple devices are managed the stored watchapp configuration could be messed up.
LocalStorage native functions are overridden to keep each watchface's settings separated. It's possible the bind method do not work on older versions of android.
- localstorage is now cleared at every launch: this prevents some clay configuration pages to send back to the watch a number of keys that were set by other configuration pages
- only execute JS on document ready: this prevents some race conditions
- added dummy getTimelineToken function to Pebble JS object
- corrected (hopefully!) a few logic errors in the JS code (this referenced where it wasn't)
- refactored the steps visualization in JS
- lifecycle changes to the java activity: now the configuration page gets closed as soon as the settings have been sent, and there is only one instance of it