-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
History management for android #453
Conversation
… for android. This follows the usage recommended at https://developer.android.com/reference/androidx/webkit/WebViewAssetLoader to avoid an issue where assets referred to by file:// urls would receive a permissions error and never be passed to shouldInterceptRequest in sufficiently high API levels. It may be appropriate to expose a method to use a different base URI, which could simplify CORS for android apps in some use cases, and additionally a full conversion to WebViewAssetLoader might be reasonable.
Also exposes the external updates from manageHistory, to allow additional behavior on "back" and "forward" such as skipping redirected routes when going backwards.
Also includes the change to https://appassets.androidplatform.net for assets. |
@@ -87,7 +86,7 @@ public WebResourceResponse shouldInterceptRequest (WebView view, WebResourceRequ | |||
|
|||
@Override | |||
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |||
if( url != null && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("file://")) { | |||
if( url != null && !url.startsWith("http://appassets.androidplatform.net") && !url.startsWith("https://appassets.androidplatform.net") && !url.startsWith("file://")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this bit be included in #452 ?
Pre-existing, but it's odd that above scheme
/encodedAuthority
are used but here startsWith
is used. Maybe we want this de-duplicated
@@ -76,17 +83,24 @@ run jsm = do | |||
continueWithCallbacks $ def | |||
{ _activityCallbacks_onCreate = \_ -> do | |||
a <- getHaskellActivity | |||
let startPage = fromString "file:///android_asset/index.html" | |||
let startPage = fromString "https:///appassets.androidplatform.net/index.html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra /
?
Adds support for the "back" button in android, adds a function to trigger platform-dependent "back" handling (which on Android includes exiting the app if the history is empty), and extends manageHistory slightly to allow additional behavior on external history navigation such as skipping updates that would now reroute when going backwards.