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 {
...
@@ -161,7 +161,7 @@ final public class InAppWebView extends InputAwareWebView {
" event: {"
+
" event: {"
+
" type: e.type,"
+
" type: e.type,"
+
" loaded: e.loaded,"
+
" loaded: e.loaded,"
+
" lengthComputable: e.lengthComputable"
+
" lengthComputable: e.lengthComputable
,
"
+
" total: e.total"
+
" 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 {
...
@@ -84,17 +84,20 @@ public class InAppWebViewOptions extends Options {
@Override
@Override
public
Object
onParse
(
Map
.
Entry
<
String
,
Object
>
pair
)
{
public
Object
onParse
(
Map
.
Entry
<
String
,
Object
>
pair
)
{
if
(
pair
.
getKey
().
equals
(
"layoutAlgorithm"
))
{
if
(
pair
.
getKey
().
equals
(
"layoutAlgorithm"
))
{
switch
((
String
)
pair
.
getValue
())
{
String
value
=
(
String
)
pair
.
getValue
();
case
"NORMAL"
:
if
(
value
!=
null
)
{
pair
.
setValue
(
NORMAL
);
switch
(
value
)
{
return
pair
;
case
"NORMAL"
:
case
"TEXT_AUTOSIZING"
:
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
return
pair
.
setValue
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
);
}
else
{
pair
.
setValue
(
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
);
return
super
.
onParse
(
pair
);
...
@@ -105,14 +108,16 @@ public class InAppWebViewOptions extends Options {
...
@@ -105,14 +108,16 @@ public class InAppWebViewOptions extends Options {
if
(
field
.
getName
().
equals
(
"layoutAlgorithm"
))
{
if
(
field
.
getName
().
equals
(
"layoutAlgorithm"
))
{
try
{
try
{
WebSettings
.
LayoutAlgorithm
value
=
(
WebSettings
.
LayoutAlgorithm
)
field
.
get
(
this
);
WebSettings
.
LayoutAlgorithm
value
=
(
WebSettings
.
LayoutAlgorithm
)
field
.
get
(
this
);
switch
(
value
)
{
if
(
value
!=
null
)
{
case
NORMAL:
switch
(
value
)
{
return
"NORMAL"
;
case
NORMAL:
default
:
return
"NORMAL"
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
&&
value
.
equals
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
))
{
default
:
return
"TEXT_AUTOSIZING"
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
&&
value
.
equals
(
WebSettings
.
LayoutAlgorithm
.
TEXT_AUTOSIZING
))
{
}
return
"TEXT_AUTOSIZING"
;
return
"NORMAL"
;
}
return
"NORMAL"
;
}
}
}
}
catch
(
IllegalAccessException
e
)
{
}
catch
(
IllegalAccessException
e
)
{
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
Log
.
d
(
LOG_TAG
,
e
.
getMessage
());
...
...
example/lib/inline_example.screen.dart
View file @
bb0e7f70
...
@@ -288,7 +288,7 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
...
@@ -288,7 +288,7 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
print
(
"Current highlighted:
$activeMatchOrdinal
, Number of matches found:
$numberOfMatches
, find operation completed:
$isDoneCounting
"
);
print
(
"Current highlighted:
$activeMatchOrdinal
, Number of matches found:
$numberOfMatches
, find operation completed:
$isDoneCounting
"
);
},
},
shouldInterceptAjaxRequest:
(
InAppWebViewController
controller
,
AjaxRequest
ajaxRequest
)
async
{
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.method = "GET";
// ajaxRequest.url = "http://192.168.1.20:8082/test-download-file";
// ajaxRequest.url = "http://192.168.1.20:8082/test-download-file";
// ajaxRequest.headers = {
// ajaxRequest.headers = {
...
@@ -298,11 +298,11 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
...
@@ -298,11 +298,11 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
return
null
;
return
null
;
},
},
onAjaxReadyStateChange:
(
InAppWebViewController
controller
,
AjaxRequest
ajaxRequest
)
async
{
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
;
return
AjaxRequestAction
.
PROCEED
;
},
},
onAjaxProgress:
(
InAppWebViewController
controller
,
AjaxRequest
ajaxRequest
)
async
{
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
;
return
AjaxRequestAction
.
PROCEED
;
},
},
shouldInterceptFetchRequest:
(
InAppWebViewController
controller
,
FetchRequest
fetchRequest
)
async
{
shouldInterceptFetchRequest:
(
InAppWebViewController
controller
,
FetchRequest
fetchRequest
)
async
{
...
...
ios/Classes/InAppWebView.swift
View file @
bb0e7f70
...
@@ -311,7 +311,7 @@ let interceptAjaxRequestsJS = """
...
@@ -311,7 +311,7 @@ let interceptAjaxRequestsJS = """
event: {
event: {
type: e.type,
type: e.type,
loaded: e.loaded,
loaded: e.loaded,
lengthComputable: e.lengthComputable
lengthComputable: e.lengthComputable
,
total: e.total
total: e.total
}
}
};
};
...
...
lib/src/content_blocker.dart
View file @
bb0e7f70
///
class
ContentBlocker
{
class
ContentBlocker
{
ContentBlockerTrigger
trigger
;
ContentBlockerTrigger
trigger
;
ContentBlockerAction
action
;
ContentBlockerAction
action
;
...
@@ -23,6 +24,7 @@ class ContentBlocker {
...
@@ -23,6 +24,7 @@ class ContentBlocker {
}
}
}
}
///
class
ContentBlockerTriggerResourceType
{
class
ContentBlockerTriggerResourceType
{
final
String
_value
;
final
String
_value
;
const
ContentBlockerTriggerResourceType
.
_internal
(
this
.
_value
);
const
ContentBlockerTriggerResourceType
.
_internal
(
this
.
_value
);
...
@@ -42,6 +44,7 @@ class ContentBlockerTriggerResourceType {
...
@@ -42,6 +44,7 @@ class ContentBlockerTriggerResourceType {
static
const
RAW
=
const
ContentBlockerTriggerResourceType
.
_internal
(
'raw'
);
static
const
RAW
=
const
ContentBlockerTriggerResourceType
.
_internal
(
'raw'
);
}
}
///
class
ContentBlockerTriggerLoadType
{
class
ContentBlockerTriggerLoadType
{
final
String
_value
;
final
String
_value
;
const
ContentBlockerTriggerLoadType
.
_internal
(
this
.
_value
);
const
ContentBlockerTriggerLoadType
.
_internal
(
this
.
_value
);
...
@@ -54,6 +57,7 @@ class ContentBlockerTriggerLoadType {
...
@@ -54,6 +57,7 @@ class ContentBlockerTriggerLoadType {
static
const
THIRD_PARTY
=
const
ContentBlockerTriggerLoadType
.
_internal
(
'third-party'
);
static
const
THIRD_PARTY
=
const
ContentBlockerTriggerLoadType
.
_internal
(
'third-party'
);
}
}
///
class
ContentBlockerTrigger
{
class
ContentBlockerTrigger
{
String
urlFilter
;
String
urlFilter
;
bool
urlFilterIsCaseSensitive
;
bool
urlFilterIsCaseSensitive
;
...
@@ -136,6 +140,7 @@ class ContentBlockerTrigger {
...
@@ -136,6 +140,7 @@ class ContentBlockerTrigger {
}
}
}
}
///
class
ContentBlockerActionType
{
class
ContentBlockerActionType
{
final
String
_value
;
final
String
_value
;
const
ContentBlockerActionType
.
_internal
(
this
.
_value
);
const
ContentBlockerActionType
.
_internal
(
this
.
_value
);
...
@@ -149,6 +154,7 @@ class ContentBlockerActionType {
...
@@ -149,6 +154,7 @@ class ContentBlockerActionType {
static
const
MAKE_HTTPS
=
const
ContentBlockerActionType
.
_internal
(
'make-https'
);
static
const
MAKE_HTTPS
=
const
ContentBlockerActionType
.
_internal
(
'make-https'
);
}
}
///
class
ContentBlockerAction
{
class
ContentBlockerAction
{
ContentBlockerActionType
type
;
ContentBlockerActionType
type
;
String
selector
;
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