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

Commit 6bba843

Browse files
[webview_flutter_android] Copies Android implementation of webview_flutter from v4_webview (#6851)
* new android release * Version bump * update all plugins config * fix lints and add action item to changelog
1 parent 6c0df1a commit 6bba843

File tree

58 files changed

+9761
-4164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+9761
-4164
lines changed

packages/webview_flutter/webview_flutter_android/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.0.0
2+
3+
* **BREAKING CHANGE** Updates platform implementation to `2.0.0` release of
4+
`webview_flutter_platform_interface`. See
5+
[webview_flutter](https://pub.dev/packages/webview_flutter/versions/4.0.0) for updated usage.
6+
17
## 2.10.4
28

39
* Updates code for `no_leading_underscores_for_local_identifiers` lint.

packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/DownloadListenerFlutterApiImpl.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,6 @@ public void onDownloadStart(
4747
callback);
4848
}
4949

50-
/**
51-
* Communicates to Dart that the reference to a {@link DownloadListener} was removed.
52-
*
53-
* @param downloadListener the instance whose reference will be removed
54-
* @param callback reply callback with return value from Dart
55-
*/
56-
public void dispose(DownloadListener downloadListener, Reply<Void> callback) {
57-
if (instanceManager.containsInstance(downloadListener)) {
58-
dispose(getIdentifierForListener(downloadListener), callback);
59-
} else {
60-
callback.reply(null);
61-
}
62-
}
63-
6450
private long getIdentifierForListener(DownloadListener listener) {
6551
final Long identifier = instanceManager.getIdentifierForStrongReference(listener);
6652
if (identifier == null) {

packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/DownloadListenerHostApiImpl.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import android.webkit.DownloadListener;
88
import androidx.annotation.NonNull;
9-
import androidx.annotation.Nullable;
109
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.DownloadListenerHostApi;
1110

1211
/**
@@ -21,11 +20,9 @@ public class DownloadListenerHostApiImpl implements DownloadListenerHostApi {
2120

2221
/**
2322
* Implementation of {@link DownloadListener} that passes arguments of callback methods to Dart.
24-
*
25-
* <p>No messages are sent to Dart after {@link DownloadListenerImpl#release} is called.
2623
*/
27-
public static class DownloadListenerImpl implements DownloadListener, Releasable {
28-
@Nullable private DownloadListenerFlutterApiImpl flutterApi;
24+
public static class DownloadListenerImpl implements DownloadListener {
25+
private final DownloadListenerFlutterApiImpl flutterApi;
2926

3027
/**
3128
* Creates a {@link DownloadListenerImpl} that passes arguments of callbacks methods to Dart.
@@ -43,18 +40,8 @@ public void onDownloadStart(
4340
String contentDisposition,
4441
String mimetype,
4542
long contentLength) {
46-
if (flutterApi != null) {
47-
flutterApi.onDownloadStart(
48-
this, url, userAgent, contentDisposition, mimetype, contentLength, reply -> {});
49-
}
50-
}
51-
52-
@Override
53-
public void release() {
54-
if (flutterApi != null) {
55-
flutterApi.dispose(this, reply -> {});
56-
}
57-
flutterApi = null;
43+
flutterApi.onDownloadStart(
44+
this, url, userAgent, contentDisposition, mimetype, contentLength, reply -> {});
5845
}
5946
}
6047

0 commit comments

Comments
 (0)