From 24510e49ba4dd9d86c8eef166a959288c57714f7 Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Thu, 5 Dec 2019 23:56:19 -0600 Subject: [PATCH 01/12] Ignore secrets-related files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 7fbdcfcb3..70c46f04a 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,7 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output + +/Shared/Secrets.swift +*.py[cod] + From c66ed357997acbf28b9c6c01422bacc27aa9a96d Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Fri, 6 Dec 2019 00:31:37 -0600 Subject: [PATCH 02/12] Add WordPress specific emoji style --- Mac/MainWindow/Detail/styleSheet.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mac/MainWindow/Detail/styleSheet.css b/Mac/MainWindow/Detail/styleSheet.css index 107a7cb7e..458a9d871 100644 --- a/Mac/MainWindow/Detail/styleSheet.css +++ b/Mac/MainWindow/Detail/styleSheet.css @@ -181,3 +181,9 @@ img[src*="feedblitz"], img[src*="share-buttons"] { display: none !important; } + +/* Site specific styles */ +.wp-smiley { + height: 1em; + max-height: 1em; +} From 073eee6ff829c54c5e0f8698b288ee74b0201861 Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Wed, 29 Jan 2020 17:50:37 -0600 Subject: [PATCH 03/12] Rename Feedbin account "Create" button to "Add Account" --- Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift b/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift index 11cdcc109..3886dd86b 100644 --- a/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsFeedbinWindowController.swift @@ -34,7 +34,7 @@ class AccountsFeedbinWindowController: NSWindowController { } actionButton.title = NSLocalizedString("Update", comment: "Update") } else { - actionButton.title = NSLocalizedString("Create", comment: "Create") + actionButton.title = NSLocalizedString("Add Account", comment: "Add Account") } } From 42f97172b78160c472916f6adb6645af8175fa89 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 21 Feb 2020 17:22:13 -0800 Subject: [PATCH 04/12] Store the url in the correct location. Issue #1656 --- Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index 5bd1b5c76..faf263da5 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -1061,7 +1061,7 @@ private extension FeedbinAccountDelegate { let parsedItems: [ParsedItem] = entries.map { entry in let authors = Set([ParsedAuthor(name: entry.authorName, url: entry.jsonFeed?.jsonFeedAuthor?.url, avatarURL: entry.jsonFeed?.jsonFeedAuthor?.avatarURL, emailAddress: nil)]) - return ParsedItem(syncServiceID: String(entry.articleID), uniqueID: String(entry.articleID), feedURL: String(entry.feedID), url: nil, externalURL: entry.url, title: entry.title, contentHTML: entry.contentHTML, contentText: nil, summary: entry.summary, imageURL: nil, bannerImageURL: nil, datePublished: entry.parsedDatePublished, dateModified: nil, authors: authors, tags: nil, attachments: nil) + return ParsedItem(syncServiceID: String(entry.articleID), uniqueID: String(entry.articleID), feedURL: String(entry.feedID), url: entry.url, externalURL: nil, title: entry.title, contentHTML: entry.contentHTML, contentText: nil, summary: entry.summary, imageURL: nil, bannerImageURL: nil, datePublished: entry.parsedDatePublished, dateModified: nil, authors: authors, tags: nil, attachments: nil) } return Set(parsedItems) From 66ce3db1fceab415e4d011c3f77d0670ed72454c Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 26 Feb 2020 11:29:59 -0800 Subject: [PATCH 05/12] Trigger old, expired timers when the computer wakes from sleep to get refreshes going again. Issue #1122 --- Mac/AppDelegate.swift | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 73519e152..4e8120779 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -71,6 +71,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(inspectableObjectsDidChange(_:)), name: .InspectableObjectsDidChange, object: nil) + NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(didWakeNotification(_:)), name: NSWorkspace.didWakeNotification, object: nil) appDelegate = self } @@ -223,10 +224,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, } func applicationDidBecomeActive(_ notification: Notification) { - // It’s possible there’s a refresh timer set to go off in the past. - // In that case, refresh now and update the timer. - refreshTimer?.fireOldTimer() - syncTimer?.fireOldTimer() + fireOldTimers() } func applicationDidResignActive(_ notification: Notification) { @@ -282,6 +280,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, refreshTimer?.update() updateDockBadge() } + + @objc func didWakeNotification(_ note: Notification) { + fireOldTimers() + } // MARK: Main Window @@ -564,6 +566,13 @@ extension AppDelegate { private extension AppDelegate { + func fireOldTimers() { + // It’s possible there’s a refresh timer set to go off in the past. + // In that case, refresh now and update the timer. + refreshTimer?.fireOldTimer() + syncTimer?.fireOldTimer() + } + func createReaderWindow() -> MainWindowController { return windowControllerWithName("MainWindow") as! MainWindowController From 7c060bb0686aad7d55c0b2d08b1c94ef9e0ab050 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 26 Feb 2020 17:28:52 -0800 Subject: [PATCH 06/12] Change so that the tree controller can't be rebuilt before all async deletes have completed. Issue #1002 --- Shared/Commands/DeleteCommand.swift | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Shared/Commands/DeleteCommand.swift b/Shared/Commands/DeleteCommand.swift index 972ffcc8c..8b3588163 100644 --- a/Shared/Commands/DeleteCommand.swift +++ b/Shared/Commands/DeleteCommand.swift @@ -44,26 +44,21 @@ final class DeleteCommand: UndoableCommand { } func perform() { - - BatchUpdate.shared.perform { - itemSpecifiers.forEach { $0.delete() {} } - treeController.rebuild() - } - registerUndo() + perform {} } func perform(completion: @escaping () -> Void) { let group = DispatchGroup() - group.enter() itemSpecifiers.forEach { + group.enter() $0.delete() { group.leave() } } - treeController.rebuild() group.notify(queue: DispatchQueue.main) { + self.treeController.rebuild() self.registerUndo() completion() } From a4650458880c8ce0e56f5a5e9d15841177624b2a Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 27 Feb 2020 11:27:41 -0800 Subject: [PATCH 07/12] Save last used folder name when adding a feed. Issue #1462 --- Mac/AppDefaults.swift | 10 ++++++++++ Mac/MainWindow/AddFeed/AddFeedWindowController.swift | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Mac/AppDefaults.swift b/Mac/AppDefaults.swift index 2eaade629..b35969f6c 100644 --- a/Mac/AppDefaults.swift +++ b/Mac/AppDefaults.swift @@ -28,6 +28,7 @@ struct AppDefaults { static let mainWindowWidths = "mainWindowWidths" static let refreshInterval = "refreshInterval" static let addFeedAccountID = "addFeedAccountID" + static let addFeedFolderName = "addFeedFolderName" static let addFolderAccountID = "addFolderAccountID" static let importOPMLAccountID = "importOPMLAccountID" static let exportOPMLAccountID = "exportOPMLAccountID" @@ -109,6 +110,15 @@ struct AppDefaults { } } + static var addFeedFolderName: String? { + get { + return string(for: Key.addFeedFolderName) + } + set { + setString(for: Key.addFeedFolderName, newValue) + } + } + static var addFolderAccountID: String? { get { return string(for: Key.addFolderAccountID) diff --git a/Mac/MainWindow/AddFeed/AddFeedWindowController.swift b/Mac/MainWindow/AddFeed/AddFeedWindowController.swift index 5c05b2af5..386a7fc29 100644 --- a/Mac/MainWindow/AddFeed/AddFeedWindowController.swift +++ b/Mac/MainWindow/AddFeed/AddFeedWindowController.swift @@ -73,7 +73,13 @@ class AddFeedWindowController : NSWindowController { FolderTreeMenu.select(account: account, folder: initialFolder, in: folderPopupButton) } else if let accountID = AppDefaults.addFeedAccountID { if let account = AccountManager.shared.existingAccount(with: accountID) { - FolderTreeMenu.select(account: account, folder: nil, in: folderPopupButton) + let folder: Folder? = { + if let folderName = AppDefaults.addFeedFolderName { + return account.ensureFolder(with: folderName) + } + return nil + }() + FolderTreeMenu.select(account: account, folder: folder, in: folderPopupButton) } } @@ -102,8 +108,10 @@ class AddFeedWindowController : NSWindowController { let container = selectedContainer()! if let selectedAccount = container as? Account { AppDefaults.addFeedAccountID = selectedAccount.accountID + AppDefaults.addFeedFolderName = nil } else if let selectedFolder = container as? Folder, let selectedAccount = selectedFolder.account { AppDefaults.addFeedAccountID = selectedAccount.accountID + AppDefaults.addFeedFolderName = selectedFolder.name } delegate?.addFeedWindowController(self, userEnteredURL: url, userEnteredTitle: userEnteredTitle, container: container) From 85bd20ca802d69f9a1503d71c01e320f194b5ce2 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 27 Feb 2020 12:15:41 -0800 Subject: [PATCH 08/12] Stop media playback when the main window is closed. Issue #1646 --- Mac/MainWindow/Detail/DetailViewController.swift | 4 ++++ Mac/MainWindow/Detail/DetailWebViewController.swift | 6 ++++++ Mac/MainWindow/MainWindowController.swift | 8 ++++++++ Shared/Article Rendering/ArticleRenderer.swift | 11 +++++++++++ 4 files changed, 29 insertions(+) diff --git a/Mac/MainWindow/Detail/DetailViewController.swift b/Mac/MainWindow/Detail/DetailViewController.swift index c1d26e512..1b0200949 100644 --- a/Mac/MainWindow/Detail/DetailViewController.swift +++ b/Mac/MainWindow/Detail/DetailViewController.swift @@ -56,6 +56,10 @@ final class DetailViewController: NSViewController, WKUIDelegate { currentWebViewController = webViewController(for: mode) } + func stopMediaPlayback() { + currentWebViewController.stopMediaPlayback() + } + func canScrollDown(_ callback: @escaping (Bool) -> Void) { currentWebViewController.canScrollDown(callback) } diff --git a/Mac/MainWindow/Detail/DetailWebViewController.swift b/Mac/MainWindow/Detail/DetailWebViewController.swift index bd913e5cc..e901a2a7c 100644 --- a/Mac/MainWindow/Detail/DetailWebViewController.swift +++ b/Mac/MainWindow/Detail/DetailWebViewController.swift @@ -107,6 +107,12 @@ final class DetailWebViewController: NSViewController, WKUIDelegate { reloadHTML() } + // MARK: Media Functions + + func stopMediaPlayback() { + webView.evaluateJavaScript("stopMediaPlayback();") + } + // MARK: Scrolling func canScrollDown(_ callback: @escaping (Bool) -> Void) { diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index bc00c98d1..4bdab6f89 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -376,6 +376,14 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { } } +// MARK: NSWindowDelegate + +extension MainWindowController: NSWindowDelegate { + func windowWillClose(_ notification: Notification) { + detailViewController?.stopMediaPlayback() + } +} + // MARK: - SidebarDelegate extension MainWindowController: SidebarDelegate { diff --git a/Shared/Article Rendering/ArticleRenderer.swift b/Shared/Article Rendering/ArticleRenderer.swift index b849ba206..56f5fd97f 100644 --- a/Shared/Article Rendering/ArticleRenderer.swift +++ b/Shared/Article Rendering/ArticleRenderer.swift @@ -358,6 +358,17 @@ private extension ArticleRenderer { window.webkit.messageHandlers.mouseDidExit.postMessage(anchor.href); } + function stopMediaPlayback() { + document.querySelectorAll("iframe").forEach(element => { + var iframeSrc = element.src; + element.src = iframeSrc; + }); + + document.querySelectorAll("video, audio").forEach(element => { + element.pause(); + }); + } + """ From bedaa75eb80d91da8c6c71f6215808a97d4fa604 Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Fri, 28 Feb 2020 07:47:19 -0600 Subject: [PATCH 09/12] Set max-width to 44em (792px with an 18px font-size) --- Mac/MainWindow/Detail/styleSheet.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Mac/MainWindow/Detail/styleSheet.css b/Mac/MainWindow/Detail/styleSheet.css index 458a9d871..a1ebd013d 100644 --- a/Mac/MainWindow/Detail/styleSheet.css +++ b/Mac/MainWindow/Detail/styleSheet.css @@ -1,11 +1,14 @@ body { margin-top: 20px; margin-bottom: 64px; - margin-left: 64px; - margin-right: 64px; + margin-left: auto; + margin-right: auto; + padding-left: 64px; + padding-right: 64px; font-family: -apple-system; font-size: 18px; word-wrap: break-word; /* break long words or URLs */ + max-width: 44em; } a { From 65b508ffaacc25f138cffdf54b6b7434a1b16a93 Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Fri, 28 Feb 2020 08:15:06 -0600 Subject: [PATCH 10/12] Port inline style stripping changes from master --- Shared/Article Rendering/ArticleRenderer.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Shared/Article Rendering/ArticleRenderer.swift b/Shared/Article Rendering/ArticleRenderer.swift index 56f5fd97f..1d0db9cb0 100644 --- a/Shared/Article Rendering/ArticleRenderer.swift +++ b/Shared/Article Rendering/ArticleRenderer.swift @@ -324,6 +324,12 @@ private extension ArticleRenderer { s += """