Skip to content
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

Gallery of images #277

Merged
merged 35 commits into from
Mar 15, 2019
Merged

Gallery of images #277

merged 35 commits into from
Mar 15, 2019

Conversation

pablocarmu
Copy link
Contributor

@pablocarmu pablocarmu commented Feb 19, 2019

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

BUGS & IMPROVEMENTS

super.init(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)

query.addObserver(self, forKeyPath: "hasChangesAvailable", options: [.initial, .new], context: nil)
query.addFilter(itemsFilter, withIdentifier: "items-filter")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see looking through the changes on GitHub, you're reusing the OCQuery instance from the ClientQueryViewController instead of creating a new OCQuery, so that adding a filter to only show files would also alter what can be seen in the ClientQueryViewController.

An alternative would be to perform that filtering in observeValue(forKeyPath:…) in the completionHandler of the query.requestChangeSet call.

Also, regarding working KVO: you may need to first merge in the latest changes from ios-app/master to get the latest SDK version which should properly report changes via the hasChangesAvailable property (IIRC all but the latest had cases where it did not).

@pablocarmu pablocarmu force-pushed the feature/gallery_of_images branch from 9239b9d to e846be3 Compare February 28, 2019 09:37
@pablocarmu pablocarmu requested a review from jesmrec February 28, 2019 09:43
@pablocarmu pablocarmu assigned mneuwert and hosy and unassigned mneuwert and hosy Feb 28, 2019
@pablocarmu pablocarmu requested review from mneuwert and hosy February 28, 2019 09:44
@jesmrec jesmrec added this to the 1.1.0 milestone Feb 28, 2019
@hosy
Copy link
Collaborator

hosy commented Feb 28, 2019

Thank you @pablocarmu for your implementation. Please can you check if the UIViewController has a missing background color? You can see this, if the picture is not downloaded and no network is available:

simulator screen shot - iphone xr - 2019-02-28 at 11 21 56

