Skip to content

Commit

Permalink
layout fix
Browse files Browse the repository at this point in the history
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
  • Loading branch information
marinofaggiana committed Sep 30, 2024
1 parent 7911e06 commit 5798532
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
16 changes: 8 additions & 8 deletions iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
collectionView?.collectionViewLayout = mediaLayout
self.layoutType = global.layoutPhotoSquare
}

DispatchQueue.main.async {
self.collectionView?.collectionViewLayout.invalidateLayout()
}
}

override func viewDidAppear(_ animated: Bool) {
Expand Down Expand Up @@ -311,10 +307,14 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)

coordinator.animate(alongsideTransition: nil) { _ in
self.collectionView?.collectionViewLayout.invalidateLayout()
self.dismissTip()
}
coordinator.animate(alongsideTransition: { _ in
let animator = UIViewPropertyAnimator(duration: 0.3, curve: .easeInOut) {
self.collectionView?.collectionViewLayout.invalidateLayout()
}
animator.startAnimation()
})

self.dismissTip()
}

override var canBecomeFirstResponder: Bool {
Expand Down
5 changes: 0 additions & 5 deletions iOSClient/Media/NCMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ class NCMedia: UIViewController {
networkRemoveAll()
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
coordinator.animate(alongsideTransition: nil) { _ in }
}

override var preferredStatusBarStyle: UIStatusBarStyle {
if self.traitCollection.userInterfaceStyle == .dark {
return .lightContent
Expand Down
9 changes: 6 additions & 3 deletions iOSClient/Select/NCSelect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,12 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)

coordinator.animate(alongsideTransition: nil) { _ in
self.collectionView?.collectionViewLayout.invalidateLayout()
}
coordinator.animate(alongsideTransition: { _ in
let animator = UIViewPropertyAnimator(duration: 0.3, curve: .easeInOut) {
self.collectionView?.collectionViewLayout.invalidateLayout()
}
animator.startAnimation()
})
}

func presentationControllerDidDismiss( _ presentationController: UIPresentationController) {
Expand Down
8 changes: 0 additions & 8 deletions iOSClient/Trash/NCTrash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCTrashGridCellDelegat
dataSourceTask?.cancel()
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)

coordinator.animate(alongsideTransition: nil) { _ in
self.collectionView?.collectionViewLayout.invalidateLayout()
}
}

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()

Expand Down

0 comments on commit 5798532

Please sign in to comment.