Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flutter Inappwebview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
Flutter Inappwebview
Commits
cab5338f
Commit
cab5338f
authored
Nov 25, 2019
by
Lorenzo Pichilli
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'crazecoder-master'
parents
ef8d0d1f
e05f3666
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
8 deletions
+37
-8
android/build.gradle
android/build.gradle
+11
-0
android/proguard-rules.pro
android/proguard-rules.pro
+17
-0
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java
...renzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java
+5
-0
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewChromeClient.java
...r_inappbrowser/InAppWebView/InAppWebViewChromeClient.java
+4
-8
No files found.
android/build.gradle
View file @
cab5338f
...
@@ -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'
...
...
android/proguard-rules.pro
0 → 100644
View file @
cab5338f
# 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
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java
View file @
cab5338f
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
;
}
}
}
}
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewChromeClient.java
View file @
cab5338f
...
@@ -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
))
{
mU
ploadMessageArray
.
onReceiveValue
(
WebChromeClient
.
FileChooserParams
.
parseResult
(
resultCode
,
data
));
InAppBrowserFlutterPlugin
.
u
ploadMessageArray
.
onReceiveValue
(
WebChromeClient
.
FileChooserParams
.
parseResult
(
resultCode
,
data
));
}
}
return
fals
e
;
return
tru
e
;
}
}
private
MethodChannel
getChannel
()
{
private
MethodChannel
getChannel
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment