Commit cab5338f authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

Merge branch 'crazecoder-master'

parents ef8d0d1f e05f3666
...@@ -29,10 +29,21 @@ android { ...@@ -29,10 +29,21 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
consumerProguardFiles 'proguard-rules.pro'
} }
lintOptions { lintOptions {
disable 'InvalidPackage' 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 { dependencies {
implementation 'androidx.webkit:webkit:1.0.0' implementation 'androidx.webkit:webkit:1.0.0'
implementation 'androidx.browser:browser:1.0.0' implementation 'androidx.browser:browser:1.0.0'
......
# 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.** { *; }
\ No newline at end of file
package com.pichillilorenzo.flutter_inappbrowser; package com.pichillilorenzo.flutter_inappbrowser;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.webkit.ValueCallback;
import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry; import io.flutter.plugin.common.PluginRegistry;
...@@ -15,6 +17,8 @@ public class InAppBrowserFlutterPlugin implements FlutterPlugin { ...@@ -15,6 +17,8 @@ public class InAppBrowserFlutterPlugin implements FlutterPlugin {
public static InAppBrowser inAppBrowser; public static InAppBrowser inAppBrowser;
public static MyCookieManager myCookieManager; public static MyCookieManager myCookieManager;
public static CredentialDatabaseHandler credentialDatabaseHandler; public static CredentialDatabaseHandler credentialDatabaseHandler;
public static ValueCallback<Uri[]> uploadMessageArray;
public InAppBrowserFlutterPlugin() {} public InAppBrowserFlutterPlugin() {}
...@@ -61,5 +65,6 @@ public class InAppBrowserFlutterPlugin implements FlutterPlugin { ...@@ -61,5 +65,6 @@ public class InAppBrowserFlutterPlugin implements FlutterPlugin {
credentialDatabaseHandler.dispose(); credentialDatabaseHandler.dispose();
credentialDatabaseHandler = null; credentialDatabaseHandler = null;
} }
uploadMessageArray = null;
} }
} }
...@@ -46,13 +46,11 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR ...@@ -46,13 +46,11 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
private PluginRegistry.Registrar registrar; private PluginRegistry.Registrar registrar;
private FlutterWebView flutterWebView; private FlutterWebView flutterWebView;
private InAppBrowserActivity inAppBrowserActivity; private InAppBrowserActivity inAppBrowserActivity;
private ValueCallback<Uri[]> mUploadMessageArray;
private ValueCallback<Uri> mUploadMessage; private ValueCallback<Uri> mUploadMessage;
private final static int FILECHOOSER_RESULTCODE = 1; private final static int FILECHOOSER_RESULTCODE = 1;
private View mCustomView; private View mCustomView;
private WebChromeClient.CustomViewCallback mCustomViewCallback; private WebChromeClient.CustomViewCallback mCustomViewCallback;
protected FrameLayout mFullscreenContainer;
private int mOriginalOrientation; private int mOriginalOrientation;
private int mOriginalSystemUiVisibility; private int mOriginalSystemUiVisibility;
...@@ -545,10 +543,8 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR ...@@ -545,10 +543,8 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
} }
//For Android 5.0+ //For Android 5.0+
public boolean onShowFileChooser( public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
WebView webView, ValueCallback<Uri[]> filePathCallback, InAppBrowserFlutterPlugin.uploadMessageArray = filePathCallback;
FileChooserParams fileChooserParams) {
mUploadMessageArray = filePathCallback;
try { try {
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
...@@ -572,9 +568,9 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR ...@@ -572,9 +568,9 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
@Override @Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == FILECHOOSER_RESULTCODE && (resultCode == RESULT_OK || resultCode == RESULT_CANCELED)) { 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() { private MethodChannel getChannel() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment