-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/thumbnails #32
Conversation
- Update ios-sdk - Thumbnail requests are now cancelled if a cell has been moved out of view and may no longer be needed
a7e0ded
to
767f99f
Compare
ownCloud/Client/ClientItemCell.swift
Outdated
let displayThumbnail = { (thumbnail: OCItemThumbnail?) in | ||
thumbnail?.requestImage(for: thumbnailSize, scale: 0, withCompletionHandler: { (thumbnail, error, _, image) in | ||
if error == nil { | ||
DispatchQueue.main.async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you update this branch with what the current master branch has (via rebase) you could get the onMainThread
function and wrap the call into:
OnMainThread {
self.iconView.image = image
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Thanks.
ownCloud/Client/ClientItemCell.swift
Outdated
if error == nil { | ||
DispatchQueue.main.async { | ||
if image != nil { | ||
if self.item?.versionIdentifier == thumbnail?.versionIdentifier { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in Swift you can chain multiple if statements with a ,
. Don't know which option is more clear to you if the one with three if statements or chain them like:
if error == nil, image != nil, self.item?.versionIdentifier == thumbnail?.versionIdentifier {
OnMainThread {
self.iconView.image = image
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I made that change.
ownCloud/Client/ClientItemCell.swift
Outdated
} | ||
|
||
if let thumbnail = item.thumbnail { | ||
_ = displayThumbnail(thumbnail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the displayThumbnail closure is taking the unused thumbnail?.requestImage(...)
Bool return as it's own return parameter and this is why it's saying to you Result of call is unused, but produces 'Bool?'
when you later call displayThumbnail(thumbnail)
if you don't assign it's return value to some variable ( in this case to a _
)
You can get rid of this _
assignment if you code it here:
_ = thumbnail?.requestImage(for: thumbnailSize, scale: 0, withCompletionHandler: { (thumbnail, error, _, image)
then you can call the displayThumbnail(thumbnail)
without any assignment:
displayThumbnail(thumbnail)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Made that change as well.
Formats that thumbnails are not displayed: TIFF, SVG. |
… item variable was updated
The latest commit fixes the issues (1) and (2). Regarding TIFF and SVG: right now, the app should request thumbnails for all items. Chances are the server you're testing against doesn't provide thumbnails for this format. |
All stuff fixed. Approved. |
Add thumbnail support:
BUGS & IMPROVEMENTS