-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[url_launcher] add support for android headers #1848
[url_launcher] add support for android headers #1848
Conversation
|
I've updated the version to a minor (rather than patch) update because you're introducing a new optional argument. |
collinjackson
left a comment
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.
Thanks for the PR!
Since these headers can only be set on Android, the documentation will need to be updated to reflect this.
| @Override | ||
| @SuppressWarnings("deprecation") | ||
| public boolean shouldOverrideUrlLoading(WebView view, String url) { | ||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { |
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.
I'm not sure I understand why are we overriding this to call loadUrl on versions older than Lolipop?
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.
You can verify why running the code in different emulators APIs, but the gist of it is that the first method is deprecated and should be used only in older versions of android, at the same time second method only exist in new API versions and they will not call the first one.
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.
Thanks for following up!
I'm still not sure I understand - what breaks if we don't override shouldOverrideUrlLoading at all?
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.
I don't quite remember, but I guess that is so the user can navigate using hyperlinks.
I didn't included the call to setWebViewClient, I just fixed the deprecation warning I was getting in Android Studio.
Description
This PR enables the developer to send headers to the Android browser.
This enables the developer to keep the app session in the browser when the same authentication header is used in the app http requests and the in the web site.
Checklist
///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?