2017-09-16 15:30:26 -07:00
|
|
|
|
//
|
|
|
|
|
// AccountDelegate.swift
|
2019-07-08 23:06:40 -07:00
|
|
|
|
// NetNewsWire
|
2017-09-16 15:30:26 -07:00
|
|
|
|
//
|
|
|
|
|
// Created by Brent Simmons on 9/16/17.
|
|
|
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
2019-05-14 15:34:05 -05:00
|
|
|
|
import Articles
|
2017-10-07 17:20:19 -07:00
|
|
|
|
import RSWeb
|
2017-09-16 15:30:26 -07:00
|
|
|
|
|
2019-05-05 07:21:26 -05:00
|
|
|
|
protocol AccountDelegate {
|
2017-09-16 15:30:26 -07:00
|
|
|
|
|
2019-09-20 11:34:31 -05:00
|
|
|
|
var behaviors: AccountBehaviors { get }
|
|
|
|
|
|
2019-06-19 17:50:32 -05:00
|
|
|
|
var isOPMLImportInProgress: Bool { get }
|
2019-05-17 10:44:22 -05:00
|
|
|
|
|
2019-05-04 11:48:48 -05:00
|
|
|
|
var server: String? { get }
|
2019-05-05 03:25:21 -05:00
|
|
|
|
var credentials: Credentials? { get set }
|
2019-05-05 07:49:59 -05:00
|
|
|
|
var accountMetadata: AccountMetadata? { get set }
|
2017-10-07 14:40:14 -07:00
|
|
|
|
|
2017-10-07 17:43:10 -07:00
|
|
|
|
var refreshProgress: DownloadProgress { get }
|
2017-09-16 15:30:26 -07:00
|
|
|
|
|
2019-05-26 11:54:32 -05:00
|
|
|
|
func refreshAll(for account: Account, completion: @escaping (Result<Void, Error>) -> Void)
|
2019-11-04 20:24:21 -06:00
|
|
|
|
func sendArticleStatus(for account: Account, completion: @escaping ((Result<Void, Error>) -> Void))
|
|
|
|
|
func refreshArticleStatus(for account: Account, completion: @escaping ((Result<Void, Error>) -> Void))
|
2019-05-15 11:52:56 -05:00
|
|
|
|
|
2019-05-11 12:26:23 -05:00
|
|
|
|
func importOPML(for account:Account, opmlFile: URL, completion: @escaping (Result<Void, Error>) -> Void)
|
|
|
|
|
|
2019-05-30 14:36:21 -05:00
|
|
|
|
func addFolder(for account: Account, name: String, completion: @escaping (Result<Folder, Error>) -> Void)
|
2019-05-08 17:41:19 -05:00
|
|
|
|
func renameFolder(for account: Account, with folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
|
2019-05-29 20:53:00 -05:00
|
|
|
|
func removeFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void)
|
2019-05-06 17:34:41 -05:00
|
|
|
|
|
2019-11-14 20:11:41 -06:00
|
|
|
|
func createWebFeed(for account: Account, url: String, name: String?, container: Container, completion: @escaping (Result<WebFeed, Error>) -> Void)
|
|
|
|
|
func renameWebFeed(for account: Account, with feed: WebFeed, to name: String, completion: @escaping (Result<Void, Error>) -> Void)
|
|
|
|
|
func addWebFeed(for account: Account, with: WebFeed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
|
|
|
|
func removeWebFeed(for account: Account, with feed: WebFeed, from container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
|
|
|
|
func moveWebFeed(for account: Account, with feed: WebFeed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
2019-05-09 13:31:18 -05:00
|
|
|
|
|
2019-11-14 20:11:41 -06:00
|
|
|
|
func restoreWebFeed(for account: Account, feed: WebFeed, container: Container, completion: @escaping (Result<Void, Error>) -> Void)
|
2019-05-09 16:09:21 -05:00
|
|
|
|
func restoreFolder(for account: Account, folder: Folder, completion: @escaping (Result<Void, Error>) -> Void)
|
|
|
|
|
|
2019-05-14 15:34:05 -05:00
|
|
|
|
func markArticles(for account: Account, articles: Set<Article>, statusKey: ArticleStatus.Key, flag: Bool) -> Set<Article>?
|
|
|
|
|
|
2017-12-19 17:48:30 -08:00
|
|
|
|
// Called at the end of account’s init method.
|
|
|
|
|
func accountDidInitialize(_ account: Account)
|
2019-11-11 18:42:31 +11:00
|
|
|
|
|
|
|
|
|
func accountWillBeDeleted(_ account: Account)
|
2017-12-19 17:48:30 -08:00
|
|
|
|
|
2019-05-29 15:16:09 -04:00
|
|
|
|
static func validateCredentials(transport: Transport, credentials: Credentials, endpoint: URL?, completion: @escaping (Result<Credentials?, Error>) -> Void)
|
2019-11-29 22:57:14 -08:00
|
|
|
|
|
2019-12-04 17:27:39 -07:00
|
|
|
|
/// Suspend all network activity
|
|
|
|
|
func suspendNetwork()
|
|
|
|
|
|
|
|
|
|
/// Suspend the SQLLite databases
|
|
|
|
|
func suspendDatabase()
|
|
|
|
|
|
|
|
|
|
/// Make sure no SQLite databases are open and we are ready to issue network requests.
|
2019-11-29 22:57:14 -08:00
|
|
|
|
func resume()
|
2017-09-16 15:30:26 -07:00
|
|
|
|
}
|