Merge branch 'crazecoder-master'
This commit is contained in:
commit
cab5338f3d
|
@ -29,10 +29,21 @@ android {
|
|||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
consumerProguardFiles 'proguard-rules.pro'
|
||||
}
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation 'androidx.webkit:webkit:1.0.0'
|
||||
implementation 'androidx.browser:browser:1.0.0'
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# WebView
|
||||
-keepattributes *JavascriptInterface*
|
||||
-keepclassmembers class * {
|
||||
@android.webkit.JavascriptInterface <methods>;
|
||||
}
|
||||
-keepclassmembers class * extends android.webkit.WebViewClient {
|
||||
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
|
||||
public boolean *(android.webkit.WebView, java.lang.String);
|
||||
public void *(android.webkit.webView, jav.lang.String);
|
||||
}
|
||||
-keepclassmembers class com.pichillilorenzo.flutter_inappbrowser$JavaScriptBridgeInterface {
|
||||
<fields>;
|
||||
<methods>;
|
||||
public *;
|
||||
private *;
|
||||
}
|
||||
-keep class com.pichillilorenzo.flutter_inappbrowser.** { *; }
|
|
@ -1,6 +1,8 @@
|
|||
package com.pichillilorenzo.flutter_inappbrowser;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.webkit.ValueCallback;
|
||||
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.common.PluginRegistry;
|
||||
|
@ -15,6 +17,8 @@ public class InAppBrowserFlutterPlugin implements FlutterPlugin {
|
|||
public static InAppBrowser inAppBrowser;
|
||||
public static MyCookieManager myCookieManager;
|
||||
public static CredentialDatabaseHandler credentialDatabaseHandler;
|
||||
public static ValueCallback<Uri[]> uploadMessageArray;
|
||||
|
||||
|
||||
public InAppBrowserFlutterPlugin() {}
|
||||
|
||||
|
@ -61,5 +65,6 @@ public class InAppBrowserFlutterPlugin implements FlutterPlugin {
|
|||
credentialDatabaseHandler.dispose();
|
||||
credentialDatabaseHandler = null;
|
||||
}
|
||||
uploadMessageArray = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,13 +46,11 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
|
|||
private PluginRegistry.Registrar registrar;
|
||||
private FlutterWebView flutterWebView;
|
||||
private InAppBrowserActivity inAppBrowserActivity;
|
||||
private ValueCallback<Uri[]> mUploadMessageArray;
|
||||
private ValueCallback<Uri> mUploadMessage;
|
||||
private final static int FILECHOOSER_RESULTCODE = 1;
|
||||
|
||||
private View mCustomView;
|
||||
private WebChromeClient.CustomViewCallback mCustomViewCallback;
|
||||
protected FrameLayout mFullscreenContainer;
|
||||
private int mOriginalOrientation;
|
||||
private int mOriginalSystemUiVisibility;
|
||||
|
||||
|
@ -545,10 +543,8 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
|
|||
}
|
||||
|
||||
//For Android 5.0+
|
||||
public boolean onShowFileChooser(
|
||||
WebView webView, ValueCallback<Uri[]> filePathCallback,
|
||||
FileChooserParams fileChooserParams) {
|
||||
mUploadMessageArray = filePathCallback;
|
||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
|
||||
InAppBrowserFlutterPlugin.uploadMessageArray = filePathCallback;
|
||||
try {
|
||||
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
|
@ -572,9 +568,9 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
|
|||
@Override
|
||||
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == FILECHOOSER_RESULTCODE && (resultCode == RESULT_OK || resultCode == RESULT_CANCELED)) {
|
||||
mUploadMessageArray.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, data));
|
||||
InAppBrowserFlutterPlugin.uploadMessageArray.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, data));
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private MethodChannel getChannel() {
|
||||
|
|
Loading…
Reference in New Issue