Merge branch 'mac-candidate'
This commit is contained in:
commit
e263665a21
|
@ -0,0 +1,49 @@
|
||||||
|
-- This script creates a new Safari window with all the starred articles in a NetNewsWire instance, each in its own tab
|
||||||
|
|
||||||
|
-- declare the safariWindow property here so we can use is throughout the whole script
|
||||||
|
|
||||||
|
property safariWindow : missing value
|
||||||
|
|
||||||
|
-- the openTabInSafari() function opens a new tab in the appropriate window
|
||||||
|
|
||||||
|
to openTabInSafari(theUrl)
|
||||||
|
tell application "Safari"
|
||||||
|
-- test if this is the first call to openTabInSafari()
|
||||||
|
if (my safariWindow is missing value) then
|
||||||
|
-- first time through, make a new window with the given url in the only tab
|
||||||
|
set newdoc to make new document at front with properties {URL:theUrl}
|
||||||
|
-- because we created the doucument "at front", we know it is window 1
|
||||||
|
set safariWindow to window 1
|
||||||
|
else
|
||||||
|
-- after the first time, make a new tab in the wndow we created the first tim
|
||||||
|
tell safariWindow
|
||||||
|
make new tab with properties {URL:theUrl}
|
||||||
|
end tell
|
||||||
|
end if
|
||||||
|
end tell
|
||||||
|
end openTabInSafari
|
||||||
|
|
||||||
|
|
||||||
|
-- the script starts here
|
||||||
|
-- First, initialize safariWindow to be missing value, so that the first time through
|
||||||
|
-- openTabInSafari() we'll make a new window to hold all our articles
|
||||||
|
|
||||||
|
set safariWindow to missing value
|
||||||
|
|
||||||
|
|
||||||
|
-- Then we loop though all the feeds of all the accounts
|
||||||
|
-- for each feed, we find all the starred articles
|
||||||
|
--for each one of those, open a new tab in Safari
|
||||||
|
|
||||||
|
tell application "NetNewsWire"
|
||||||
|
set allAccounts to every account
|
||||||
|
repeat with nthAccount in allAccounts
|
||||||
|
set allFeeds to every feed of nthAccount
|
||||||
|
repeat with nthFeed in allFeeds
|
||||||
|
set starredArticles to (get every article of nthFeed where starred is true)
|
||||||
|
repeat with nthArticle in starredArticles
|
||||||
|
my openTabInSafari(url of nthArticle)
|
||||||
|
end repeat
|
||||||
|
end repeat
|
||||||
|
end repeat
|
||||||
|
end tell
|
|
@ -449,7 +449,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||||
return feed
|
return feed
|
||||||
}
|
}
|
||||||
|
|
||||||
public func removeFeed(_ feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
public func removeFeed(_ feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
delegate.removeFeed(for: self, with: feed, from: container, completion: completion)
|
delegate.removeFeed(for: self, with: feed, from: container, completion: completion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ protocol AccountDelegate {
|
||||||
func createFeed(for account: Account, url: String, name: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void)
|
func createFeed(for account: Account, url: String, name: String?, container: Container, completion: @escaping (Result<Feed, Error>) -> Void)
|
||||||
func renameFeed(for account: Account, with feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
|
func renameFeed(for account: Account, with feed: Feed, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
func addFeed(for account: Account, with: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
func addFeed(for account: Account, with: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void)
|
func removeFeed(for account: Account, with feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
func moveFeed(for account: Account, with feed: Feed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
func moveFeed(for account: Account, with feed: Feed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
|
|
||||||
func restoreFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
func restoreFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
||||||
|
|
|
@ -396,8 +396,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
func removeFeed(for account: Account, with feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
retrieveCredentialsIfNecessary(account)
|
|
||||||
if feed.folderRelationship?.count ?? 0 > 1 {
|
if feed.folderRelationship?.count ?? 0 > 1 {
|
||||||
deleteTagging(for: account, with: feed, from: container, completion: completion)
|
deleteTagging(for: account, with: feed, from: container, completion: completion)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -140,8 +140,8 @@ final class LocalAccountDelegate: AccountDelegate {
|
||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
func removeFeed(for account: Account, with feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
container?.removeFeed(feed)
|
container.removeFeed(feed)
|
||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeFeed(for account: Account, with feed: Feed, from container: Container?, completion: @escaping (Result<Void, Error>) -> Void) {
|
func removeFeed(for account: Account, with feed: Feed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
|
||||||
if feed.folderRelationship?.count ?? 0 > 1 {
|
if feed.folderRelationship?.count ?? 0 > 1 {
|
||||||
deleteTagging(for: account, with: feed, from: container, completion: completion)
|
deleteTagging(for: account, with: feed, from: container, completion: completion)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,8 +58,10 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
|
||||||
var container: Container? = nil
|
var container: Container? = nil
|
||||||
if let scriptableFolder = scriptableFeed.container as? ScriptableFolder {
|
if let scriptableFolder = scriptableFeed.container as? ScriptableFolder {
|
||||||
container = scriptableFolder.folder
|
container = scriptableFolder.folder
|
||||||
|
} else {
|
||||||
|
container = account
|
||||||
}
|
}
|
||||||
account.removeFeed(scriptableFeed.feed, from: container) { result in
|
account.removeFeed(scriptableFeed.feed, from: container!) { result in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,19 +159,28 @@ private struct SidebarItemSpecifier {
|
||||||
func delete(completion: @escaping () -> Void) {
|
func delete(completion: @escaping () -> Void) {
|
||||||
|
|
||||||
if let feed = feed {
|
if let feed = feed {
|
||||||
|
|
||||||
|
guard let container = path.resolveContainer() else {
|
||||||
|
completion()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
BatchUpdate.shared.start()
|
BatchUpdate.shared.start()
|
||||||
account?.removeFeed(feed, from: path.resolveContainer()) { result in
|
account?.removeFeed(feed, from: container) { result in
|
||||||
BatchUpdate.shared.end()
|
BatchUpdate.shared.end()
|
||||||
completion()
|
completion()
|
||||||
self.checkResult(result)
|
self.checkResult(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if let folder = folder {
|
} else if let folder = folder {
|
||||||
|
|
||||||
BatchUpdate.shared.start()
|
BatchUpdate.shared.start()
|
||||||
account?.removeFolder(folder) { result in
|
account?.removeFolder(folder) { result in
|
||||||
BatchUpdate.shared.end()
|
BatchUpdate.shared.end()
|
||||||
completion()
|
completion()
|
||||||
self.checkResult(result)
|
self.checkResult(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue