Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## NEXT
## 3.4.6

* Bumps androidx.webkit:webkit from 1.6.0 to 1.6.1.
* Fixes common typos in tests and documentation.
* Updates pigeon dev dependency to `9.2.4`.
* Fixes Android lint warnings.

## 3.4.5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ android {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}

dependencies {
Expand Down
4,107 changes: 0 additions & 4,107 deletions packages/webview_flutter/webview_flutter_android/android/lint-baseline.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

import android.os.Build;
import android.webkit.CookieManager;
import androidx.annotation.NonNull;
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CookieManagerHostApi;

class CookieManagerHostApiImpl implements GeneratedAndroidWebView.CookieManagerHostApi {
class CookieManagerHostApiImpl implements CookieManagerHostApi {
@Override
public void clearCookies(GeneratedAndroidWebView.Result<Boolean> result) {
public void clearCookies(@NonNull GeneratedAndroidWebView.Result<Boolean> result) {
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.removeAllCookies(result::success);
Expand All @@ -19,7 +21,7 @@ public void clearCookies(GeneratedAndroidWebView.Result<Boolean> result) {
}

@Override
public void setCookie(String url, String value) {
public void setCookie(@NonNull String url, @NonNull String value) {
CookieManager.getInstance().setCookie(url, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import static android.hardware.display.DisplayManager.DisplayListener;

import android.annotation.TargetApi;
import android.hardware.display.DisplayManager;
import android.os.Build;
import android.util.Log;
Expand Down Expand Up @@ -39,7 +38,6 @@
* first initialization of a webview within the process the difference between the lists is the
* webview's display listener.
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
class DisplayListenerProxy {
private static final String TAG = "DisplayListenerProxy";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package io.flutter.plugins.webviewflutter;

import android.webkit.DownloadListener;
import androidx.annotation.NonNull;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.DownloadListenerFlutterApi;

Expand All @@ -23,20 +24,20 @@ public class DownloadListenerFlutterApiImpl extends DownloadListenerFlutterApi {
* @param instanceManager maintains instances stored to communicate with Dart objects
*/
public DownloadListenerFlutterApiImpl(
BinaryMessenger binaryMessenger, InstanceManager instanceManager) {
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) {
super(binaryMessenger);
this.instanceManager = instanceManager;
}

/** Passes arguments from {@link DownloadListener#onDownloadStart} to Dart. */
public void onDownloadStart(
DownloadListener downloadListener,
String url,
String userAgent,
String contentDisposition,
String mimetype,
@NonNull DownloadListener downloadListener,
@NonNull String url,
@NonNull String userAgent,
@NonNull String contentDisposition,
@NonNull String mimetype,
long contentLength,
Reply<Void> callback) {
@NonNull Reply<Void> callback) {
onDownloadStart(
getIdentifierForListener(downloadListener),
url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public DownloadListenerImpl(@NonNull DownloadListenerFlutterApiImpl flutterApi)

@Override
public void onDownloadStart(
String url,
String userAgent,
String contentDisposition,
String mimetype,
@NonNull String url,
@NonNull String userAgent,
@NonNull String contentDisposition,
@NonNull String mimetype,
long contentLength) {
flutterApi.onDownloadStart(
this, url, userAgent, contentDisposition, mimetype, contentLength, reply -> {});
Expand All @@ -53,7 +53,9 @@ public static class DownloadListenerCreator {
* @param flutterApi handles sending messages to Dart
* @return the created {@link DownloadListenerImpl}
*/
public DownloadListenerImpl createDownloadListener(DownloadListenerFlutterApiImpl flutterApi) {
@NonNull
public DownloadListenerImpl createDownloadListener(
@NonNull DownloadListenerFlutterApiImpl flutterApi) {
return new DownloadListenerImpl(flutterApi);
}
}
Expand All @@ -66,16 +68,16 @@ public DownloadListenerImpl createDownloadListener(DownloadListenerFlutterApiImp
* @param flutterApi handles sending messages to Dart
*/
public DownloadListenerHostApiImpl(
InstanceManager instanceManager,
DownloadListenerCreator downloadListenerCreator,
DownloadListenerFlutterApiImpl flutterApi) {
@NonNull InstanceManager instanceManager,
@NonNull DownloadListenerCreator downloadListenerCreator,
@NonNull DownloadListenerFlutterApiImpl flutterApi) {
this.instanceManager = instanceManager;
this.downloadListenerCreator = downloadListenerCreator;
this.flutterApi = flutterApi;
}

@Override
public void create(Long instanceId) {
public void create(@NonNull Long instanceId) {
final DownloadListener downloadListener =
downloadListenerCreator.createDownloadListener(flutterApi);
instanceManager.addDartCreatedInstance(downloadListener, instanceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import android.os.Build;
import android.webkit.WebChromeClient;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import io.flutter.plugin.common.BinaryMessenger;
import java.util.Arrays;
Expand All @@ -28,7 +29,7 @@ public class FileChooserParamsFlutterApiImpl
* @param instanceManager maintains instances stored to communicate with Dart objects
*/
public FileChooserParamsFlutterApiImpl(
BinaryMessenger binaryMessenger, InstanceManager instanceManager) {
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) {
super(binaryMessenger);
this.instanceManager = instanceManager;
}
Expand Down Expand Up @@ -58,7 +59,8 @@ private static GeneratedAndroidWebView.FileChooserModeEnumData toFileChooserEnum
* Stores the FileChooserParams instance and notifies Dart to create a new FileChooserParams
* instance that is attached to this one.
*/
public void create(WebChromeClient.FileChooserParams instance, Reply<Void> callback) {
public void create(
@NonNull WebChromeClient.FileChooserParams instance, @NonNull Reply<Void> callback) {
if (!instanceManager.containsInstance(instance)) {
create(
instanceManager.addHostCreatedInstance(instance),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.IOException;

/** Provides access to the assets registered as part of the App bundle. */
@SuppressWarnings({"deprecation", "DeprecatedIsStillUsed"})
abstract class FlutterAssetManager {
final AssetManager assetManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package io.flutter.plugins.webviewflutter;

import android.webkit.WebView;
import androidx.annotation.NonNull;
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.FlutterAssetManagerHostApi;
import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -20,12 +21,13 @@ public class FlutterAssetManagerHostApiImpl implements FlutterAssetManagerHostAp
final FlutterAssetManager flutterAssetManager;

/** Constructs a new instance of {@link FlutterAssetManagerHostApiImpl}. */
public FlutterAssetManagerHostApiImpl(FlutterAssetManager flutterAssetManager) {
public FlutterAssetManagerHostApiImpl(@NonNull FlutterAssetManager flutterAssetManager) {
this.flutterAssetManager = flutterAssetManager;
}

@NonNull
@Override
public List<String> list(String path) {
public List<String> list(@NonNull String path) {
try {
String[] paths = flutterAssetManager.list(path);

Expand All @@ -39,8 +41,9 @@ public List<String> list(String path) {
}
}

@NonNull
@Override
public String getAssetFilePathByName(String name) {
public String getAssetFilePathByName(@NonNull String name) {
return flutterAssetManager.getAssetFilePathByName(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
package io.flutter.plugins.webviewflutter;

import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.plugin.common.StandardMessageCodec;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.plugin.platform.PlatformViewFactory;
Expand All @@ -17,9 +19,15 @@ class FlutterWebViewFactory extends PlatformViewFactory {
this.instanceManager = instanceManager;
}

@NonNull
@Override
public PlatformView create(Context context, int id, Object args) {
final PlatformView view = (PlatformView) instanceManager.getInstance((Integer) args);
public PlatformView create(Context context, int viewId, @Nullable Object args) {
final Integer identifier = (Integer) args;
if (identifier == null) {
throw new IllegalStateException("An identifier is required to retrieve WebView instance.");
}

final PlatformView view = instanceManager.getInstance(identifier);
if (view == null) {
throw new IllegalStateException("Unable to find WebView instance: " + args);
}
Expand Down
Loading