Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangyongji
/
MRFramework
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9b9cff45
authored
Oct 09, 2019
by
Sarkizz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正超时逻辑问题
parent
e39a6907
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
MRFramework/MRFramework/UIControls/Album/MRAlbumDetailViewController.swift
+13
-7
No files found.
MRFramework/MRFramework/UIControls/Album/MRAlbumDetailViewController.swift
View file @
9b9cff45
...
...
@@ -26,7 +26,7 @@ open class MRAlbumDetailViewController: UIViewController {
public
static
var
checkedOptions
:
MRCheckBoxOptions
=
.
defaultCheck
(
checkboxSize
)
public
var
confirm
:
((
_
vc
:
MRAlbumDetailViewController
,
_
isSelected
:
Bool
)
->
Void
)?
public
var
requestTimeout
:
TimeInterval
=
20
public
var
requestTimeout
=
20
public
var
assest
:
PHAsset
!
public
var
isSelected
=
false
...
...
@@ -117,15 +117,21 @@ extension MRAlbumDetailViewController {
self
.
requestID
=
self
.
imageCache
.
requestImage
(
for
:
self
.
assest
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
options
,
resultHandler
:
{
(
image
,
_
)
in
DispatchQueue
.
main
.
async
{
ToastView
.
hide
()
self
.
requestID
=
nil
completion
(
image
,
nil
)
}
})
weak
var
weakSelf
=
self
self
.
countdownor
=
self
.
requestTimeout
.
countdown
({
(
_
,
_
,
_
,
sec
)
in
if
sec
<=
0
,
let
`
self
`
=
weakSelf
,
let
id
=
self
.
requestID
{
self
.
imageCache
.
cancelImageRequest
(
id
)
}
})
}
startTimeoutCheck
()
}
private
func
startTimeoutCheck
()
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
DispatchTime
.
now
()
+
DispatchTimeInterval
.
seconds
(
self
.
requestTimeout
))
{
if
let
id
=
self
.
requestID
{
self
.
imageCache
.
cancelImageRequest
(
id
)
self
.
requestID
=
nil
ToastView
.
hide
()
}
}
}
...
...
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