if let item = item, item.localID == self?.lastTappedItemLocalID, let core = core {
let itemViewController = DisplayHostViewController(for: item, with: core, root: query.rootItem!)
self?.navigationController?.pushViewController(itemViewController, animated: true)
if let item = item, item.localID == self.lastTappedItemLocalID, let core = core {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablocarmu I would probably not mix if let constructs and regular if conditions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll split them into 2 if-else


private let reuseIdentifier = "Cell"

class AlternativeCollectionCollectionViewController: UICollectionViewController {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablocarmu CollectionCollection?

if let parent = parent, let itemName = item.name {
parent.navigationItem.title = itemName
func updateNavigationBarItems() {
if let parent = parent, let item = item, let itemName = item.name {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablocarmu you don't use item but just itemName? Or am I overlooking it?

if let item = dataSource?.itemFor(viewController: self) {
self.item = item
} else {
if let nonSupportedView = dataSource?.nonSupportedItemView() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablocarmu better notSupported?


// MARK: - ViewController lifecycle
override func viewDidLoad() {
super.viewDidLoad()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong code indention for the last two lines

}
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wrong indention

@@ -130,6 +132,10 @@ extension WebViewDisplayViewController: DisplayExtension {

extension WebViewDisplayViewController: UIGestureRecognizerDelegate {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong indention

@michaelstingl
Copy link
Contributor

If I zoom in, then swipe to the next image, then swipe back to the previous one, the previous one is still zoomed in. Bug or feature?

iOS Photos:

  • Zoom gets reset

iOS Files:

  • can’t swipe to next when zoomed in (why?)

@hosy
Copy link
Collaborator

hosy commented Mar 3, 2019

I also think zoom should be reset.

@pablocarmu
Copy link
Contributor Author

Did you profile using Instruments? What takes that much time? Loading or may be decoding of the images?

I didn't make any profile because I've never noticed this smooth-problem, but I'll check it with instruments

@mneuwert
Copy link
Contributor

mneuwert commented Mar 7, 2019

Did you profile using Instruments? What takes that much time? Loading or may be decoding of the images?

I didn't make any profile because I've never noticed this smooth-problem, but I'll check it with instruments

You can also check out https://developer.apple.com/videos/play/wwdc2018/219/
They talk about many useful techniques like downsampling, also you shall keep an eye on memory use.

hosy and others added 2 commits March 7, 2019 12:48
- Use downsample technique in background to save memory and CPU cycles.
- Improve the performance of the gallery.
@pablocarmu
Copy link
Contributor Author

@mneuwert I've used the downsample technique of the talk and I think the performance improvement is great.
Also, I've done it inside a background queue and now the app is not stuck anymore.

@mneuwert
Copy link
Contributor

mneuwert commented Mar 7, 2019

@mneuwert I've used the downsample technique of the talk and I think the performance improvement is great.
Also, I've done it inside a background queue and now the app is not stuck anymore.

@pablocarmu Sounds good! I checked the implementation, and there is one more thing actually. When you zoom in, you will see downsampled and potentially pixelated version of the image, although the source image with higher resolution is available. So may be zooming can be done in more sophisticated way using dynamic downsampling based on the current zoom level, may be combined with tiling techniques in order to avoid memory usage going high. But it is also a question to @michaelstingl if we shall spend that effort or if we treat it as a separate feature.

@michaelstingl
Copy link
Contributor

Can be improved in a separate PR… (I hope “Open in” sends the original file, not the downsampled one)

hosy added 2 commits March 8, 2019 11:32
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@codecov
Copy link

codecov bot commented Mar 8, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@4053c53). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #277   +/-   ##
=========================================
  Coverage          ?   29.48%           
=========================================
  Files             ?      229           
  Lines             ?    15477           
  Branches          ?        0           
=========================================
  Hits              ?     4564           
  Misses            ?    10913           
  Partials          ?        0
Impacted Files Coverage Δ
ownCloud/Viewer/WebViewDisplayViewController.swift 17.54% <0%> (ø)
ownCloud/UIKit Extensions/String+Extension.swift 22.22% <0%> (ø)
ownCloud/Viewer/DisplayViewController.swift 0% <0%> (ø)
ownCloud/Gallery/GalleryHostViewController.swift 0% <0%> (ø)
ownCloud/Client/ClientQueryViewController.swift 34.1% <0%> (ø)
ownCloud/Viewer/ImageDisplayViewController.swift 8.54% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4053c53...1a6be86. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 8, 2019

Codecov Report

Merging #277 into master will decrease coverage by 0.34%.
The diff coverage is 3.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
- Coverage   29.86%   29.52%   -0.35%     
==========================================
  Files         228      229       +1     
  Lines       15284    15484     +200     
==========================================
+ Hits         4564     4571       +7     
- Misses      10720    10913     +193
Impacted Files Coverage Δ
ownCloud/Viewer/WebViewDisplayViewController.swift 17.54% <0%> (-1.69%) ⬇️
ownCloud/UIKit Extensions/String+Extension.swift 22.22% <0%> (-17.78%) ⬇️
ownCloud/Viewer/DisplayViewController.swift 0% <0%> (ø) ⬆️
ownCloud/Gallery/GalleryHostViewController.swift 0% <0%> (ø)
ownCloud/UI Elements/ImageScrollView.swift 0% <0%> (ø) ⬆️
ownCloud/Client/ClientQueryViewController.swift 34.1% <0%> (-0.2%) ⬇️
ownCloud/Viewer/ImageDisplayViewController.swift 8.54% <0%> (-4.97%) ⬇️
ownCloud/Client/ClientRootViewController.swift 79.29% <100%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 549dcd3...504ab3d. Read the comment docs.

@jesmrec
Copy link
Contributor

jesmrec commented Mar 15, 2019

(1) -> Fixed
(2) -> Fixed
(3) -> will open an issue to improve.

Also, an issue to improve the GIF preview will be opened.

From my side it is OK

@jesmrec jesmrec added the Approved by QA Approved by QA label Mar 15, 2019
@jesmrec jesmrec merged commit 868097f into master Mar 15, 2019
@delete-merged-branch delete-merged-branch bot deleted the feature/gallery_of_images branch March 15, 2019 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved by QA Approved by QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants