Swiftformat

This commit is contained in:
Thomas Ricouard 2023-02-01 12:49:59 +01:00
parent 383eb84e98
commit 4e77669181
9 changed files with 52 additions and 51 deletions

View File

@ -247,7 +247,7 @@ class AccountDetailViewModel: ObservableObject, StatusesFetcher {
}
}
func statusDidAppear(status: Models.Status) { }
func statusDidAppear(status _: Models.Status) {}
func statusDidDisappear(status: Status) { }
func statusDidDisappear(status _: Status) {}
}

View File

@ -1,6 +1,6 @@
import Foundation
import SwiftUI
import Models
import SwiftUI
@MainActor
class PendingStatusesObserver: ObservableObject {

View File

@ -1,6 +1,6 @@
import SwiftUI
import Models
import Network
import SwiftUI
actor TimelineCache {
static let shared: TimelineCache = .init()
@ -10,7 +10,7 @@ actor TimelineCache {
private init() {}
func set(statuses: [Status], client: Client) {
memoryCache[client] = statuses.prefix(upTo: min(100, (statuses.count - 1))).map{ $0 }
memoryCache[client] = statuses.prefix(upTo: min(100, statuses.count - 1)).map { $0 }
}
func getStatuses(for client: Client) -> [Status]? {

View File

@ -57,7 +57,6 @@ class TimelineViewModel: ObservableObject {
client?.server ?? "Error"
}
func fetchTag(id: String) async {
guard let client else { return }
do {
@ -65,7 +64,7 @@ class TimelineViewModel: ObservableObject {
} catch {}
}
func handleEvent(event: any StreamEvent, currentAccount: CurrentAccount) {
func handleEvent(event: any StreamEvent, currentAccount _: CurrentAccount) {
if let event = event as? StreamEventUpdate,
canStreamEvents,
pendingStatusesEnabled,
@ -91,6 +90,7 @@ class TimelineViewModel: ObservableObject {
}
// MARK: - Cache
extension TimelineViewModel {
private func cache(statuses: [Status]) async {
if let client {
@ -107,6 +107,7 @@ extension TimelineViewModel {
}
// MARK: - StatusesFetcher
extension TimelineViewModel: StatusesFetcher {
func fetchStatuses() async {
guard let client else { return }
@ -152,7 +153,7 @@ extension TimelineViewModel: StatusesFetcher {
}
// Fetch pages from the top most status of the tomeline.
private func fetchNewPagesFrom(latestStatus: Status, client: Client) async throws {
private func fetchNewPagesFrom(latestStatus: Status, client _: Client) async throws {
canStreamEvents = false
var newStatuses: [Status] = await fetchNewPages(minId: latestStatus.id, maxPages: 10)