what-the-bank/sources/io/flutter/plugins/webviewflutter/FlutterCookieManager.java

54 lines
2.0 KiB
Java

package io.flutter.plugins.webviewflutter;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
/* loaded from: classes6.dex */
class FlutterCookieManager implements MethodChannel.MethodCallHandler {
private final MethodChannel methodChannel;
/* JADX INFO: Access modifiers changed from: package-private */
public FlutterCookieManager(BinaryMessenger binaryMessenger) {
MethodChannel methodChannel = new MethodChannel(binaryMessenger, "plugins.flutter.io/cookie_manager");
this.methodChannel = methodChannel;
methodChannel.setMethodCallHandler(this);
}
@Override // io.flutter.plugin.common.MethodChannel.MethodCallHandler
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
String str = methodCall.method;
str.hashCode();
if (str.equals("clearCookies")) {
clearCookies(result);
} else {
result.notImplemented();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void dispose() {
this.methodChannel.setMethodCallHandler(null);
}
private static void clearCookies(MethodChannel.Result result) {
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookies(new ValueCallback<Boolean>(result, cookieManager.hasCookies()) { // from class: io.flutter.plugins.webviewflutter.FlutterCookieManager.1
final boolean val$hasCookies;
final MethodChannel.Result val$result;
{
this.val$result = result;
this.val$hasCookies = r2;
}
@Override // android.webkit.ValueCallback
public void onReceiveValue(Boolean bool) {
this.val$result.success(Boolean.valueOf(this.val$hasCookies));
}
});
}
}