Convert several methods to async await.

This commit is contained in:
Brent Simmons
2024-05-05 17:08:30 -07:00
parent 399703c2fe
commit fba8c52b67
4 changed files with 56 additions and 43 deletions

View File

@@ -288,26 +288,36 @@ final class MainWindowController : NSWindowController, NSUserInterfaceValidation
// MARK: - Actions
@IBAction func scrollOrGoToNextUnread(_ sender: Any?) {
guard let detailViewController = detailViewController else {
guard let detailViewController else {
return
}
detailViewController.canScrollDown { (canScroll) in
Task { @MainActor in
let canScroll = await detailViewController.canScrollDown()
NSCursor.setHiddenUntilMouseMoves(true)
canScroll ? detailViewController.scrollPageDown(sender) : self.nextUnread(sender)
if canScroll {
detailViewController.scrollPageDown(sender)
} else {
self.nextUnread(sender)
}
}
}
@IBAction func scrollUp(_ sender: Any?) {
guard let detailViewController = detailViewController else {
guard let detailViewController else {
return
}
detailViewController.canScrollUp { (canScroll) in
if (canScroll) {
Task { @MainActor in
let canScroll = await detailViewController.canScrollUp()
if canScroll {
NSCursor.setHiddenUntilMouseMoves(true)
detailViewController.scrollPageUp(sender)
}
}
}
@IBAction func copyArticleURL(_ sender: Any?) {