mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Continue progress on modern look.
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -26,7 +24,7 @@
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7mJ-VZ-zqU">
|
||||
<rect key="frame" x="214" y="34" width="33" height="22"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
@@ -53,9 +51,4 @@
|
||||
<point key="canvasLocation" x="-75" y="-117"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<systemColor name="secondaryLabelColor">
|
||||
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -10,8 +10,15 @@ import Foundation
|
||||
import UIKit
|
||||
import Account
|
||||
|
||||
protocol SidebarViewControllerDelegate: AnyObject {
|
||||
|
||||
func sidebarViewController(_: SidebarViewController, didSelect: [any Item])
|
||||
}
|
||||
|
||||
final class SidebarViewController: UICollectionViewController {
|
||||
|
||||
weak var delegate: SidebarViewControllerDelegate?
|
||||
|
||||
private let tree = SidebarTree()
|
||||
|
||||
typealias DataSource = UICollectionViewDiffableDataSource<SectionID, ItemID>
|
||||
@@ -63,20 +70,7 @@ final class SidebarViewController: UICollectionViewController {
|
||||
|
||||
title = "Feeds"
|
||||
navigationController?.navigationBar.prefersLargeTitles = true
|
||||
|
||||
let appearance = UINavigationBarAppearance()
|
||||
appearance.configureWithOpaqueBackground() // Ensures solid background
|
||||
appearance.backgroundColor = AppColor.navigationBarBackground // Set your desired color
|
||||
appearance.titleTextAttributes = [.foregroundColor: UIColor.white] // Regular title text
|
||||
appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white] // Large title text
|
||||
appearance.shadowColor = .clear
|
||||
|
||||
// Apply the appearance settings
|
||||
navigationController?.navigationBar.standardAppearance = appearance
|
||||
navigationController?.navigationBar.scrollEdgeAppearance = appearance
|
||||
navigationController?.navigationBar.compactAppearance = appearance // Optional
|
||||
navigationController?.navigationBar.compactScrollEdgeAppearance = appearance
|
||||
|
||||
navigationController?.navigationBar.tintColor = .white
|
||||
navigationController?.navigationBar.isTranslucent = false
|
||||
|
||||
if let subviews = navigationController?.navigationBar.subviews {
|
||||
@@ -88,8 +82,10 @@ final class SidebarViewController: UICollectionViewController {
|
||||
}
|
||||
|
||||
navigationItem.rightBarButtonItem = filterButton
|
||||
|
||||
navigationItem.largeTitleDisplayMode = .always
|
||||
|
||||
toolbar.barTintColor = AppColor.toolbarBackground
|
||||
toolbar.tintColor = .white
|
||||
toolbar.isTranslucent = false
|
||||
toolbar.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
@@ -124,24 +120,37 @@ final class SidebarViewController: UICollectionViewController {
|
||||
collectionView.verticalScrollIndicatorInsets.bottom = toolbarHeight
|
||||
}
|
||||
|
||||
func updateVisibleRows() {
|
||||
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
|
||||
var itemIDsToReload = [ItemID]()
|
||||
|
||||
for indexPath in collectionView.indexPathsForVisibleItems {
|
||||
if let itemID = dataSource.itemIdentifier(for: indexPath) {
|
||||
itemIDsToReload.append(itemID)
|
||||
}
|
||||
guard let itemID = dataSource.itemIdentifier(for: indexPath) else {
|
||||
assertionFailure("Expected itemID for indexPath \(indexPath).")
|
||||
return
|
||||
}
|
||||
guard let item = tree.item(with: itemID) else {
|
||||
assertionFailure("Expected item for itemID \(itemID).")
|
||||
return
|
||||
}
|
||||
|
||||
if !itemIDsToReload.isEmpty {
|
||||
var snapshot = dataSource.snapshot()
|
||||
snapshot.reloadItems(itemIDsToReload)
|
||||
dataSource.apply(snapshot, animatingDifferences: false)
|
||||
}
|
||||
delegate?.sidebarViewController(self, didSelect: [item])
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
// TODO: Implement actions
|
||||
|
||||
extension SidebarViewController {
|
||||
|
||||
@objc func toggleFilter(_ sender: Any) {
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
@objc func showSettings(_ sender: Any?) {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
private extension SidebarViewController {
|
||||
|
||||
@objc func faviconDidBecomeAvailable(_ note: Notification) {
|
||||
updateVisibleRows()
|
||||
@@ -160,18 +169,7 @@ final class SidebarViewController: UICollectionViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
// TODO: Implement actions
|
||||
|
||||
extension SidebarViewController {
|
||||
|
||||
@objc func toggleFilter(_ sender: Any) {
|
||||
}
|
||||
|
||||
@objc func showSettings(_ sender: Any?) {
|
||||
}
|
||||
}
|
||||
// MARK: - Private
|
||||
|
||||
private extension SidebarViewController {
|
||||
|
||||
@@ -252,4 +250,21 @@ private extension SidebarViewController {
|
||||
|
||||
dataSource.apply(snapshot, animatingDifferences: true)
|
||||
}
|
||||
|
||||
func updateVisibleRows() {
|
||||
|
||||
var itemIDsToReload = [ItemID]()
|
||||
|
||||
for indexPath in collectionView.indexPathsForVisibleItems {
|
||||
if let itemID = dataSource.itemIdentifier(for: indexPath) {
|
||||
itemIDsToReload.append(itemID)
|
||||
}
|
||||
}
|
||||
|
||||
if !itemIDsToReload.isEmpty {
|
||||
var snapshot = dataSource.snapshot()
|
||||
snapshot.reloadItems(itemIDsToReload)
|
||||
dataSource.apply(snapshot, animatingDifferences: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user