Merge pull request #5071 from stuartbreckenridge/main

Fix UI issues
This commit is contained in:
Brent Simmons authored and GitHub committed 2026-02-02 08:42:21 -08:00
commit b2ffc66201
5 files changed
+40 -33

No files matched your search

+1 -1
View File
@@ -126,7 +126,7 @@
<size key="itemSize" width="402" height="128"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="8" minY="0.0" maxX="8" maxY="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="MainTimelineCellIndexZero" id="mnV-bT-V2W" customClass="MainTimelineCollectionViewCell" customModule="NetNewsWire" customModuleProvider="target">
@@ -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
// <https://github.com/Ranchero-Software/NetNewsWire/issues/5043>
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() {
@@ -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 {
@@ -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)
+5 -5
View File
@@ -649,7 +649,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="20" minimumInteritemSpacing="10" id="JcL-Zm-mbs">
<collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="20" minimumInteritemSpacing="10" sectionInsetReference="safeArea" id="JcL-Zm-mbs">
<size key="itemSize" width="414" height="128"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
@@ -983,16 +983,16 @@
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="secondaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="secondarySystemBackgroundColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="secondarySystemFillColor">
<color red="0.47058823529411764" green="0.47058823529411764" blue="0.50196078431372548" alpha="0.16" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.47058823529999999" green="0.47058823529999999" blue="0.50196078430000002" alpha="0.16" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="separatorColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>