Merge pull request #1170 from Wevah/row-swipe-icons

Use glyphs from SF Symbols for table row swipe actions
This commit is contained in:
Brent Simmons 2019-10-26 12:25:22 -07:00 committed by GitHub
commit 759f89ec84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 116 additions and 4 deletions

View File

@ -94,4 +94,20 @@ struct AppAssets {
return RSImage(named: NSImage.smartBadgeTemplateName)!
}()
static var swipeMarkReadImage: RSImage = {
return RSImage(named: "swipeMarkRead")!
}()
static var swipeMarkUnreadImage: RSImage = {
return RSImage(named: "swipeMarkUnread")!
}()
static var swipeMarkStarredImage: RSImage = {
return RSImage(named: "swipeMarkStarred")!
}()
static var swipeMarkUnstarredImage: RSImage = {
return RSImage(named: "swipeMarkUnstarred")!
}()
}

View File

@ -779,19 +779,19 @@ extension TimelineViewController: NSTableViewDelegate {
switch edge {
case .leading:
let title = article.status.read ? NSLocalizedString("Mark Unread", comment: "mark unread") : NSLocalizedString("Mark Read", comment: "mark read")
let action = NSTableViewRowAction(style: .regular, title: title) { (action, row) in
let action = NSTableViewRowAction(style: .regular, title: "") { (action, row) in
self.toggleArticleRead(article);
tableView.rowActionsVisible = false
}
action.image = article.status.read ? AppAssets.swipeMarkUnreadImage : AppAssets.swipeMarkReadImage
return [action]
case .trailing:
let title = article.status.starred ? NSLocalizedString("Mark Unstarred", comment: "mark unstarred") : NSLocalizedString("Mark Starred", comment: "mark starred")
let action = NSTableViewRowAction(style: .regular, title: title) { (action, row) in
let action = NSTableViewRowAction(style: .regular, title: "") { (action, row) in
self.toggleArticleStarred(article);
tableView.rowActionsVisible = false
}
action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage
return [action]
@unknown default:

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "checkmark.circle.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "star.fill.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "circle.fill.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "star.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}