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