Merge branch 'mac-release'
This commit is contained in:
commit
94c6ca428f
|
@ -69,7 +69,13 @@ fastlane/Preview.html
|
|||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
/Shared/Secrets.swift
|
||||
*.py[cod]
|
||||
=======
|
||||
/Shared/Secrets.swift
|
||||
*.py[cod]
|
||||
|
||||
>>>>>>> mac-release
|
||||
|
|
|
@ -89,6 +89,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
|
||||
}
|
||||
|
@ -268,10 +269,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) {
|
||||
|
@ -328,6 +326,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
refreshTimer?.update()
|
||||
updateDockBadge()
|
||||
}
|
||||
|
||||
@objc func didWakeNotification(_ note: Notification) {
|
||||
fireOldTimers()
|
||||
}
|
||||
|
||||
// MARK: Main Window
|
||||
func windowControllerWithName(_ storyboardName: String) -> NSWindowController {
|
||||
|
@ -624,6 +626,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
|
||||
|
|
|
@ -58,8 +58,12 @@ final class DetailViewController: NSViewController, WKUIDelegate {
|
|||
currentWebViewController = webViewController(for: mode)
|
||||
}
|
||||
|
||||
func canScrollDown(_ completion: @escaping (Bool) -> Void) {
|
||||
currentWebViewController.canScrollDown(completion)
|
||||
func stopMediaPlayback() {
|
||||
currentWebViewController.stopMediaPlayback()
|
||||
}
|
||||
|
||||
func canScrollDown(_ callback: @escaping (Bool) -> Void) {
|
||||
currentWebViewController.canScrollDown(callback)
|
||||
}
|
||||
|
||||
override func scrollPageDown(_ sender: Any?) {
|
||||
|
|
|
@ -136,6 +136,12 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
|
|||
reloadArticleImage()
|
||||
}
|
||||
|
||||
// MARK: Media Functions
|
||||
|
||||
func stopMediaPlayback() {
|
||||
webView.evaluateJavaScript("stopMediaPlayback();")
|
||||
}
|
||||
|
||||
// MARK: Scrolling
|
||||
|
||||
func canScrollDown(_ completion: @escaping (Bool) -> Void) {
|
||||
|
|
|
@ -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 {
|
||||
|
@ -161,7 +164,7 @@ code, pre {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
img, figure, iframe, div {
|
||||
img, figure, div {
|
||||
max-width: 100%;
|
||||
height: auto !important;
|
||||
margin: 0 auto;
|
||||
|
@ -173,6 +176,11 @@ video {
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
iframe {
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
font-size: 14px;
|
||||
line-height: 1.3em;
|
||||
|
@ -239,7 +247,6 @@ img[src*="share-buttons"] {
|
|||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
/* Newsfoot specific styles. Structural styles come first, theme styles second */
|
||||
.newsfoot-footnote-container {
|
||||
position: relative;
|
||||
|
@ -372,3 +379,8 @@ sup > div > a[href^='#fn']:hover {
|
|||
|
||||
}
|
||||
|
||||
/* Site specific styles */
|
||||
.wp-smiley {
|
||||
height: 1em;
|
||||
max-height: 1em;
|
||||
}
|
||||
|
|
|
@ -457,6 +457,14 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
|
||||
}
|
||||
|
||||
// MARK: NSWindowDelegate
|
||||
|
||||
extension MainWindowController: NSWindowDelegate {
|
||||
func windowWillClose(_ notification: Notification) {
|
||||
detailViewController?.stopMediaPlayback()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - SidebarDelegate
|
||||
|
||||
extension MainWindowController: SidebarDelegate {
|
||||
|
|
|
@ -306,7 +306,7 @@ protocol SidebarDelegate: class {
|
|||
func deleteNodes(_ nodes: [Node]) {
|
||||
let nodesToDelete = treeController.normalizedSelectedNodes(nodes)
|
||||
|
||||
guard let undoManager = undoManager, let deleteCommand = DeleteCommand(nodesToDelete: nodesToDelete, undoManager: undoManager, errorHandler: ErrorHandler.present) else {
|
||||
guard let undoManager = undoManager, let deleteCommand = DeleteCommand(nodesToDelete: nodesToDelete, treeController: treeController, undoManager: undoManager, errorHandler: ErrorHandler.present) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class AccountsFeedbinWindowController: NSWindowController {
|
|||
usernameTextField.stringValue = credentials.username
|
||||
actionButton.title = NSLocalizedString("Update", comment: "Update")
|
||||
} else {
|
||||
actionButton.title = NSLocalizedString("Create", comment: "Create")
|
||||
actionButton.title = NSLocalizedString("Add Account", comment: "Add Account")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -264,5 +264,6 @@ private extension Article {
|
|||
}
|
||||
return url
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,17 @@ function reloadArticleImage(imageSrc) {
|
|||
image.src = imageSrc;
|
||||
}
|
||||
|
||||
function stopMediaPlayback() {
|
||||
document.querySelectorAll("iframe").forEach(element => {
|
||||
var iframeSrc = element.src;
|
||||
element.src = iframeSrc;
|
||||
});
|
||||
|
||||
document.querySelectorAll("video, audio").forEach(element => {
|
||||
element.pause();
|
||||
});
|
||||
}
|
||||
|
||||
function error() {
|
||||
document.body.innerHTML = "error";
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import Articles
|
|||
|
||||
final class DeleteCommand: UndoableCommand {
|
||||
|
||||
let treeController: TreeController?
|
||||
let undoManager: UndoManager
|
||||
let undoActionName: String
|
||||
var redoActionName: String {
|
||||
|
@ -23,7 +24,7 @@ final class DeleteCommand: UndoableCommand {
|
|||
|
||||
private let itemSpecifiers: [SidebarItemSpecifier]
|
||||
|
||||
init?(nodesToDelete: [Node], undoManager: UndoManager, errorHandler: @escaping (Error) -> ()) {
|
||||
init?(nodesToDelete: [Node], treeController: TreeController? = nil, undoManager: UndoManager, errorHandler: @escaping (Error) -> ()) {
|
||||
|
||||
guard DeleteCommand.canDelete(nodesToDelete) else {
|
||||
return nil
|
||||
|
@ -32,6 +33,7 @@ final class DeleteCommand: UndoableCommand {
|
|||
return nil
|
||||
}
|
||||
|
||||
self.treeController = treeController
|
||||
self.undoActionName = actionName
|
||||
self.undoManager = undoManager
|
||||
self.errorHandler = errorHandler
|
||||
|
@ -44,10 +46,22 @@ final class DeleteCommand: UndoableCommand {
|
|||
}
|
||||
|
||||
func perform() {
|
||||
itemSpecifiers.forEach { $0.delete() {} }
|
||||
registerUndo()
|
||||
|
||||
let group = DispatchGroup()
|
||||
itemSpecifiers.forEach {
|
||||
group.enter()
|
||||
$0.delete() {
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
|
||||
group.notify(queue: DispatchQueue.main) {
|
||||
self.treeController?.rebuild()
|
||||
self.registerUndo()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
func undo() {
|
||||
itemSpecifiers.forEach { $0.restore() }
|
||||
registerRedo()
|
||||
|
|
|
@ -145,17 +145,6 @@ function postRenderProcessing() {
|
|||
inlineVideos();
|
||||
}
|
||||
|
||||
function stopMediaPlayback() {
|
||||
document.querySelectorAll("iframe").forEach(element => {
|
||||
var iframeSrc = element.src;
|
||||
element.src = iframeSrc;
|
||||
});
|
||||
|
||||
document.querySelectorAll("video, audio").forEach(element => {
|
||||
element.pause();
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
window.webkit.messageHandlers.domContentLoaded.postMessage("");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue