Import default feeds using OPML. Delete the old plist file.
This commit is contained in:
parent
0e3a9ba1e9
commit
91897f8ea8
|
@ -1,160 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<dict>
|
||||
<key>note</key>
|
||||
<string>By Brent Simmons, NetNewsWire developer</string>
|
||||
<key>editedName</key>
|
||||
<string>Inessential</string>
|
||||
<key>homePageURL</key>
|
||||
<string>http://inessential.com/</string>
|
||||
<key>url</key>
|
||||
<string>http://inessential.com/feed.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>editedName</key>
|
||||
<string>Xcoders</string>
|
||||
<key>homePageURL</key>
|
||||
<string>https://xcoders.org/</string>
|
||||
<key>url</key>
|
||||
<string>https://xcoders.org/feed.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://daringfireball.net/</string>
|
||||
<key>editedName</key>
|
||||
<string>Daring Fireball</string>
|
||||
<key>url</key>
|
||||
<string>https://daringfireball.net/feeds/json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://jvns.ca/</string>
|
||||
<key>editedName</key>
|
||||
<string>Julia Evans</string>
|
||||
<key>url</key>
|
||||
<string>https://jvns.ca/atom.xml</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://kottke.org/</string>
|
||||
<key>editedName</key>
|
||||
<string>Jason Kottke</string>
|
||||
<key>url</key>
|
||||
<string>http://feeds.kottke.org/json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://becky.coffee/</string>
|
||||
<key>note</key>
|
||||
<string>iOS developer & corgi enthusiast</string>
|
||||
<key>editedName</key>
|
||||
<string>Becky Hansmeyer</string>
|
||||
<key>url</key>
|
||||
<string>http://beckyhansmeyer.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://shapeof.com/</string>
|
||||
<key>note</key>
|
||||
<string>By Gus Mueller, Acorn developer</string>
|
||||
<key>editedName</key>
|
||||
<string>The Shape of Everything</string>
|
||||
<key>url</key>
|
||||
<string>http://shapeof.com/feed.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://cate.blog</string>
|
||||
<key>note</key>
|
||||
<string>Cate Huston</string>
|
||||
<key>editedName</key>
|
||||
<string>Accidentally in Code</string>
|
||||
<key>url</key>
|
||||
<string>https://cate.blog/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://www.manton.org/</string>
|
||||
<key>editedName</key>
|
||||
<string>Manton Reece</string>
|
||||
<key>url</key>
|
||||
<string>http://www.manton.org/feed/json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://sixcolors.com/</string>
|
||||
<key>note</key>
|
||||
<string>By Jason Snell & friends</string>
|
||||
<key>editedName</key>
|
||||
<string>Six Colors</string>
|
||||
<key>url</key>
|
||||
<string>https://sixcolors.com/feed.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://www.loopinsight.com/</string>
|
||||
<key>note</key>
|
||||
<string>Jim Dalrymple and Dave Mark</string>
|
||||
<key>editedName</key>
|
||||
<string>Loop Insight</string>
|
||||
<key>url</key>
|
||||
<string>http://www.loopinsight.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://nnw.ranchero.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>NetNewsWire Blog</string>
|
||||
<key>url</key>
|
||||
<string>https://nnw.ranchero.com/feed.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://scripting.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>Scripting News</string>
|
||||
<key>note</key>
|
||||
<string>Dave Winer</string>
|
||||
<key>url</key>
|
||||
<string>http://scripting.com/rss.json</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://ericasadun.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>Erica Sadun</string>
|
||||
<key>note</key>
|
||||
<string>Lots of Swift goodness.</string>
|
||||
<key>url</key>
|
||||
<string>http://ericasadun.com/feed/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>http://onefoottsunami.com/</string>
|
||||
<key>editedName</key>
|
||||
<string>One Foot Tsunami</string>
|
||||
<key>note</key>
|
||||
<string>Paul Kafasis</string>
|
||||
<key>url</key>
|
||||
<string>https://onefoottsunami.com/feed/json/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://www.omnigroup.com/blog/</string>
|
||||
<key>editedName</key>
|
||||
<string>The Omni Blog</string>
|
||||
<key>url</key>
|
||||
<string>https://www.omnigroup.com/blog/rss/</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>homePageURL</key>
|
||||
<string>https://om.co/</string>
|
||||
<key>editedName</key>
|
||||
<string>Om Malik</string>
|
||||
<key>url</key>
|
||||
<string>https://om.co/feed</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
|
@ -7,30 +7,22 @@
|
|||
//
|
||||
|
||||
import Foundation
|
||||
import Articles
|
||||
import Account
|
||||
import RSCore
|
||||
|
||||
typealias DiskFeedDictionary = [String: Any]
|
||||
|
||||
struct DefaultFeedsImporter {
|
||||
|
||||
static func importIfNeeded(_ firstRun: Bool, account: Account) {
|
||||
|
||||
if shouldImportDefaultFeeds(firstRun) {
|
||||
appDelegate.logDebugMessage("Importing default feeds.")
|
||||
FeedsImporter.importFeeds(defaultFeeds(), account: account)
|
||||
static func importIfNeeded(_ isFirstRun: Bool, account: Account) {
|
||||
guard shouldImportDefaultFeeds(isFirstRun) else {
|
||||
return
|
||||
}
|
||||
|
||||
appDelegate.logDebugMessage("Importing default feeds.")
|
||||
let defaultFeedsURL = Bundle.main.url(forResource: "DefaultFeeds", withExtension: "opml")!
|
||||
try! OPMLImporter.parseAndImport(fileURL: defaultFeedsURL, account: AccountManager.shared.localAccount)
|
||||
}
|
||||
|
||||
private static func defaultFeeds() -> [DiskFeedDictionary] {
|
||||
|
||||
let f = Bundle.main.path(forResource: "DefaultFeeds", ofType: "plist")!
|
||||
return NSArray(contentsOfFile: f)! as! [DiskFeedDictionary]
|
||||
}
|
||||
|
||||
|
||||
private static func shouldImportDefaultFeeds(_ isFirstRun: Bool) -> Bool {
|
||||
|
||||
if !isFirstRun || AccountManager.shared.anyAccountHasAtLeastOneFeed() {
|
||||
return false
|
||||
}
|
||||
|
@ -38,22 +30,3 @@ struct DefaultFeedsImporter {
|
|||
}
|
||||
}
|
||||
|
||||
struct FeedsImporter {
|
||||
|
||||
static func importFeeds(_ feedDictionaries: [DiskFeedDictionary], account: Account) {
|
||||
|
||||
let feedsToImport = feeds(with: feedDictionaries, account: account)
|
||||
|
||||
BatchUpdate.shared.perform {
|
||||
feedsToImport.forEach{ account.addFeed($0) }
|
||||
}
|
||||
account.structureDidChange()
|
||||
}
|
||||
|
||||
private static func feeds(with feedDictionaries: [DiskFeedDictionary], account: Account) -> Set<Feed> {
|
||||
|
||||
let feedArray = feedDictionaries.compactMap { Feed(account: account, dictionary: $0) }
|
||||
return Set(feedArray)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,6 @@
|
|||
840F7C9721BDA4B40057E851 /* KeyboardShortcuts.html in Resources */ = {isa = PBXBuildFile; fileRef = 84EB38101FBA8B9F000D2111 /* KeyboardShortcuts.html */; };
|
||||
840F7C9821BDA4B40057E851 /* IndeterminateProgressWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 849A97931ED9EF7A007D329B /* IndeterminateProgressWindow.xib */; };
|
||||
840F7C9921BDA4B40057E851 /* GlobalKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 844B5B641FEA11F200C7C76A /* GlobalKeyboardShortcuts.plist */; };
|
||||
840F7C9A21BDA4B40057E851 /* DefaultFeeds.plist in Resources */ = {isa = PBXBuildFile; fileRef = 849A978E1ED9EE72007D329B /* DefaultFeeds.plist */; };
|
||||
840F7C9B21BDA4B40057E851 /* TimelineKeyboardShortcuts.plist in Resources */ = {isa = PBXBuildFile; fileRef = 845479871FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist */; };
|
||||
840F7C9C21BDA4B40057E851 /* template.html in Resources */ = {isa = PBXBuildFile; fileRef = 849A979B1ED9EFEB007D329B /* template.html */; };
|
||||
840F7C9D21BDA4B40057E851 /* AddFeedSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 849A97A71ED9F9AA007D329B /* AddFeedSheet.xib */; };
|
||||
|
@ -252,7 +251,6 @@
|
|||
849A97851ED9ECCD007D329B /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97841ED9ECCD007D329B /* PreferencesWindowController.swift */; };
|
||||
849A97891ED9ECEF007D329B /* ArticleStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97871ED9ECEF007D329B /* ArticleStyle.swift */; };
|
||||
849A978A1ED9ECEF007D329B /* ArticleStylesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97881ED9ECEF007D329B /* ArticleStylesManager.swift */; };
|
||||
849A978F1ED9EE72007D329B /* DefaultFeeds.plist in Resources */ = {isa = PBXBuildFile; fileRef = 849A978E1ED9EE72007D329B /* DefaultFeeds.plist */; };
|
||||
849A97921ED9EF65007D329B /* IndeterminateProgressWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97911ED9EF65007D329B /* IndeterminateProgressWindowController.swift */; };
|
||||
849A97951ED9EF7A007D329B /* IndeterminateProgressWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 849A97931ED9EF7A007D329B /* IndeterminateProgressWindow.xib */; };
|
||||
849A97981ED9EFAA007D329B /* Node-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97971ED9EFAA007D329B /* Node-Extensions.swift */; };
|
||||
|
@ -849,7 +847,6 @@
|
|||
849A97871ED9ECEF007D329B /* ArticleStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArticleStyle.swift; sourceTree = "<group>"; };
|
||||
849A97881ED9ECEF007D329B /* ArticleStylesManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArticleStylesManager.swift; sourceTree = "<group>"; };
|
||||
849A978C1ED9EE4D007D329B /* FeedListWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedListWindowController.swift; sourceTree = "<group>"; };
|
||||
849A978E1ED9EE72007D329B /* DefaultFeeds.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DefaultFeeds.plist; path = Importers/DefaultFeeds.plist; sourceTree = SOURCE_ROOT; };
|
||||
849A97911ED9EF65007D329B /* IndeterminateProgressWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndeterminateProgressWindowController.swift; sourceTree = "<group>"; };
|
||||
849A97941ED9EF7A007D329B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = NetNewsWire/Base.lproj/IndeterminateProgressWindow.xib; sourceTree = SOURCE_ROOT; };
|
||||
849A97971ED9EFAA007D329B /* Node-Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Node-Extensions.swift"; sourceTree = "<group>"; };
|
||||
|
@ -1595,7 +1592,6 @@
|
|||
children = (
|
||||
84DAEE2F1F86CAFE0058304B /* OPMLImporter.swift */,
|
||||
849A97591ED9EB0D007D329B /* DefaultFeedsImporter.swift */,
|
||||
849A978E1ED9EE72007D329B /* DefaultFeeds.plist */,
|
||||
84A3EE52223B667F00557320 /* DefaultFeeds.opml */,
|
||||
);
|
||||
path = Importers;
|
||||
|
@ -2228,7 +2224,6 @@
|
|||
840F7C9821BDA4B40057E851 /* IndeterminateProgressWindow.xib in Resources */,
|
||||
840F7C9921BDA4B40057E851 /* GlobalKeyboardShortcuts.plist in Resources */,
|
||||
84A3EE60223B667F00557320 /* DefaultFeeds.opml in Resources */,
|
||||
840F7C9A21BDA4B40057E851 /* DefaultFeeds.plist in Resources */,
|
||||
8405DDA322168920008CE1BF /* TimelineTableView.xib in Resources */,
|
||||
840F7C9B21BDA4B40057E851 /* TimelineKeyboardShortcuts.plist in Resources */,
|
||||
840F7C9C21BDA4B40057E851 /* template.html in Resources */,
|
||||
|
@ -2266,7 +2261,6 @@
|
|||
84EB381F1FBA8B9F000D2111 /* KeyboardShortcuts.html in Resources */,
|
||||
849A97951ED9EF7A007D329B /* IndeterminateProgressWindow.xib in Resources */,
|
||||
844B5B651FEA11F200C7C76A /* GlobalKeyboardShortcuts.plist in Resources */,
|
||||
849A978F1ED9EE72007D329B /* DefaultFeeds.plist in Resources */,
|
||||
5127B23A222B4849006D641D /* DetailKeyboardShortcuts.plist in Resources */,
|
||||
845479881FEB77C000AD8B59 /* TimelineKeyboardShortcuts.plist in Resources */,
|
||||
849A979D1ED9EFEB007D329B /* template.html in Resources */,
|
||||
|
|
Loading…
Reference in New Issue