Merge pull request #486 from vincode-io/issue-367
Sorted articles by publishing date before sharing them. Issue #367 …
This commit is contained in:
commit
a0c1b63889
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
@ -130,6 +132,10 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||
didRegisterForNotifications = true
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidAppear() {
|
||||
sharingServiceDelegate = SharingServiceDelegate(self.view.window)
|
||||
}
|
||||
|
||||
// MARK: Appearance Change
|
||||
|
||||
|
|
Loading…
Reference in New Issue