Merge branch 'main' into super-cut

This commit is contained in:
Maurice Parker
2023-03-14 01:11:33 -05:00
4 changed files with 125 additions and 29 deletions

View File

@@ -124,7 +124,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
}
directlyMarkedAsUnreadArticles = Set<Article>()
lastVerticlePosition = 0
lastVerticalPosition = 0
articleRowMap = [String: [Int]]()
tableView.reloadData()
}
@@ -198,7 +198,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
private var markAsReadOnScrollWorkItem: DispatchWorkItem?
private var markAsReadOnScrollStart: Int?
private var markAsReadOnScrollEnd: Int?
private var lastVerticlePosition: CGFloat = 0
private var lastVerticalPosition: CGFloat = 0
convenience init(delegate: TimelineDelegate) {
self.init(nibName: "TimelineTableView", bundle: nil)
@@ -1347,9 +1347,9 @@ private extension TimelineViewController {
// Only try to mark if we are scrolling up
defer {
lastVerticlePosition = tableView.enclosingScrollView?.documentVisibleRect.origin.y ?? 0
lastVerticalPosition = tableView.enclosingScrollView?.documentVisibleRect.origin.y ?? 0
}
guard lastVerticlePosition < tableView.enclosingScrollView?.documentVisibleRect.origin.y ?? 0 else {
guard lastVerticalPosition < tableView.enclosingScrollView?.documentVisibleRect.origin.y ?? 0 else {
return
}

View File

@@ -36,24 +36,26 @@ a:hover {
:root {
--header-table-border-color: rgba(0, 0, 0, 0.1);
--header-color: rgba(0, 0, 0, 0.3);
--body-code-color: #666;
--header-color: rgba(0, 0, 0, 0.66);
--body-code-color: #111;
--code-background-color: #eee;
--system-message-color: #cbcbcb;
--feedlink-color: rgba(255, 0, 0, 0.6);
--article-title-color: #333;
--article-date-color: rgba(0, 0, 0, 0.3);
--article-date-color: rgba(0, 0, 0, 0.5);
--table-cell-border-color: lightgray;
}
@media(prefers-color-scheme: dark) {
:root {
--header-color: rgba(94, 158, 244, 1);
--body-code-color: #b2b2b2;
--body-code-color: #dcdcdc;
--system-message-color: #5f5f5f;
--feedlink-color: rgba(94, 158, 244, 1);
--article-title-color: #e0e0e0;
--article-date-color: rgba(255, 255, 255, 0.5);
--table-cell-border-color: dimgray;
--code-background-color: #333;
}
}
@@ -106,6 +108,8 @@ body > .systemMessage {
.articleDateline {
margin-bottom: 5px;
font-weight: bold;
font-variant-caps: all-small-caps;
letter-spacing: 0.025em;
}
.articleDateline a:link, .articleDateline a:visited {
@@ -115,6 +119,7 @@ body > .systemMessage {
.articleDatelineTitle {
margin-bottom: 5px;
font-weight: bold;
font-variant-caps: all-small-caps;
}
.articleDatelineTitle a:link, .articleDatelineTitle a:visited {
@@ -122,19 +127,37 @@ body > .systemMessage {
}
.externalLink {
margin-bottom: 5px;
margin-top: 15px;
margin-bottom: 15px;
/*
font-variant-caps: all-small-caps;
letter-spacing: 0.025em;
*/
font-size: 0.875em;
font-style: italic;
color: var(--article-date-color);
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.externalLink a {
font-family: "SF Mono", Menlo, Courier, monospace;
font-size: 0.85em;
font-variant-caps: normal;
letter-spacing: 0em;
}
.articleBody {
margin-top: 20px;
line-height: 1.6em;
}
.articleBody a {
padding: 0px 1px;
}
h1 {
line-height: 1.15em;
font-weight: bold;
@@ -149,6 +172,7 @@ pre {
overflow-y: hidden;
word-wrap: normal;
word-break: normal;
border-radius: 3px;
}
pre {
@@ -156,9 +180,15 @@ pre {
}
code, pre {
font-family: "SF Mono", Menlo, "Courier New", Courier, monospace;
font-family: "SF Mono", Menlo, Courier, monospace;
font-size: 1em;
-webkit-hyphens: none;
background: var(--code-background-color);
}
code {
padding: 1px 2px;
border-radius: 2px;
}
pre code {
@@ -219,10 +249,6 @@ img, figure, video, div, object {
margin: 0 auto;
}
video {
width: 100% !important;
}
iframe {
max-width: 100%;
margin: 0 auto;
@@ -238,7 +264,6 @@ figure {
}
figcaption {
margin-top: 0.5em;
font-size: 14px;
line-height: 1.3em;
}
@@ -286,6 +311,30 @@ blockquote {
border-top: 1px solid var(--header-table-border-color);
}
/* Twitter */
.twitterAvatar {
vertical-align: middle;
border-radius: 4px;
height: 1.7em;
width: 1.7em;
}
.twitterUsername {
line-height: 1.2;
margin-left: 4px;
display: inline-block;
vertical-align: middle;
}
.twitterScreenName {
font-size: 66%;
}
.twitterTimestamp {
font-size: 66%;
}
/* Newsfoot theme for light mode (default) */
.newsfoot-footnote-popover {
background: #ccc;
@@ -359,7 +408,6 @@ a.footnote:hover,
padding-right: 20px;
word-break: break-word;
-webkit-hyphens: auto;
-webkit-text-size-adjust: none;
}
@@ -370,7 +418,8 @@ a.footnote:hover,
font-size: [[font-size]]px;
--primary-accent-color: #086AEE;
--secondary-accent-color: #086AEE;
--block-quote-border-color: rgba(8, 106, 238, 0.75);
--block-quote-border-color: rgba(0, 0, 0, 0.25);
--ios-hover-color: lightgray; /* placeholder */
}
@media(prefers-color-scheme: dark) {
@@ -379,24 +428,44 @@ a.footnote:hover,
--secondary-accent-color: #5E9EF4;
--block-quote-border-color: rgba(94, 158, 244, 0.75);
--header-table-border-color: rgba(255, 255, 255, 0.2);
--ios-hover-color: #444444; /* placeholder */
}
}
body a, body a:visited, body a * {
color: var(--secondary-accent-color);
}
.externalLink a {
font-size: inherit;
}
.articleBody a:link, .articleBody a:visited {
text-decoration: none;
border-bottom: 1px solid var(--primary-accent-color);
color: var(--secondary-accent-color);
}
body .header {
font: -apple-system-body;
font-size: [[font-size]]px;
}
body .header a:link, body .header a:visited {
color: var(--primary-accent-color);
color: var(--secondary-accent-color);
}
@media (hover: hover) and (pointer: coarse) {
.articleBody a:hover {
background: var(--ios-hover-color);
}
}
pre {
/*
border: 1px solid var(--secondary-accent-color);
*/
padding: 5px;
}
@@ -439,15 +508,19 @@ a.footnote:hover,
:root {
color-scheme: light dark;
--accent-color: rgba(8, 106, 238, 1);
--block-quote-border-color: rgba(8, 106, 238, .50);
--accent-color: rgba( 8, 106, 238, 1);
--block-quote-border-color: rgba( 0, 0, 0, 0.25);
--hover-gradient-color-start: rgba(60, 146, 251, 1);
--hover-gradient-color-end: rgba(67, 149, 251, 1);
}
@media(prefers-color-scheme: dark) {
:root {
--accent-color: rgba(94, 158, 244, 1);
--block-quote-border-color: rgba(94, 158, 244, .50);
--header-table-border-color: rgba(255, 255, 255, 0.1);
--accent-color: rgba( 94, 158, 244, 1);
--block-quote-border-color: rgba( 94, 158, 244, 0.50);
--header-table-border-color: rgba(255, 255, 255, 0.1);
--hover-gradient-color-start: rgba( 41, 121, 213, 1);
--hover-gradient-color-end: rgba( 42, 120, 212, 1);
}
}
@@ -455,8 +528,26 @@ a.footnote:hover,
color: var(--accent-color);
}
.articleBody a:link: not(a > img, a > code), .articleBody a:visited: not(a > img, a > code) {
/* text-decoration: underline; */
border-bottom: 1px solid var(--accent-color);
}
.articleBody a:hover {
border-radius: 2px;
/*
background: var(--accent-color);
*/
background: linear-gradient(0deg, var(--hover-gradient-color-start) 0%, var(--hover-gradient-color-end) 100%);
border-bottom: 1px solid var(--hover-gradient-color-end);
color: white;
text-decoration: none;
}
pre {
/*
border: 1px solid var(--accent-color);
*/
padding: 10px;
}

View File

@@ -564,6 +564,11 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
return
}
if tableView.window == nil {
completion?()
return
}
tableView.performBatchUpdates {
if let deletes = changes.deletes, !deletes.isEmpty {
tableView.deleteSections(IndexSet(deletes), with: .middle)

View File

@@ -34,7 +34,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
private var markAsReadOnScrollWorkItem: DispatchWorkItem?
private var markAsReadOnScrollStart: Int?
private var markAsReadOnScrollEnd: Int?
private var lastVerticlePosition: CGFloat = 0
private var lastVerticalPosition: CGFloat = 0
var mainControllerIdentifier = MainControllerIdentifier.masterTimeline
@@ -696,7 +696,7 @@ private extension MasterTimelineViewController {
}
func applyChanges(animated: Bool, completion: (() -> Void)? = nil) {
lastVerticlePosition = 0
lastVerticalPosition = 0
if coordinator.articles.count == 0 {
tableView.rowHeight = tableView.estimatedRowHeight
@@ -753,15 +753,15 @@ private extension MasterTimelineViewController {
func markAsReadOnScroll() {
// Only try to mark if we are scrolling up
defer {
lastVerticlePosition = tableView.contentOffset.y
lastVerticalPosition = tableView.contentOffset.y
}
guard lastVerticlePosition < tableView.contentOffset.y else {
guard lastVerticalPosition < tableView.contentOffset.y else {
return
}
// Implement Mark As Read on Scroll where we mark after the leading edge goes a little beyond the safe area inset
guard AppDefaults.shared.markArticlesAsReadOnScroll,
lastVerticlePosition < tableView.contentOffset.y,
lastVerticalPosition < tableView.contentOffset.y,
let firstVisibleIndexPath = tableView.indexPathsForVisibleRows?.first else { return }
let firstVisibleRowRect = tableView.rectForRow(at: firstVisibleIndexPath)