-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Move clearCookies behind the platform abstraction #1663
Conversation
nkoroste
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.
Overall LGTM, I think we should get it in to unblock Fuchsia first. Then during the Fuchsia implementation we can iterate on the naming some more.
|
|
||
| typedef WebViewPlatformCreatedCallback = void Function( | ||
| WebViewPlatform webViewPlatform); | ||
| WebViewPlatformController webViewPlatform); |
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.
| WebViewPlatformController webViewPlatform); | |
| WebViewPlatformController webViewPlatformController); |
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.
done
| /// The default value is [AndroidWebViewBuilder] on Android and [CupertinoWebViewBuilder] on iOs. | ||
| static set platformBuilder(WebViewBuilder platformBuilder) { | ||
| _platformBuilder = platformBuilder; | ||
| /// The default value is [AndroidWebView] on Android and [CupertinoWebView] on iOs. |
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.
| /// The default value is [AndroidWebView] on Android and [CupertinoWebView] on iOs. | |
| /// The default value is [AndroidWebView] on Android and [CupertinoWebView] on iOS. |
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.
done
| static set platformBuilder(WebViewBuilder platformBuilder) { | ||
| _platformBuilder = platformBuilder; | ||
| /// The default value is [AndroidWebView] on Android and [CupertinoWebView] on iOs. | ||
| static set platform(WebViewPlatform platformBuilder) { |
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.
| static set platform(WebViewPlatform platformBuilder) { | |
| static set platform(WebViewPlatform platform) { |
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.
done
| _platformBuilder = platformBuilder; | ||
| /// The default value is [AndroidWebView] on Android and [CupertinoWebView] on iOs. | ||
| static set platform(WebViewPlatform platformBuilder) { | ||
| _platform = platformBuilder; |
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.
| _platform = platformBuilder; | |
| _platform = platform; |
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.
done
| } | ||
|
|
||
| final WebViewPlatform _webViewPlatform; | ||
| final WebViewPlatformController _webViewPlatform; |
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.
| final WebViewPlatformController _webViewPlatform; | |
| final WebViewPlatformController _webViewPlatformController; |
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.
done
| } | ||
|
|
||
| class MyWebViewBuilder implements WebViewBuilder { | ||
| class MyWebViewBuilder implements WebViewPlatform { |
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.
| class MyWebViewBuilder implements WebViewPlatform { | |
| class MyWebViewPlatform implements WebViewPlatform { |
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.
done
| ); | ||
|
|
||
| final MyWebViewBuilder builder = WebView.platformBuilder; | ||
| final MyWebViewBuilder builder = WebView.platform; |
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.
| final MyWebViewBuilder builder = WebView.platform; | |
| final MyWebViewPlatform builder = WebView.platform; |
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.
done
| ); | ||
|
|
||
| final MyWebViewBuilder builder = WebView.platformBuilder; | ||
| final MyWebViewBuilder builder = WebView.platform; |
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.
| final MyWebViewBuilder builder = WebView.platform; | |
| final MyWebViewPlatform builder = WebView.platform; |
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.
done
| } | ||
|
|
||
| class MyWebViewPlatform extends WebViewPlatform { | ||
| class MyWebViewPlatform extends WebViewPlatformController { |
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.
| class MyWebViewPlatform extends WebViewPlatformController { | |
| class MyWebViewPlatformController extends WebViewPlatformController { |
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.
done
…ror". (flutter#1663) (flutter#1665) * Updates the example with the missing "recordError". (flutter#1663)
This is a followup for #1618, #1624, and #1645, and moves the
plugins.flutter.io/cookie_managermethod channel behind the platform interface which allows a third party package to provide a new platform implementation the cooke manager.See the description for #1618 for more details.
Following this PR all platform specific code can be replaced by an external package.
Note on renamed classes
Before this PR we had a
WebViewBuilderclass(which had the build method) and aWebViewPlatformclass (which abstracted what's currently done on the webview method channel).A
WebViewPlatforminstance existed perWebViewinstance, andWebViewBuilderneeds to exist once.As
clearCookiesis not associated with aWebViewinstance I added it to what was previously namedWebViewBuilderand renamed both classes:WebViewPlatform->WebViewPlatformControllerWebViewBuilder->WebViewPlatformWith this, to replace the platform implementation you do
WebView.platform = FuchsiaWebView();.I'm far from being in love with the current names, and happy to do something else (we haven't published the plugin yet so this isn't a breaking change yet).
An alternative option I have in mind is to add a separate
CookieManagerPlatforminterface (this will mean we have to not only doWebView.platformBuilder = FuchsiaWebViewBuilder()but alsoCookieManager.platform = FuchsiaCookieManager().@nkoroste, @cyanglaz any thouhgs?
@Hixie you had opinions on these names in #1618, curious to see what you think.