Merge branch 'timeline-as-collection-view' of https://github.com/stuartbreckenridge/NetNewsWire into timeline-as-collection-view

This commit is contained in:
Stuart Breckenridge committed 2026-01-25 17:29:42 +08:00
commit e4576d5b9b
13 files changed
+225 -232

No files matched your search

+2 -1
View File
@@ -69,7 +69,8 @@
"Bash(done)",
"Bash(# Show files touched by state restoration related commits echo \"\"=== Files changed in state restoration commits ===\"\" for commit in 04e98a47d 89b31858c d788af388 1d49b9328 236943f82 38d6b11c5 3be027699 16c66513c 1ef2aa162 6ce3bdadc 1954f5b65 55b7da75d 20b3bda94 4bf57afc1 e0074d70b 616b9deeb f6bca9ee8 ea6eedb86 380617920 d68106ac0 d30c62757 813f0706b 2ea00619c; do git diff-tree --no-commit-id --name-only -r \"\"$commit\"\" done)",
"Bash(swiftlint version:*)",
"Bash(swiftlint:*)"
"Bash(swiftlint:*)",
"Skill(axiom:axiom-liquid-glass)"
],
"deny": [],
"ask": []
+9 -40
View File
@@ -7,58 +7,27 @@
<language>en</language>
<item>
<title>NetNewsWire 7.0b4</title>
<title>NetNewsWire 7.0b6</title>
<description><![CDATA[
<ul>
<li>Fixed Feedly syncing — it’s working again
<li>Made the article view content blur when underneath the toolbar
</ul>
]]></description>
<pubDate>Wed, 14 Jan 2026 20:45:00 -0800</pubDate>
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.0b4/NetNewsWire7.0b4.zip" sparkle:version="7004" sparkle:shortVersionString="7.0b4" length="10349072" type="application/zip" />
<pubDate>Sat, 24 Jan 2026 10:35:00 -0800</pubDate>
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.0b6/NetNewsWire7.0b6.zip" sparkle:version="7013" sparkle:shortVersionString="7.0b6" length="10356640" type="application/zip" />
<sparkle:minimumSystemVersion>26.0</sparkle:minimumSystemVersion>
</item>
<item>
<title>NetNewsWire 7.0b3</title>
<title>NetNewsWire 7.0b5</title>
<description><![CDATA[
<ul>
<li>Fixed bug with persisting the theme selection
<li>Fixed crash adding a Feedly account
<li>Fixed (we think) a crash that could happen during iCloud syncing
<li>Decreased the minimum size of the sidebar
<li>Fixed two causes of a bug where small images would sometimes display as much larger than they should be
</ul>
]]></description>
<pubDate>Sat, 10 Jan 2026 10:30:00 -0800</pubDate>
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.0b3/NetNewsWire7.1b3.zip" sparkle:version="7003" sparkle:shortVersionString="7.0b3" length="10320310" type="application/zip" />
<sparkle:minimumSystemVersion>26.0</sparkle:minimumSystemVersion>
</item>
<item>
<title>NetNewsWire 7.0b2</title>
<description><![CDATA[
<ul>
<li>Fixed crash when downloading a theme</li>
<li>Fixed hiding read articles (the toggle wasn’t toggling, now it is)</li>
</ul>
]]></description>
<pubDate>Fri, 09 Jan 2026 08:55:00 -0800</pubDate>
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.0b2/NetNewsWire7.0b2.zip" sparkle:version="7001" sparkle:shortVersionString="7.0b2" length="10322480" type="application/zip" />
<sparkle:minimumSystemVersion>26.0</sparkle:minimumSystemVersion>
</item>
<item>
<title>NetNewsWire 7.0b1</title>
<description><![CDATA[
<p>Besides the changes listed, there are <i>many</i> under-the-hood changes affecting all parts of the app. Bugs could appear anywhere! Please report anything you find to our bug tracker or to the Beta Testing topic in the Discourse forum.</p>
<ul>
<li>Adopted Liquid Glass UI</li>
<li>Adopted Swift 6 structured concurrency</li>
<li>Improved window state restoration when sidebar is collapsed</li>
<li>Added custom About window</li>
<li>Changed link in the Help from Slack to Discourse</li>
</ul>
]]></description>
<pubDate>Thu, 08 Jan 2026 11:00:00 -0800</pubDate>
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.0b1/NetNewsWire7.0b1.zip" sparkle:version="7000" sparkle:shortVersionString="7.0b1" length="10323148" type="application/zip" />
<pubDate>Thu, 22 Jan 2026 15:45:00 -0800</pubDate>
<enclosure url="https://github.com/Ranchero-Software/NetNewsWire/releases/download/mac-7.0b5/NetNewsWire7.0b5.zip" sparkle:version="7011" sparkle:shortVersionString="7.0b5" length="10354304" type="application/zip" />
<sparkle:minimumSystemVersion>26.0</sparkle:minimumSystemVersion>
</item>
+55 -6
View File
@@ -11,11 +11,37 @@ import WebKit
import RSCore
final class DetailWebView: WKWebView {
weak var keyboardDelegate: KeyboardDelegate?
private var isObservingResizeNotifications = false
private static let estimatedToolbarHeight: CGFloat = 52 // Height of macOS 26.2 icon-only toolbar
private var toolbarHeight: CGFloat {
guard let window,
let toolbar = window.toolbar,
toolbar.isVisible,
let contentView = window.contentView else {
return lastToolbarHeight ?? Self.estimatedToolbarHeight
}
let contentLayoutRect = window.contentLayoutRect
let windowHeight = contentView.bounds.height
let height = windowHeight - contentLayoutRect.height
lastToolbarHeight = height
return height
}
private var lastToolbarHeight: CGFloat?
override init(frame: CGRect, configuration: WKWebViewConfiguration) {
super.init(frame: frame, configuration: configuration)
updateObscuredContentInsets()
}
required init?(coder: NSCoder) {
abort()
}
override func accessibilityLabel() -> String? {
return NSLocalizedString("Article", comment: "Article")
NSLocalizedString("Article", comment: "Article")
}
// MARK: - NSResponder
@@ -27,7 +53,26 @@ final class DetailWebView: WKWebView {
super.keyDown(with: event)
}
// MARK: NSView
// MARK: - NSView
override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
updateObscuredContentInsets()
if let window, !isObservingResizeNotifications {
NotificationCenter.default.addObserver(
self,
selector: #selector(windowDidResize(_:)),
name: NSWindow.didResizeNotification,
object: window
)
isObservingResizeNotifications = true
}
}
@objc func windowDidResize(_ notification: Notification) {
updateObscuredContentInsets()
}
override func willOpenMenu(_ menu: NSMenu, with event: NSEvent) {
// There’s no API for affecting a WKWebView’s contextual menu.
@@ -59,18 +104,15 @@ final class DetailWebView: WKWebView {
// MARK: - Private
private extension NSUserInterfaceItemIdentifier {
static let DetailMenuItemIdentifierReload = NSUserInterfaceItemIdentifier(rawValue: "WKMenuItemIdentifierReload")
static let DetailMenuItemIdentifierOpenLink = NSUserInterfaceItemIdentifier(rawValue: "WKMenuItemIdentifierOpenLink")
}
private extension DetailWebView {
static let menuItemIdentifiersToHide: [NSUserInterfaceItemIdentifier] = [.DetailMenuItemIdentifierReload]
static let menuItemIdentifierMatchStrings = ["newwindow", "download"]
func shouldHideMenuItem(_ menuItem: NSMenuItem) -> Bool {
guard let identifier = menuItem.identifier else {
return false
}
@@ -88,4 +130,11 @@ private extension DetailWebView {
return false
}
func updateObscuredContentInsets() {
let updatedObscuredContentInsets = NSEdgeInsets(top: toolbarHeight, left: 0, bottom: 0, right: 0)
if obscuredContentInsets != updatedObscuredContentInsets {
obscuredContentInsets = updatedObscuredContentInsets
}
}
}
@@ -1356,6 +1356,10 @@ public enum FetchType {
}
func noteStatusesForArticlesDidChange(_ articles: Set<Article>) {
guard !articles.isEmpty else {
return
}
let feeds = Set(articles.compactMap { $0.feed })
let statuses = Set(articles.map { $0.status })
let articleIDs = Set(articles.map { $0.articleID })
+3 -1
View File
@@ -25,6 +25,8 @@ Smoke test
On main: update Technotes/Status.md
commit
git push
Tag the app:
git tag mac-6.1.5b4
@@ -48,7 +50,7 @@ Update Appcast on main branch
Update file size - length
Run xmllint on appcast
xmllint --noout netnewswire-beta.xml
xmllint --noout ~/Projects/nnw/main/Appcasts/netnewswire-beta.xml
Upload appcast
Commit and push git change
+5 -1
View File
@@ -1,6 +1,10 @@
# Mac Release Notes
### 7.0b5 build 7011 14 Jan 2026 — branch: main tag: mac-7.0b5
### 7.0b6 build 7013 24 Jan 2026 — branch: main tag: mac-7.0b6
Made the article view content blur when underneath the toolbar. (Technical detail for the curious: WKWebView has a new property `obscuredContentInsets` for this scenario.)
### 7.0b5 build 7011 22 Jan 2026 — branch: main tag: mac-7.0b5
Decreased the minimum size of the sidebar
Fixed two causes of a bug where small images would sometimes display as much larger than they should be
+5
View File
@@ -1,5 +1,10 @@
# iOS Release Notes
### 7.0 TestFlight build 7012 21 Jan 2026 - branch: main tag: iOS-7.0-7012
Fixed a bug that could cause timeline articles to not get updated properly on things like status changes
Fixed a crash that could happen updating timeline articles
### 7.0 TestFlight build 7010 21 Jan 2026 - branch: main tag: iOS-7.0-7010
Fixed two causes of a bug where small images would sometimes display as much larger than they should be
+2 -2
View File
@@ -18,5 +18,5 @@ https://github.com/Ranchero-Software/NetNewsWire/releases/tag/iOS-7.0-7010
Mac shipping: 6.2.1
https://github.com/Ranchero-Software/NetNewsWire/releases/tag/mac-6.2.1
Mac beta: 7.0b5
https://github.com/Ranchero-Software/NetNewsWire/releases/tag/mac-7.0b5
Mac beta: 7.0b6
https://github.com/Ranchero-Software/NetNewsWire/releases/tag/mac-7.0b6
@@ -573,22 +573,22 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
as? MainFeedCollectionHeaderReusableView
}
private func reconfigureVisibleCells() {
private func reloadAllVisibleCells() {
let visibleIndexPaths = collectionView.indexPathsForVisibleItems
let itemIdentifiers = visibleIndexPaths.compactMap { dataSource.itemIdentifier(for: $0) }
reconfigureCells(itemIdentifiers) { [weak self] in
reloadCells(itemIdentifiers) { [weak self] in
self?.restoreSelectionIfNecessary(adjustScroll: false)
}
}
private func reconfigureCells(_ items: [SidebarItemNode], completion: (() -> Void)? = nil) {
private func reloadCells(_ items: [SidebarItemNode], completion: (() -> Void)? = nil) {
guard !items.isEmpty else {
completion?()
return
}
var snapshot = dataSource.snapshot()
snapshot.reconfigureItems(items)
snapshot.reloadItems(items)
dataSource.apply(snapshot, animatingDifferences: false) {
completion?()
}
@@ -608,7 +608,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
@objc func preferredContentSizeCategoryDidChange() {
IconImageCache.shared.emptyCache()
reconfigureVisibleCells()
reloadAllVisibleCells()
}
@objc func unreadCountDidChange(_ note: Notification) {
@@ -625,16 +625,19 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
return
}
let visibleIndexPaths = collectionView.indexPathsForVisibleItems
let itemsToReconfigure = visibleIndexPaths.compactMap { indexPath -> SidebarItemNode? in
guard let sidebarItemNode = dataSource.itemIdentifier(for: indexPath),
for cell in collectionView.visibleCells {
guard let indexPath = collectionView.indexPath(for: cell),
let sidebarItemNode = dataSource.itemIdentifier(for: indexPath),
sidebarItemNode.node.representedObject === unreadCountProvider as AnyObject else {
return nil
continue
}
if let feedCell = cell as? MainFeedCollectionViewCell {
feedCell.unreadCount = unreadCountProvider.unreadCount
}
if let folderCell = cell as? MainFeedCollectionViewFolderCell {
folderCell.unreadCount = unreadCountProvider.unreadCount
}
return sidebarItemNode
}
reconfigureCells(itemsToReconfigure)
}
@objc func feedSettingDidChange(_ note: Notification) {
@@ -647,25 +650,14 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
}
@objc func faviconDidBecomeAvailable(_ note: Notification) {
reconfigureVisibleCells()
applyToAvailableCells(configureIcon)
}
@objc func feedIconDidBecomeAvailable(_ note: Notification) {
guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed else {
return
}
let visibleIndexPaths = collectionView.indexPathsForVisibleItems
let itemsToReconfigure = visibleIndexPaths.compactMap { indexPath -> SidebarItemNode? in
guard let sidebarItemNode = dataSource.itemIdentifier(for: indexPath),
let candidateSidebarItem = sidebarItemNode.node.representedObject as? SidebarItem,
feed.sidebarItemID == candidateSidebarItem.sidebarItemID else {
return nil
}
return sidebarItemNode
}
reconfigureCells(itemsToReconfigure)
applyToCellsForRepresentedObject(feed, configureIcon(_:_:))
}
// MARK: - Actions
+119 -149
View File
@@ -8,23 +8,24 @@
import UIKit
class MainTimelineCell: UITableViewCell {
final class MainTimelineCell: UITableViewCell {
@IBOutlet var articleContent: UILabel!
@IBOutlet var articleByLine: UILabel!
@IBOutlet var feedIcon: IconView?
@IBOutlet var indicatorView: IconView!
@IBOutlet var articleDate: UILabel!
@IBOutlet var metaDataStackView: UIStackView!
var cellData: MainTimelineCellData! {
didSet {
configure(cellData)
}
}
var isPreview: Bool = false
private static let indicatorAnimationDuration = 0.25
override func awakeFromNib() {
MainActor.assumeIsolated {
super.awakeFromNib()
@@ -33,36 +34,67 @@ class MainTimelineCell: UITableViewCell {
configureStackView()
}
}
override func layoutSubviews() {
super.layoutSubviews()
func setIconImage(_ iconImage: IconImage?) {
guard let feedIcon else {
return
}
if feedIcon.iconImage !== iconImage {
feedIcon.iconImage = iconImage
}
}
private func configure(_ cellData: MainTimelineCellData) {
override func updateConfiguration(using state: UICellConfigurationState) {
super.updateConfiguration(using: state)
var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
backgroundConfig.cornerRadius = 20
if traitCollection.userInterfaceIdiom == .pad {
backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing]
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: !isPreview ? -4 : -12, bottom: 0, trailing: !isPreview ? -4 : -12)
}
articleContent.textColor = titleTextColor(for: state)
if isActive(state) {
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
articleDate.textColor = .lightText
articleByLine.textColor = .lightText
} else {
articleDate.textColor = .secondaryLabel
articleByLine.textColor = .secondaryLabel
}
updateIndicatorView(state)
backgroundConfiguration = backgroundConfig
}
}
private extension MainTimelineCell {
func configure(_ cellData: MainTimelineCellData) {
articleContent.numberOfLines = cellData.numberOfLines
addArticleContent(configurationState)
if cellData.showFeedName == .feed {
switch cellData.showFeedName {
case .feed:
articleByLine.text = cellData.feedName
} else if cellData.showFeedName == .byline {
case .byline:
articleByLine.text = cellData.byline
} else if cellData.showFeedName == .none {
case .none:
articleByLine.text = ""
}
if feedIcon != nil {
setIconImage(cellData.iconImage, with: cellData.iconSize)
}
setIconImage(cellData.iconImage, with: cellData.iconSize)
articleDate.text = cellData.dateString
}
private func updateIndicatorView(_ state: UICellConfigurationState) {
func updateIndicatorView(_ state: UICellConfigurationState) {
if cellData.read == false {
if indicatorView.alpha == 0.0 {
indicatorView.alpha = 1.0
}
UIView.animate(withDuration: 0.25) {
UIView.animate(withDuration: Self.indicatorAnimationDuration) {
self.indicatorView.iconImage = Assets.Images.unreadCellIndicator
self.indicatorView.tintColor = self.isActive(state) ? .white : Assets.Colors.secondaryAccent
}
@@ -71,20 +103,20 @@ class MainTimelineCell: UITableViewCell {
if indicatorView.alpha == 0.0 {
indicatorView.alpha = 1.0
}
UIView.animate(withDuration: 0.25) {
UIView.animate(withDuration: Self.indicatorAnimationDuration) {
self.indicatorView.iconImage = Assets.Images.starredFeed
self.indicatorView.tintColor = self.isActive(state) ? .white : Assets.Colors.star
}
return
} else if indicatorView.alpha == 1.0 {
UIView.animate(withDuration: 0.25) {
UIView.animate(withDuration: Self.indicatorAnimationDuration) {
self.indicatorView.alpha = 0.0
self.indicatorView.iconImage = nil
}
}
}
private func configureStackView() {
func configureStackView() {
switch traitCollection.preferredContentSizeCategory {
case .accessibilityMedium, .accessibilityLarge, .accessibilityExtraLarge, .accessibilityExtraExtraLarge, .accessibilityExtraExtraExtraLarge:
metaDataStackView.axis = .vertical
@@ -96,140 +128,106 @@ class MainTimelineCell: UITableViewCell {
metaDataStackView.distribution = .fillEqually
}
}
private func isActive(_ state: UICellConfigurationState) -> Bool {
let active = state.isSwiped || state.isSelected || state.isEditing || state.isHighlighted
if cellData.title.contains("Vouchers") {
print("Vouchers: \(active)")
}
return active
func isActive(_ state: UICellConfigurationState) -> Bool {
state.isSwiped || state.isSelected || state.isEditing || state.isHighlighted
}
func setIconImage(_ iconImage: IconImage?) {
if feedIcon!.iconImage !== iconImage {
feedIcon!.iconImage = iconImage
}
}
private func setIconImage(_ iconImage: IconImage?, with size: IconSize) {
feedIcon!.iconImage = iconImage
func setIconImage(_ iconImage: IconImage?, with size: IconSize) {
setIconImage(iconImage)
updateIconViewSizeConstraints(to: size.size)
}
private func updateIconViewSizeConstraints(to size: CGSize) {
guard feedIcon != nil else { return }
for constraint in feedIcon!.constraints.compactMap({ $0 }) {
func updateIconViewSizeConstraints(to size: CGSize) {
guard let feedIcon else {
return
}
for constraint in feedIcon.constraints {
constraint.isActive = false
}
NSLayoutConstraint.activate([
feedIcon!.widthAnchor.constraint(equalToConstant: size.width),
feedIcon!.heightAnchor.constraint(equalToConstant: size.height)
feedIcon.widthAnchor.constraint(equalToConstant: size.width),
feedIcon.heightAnchor.constraint(equalToConstant: size.height)
])
setNeedsLayout()
}
private func addArticleContent(_ state: UICellConfigurationState) {
func paragraphStyle(lineHeight: CGFloat) -> NSParagraphStyle {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = lineHeight
paragraphStyle.maximumLineHeight = lineHeight
paragraphStyle.lineBreakMode = .byWordWrapping
paragraphStyle.lineBreakStrategy = []
paragraphStyle.hyphenationFactor = 1.0
paragraphStyle.allowsDefaultTighteningForTruncation = true
return paragraphStyle
}
func attributes(textStyle: UIFont.TextStyle, color: UIColor) -> [NSAttributedString.Key: Any] {
let font = UIFont.preferredFont(forTextStyle: textStyle)
let paragraphStyle = paragraphStyle(lineHeight: font.lineHeight)
return [.font: font, .paragraphStyle: paragraphStyle, .foregroundColor: color]
}
func addArticleContent(_ state: UICellConfigurationState) {
let attributedCellText = NSMutableAttributedString()
// 1. Prepare Title
if cellData.title != "" {
let titleFont = UIFont.preferredFont(forTextStyle: .headline)
let lineHeight = titleFont.lineHeight
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = lineHeight
paragraphStyle.maximumLineHeight = lineHeight
paragraphStyle.lineBreakMode = .byWordWrapping
paragraphStyle.lineBreakStrategy = []
paragraphStyle.hyphenationFactor = 1.0
paragraphStyle.allowsDefaultTighteningForTruncation = true
let titleAttributes: [NSAttributedString.Key: Any] = [
.font: titleFont,
.paragraphStyle: paragraphStyle,
.foregroundColor: titleTextColor(for: state)
]
if !cellData.title.isEmpty {
let titleAttributes = attributes(textStyle: .headline, color: titleTextColor(for: state))
let titleAttributed = NSAttributedString(string: cellData.title, attributes: titleAttributes)
let linesUsed = countLines(of: titleAttributed, width: articleContent.bounds.width)
// 2. Measure Title Height
let linesUsed = countLines(of: titleAttributed, width: articleContent.bounds.width)
if linesUsed >= cellData.numberOfLines {
// The title already fills 3 lines, set it and exit
// The title already fills numberOfLines lines, set it and exit
articleContent.attributedText = titleAttributed
articleContent.lineBreakMode = .byTruncatingTail
return
}
attributedCellText.append(titleAttributed)
}
// 3. Prepare Summary (Only reached if Title < 3 lines)
if cellData.summary != "" {
let summaryFont = UIFont.preferredFont(forTextStyle: .body)
let summaryLineHeight = summaryFont.lineHeight
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = summaryLineHeight
paragraphStyle.maximumLineHeight = summaryLineHeight
paragraphStyle.lineBreakMode = .byWordWrapping
paragraphStyle.lineBreakStrategy = []
paragraphStyle.hyphenationFactor = 1.0
paragraphStyle.allowsDefaultTighteningForTruncation = true
let summaryAttributes: [NSAttributedString.Key: Any] = [
.font: summaryFont,
.paragraphStyle: paragraphStyle,
.foregroundColor: titleTextColor(for: state)
]
// 3. Prepare Summary (only reached if title < numberOfLines lines)
if !cellData.summary.isEmpty {
let summaryAttributes = attributes(textStyle: .body, color: titleTextColor(for: state))
let prefix = cellData.title != "" ? "\n" : ""
let summaryAttributed = NSAttributedString(string: prefix + cellData.summary, attributes: summaryAttributes)
attributedCellText.append(summaryAttributed)
}
articleContent.attributedText = attributedCellText
let linesUsed = countLines(of: attributedCellText, width: articleContent.bounds.width)
if attributedCellText.string.contains("Bree-folk") {
print("Bree-folk: \(linesUsed), \(self.feedIcon != nil)")
}
if linesUsed >= cellData.numberOfLines {
// The title already fills 3 lines, set it and exit
articleContent.attributedText = attributedCellText
articleContent.lineBreakMode = .byTruncatingTail
return
} else {
articleContent.attributedText = attributedCellText
articleContent.lineBreakMode = .byWordWrapping
}
let lineBreakMode: NSLineBreakMode = linesUsed >= cellData.numberOfLines ? .byTruncatingTail : .byWordWrapping
articleContent.lineBreakMode = lineBreakMode
}
func titleTextColor(for state: UICellConfigurationState) -> UIColor {
if isActive(state) {
return .white
} else {
return .label
}
isActive(state) ? .white : .label
}
func countLines(of attributedString: NSAttributedString, width: CGFloat) -> Int {
let textStorage = NSTextStorage(attributedString: attributedString)
let textContainer = NSTextContainer(size: CGSize(width: width, height: .greatestFiniteMagnitude))
let layoutManager = NSLayoutManager()
layoutManager.addTextContainer(textContainer)
textStorage.addLayoutManager(layoutManager)
textContainer.lineFragmentPadding = 0 // UILabel uses 0 or very small
layoutManager.ensureLayout(for: textContainer)
var lineCount = 0
var index = 0
var lineRange = NSRange()
while index < layoutManager.numberOfGlyphs {
layoutManager.lineFragmentRect(forGlyphAt: index, effectiveRange: &lineRange)
index = NSMaxRange(lineRange)
@@ -237,32 +235,4 @@ class MainTimelineCell: UITableViewCell {
}
return lineCount
}
override func updateConfiguration(using state: UICellConfigurationState) {
super.updateConfiguration(using: state)
var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
backgroundConfig.cornerRadius = 20
if traitCollection.userInterfaceIdiom == .pad {
backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing]
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: !isPreview ? -4 : -12, bottom: 0, trailing: !isPreview ? -4 : -12)
}
if isActive(state) {
backgroundConfig.backgroundColor = Assets.Colors.primaryAccent
articleContent.textColor = titleTextColor(for: state)
articleDate.textColor = .lightText
articleByLine.textColor = .lightText
} else {
articleContent.textColor = titleTextColor(for: state)
articleDate.textColor = .secondaryLabel
articleByLine.textColor = .secondaryLabel
}
updateIndicatorView(state)
self.backgroundConfiguration = backgroundConfig
}
}
@@ -9,9 +9,6 @@
import UIKit
import Articles
final class TimelineCustomizerTableViewController: UITableViewController {
private var previewArticle: Article {
var components = DateComponents()
@@ -74,7 +71,7 @@ final class TimelineCustomizerTableViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "IconSizeCell") as! ModernTimelineSliderCell
cell.sliderConfiguration = .iconSize
@@ -1,6 +1,6 @@
// High Level Settings common to both the iOS application and any extensions we bundle with it
MARKETING_VERSION = 7.0
CURRENT_PROJECT_VERSION = 7010
CURRENT_PROJECT_VERSION = 7012
APP_GROUP_ID = group.$(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS$(APP_GROUP_SUFFIX)
@@ -1,6 +1,6 @@
// High Level Settings common to both the Mac application and any extensions we bundle with it
MARKETING_VERSION = 7.0b5
CURRENT_PROJECT_VERSION = 7011
MARKETING_VERSION = 7.0b6
CURRENT_PROJECT_VERSION = 7013
APP_GROUP_ID = group.$(ORGANIZATION_IDENTIFIER).NetNewsWire-Evergreen$(APP_GROUP_SUFFIX)