mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-16 03:11:59 +01:00
33 lines
806 B
Swift
33 lines
806 B
Swift
//
|
|
// DefaultFeedsImporter.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Brent Simmons on 8/13/15.
|
|
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import Account
|
|
import RSCore
|
|
|
|
struct DefaultFeedsImporter {
|
|
|
|
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")!
|
|
AccountManager.shared.defaultAccount.importOPML(defaultFeedsURL) { result in }
|
|
}
|
|
|
|
private static func shouldImportDefaultFeeds(_ isFirstRun: Bool) -> Bool {
|
|
if !isFirstRun || AccountManager.shared.anyAccountHasAtLeastOneFeed() {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
|