Skip to content

Commit

Permalink
[webview_flutter] Extract WKWebView implementation into a separate pa…
Browse files Browse the repository at this point in the history
…ckage (flutter#4345)

* Setup webview_flutter_wkwebview package.

Creates a new `webview_flutter_wkwebview` directory and adds
the following meta-data files:
- `AUTHORS`: copied from the `webview_flutter` package and added my name;
- `CHANGELOG.md`: new file adding description for release 0.0.1;
- `LICENSE`: copied from the `webview_flutter` package;
- `README.md`: new file adding the standard platform implementation
  description;
- `pubspec.yaml`: new file adding package meta-data for the
  `webview_flutter_wkwebview` package.

* Direct copy of "iOS" folder.

A one to one copy of the `webview_flutter/ios` folder to
`webview_flutter_wkwebview/` using the following command:
```
cp -R ./webview_flutter/ios ./webview_flutter_wkwebview/
```

* Rename .podspec file to match package name.

For the Cocaopod package to be registered correctly the .podspec file
name needs to match the name of the Flutter package.

* Direct copy of WKWebView specific .dart files.

Copied the WKWebView specific .dart files over from the
`./webview_flutter` package.

* Modify .dart code to work with new platform_interface.

Make sure the `CupertinoWebView` widget extends the `WebViewPlatform`
class from the `webview_flutter_platform_interface` package correctly by
accepting an instance of the `JavascriptChannelRegistry` class.

* Direct copy of the `webview_flutter/example` app.

This commit makes a direct copy of the `webview_flutter/example` app to
the  `webview_flutter_wkwebview` package. After the copy the `example/android`
folder is removed as it doesn't serve a purpose in the WKWebView specific
package. Commands run where:
```
cp -R ./webview_flutter/example ./webview_flutter_wkwebview/
rm -rf ./webview_flutter_wkwebview/example/ios
```

* Update example to WKWebView specific implementation.

This commit updates the example App so it directly implements the
WKWebView specific implementation of the webview_flutter_platform_interface.

* Update integration tests.

Updated the existing integration tests (copied from webview_flutter
package) so they work correctly with the implementation of the
webview_flutter_wkwebview package.

Co-authored-by: BeMacized <[email protected]>

* Fix iOS UI tests.

This commit resolves failing UI tests and ensures the `Publishable` task
is green.

* Point to existing documentation URL

Update the documentation URL in the
`ios/webview_flutter_wkwebview.podspec` file to point to a valid
location. The `https://pub.dev/packages/webview_flutter_wkwebview`
package doesn't exists until this PR is published. However the `pod lib
lint` step in CI is failing if the URL doesn't exist yet.

* Split helper classes from main example widget.

Move the `WebView` and related `WebViewController` classes from the
main.dart into a separate web_view.dart file.

* Updated version numbers as suggested in review.

Updated the version of the plugin to the version of webview_flutter
package (2.0.13).

Also updated the Dart and Flutter versions to respectively 2.14.0 and
2.5.0.

Co-authored-by: BeMacized <[email protected]>
  • Loading branch information
2 people authored and amantoux committed Sep 27, 2021
1 parent 7a071d1 commit cf64c78
Show file tree
Hide file tree
Showing 73 changed files with 4,814 additions and 0 deletions.
67 changes: 67 additions & 0 deletions packages/webview_flutter/webview_flutter_wkwebview/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Below is a list of people and organizations that have contributed
# to the Flutter project. Names should be added to the list like so:
#
# Name/Organization <email address>

Google Inc.
The Chromium Authors
German Saprykin <[email protected]>
Benjamin Sauer <[email protected]>
[email protected]
Ali Bitek <[email protected]>
Pol Batlló <[email protected]>
Anatoly Pulyaevskiy
Hayden Flinner <[email protected]>
Stefano Rodriguez <[email protected]>
Salvatore Giordano <[email protected]>
Brian Armstrong <[email protected]>
Paul DeMarco <[email protected]>
Fabricio Nogueira <[email protected]>
Simon Lightfoot <[email protected]>
Ashton Thomas <[email protected]>
Thomas Danner <[email protected]>
Diego Velásquez <[email protected]>
Hajime Nakamura <[email protected]>
Tuyển Vũ Xuân <[email protected]>
Miguel Ruivo <[email protected]>
Sarthak Verma <[email protected]>
Mike Diarmid <[email protected]>
Invertase <[email protected]>
Elliot Hesp <[email protected]>
Vince Varga <[email protected]>
Aawaz Gyawali <[email protected]>
EUI Limited <[email protected]>
Katarina Sheremet <[email protected]>
Thomas Stockx <[email protected]>
Sarbagya Dhaubanjar <[email protected]>
Ozkan Eksi <[email protected]>
Rishab Nayak <[email protected]>
ko2ic <[email protected]>
Jonathan Younger <[email protected]>
Jose Sanchez <[email protected]>
Debkanchan Samadder <[email protected]>
Audrius Karosevicius <[email protected]>
Lukasz Piliszczuk <[email protected]>
SoundReply Solutions GmbH <[email protected]>
Rafal Wachol <[email protected]>
Pau Picas <[email protected]>
Christian Weder <[email protected]>
Alexandru Tuca <[email protected]>
Christian Weder <[email protected]>
Rhodes Davis Jr. <[email protected]>
Luigi Agosti <[email protected]>
Quentin Le Guennec <[email protected]>
Koushik Ravikumar <[email protected]>
Nissim Dsilva <[email protected]>
Giancarlo Rocha <[email protected]>
Ryo Miyake <[email protected]>
Théo Champion <[email protected]>
Kazuki Yamaguchi <[email protected]>
Eitan Schwartz <[email protected]>
Chris Rutkowski <[email protected]>
Juan Alvarez <[email protected]>
Aleksandr Yurkovskiy <[email protected]>
Anton Borries <[email protected]>
Alex Li <[email protected]>
Rahul Raj <[email protected]>
Maurits van Beusekom <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2.0.13

* Extract WKWebView implementation from `webview_flutter`.
25 changes: 25 additions & 0 deletions packages/webview_flutter/webview_flutter_wkwebview/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright 2013 The Flutter Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 changes: 11 additions & 0 deletions packages/webview_flutter/webview_flutter_wkwebview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# webview\_flutter\_wkwebview

The Apple WKWebView implementation of [`webview_flutter`][1].

## Usage

This package is [endorsed][2], which means you can simply use `webview_flutter`
normally. This package will be automatically included in your app when you do.

[1]: https://pub.dev/packages/webview_flutter
[2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 1e5cb2d87f8542f9fbbd0f22d528823274be0acb
channel: master
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# webview_flutter_example

Demonstrates how to use the webview_flutter plugin.

## Getting Started

For help getting started with Flutter, view our online
[documentation](https://flutter.dev/).
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit cf64c78

Please sign in to comment.