Sorted articles by publishing date before sharing them. Issue #367 Also fixed issue where mail subject wasn't being set when sharing via the context share menu.

This commit is contained in:
Maurice Parker 2018-09-25 22:20:59 -05:00
parent d738bff2ad
commit 3128475640
3 changed files with 11 additions and 2 deletions

View File

@ -363,7 +363,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
return
}
let items = selectedArticles.map { ArticlePasteboardWriter(article: $0) }
let sortedArticles = selectedArticles.sortedByDate(.orderedAscending)
let items = sortedArticles.map { ArticlePasteboardWriter(article: $0) }
let sharingServicePicker = NSSharingServicePicker(items: items)
sharingServicePicker.delegate = sharingServicePickerDelegate
sharingServicePicker.show(relativeTo: view.bounds, of: view, preferredEdge: .minY)

View File

@ -166,7 +166,8 @@ private extension TimelineViewController {
return nil
}
let items = articles.map { ArticlePasteboardWriter(article: $0) }
let sortedArticles = selectedArticles.sortedByDate(.orderedAscending)
let items = sortedArticles.map { ArticlePasteboardWriter(article: $0) }
let standardServices = NSSharingService.sharingServices(forItems: items)
let customServices = SharingServicePickerDelegate.customSharingServices(for: items)
let services = standardServices + customServices
@ -176,6 +177,7 @@ private extension TimelineViewController {
let menu = NSMenu(title: NSLocalizedString("Share", comment: "Share menu name"))
services.forEach { (service) in
service.delegate = sharingServiceDelegate
let menuItem = NSMenuItem(title: service.menuItemTitle, action: #selector(performShareServiceFromContextualMenu(_:)), keyEquivalent: "")
menuItem.image = service.image
let sharingCommandInfo = SharingCommandInfo(service: service, items: items)

View File

@ -17,6 +17,8 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
@IBOutlet var contextualMenuDelegate: TimelineContextualMenuDelegate?
@IBOutlet var dataSource: TimelineDataSource!
var sharingServiceDelegate: NSSharingServiceDelegate?
var selectedArticles: [Article] {
return Array(articles.articlesForIndexes(tableView.selectedRowIndexes))
}
@ -128,6 +130,10 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
didRegisterForNotifications = true
}
}
override func viewDidAppear() {
sharingServiceDelegate = SharingServiceDelegate(self.view.window)
}
// MARK: Appearance Change