2017-09-17 20:32:58 +02:00
|
|
|
//
|
|
|
|
// LocalAccountDelegate.swift
|
|
|
|
// Account
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 9/16/17.
|
|
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
2017-10-08 02:20:19 +02:00
|
|
|
import RSWeb
|
2017-09-17 20:32:58 +02:00
|
|
|
|
2017-10-07 23:40:14 +02:00
|
|
|
final class LocalAccountDelegate: AccountDelegate {
|
2019-05-05 14:21:26 +02:00
|
|
|
|
2017-09-28 22:16:47 +02:00
|
|
|
let supportsSubFolders = false
|
2019-05-04 18:48:48 +02:00
|
|
|
let server: String? = nil
|
2019-05-05 10:25:21 +02:00
|
|
|
var credentials: Credentials?
|
2019-05-05 14:49:59 +02:00
|
|
|
var accountMetadata: AccountMetadata?
|
2019-05-05 14:21:26 +02:00
|
|
|
|
2017-10-02 22:15:07 +02:00
|
|
|
private let refresher = LocalAccountRefresher()
|
2017-10-07 23:40:14 +02:00
|
|
|
|
2017-10-08 02:20:19 +02:00
|
|
|
var refreshProgress: DownloadProgress {
|
2018-02-14 22:14:25 +01:00
|
|
|
return refresher.progress
|
2017-10-08 02:20:19 +02:00
|
|
|
}
|
|
|
|
|
2019-05-05 22:41:20 +02:00
|
|
|
// LocalAccountDelegate doesn't wait for completion before calling the completion block
|
2019-05-06 17:53:20 +02:00
|
|
|
func refreshAll(for account: Account, completion: (() -> Void)? = nil) {
|
2019-04-26 21:21:17 +02:00
|
|
|
refresher.refreshFeeds(account.flattenedFeeds())
|
2019-05-05 22:41:20 +02:00
|
|
|
completion?()
|
2017-09-17 20:32:58 +02:00
|
|
|
}
|
2017-10-19 04:14:40 +02:00
|
|
|
|
2019-05-07 00:34:41 +02:00
|
|
|
func renameFolder(for account: Account, with folder: Folder, to name: String, completion: @escaping (Result<Void, Error>) -> Void) {
|
2019-05-06 17:53:20 +02:00
|
|
|
folder.name = name
|
|
|
|
completion(.success(()))
|
|
|
|
}
|
|
|
|
|
2019-05-07 00:34:41 +02:00
|
|
|
func deleteFolder(for account: Account, with folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) {
|
|
|
|
account.deleteFolder(folder)
|
|
|
|
completion(.success(()))
|
|
|
|
}
|
|
|
|
|
2017-12-20 02:48:30 +01:00
|
|
|
func accountDidInitialize(_ account: Account) {
|
|
|
|
}
|
|
|
|
|
2019-05-06 17:53:20 +02:00
|
|
|
static func validateCredentials(transport: Transport, credentials: Credentials, completion: (Result<Bool, Error>) -> Void) {
|
|
|
|
return completion(.success(false))
|
|
|
|
}
|
|
|
|
|
2017-09-17 20:32:58 +02:00
|
|
|
}
|