Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter] Add supporting interfaces for setting cookies to platform interface. #4555

Merged

Conversation

BeMacized
Copy link
Member

This PR adds the following:

  • A CookieManager interface for cookie related operations. clearCookies was moved here, and setCookie was added.
    • Currently, adding new functionality to WebViewPlatform causes breaking changes due to [webview_flutter] Update to standard platform interface structure flutter#94051. Having a separate cookie manager should prevent this.
    • Having cookie functionality separated should allow the implementating class to be more accessible. It allows the cookie manager, for example, to be accessed from the WebViewController in the android package, to set initial cookies from the creation params. Previously, the location of clearCookies made this rather difficult.
  • CreationParams has been expanded to also contain initial cookies to be set upon creation of the webview.
  • clearCookies in WebViewPlatform has been deprecated in favour of WebViewCookieManager.clearCookies.

Relevant issue:

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@google-cla google-cla bot added the cla: yes label Nov 29, 2021
@github-actions github-actions bot added the p: webview_flutter Edits files for a webview_flutter plugin label Nov 29, 2021
@@ -59,6 +59,7 @@ abstract class WebViewPlatform {
/// Clears all cookies for all [WebView] instances.
///
/// Returns true if cookies were present before clearing, else false.
@Deprecated('Use `WebViewCookieManagerPlatform.clearCookies` instead.')
Copy link
Member Author

@BeMacized BeMacized Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ reviewer: Just want to double check if it's ok to deprecate platform interface methods like this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't deprecate methods we're still using; it breaks the tree. (I should have tooling soon that will catch this kind of thing in CI.)

They can be commented as deprecated, and then actually deprecated later once the uses have been removed.

Unless you can fix the call sites right away, we need to revert this part, as this will close not only our tree, but the flutter/flutter tree as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan Alright, I'll quickly submit a PR that changes this annotation to a comment.

@BeMacized BeMacized marked this pull request as draft November 29, 2021 16:02
@BeMacized BeMacized marked this pull request as ready for review November 29, 2021 18:53
Copy link
Contributor

@mvanbeusekom mvanbeusekom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, I just added some comments regarding some of the DartDocs.

Copy link
Contributor

@mvanbeusekom mvanbeusekom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BeMacized BeMacized added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Dec 2, 2021
@fluttergithubbot fluttergithubbot merged commit 702fada into flutter:master Dec 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 2, 2021
@mvanbeusekom mvanbeusekom deleted the webview_flutter/set_cookies_platform branch December 2, 2021 13:07
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 2, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Dec 11, 2021
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes p: webview_flutter Edits files for a webview_flutter plugin waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
4 participants