diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index 95c907694..8990d9964 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -126,7 +126,7 @@ - + diff --git a/iOS/MainFeed/MainFeedCollectionViewController.swift b/iOS/MainFeed/MainFeedCollectionViewController.swift index 807f35051..4ac1f0638 100644 --- a/iOS/MainFeed/MainFeedCollectionViewController.swift +++ b/iOS/MainFeed/MainFeedCollectionViewController.swift @@ -71,6 +71,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab } override func viewWillAppear(_ animated: Bool) { + Self.logger.debug("MainFeedCollectionViewController: viewWillAppear") navigationController?.isToolbarHidden = false updateUI() super.viewWillAppear(animated) @@ -97,12 +98,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - Self.logger.debug("MainFeedCollectionViewController: viewDidAppear") - /// On iPhone, once the deselection animation has completed, set `isAnimating` - /// to false and this will allow selection. - DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { - self.deselectIfNeccessary() - } + self.deselectIfNeccessary() } func deselectIfNeccessary() { @@ -111,20 +107,29 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab } defer { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { - self.isAnimating = false - } + self.isAnimating = false } - // Pro Max may have split view in landscape — make sure it's collapsed. + // Pro Max may have split view in landscape — give the device some + // time to change its size class and then decide to deselect // - guard coordinator.isRootSplitCollapsed else { - return - } - - if collectionView.indexPathsForSelectedItems != nil { - coordinator.selectSidebarItem(indexPath: nil, animations: [.select]) - } + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: { + // If the iPhone is in portrait, deselect. + if UIDevice.current.orientation.isPortrait { + if self.collectionView.indexPathsForSelectedItems != nil { + self.coordinator.selectSidebarItem(indexPath: nil, animations: [.select]) + } + return + } + + // If the iPhone is in landscape, and the horizontal + // size class is compact, deselect. + if self.view.window!.traitCollection.horizontalSizeClass == .compact { + if self.collectionView.indexPathsForSelectedItems != nil { self.coordinator.selectSidebarItem(indexPath: nil, animations: [.select]) + } + return + } + }) } func registerForNotifications() { diff --git a/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift b/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift index e56c75ba5..afdd3a731 100644 --- a/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift +++ b/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift @@ -309,7 +309,11 @@ class MainTimelineCollectionViewCell: UICollectionViewCell { if UIDevice.current.userInterfaceIdiom == .pad { backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -8, bottom: 0, trailing: -8) } else { - backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -12, bottom: 0, trailing: -12) + if !isPreview { + backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -12, bottom: 0, trailing: -12) + } else { + backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: -16, bottom: 0, trailing: -16) + } } if state.isSwiped && state.isSelected { diff --git a/iOS/MainTimeline/MainTimelineModernViewController.swift b/iOS/MainTimeline/MainTimelineModernViewController.swift index dd3fc53db..33174ba6d 100644 --- a/iOS/MainTimeline/MainTimelineModernViewController.swift +++ b/iOS/MainTimeline/MainTimelineModernViewController.swift @@ -221,9 +221,7 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR // Deselect only when returning from article navigation if coordinator?.isRootSplitCollapsed ?? true, didPushArticleViewController { didPushArticleViewController = false - DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { - self.deselectIfNecessary() - } + self.deselectIfNecessary() } } @@ -555,12 +553,12 @@ extension MainTimelineModernViewController: UICollectionViewDelegate { let previewView = cell.contentView var bounds = previewView.bounds let parameters = UIPreviewParameters() - parameters.backgroundColor = .tertiarySystemBackground + parameters.backgroundColor = cell.isSelected ? cell.backgroundConfiguration?.backgroundColor : .tertiarySystemBackground if let insets = cell.backgroundConfiguration?.backgroundInsets { bounds = bounds.inset(by: UIEdgeInsets(top: insets.top, - left: -insets.leading, + left: -insets.leading - 4, bottom: insets.bottom, - right: -insets.trailing)) + right: -insets.trailing - 4)) } parameters.visiblePath = UIBezierPath(roundedRect: bounds, cornerRadius: 20) @@ -576,12 +574,12 @@ extension MainTimelineModernViewController: UICollectionViewDelegate { let previewView = cell.contentView var bounds = previewView.bounds let parameters = UIPreviewParameters() - parameters.backgroundColor = .tertiarySystemBackground + parameters.backgroundColor = cell.isSelected ? cell.backgroundConfiguration?.backgroundColor : .tertiarySystemBackground if let insets = cell.backgroundConfiguration?.backgroundInsets { bounds = bounds.inset(by: UIEdgeInsets(top: insets.top, - left: -insets.leading, + left: -insets.leading - 4, bottom: insets.bottom, - right: -insets.trailing)) + right: -insets.trailing - 4)) } parameters.visiblePath = UIBezierPath(roundedRect: bounds, cornerRadius: 20) diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index ee71fff49..44981aa72 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -649,7 +649,7 @@ - + @@ -983,16 +983,16 @@ - + - + - + - +