mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-22 13:37:01 +00:00
Refactoring
This commit is contained in:
parent
f1f49b7c3f
commit
2040c0dc6d
6 changed files with 10 additions and 21 deletions
|
@ -26,10 +26,7 @@ public struct AccountListService {
|
|||
.map { [$0.map(CollectionItem.account)] }
|
||||
.eraseToAnyPublisher()
|
||||
nextPageMaxIDs = nextPageMaxIDsSubject.eraseToAnyPublisher()
|
||||
navigationService = NavigationService(
|
||||
status: nil,
|
||||
mastodonAPIClient: mastodonAPIClient,
|
||||
contentDatabase: contentDatabase)
|
||||
navigationService = NavigationService(mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,15 +9,13 @@ import MastodonAPI
|
|||
public struct AccountService {
|
||||
public let account: Account
|
||||
public let navigationService: NavigationService
|
||||
|
||||
private let mastodonAPIClient: MastodonAPIClient
|
||||
private let contentDatabase: ContentDatabase
|
||||
|
||||
init(account: Account, mastodonAPIClient: MastodonAPIClient, contentDatabase: ContentDatabase) {
|
||||
self.account = account
|
||||
self.navigationService = NavigationService(
|
||||
status: nil,
|
||||
mastodonAPIClient: mastodonAPIClient,
|
||||
contentDatabase: contentDatabase)
|
||||
navigationService = NavigationService(mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
||||
self.mastodonAPIClient = mastodonAPIClient
|
||||
self.contentDatabase = contentDatabase
|
||||
}
|
||||
|
|
|
@ -22,10 +22,7 @@ public struct ContextService {
|
|||
self.mastodonAPIClient = mastodonAPIClient
|
||||
self.contentDatabase = contentDatabase
|
||||
sections = contentDatabase.contextObservation(parentID: statusID)
|
||||
navigationService = NavigationService(
|
||||
status: nil,
|
||||
mastodonAPIClient: mastodonAPIClient,
|
||||
contentDatabase: contentDatabase)
|
||||
navigationService = NavigationService(mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@ public enum Navigation {
|
|||
}
|
||||
|
||||
public struct NavigationService {
|
||||
private let status: Status?
|
||||
private let mastodonAPIClient: MastodonAPIClient
|
||||
private let contentDatabase: ContentDatabase
|
||||
private let status: Status?
|
||||
|
||||
init(status: Status?, mastodonAPIClient: MastodonAPIClient, contentDatabase: ContentDatabase) {
|
||||
self.status = status
|
||||
init(mastodonAPIClient: MastodonAPIClient, contentDatabase: ContentDatabase, status: Status? = nil) {
|
||||
self.mastodonAPIClient = mastodonAPIClient
|
||||
self.contentDatabase = contentDatabase
|
||||
self.status = status
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ public struct StatusService {
|
|||
init(status: Status, mastodonAPIClient: MastodonAPIClient, contentDatabase: ContentDatabase) {
|
||||
self.status = status
|
||||
self.navigationService = NavigationService(
|
||||
status: status.displayStatus,
|
||||
mastodonAPIClient: mastodonAPIClient,
|
||||
contentDatabase: contentDatabase)
|
||||
contentDatabase: contentDatabase,
|
||||
status: status.displayStatus)
|
||||
self.mastodonAPIClient = mastodonAPIClient
|
||||
self.contentDatabase = contentDatabase
|
||||
}
|
||||
|
|
|
@ -23,10 +23,7 @@ public struct TimelineService {
|
|||
self.mastodonAPIClient = mastodonAPIClient
|
||||
self.contentDatabase = contentDatabase
|
||||
sections = contentDatabase.observation(timeline: timeline)
|
||||
navigationService = NavigationService(
|
||||
status: nil,
|
||||
mastodonAPIClient: mastodonAPIClient,
|
||||
contentDatabase: contentDatabase)
|
||||
navigationService = NavigationService(mastodonAPIClient: mastodonAPIClient, contentDatabase: contentDatabase)
|
||||
nextPageMaxIDs = nextPageMaxIDsSubject.eraseToAnyPublisher()
|
||||
|
||||
if case let .tag(tag) = timeline {
|
||||
|
|
Loading…
Reference in a new issue