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
54faefe2
Commit
54faefe2
authored
Dec 12, 2018
by
Ryan
Committed by
GitHub
Dec 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update InAppWebView.swift
parent
31265532
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
ios/Classes/InAppWebView.swift
ios/Classes/InAppWebView.swift
+7
-7
No files found.
ios/Classes/InAppWebView.swift
View file @
54faefe2
...
...
@@ -15,7 +15,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
var
options
:
InAppWebViewOptions
?
var
currentURL
:
URL
?
var
WKNavigationMap
:
[
String
:
[
String
:
Any
]]
=
[:]
var
startPageTime
=
0
var
startPageTime
:
Int64
=
0
init
(
frame
:
CGRect
,
configuration
:
WKWebViewConfiguration
,
IABController
:
InAppBrowserWebViewController
?,
IAWController
:
FlutterWebViewController
?)
{
super
.
init
(
frame
:
frame
,
configuration
:
configuration
)
...
...
@@ -449,9 +449,9 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
if
(
options
?
.
useOnLoadResource
)
!
{
if
let
url
=
navigationResponse
.
response
.
url
{
if
WKNavigationMap
[
url
.
absoluteString
]
!=
nil
{
let
startResourceTime
=
(
WKNavigationMap
[
url
.
absoluteString
]
!
[
"startTime"
]
as!
Int
)
let
startTime
=
startResourceTime
-
startPageTime
;
let
duration
=
currentTimeInMilliSeconds
()
-
startResourceTime
;
let
startResourceTime
:
Int64
=
(
WKNavigationMap
[
url
.
absoluteString
]
!
[
"startTime"
]
as!
Int64
)
let
startTime
:
Int64
=
startResourceTime
-
startPageTime
;
let
duration
:
Int64
=
currentTimeInMilliSeconds
()
-
startResourceTime
;
onLoadResource
(
response
:
navigationResponse
.
response
,
fromRequest
:
WKNavigationMap
[
url
.
absoluteString
]
!
[
"request"
]
as?
URLRequest
,
withData
:
Data
(),
startTime
:
startTime
,
duration
:
duration
)
}
}
...
...
@@ -520,7 +520,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
getChannel
()
.
invokeMethod
(
"onProgressChanged"
,
arguments
:
arguments
)
}
public
func
onLoadResource
(
response
:
URLResponse
,
fromRequest
request
:
URLRequest
?,
withData
data
:
Data
,
startTime
:
Int
,
duration
:
Int
)
{
public
func
onLoadResource
(
response
:
URLResponse
,
fromRequest
request
:
URLRequest
?,
withData
data
:
Data
,
startTime
:
Int
64
,
duration
:
Int64
)
{
var
headersResponse
=
(
response
as!
HTTPURLResponse
)
.
allHeaderFields
as!
[
String
:
String
]
headersResponse
.
lowercaseKeys
()
...
...
@@ -613,8 +613,8 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
if
!
UIApplication
.
shared
.
canOpenURL
(
url
)
{
return
}
let
startTime
=
Int
(
resource
[
"startTime"
]
as!
Double
)
let
duration
=
Int
(
resource
[
"duration"
]
as!
Double
)
let
startTime
:
Int64
=
Int64
(
resource
[
"startTime"
]
as!
Double
)
let
duration
:
Int64
=
Int64
(
resource
[
"duration"
]
as!
Double
)
var
urlRequest
=
URLRequest
(
url
:
url
)
urlRequest
.
allHTTPHeaderFields
=
[:]
let
config
=
URLSessionConfiguration
.
default
...
...
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