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
31265532
Commit
31265532
authored
Dec 12, 2018
by
Ryan
Committed by
GitHub
Dec 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update InAppBrowserWebViewController.swift
parent
8b5a6347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
ios/Classes/InAppBrowserWebViewController.swift
ios/Classes/InAppBrowserWebViewController.swift
+9
-9
No files found.
ios/Classes/InAppBrowserWebViewController.swift
View file @
31265532
...
...
@@ -64,10 +64,10 @@ window.\(JAVASCRIPT_BRIDGE_NAME).callHandler = function(handlerName, ...args) {
}
"""
func
currentTimeInMilliSeconds
()
->
Int
{
func
currentTimeInMilliSeconds
()
->
Int
64
{
let
currentDate
=
Date
()
let
since1970
=
currentDate
.
timeIntervalSince1970
return
Int
(
since1970
*
1000
)
return
Int
64
(
since1970
*
1000
)
}
func
convertToDictionary
(
text
:
String
)
->
[
String
:
Any
]?
{
...
...
@@ -168,7 +168,7 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU
var
isHidden
=
false
var
uuid
:
String
=
""
var
WKNavigationMap
:
[
String
:
[
String
:
Any
]]
=
[:]
var
startPageTime
=
0
var
startPageTime
:
Int64
=
0
var
viewPrepared
=
false
required
init
(
coder
aDecoder
:
NSCoder
)
{
...
...
@@ -609,9 +609,9 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU
if
(
webViewOptions
?
.
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
;
self
.
didReceiveResourceResponse
(
navigationResponse
.
response
,
fromRequest
:
WKNavigationMap
[
url
.
absoluteString
]
!
[
"request"
]
as?
URLRequest
,
withData
:
Data
(),
startTime
:
startTime
,
duration
:
duration
)
}
}
...
...
@@ -701,7 +701,7 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU
}
}
func
didReceiveResourceResponse
(
_
response
:
URLResponse
,
fromRequest
request
:
URLRequest
?,
withData
data
:
Data
,
startTime
:
Int
,
duration
:
Int
)
{
func
didReceiveResourceResponse
(
_
response
:
URLResponse
,
fromRequest
request
:
URLRequest
?,
withData
data
:
Data
,
startTime
:
Int
64
,
duration
:
Int64
)
{
if
navigationDelegate
!=
nil
{
navigationDelegate
?
.
onLoadResource
(
uuid
:
self
.
uuid
,
webView
:
webView
,
response
:
response
,
fromRequest
:
request
,
withData
:
data
,
startTime
:
startTime
,
duration
:
duration
)
}
...
...
@@ -750,8 +750,8 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU
if
!
UIApplication
.
shared
.
canOpenURL
(
url
)
{
return
}
let
startTime
=
Int
(
resource
[
"startTime"
]
as!
Double
)
let
duration
=
Int
(
resource
[
"duration"
]
as!
Double
)
let
startTime
=
Int
64
(
resource
[
"startTime"
]
as!
Double
)
let
duration
=
Int
64
(
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