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
bb0e7f70
Commit
bb0e7f70
authored
Nov 10, 2019
by
Lorenzo Pichilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed InAppWebViewOptions error, fixed javascript error for ajax requests
parent
0c17e032
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
120 deletions
+148
-120
.idea/workspace.xml
.idea/workspace.xml
+114
-97
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
...renzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
+1
-1
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java
...lutter_inappbrowser/InAppWebView/InAppWebViewOptions.java
+23
-18
example/lib/inline_example.screen.dart
example/lib/inline_example.screen.dart
+3
-3
ios/Classes/InAppWebView.swift
ios/Classes/InAppWebView.swift
+1
-1
lib/src/content_blocker.dart
lib/src/content_blocker.dart
+6
-0
No files found.
.idea/workspace.xml
View file @
bb0e7f70
This diff is collapsed.
Click to expand it.
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
View file @
bb0e7f70
...
...
@@ -161,7 +161,7 @@ final public class InAppWebView extends InputAwareWebView {
" event: {"
+
" type: e.type,"
+
" loaded: e.loaded,"
+
" lengthComputable: e.lengthComputable"
+
" lengthComputable: e.lengthComputable
,
"
+
" total: e.total"
+
" }"
+
" };"
+
...
...
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java
View file @
bb0e7f70
...
...
@@ -84,17 +84,20 @@ public class InAppWebViewOptions extends Options {
@Override
public
Object
onParse
(
Map
.
Entry
<
String
,
Object
>
pair
)
{
if
(
pair
.
getKey
().
equals
(
"layoutAlgorithm"
))
{
switch
((
String
)
pair
.
getValue
())
{
case
"NORMAL"
:
pair
.
setValue
(
NORMAL
);
return
pair
;
case
"TEXT_AUTOSIZING"
:
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
return
pair
.
setValue
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
);
}
else
{
String
value
=
(
String
)
pair
.
getValue
();
if
(
value
!=
null
)
{
switch
(
value
)
{
case
"NORMAL"
:
pair
.
setValue
(
NORMAL
);
}
return
pair
;
return
pair
;
case
"TEXT_AUTOSIZING"
:
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
return
pair
.
setValue
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
);
}
else
{
pair
.
setValue
(
NORMAL
);
}
return
pair
;
}
}
}
return
super
.
onParse
(
pair
);
...
...
@@ -105,14 +108,16 @@ public class InAppWebViewOptions extends Options {
if
(
field
.
getName
().
equals
(
"layoutAlgorithm"
))
{
try
{
WebSettings
.
LayoutAlgorithm
value
=
(
WebSettings
.
LayoutAlgorithm
)
field
.
get
(
this
);
switch
(
value
)
{
case
NORMAL:
return
"NORMAL"
;
default
:
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
&&
value
.
equals
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
))
{
return
"TEXT_AUTOSIZING"
;
}
return
"NORMAL"
;
if
(
value
!=
null
)
{
switch
(
value
)
{
case
NORMAL:
return
"NORMAL"
;
default
:
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
&&
value
.
equals
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
))
{
return
"TEXT_AUTOSIZING"
;
}
return
"NORMAL"
;
}
}
}
catch
(
IllegalAccessException
e
)
{
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
...
...
example/lib/inline_example.screen.dart
View file @
bb0e7f70
...
...
@@ -288,7 +288,7 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
print
(
"Current highlighted:
$activeMatchOrdinal
, Number of matches found:
$numberOfMatches
, find operation completed:
$isDoneCounting
"
);
},
shouldInterceptAjaxRequest:
(
InAppWebViewController
controller
,
AjaxRequest
ajaxRequest
)
async
{
//
print("AJAX REQUEST: ${ajaxRequest.method} - ${ajaxRequest.url}, DATA: ${ajaxRequest.data}");
print
(
"AJAX REQUEST:
${ajaxRequest.method}
-
${ajaxRequest.url}
, DATA:
${ajaxRequest.data}
"
);
// ajaxRequest.method = "GET";
// ajaxRequest.url = "http://192.168.1.20:8082/test-download-file";
// ajaxRequest.headers = {
...
...
@@ -298,11 +298,11 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
return
null
;
},
onAjaxReadyStateChange:
(
InAppWebViewController
controller
,
AjaxRequest
ajaxRequest
)
async
{
//
print("AJAX READY STATE CHANGE: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.status}, ${ajaxRequest.readyState}, ${ajaxRequest.responseType}, ${ajaxRequest.responseText}, ${ajaxRequest.responseHeaders}");
print
(
"AJAX READY STATE CHANGE:
${ajaxRequest.method}
-
${ajaxRequest.url}
,
${ajaxRequest.status}
,
${ajaxRequest.readyState}
,
${ajaxRequest.responseType}
,
${ajaxRequest.responseText}
,
${ajaxRequest.responseHeaders}
"
);
return
AjaxRequestAction
.
PROCEED
;
},
onAjaxProgress:
(
InAppWebViewController
controller
,
AjaxRequest
ajaxRequest
)
async
{
//
print("AJAX EVENT: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.event.type}, LOADED: ${ajaxRequest.event.loaded}, ${ajaxRequest.responseHeaders}");
print
(
"AJAX EVENT:
${ajaxRequest.method}
-
${ajaxRequest.url}
,
${ajaxRequest.event.type}
, LOADED:
${ajaxRequest.event.loaded}
,
${ajaxRequest.responseHeaders}
"
);
return
AjaxRequestAction
.
PROCEED
;
},
shouldInterceptFetchRequest:
(
InAppWebViewController
controller
,
FetchRequest
fetchRequest
)
async
{
...
...
ios/Classes/InAppWebView.swift
View file @
bb0e7f70
...
...
@@ -311,7 +311,7 @@ let interceptAjaxRequestsJS = """
event: {
type: e.type,
loaded: e.loaded,
lengthComputable: e.lengthComputable
lengthComputable: e.lengthComputable
,
total: e.total
}
};
...
...
lib/src/content_blocker.dart
View file @
bb0e7f70
///
class
ContentBlocker
{
ContentBlockerTrigger
trigger
;
ContentBlockerAction
action
;
...
...
@@ -23,6 +24,7 @@ class ContentBlocker {
}
}
///
class
ContentBlockerTriggerResourceType
{
final
String
_value
;
const
ContentBlockerTriggerResourceType
.
_internal
(
this
.
_value
);
...
...
@@ -42,6 +44,7 @@ class ContentBlockerTriggerResourceType {
static
const
RAW
=
const
ContentBlockerTriggerResourceType
.
_internal
(
'raw'
);
}
///
class
ContentBlockerTriggerLoadType
{
final
String
_value
;
const
ContentBlockerTriggerLoadType
.
_internal
(
this
.
_value
);
...
...
@@ -54,6 +57,7 @@ class ContentBlockerTriggerLoadType {
static
const
THIRD_PARTY
=
const
ContentBlockerTriggerLoadType
.
_internal
(
'third-party'
);
}
///
class
ContentBlockerTrigger
{
String
urlFilter
;
bool
urlFilterIsCaseSensitive
;
...
...
@@ -136,6 +140,7 @@ class ContentBlockerTrigger {
}
}
///
class
ContentBlockerActionType
{
final
String
_value
;
const
ContentBlockerActionType
.
_internal
(
this
.
_value
);
...
...
@@ -149,6 +154,7 @@ class ContentBlockerActionType {
static
const
MAKE_HTTPS
=
const
ContentBlockerActionType
.
_internal
(
'make-https'
);
}
///
class
ContentBlockerAction
{
ContentBlockerActionType
type
;
String
selector
;
...
...
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