mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Update to latest RSCore
This commit is contained in:
@@ -98,8 +98,8 @@ class AddFeedController: AddFeedWindowControllerDelegate {
|
||||
private extension AddFeedController {
|
||||
|
||||
var urlStringFromPasteboard: String? {
|
||||
if let urlString = NSPasteboard.rs_urlString(from: NSPasteboard.general) {
|
||||
return urlString.rs_normalizedURL()
|
||||
if let urlString = NSPasteboard.urlString(from: NSPasteboard.general) {
|
||||
return urlString.normalizedURL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class AddFeedWindowController : NSWindowController {
|
||||
|
||||
private var userEnteredTitle: String? {
|
||||
var s = nameTextField.stringValue
|
||||
s = s.rs_stringWithCollapsedWhitespace()
|
||||
s = s.collapsingWhitespace
|
||||
if s.isEmpty {
|
||||
return nil
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class AddFeedWindowController : NSWindowController {
|
||||
|
||||
@IBAction func addFeed(_ sender: Any?) {
|
||||
let urlString = urlTextField.stringValue
|
||||
let normalizedURLString = (urlString as NSString).rs_normalizedURL()
|
||||
let normalizedURLString = urlString.normalizedURL
|
||||
|
||||
if normalizedURLString.isEmpty {
|
||||
cancelSheet()
|
||||
@@ -137,7 +137,7 @@ class AddFeedWindowController : NSWindowController {
|
||||
private extension AddFeedWindowController {
|
||||
|
||||
private func updateUI() {
|
||||
addButton.isEnabled = urlTextField.stringValue.rs_stringMayBeURL()
|
||||
addButton.isEnabled = urlTextField.stringValue.mayBeURL
|
||||
}
|
||||
|
||||
func cancelSheet() {
|
||||
|
||||
@@ -67,7 +67,7 @@ private extension DetailStatusBarView {
|
||||
|
||||
func updateLinkForDisplay() {
|
||||
if let mouseoverLink = mouseoverLink, !mouseoverLink.isEmpty {
|
||||
linkForDisplay = (mouseoverLink as NSString).rs_stringByStrippingHTTPOrHTTPSScheme()
|
||||
linkForDisplay = mouseoverLink.strippingHTTPOrHTTPSScheme
|
||||
}
|
||||
else {
|
||||
linkForDisplay = nil
|
||||
|
||||
@@ -32,7 +32,7 @@ struct NNW3Document {
|
||||
|
||||
extension NNW3Document: OPMLRepresentable {
|
||||
|
||||
func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
|
||||
func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
|
||||
var s =
|
||||
"""
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
@@ -46,7 +46,7 @@ extension NNW3Document: OPMLRepresentable {
|
||||
|
||||
if let children = children {
|
||||
for child in children {
|
||||
s += child.OPMLString(indentLevel: indentLevel + 1, strictConformance: true)
|
||||
s += child.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,19 +94,19 @@ private struct NNW3Folder {
|
||||
|
||||
extension NNW3Folder: OPMLRepresentable {
|
||||
|
||||
func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
|
||||
let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
|
||||
func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
|
||||
let t = title?.escapingSpecialXMLCharacters ?? ""
|
||||
guard let children = children else {
|
||||
// Empty folder.
|
||||
return "<outline text=\"\(t)\" title=\"\(t)\" />\n".rs_string(byPrependingNumberOfTabs: indentLevel)
|
||||
return "<outline text=\"\(t)\" title=\"\(t)\" />\n".prepending(tabCount: indentLevel)
|
||||
}
|
||||
|
||||
var s = "<outline text=\"\(t)\" title=\"\(t)\">\n".rs_string(byPrependingNumberOfTabs: indentLevel)
|
||||
var s = "<outline text=\"\(t)\" title=\"\(t)\">\n".prepending(tabCount: indentLevel)
|
||||
for child in children {
|
||||
s += child.OPMLString(indentLevel: indentLevel + 1, strictConformance: true)
|
||||
s += child.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: false)
|
||||
}
|
||||
|
||||
s += "</outline>\n".rs_string(byPrependingNumberOfTabs: indentLevel)
|
||||
s += "</outline>\n".prepending(tabCount: indentLevel)
|
||||
return s
|
||||
}
|
||||
}
|
||||
@@ -130,13 +130,13 @@ private struct NNW3Feed {
|
||||
|
||||
extension NNW3Feed: OPMLRepresentable {
|
||||
|
||||
func OPMLString(indentLevel: Int, strictConformance: Bool) -> String {
|
||||
let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
|
||||
let p = homePageURL?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
|
||||
let f = feedURL?.rs_stringByEscapingSpecialXMLCharacters() ?? ""
|
||||
func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
|
||||
let t = title?.escapingSpecialXMLCharacters ?? ""
|
||||
let p = homePageURL?.escapingSpecialXMLCharacters ?? ""
|
||||
let f = feedURL?.escapingSpecialXMLCharacters ?? ""
|
||||
|
||||
var s = "<outline text=\"\(t)\" title=\"\(t)\" description=\"\" type=\"rss\" version=\"RSS\" htmlUrl=\"\(p)\" xmlUrl=\"\(f)\"/>\n"
|
||||
s = s.rs_string(byPrependingNumberOfTabs: indentLevel)
|
||||
s = s.prepending(tabCount: indentLevel)
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ private extension NNW3ImportController {
|
||||
guard let document = NNW3Document(subscriptionsPlistURL: url) else {
|
||||
return nil
|
||||
}
|
||||
let opml = document.OPMLString(indentLevel: 0, strictConformance: true)
|
||||
let opml = document.OPMLString(indentLevel: 0, allowCustomAttributes: false)
|
||||
|
||||
let opmlURL = FileManager.default.temporaryDirectory.appendingPathComponent("NNW3.opml")
|
||||
do {
|
||||
|
||||
@@ -143,9 +143,9 @@ private extension SidebarCell {
|
||||
}
|
||||
|
||||
func layoutWith(_ layout: SidebarCellLayout) {
|
||||
faviconImageView.rs_setFrameIfNotEqual(layout.faviconRect)
|
||||
titleView.rs_setFrameIfNotEqual(layout.titleRect)
|
||||
unreadCountView.rs_setFrameIfNotEqual(layout.unreadCountRect)
|
||||
faviconImageView.setFrame(ifNotEqualTo: layout.faviconRect)
|
||||
titleView.setFrame(ifNotEqualTo: layout.titleRect)
|
||||
unreadCountView.setFrame(ifNotEqualTo: layout.unreadCountRect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ struct SidebarCellLayout {
|
||||
var rFavicon = NSRect.zero
|
||||
if shouldShowImage {
|
||||
rFavicon = NSRect(x: 0.0, y: 0.0, width: appearance.imageSize.width, height: appearance.imageSize.height)
|
||||
rFavicon = RSRectCenteredVerticallyInRect(rFavicon, bounds)
|
||||
rFavicon = rFavicon.centeredVertically(in: bounds)
|
||||
}
|
||||
self.faviconRect = rFavicon
|
||||
|
||||
@@ -34,7 +34,7 @@ struct SidebarCellLayout {
|
||||
if shouldShowImage {
|
||||
rTextField.origin.x = NSMaxX(rFavicon) + appearance.imageMarginRight
|
||||
}
|
||||
rTextField = RSRectCenteredVerticallyInRect(rTextField, bounds)
|
||||
rTextField = rTextField.centeredVertically(in: bounds)
|
||||
|
||||
let unreadCountSize = unreadCountView.intrinsicContentSize
|
||||
let unreadCountIsHidden = unreadCountView.unreadCount < 1
|
||||
@@ -43,7 +43,7 @@ struct SidebarCellLayout {
|
||||
if !unreadCountIsHidden {
|
||||
rUnread.size = unreadCountSize
|
||||
rUnread.origin.x = NSMaxX(bounds) - unreadCountSize.width
|
||||
rUnread = RSRectCenteredVerticallyInRect(rUnread, bounds)
|
||||
rUnread = rUnread.centeredVertically(in: bounds)
|
||||
let textFieldMaxX = NSMinX(rUnread) - appearance.unreadCountMarginLeft
|
||||
if NSMaxX(rTextField) > textFieldMaxX {
|
||||
rTextField.size.width = textFieldMaxX - NSMinX(rTextField)
|
||||
|
||||
@@ -37,9 +37,9 @@ struct PasteboardFeed: Hashable {
|
||||
let isLocalFeed: Bool
|
||||
|
||||
init(url: String, feedID: String?, homePageURL: String?, name: String?, editedName: String?, accountID: String?, accountType: AccountType?) {
|
||||
self.url = url.rs_normalizedURL()
|
||||
self.url = url.normalizedURL
|
||||
self.feedID = feedID
|
||||
self.homePageURL = homePageURL?.rs_normalizedURL()
|
||||
self.homePageURL = homePageURL?.normalizedURL
|
||||
self.name = name
|
||||
self.editedName = editedName
|
||||
self.accountID = accountID
|
||||
@@ -93,7 +93,7 @@ struct PasteboardFeed: Hashable {
|
||||
}
|
||||
if let foundType = pasteboardType {
|
||||
if let possibleURLString = pasteboardItem.string(forType: foundType) {
|
||||
if possibleURLString.rs_stringMayBeURL() {
|
||||
if possibleURLString.mayBeURL {
|
||||
self.init(url: possibleURLString, feedID: nil, homePageURL: nil, name: nil, editedName: nil, accountID: nil, accountType: nil)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ private extension ArticlePasteboardWriter {
|
||||
s += "\(summary)\n\n"
|
||||
}
|
||||
else if let html = article.contentHTML {
|
||||
let convertedHTML = html.rs_stringByConvertingToPlainText()
|
||||
let convertedHTML = html.convertingToPlainText()
|
||||
s += "\(convertedHTML)\n\n"
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ final class TimelineAvatarView: NSView {
|
||||
}
|
||||
|
||||
override func resizeSubviews(withOldSize oldSize: NSSize) {
|
||||
imageView.rs_setFrameIfNotEqual(rectForImageView())
|
||||
imageView.setFrame(ifNotEqualTo: rectForImageView())
|
||||
}
|
||||
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
|
||||
@@ -116,12 +116,12 @@ class TimelineTableCellView: NSTableCellView {
|
||||
setFrame(for: summaryView, rect: layoutRects.summaryRect)
|
||||
setFrame(for: textView, rect: layoutRects.textRect)
|
||||
|
||||
dateView.rs_setFrameIfNotEqual(layoutRects.dateRect)
|
||||
unreadIndicatorView.rs_setFrameIfNotEqual(layoutRects.unreadIndicatorRect)
|
||||
feedNameView.rs_setFrameIfNotEqual(layoutRects.feedNameRect)
|
||||
avatarView.rs_setFrameIfNotEqual(layoutRects.avatarImageRect)
|
||||
starView.rs_setFrameIfNotEqual(layoutRects.starRect)
|
||||
separatorView.rs_setFrameIfNotEqual(layoutRects.separatorRect)
|
||||
dateView.setFrame(ifNotEqualTo: layoutRects.dateRect)
|
||||
unreadIndicatorView.setFrame(ifNotEqualTo: layoutRects.unreadIndicatorRect)
|
||||
feedNameView.setFrame(ifNotEqualTo: layoutRects.feedNameRect)
|
||||
avatarView.setFrame(ifNotEqualTo: layoutRects.avatarImageRect)
|
||||
starView.setFrame(ifNotEqualTo: layoutRects.starRect)
|
||||
separatorView.setFrame(ifNotEqualTo: layoutRects.separatorRect)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ private extension TimelineTableCellView {
|
||||
}
|
||||
else {
|
||||
showView(textField)
|
||||
textField.rs_setFrameIfNotEqual(rect)
|
||||
textField.setFrame(ifNotEqualTo: rect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
tableView.scrollTo(row: 0, extraHeight: 0)
|
||||
}
|
||||
|
||||
tableView.rs_selectRow(nextRowIndex)
|
||||
tableView.selectRow(nextRowIndex)
|
||||
|
||||
let followingRowIndex = nextRowIndex - 1
|
||||
if followingRowIndex < 0 {
|
||||
@@ -278,7 +278,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
tableView.scrollTo(row: tableMaxIndex, extraHeight: 0)
|
||||
}
|
||||
|
||||
tableView.rs_selectRow(nextRowIndex)
|
||||
tableView.selectRow(nextRowIndex)
|
||||
|
||||
let followingRowIndex = nextRowIndex + 1
|
||||
if followingRowIndex > tableMaxIndex {
|
||||
@@ -383,7 +383,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
return
|
||||
}
|
||||
NSCursor.setHiddenUntilMouseMoves(true)
|
||||
tableView.rs_selectRow(ix)
|
||||
tableView.selectRow(ix)
|
||||
tableView.scrollTo(row: ix)
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
|
||||
window.makeFirstResponderUnlessDescendantIsFirstResponder(tableView)
|
||||
if !hasAtLeastOneSelectedArticle && articles.count > 0 {
|
||||
tableView.rs_selectRowAndScrollToVisible(0)
|
||||
tableView.selectRowAndScrollToVisible(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user