This commit is contained in:
Justin Mazzocchi 2020-09-25 20:28:50 -07:00
parent 745a420c19
commit cf342bf3ae
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
7 changed files with 9 additions and 9 deletions

View file

@ -124,7 +124,7 @@ public extension ContentDatabase {
.eraseToAnyPublisher() .eraseToAnyPublisher()
} }
func setLists(_ lists: [MastodonList]) -> AnyPublisher<Never, Error> { func setLists(_ lists: [List]) -> AnyPublisher<Never, Error> {
databaseQueue.writePublisher { databaseQueue.writePublisher {
for list in lists { for list in lists {
try Timeline.list(list).save($0) try Timeline.list(list).save($0)
@ -139,7 +139,7 @@ public extension ContentDatabase {
.eraseToAnyPublisher() .eraseToAnyPublisher()
} }
func createList(_ list: MastodonList) -> AnyPublisher<Never, Error> { func createList(_ list: List) -> AnyPublisher<Never, Error> {
databaseQueue.writePublisher(updates: Timeline.list(list).save) databaseQueue.writePublisher(updates: Timeline.list(list).save)
.ignoreOutput() .ignoreOutput()
.eraseToAnyPublisher() .eraseToAnyPublisher()

View file

@ -18,7 +18,7 @@ extension Timeline: FetchableRecord, PersistableRecord {
case (Timeline.federated.id, _): case (Timeline.federated.id, _):
self = .federated self = .federated
case (let id, .some(let title)): case (let id, .some(let title)):
self = .list(MastodonList(id: id, title: title)) self = .list(List(id: id, title: title))
default: default:
var tag: String = row[Columns.id] var tag: String = row[Columns.id]

View file

@ -2,7 +2,7 @@
import Foundation import Foundation
public struct MastodonList: Codable, Hashable, Identifiable { public struct List: Codable, Hashable, Identifiable {
public let id: String public let id: String
public let title: String public let title: String

View file

@ -6,7 +6,7 @@ public enum Timeline: Hashable {
case home case home
case local case local
case federated case federated
case list(MastodonList) case list(List)
case tag(String) case tag(String)
} }

View file

@ -9,7 +9,7 @@ public enum ListEndpoint {
} }
extension ListEndpoint: Endpoint { extension ListEndpoint: Endpoint {
public typealias ResultType = MastodonList public typealias ResultType = List
public var context: [String] { public var context: [String] {
defaultContext + ["lists"] defaultContext + ["lists"]

View file

@ -9,7 +9,7 @@ public enum ListsEndpoint {
} }
extension ListsEndpoint: Endpoint { extension ListsEndpoint: Endpoint {
public typealias ResultType = [MastodonList] public typealias ResultType = [List]
public var pathComponentsInContext: [String] { public var pathComponentsInContext: [String] {
["lists"] ["lists"]

View file

@ -6,7 +6,7 @@ import Mastodon
import ServiceLayer import ServiceLayer
public final class ListsViewModel: ObservableObject { public final class ListsViewModel: ObservableObject {
@Published public private(set) var lists = [MastodonList]() @Published public private(set) var lists = [List]()
@Published public private(set) var creatingList = false @Published public private(set) var creatingList = false
@Published public var alertItem: AlertItem? @Published public var alertItem: AlertItem?
@ -47,7 +47,7 @@ public extension ListsViewModel {
.store(in: &cancellables) .store(in: &cancellables)
} }
func delete(list: MastodonList) { func delete(list: List) {
identification.service.deleteList(id: list.id) identification.service.deleteList(id: list.id)
.assignErrorsToAlertItem(to: \.alertItem, on: self) .assignErrorsToAlertItem(to: \.alertItem, on: self)
.sink { _ in } .sink { _ in }