mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-09 16:08:47 +01:00
Swiftformat
This commit is contained in:
parent
383eb84e98
commit
4e77669181
@ -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) {}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class StatusEditorViewModel: ObservableObject {
|
||||
mentionString += "@\(mention.acct)"
|
||||
}
|
||||
if !mentionString.isEmpty {
|
||||
mentionString += " "
|
||||
mentionString += " "
|
||||
}
|
||||
replyToStatus = status
|
||||
visibility = status.visibility
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import Models
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
class PendingStatusesObserver: ObservableObject {
|
||||
@ -18,12 +18,12 @@ class PendingStatusesObserver: ObservableObject {
|
||||
|
||||
func removeStatus(status: Status) {
|
||||
if !disableUpdate, let index = pendingStatuses.firstIndex(of: status.id) {
|
||||
pendingStatuses.removeSubrange(index...(pendingStatuses.count - 1))
|
||||
pendingStatuses.removeSubrange(index ... (pendingStatuses.count - 1))
|
||||
feedbackGenerator.impactOccurred()
|
||||
}
|
||||
}
|
||||
|
||||
init() { }
|
||||
init() {}
|
||||
}
|
||||
|
||||
struct PendingStatusesObserverView: View {
|
||||
@ -32,7 +32,7 @@ struct PendingStatusesObserverView: View {
|
||||
if observer.pendingStatusesCount > 0 {
|
||||
HStack(spacing: 6) {
|
||||
Spacer()
|
||||
Button { } label: {
|
||||
Button {} label: {
|
||||
Text("\(observer.pendingStatusesCount)")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
@ -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]? {
|
||||
|
@ -156,7 +156,7 @@ public struct TimelineView: View {
|
||||
}
|
||||
|
||||
private var scrollToTopView: some View {
|
||||
HStack{ EmptyView() }
|
||||
HStack { EmptyView() }
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
.listRowSeparator(.hidden)
|
||||
.listRowInsets(.init())
|
||||
|
@ -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)
|
||||
|
||||
@ -187,7 +188,7 @@ extension TimelineViewModel: StatusesFetcher {
|
||||
}
|
||||
} else {
|
||||
// Append new statuses in the timeline indicator.
|
||||
pendingStatusesObserver.pendingStatuses.insert(contentsOf: newStatuses.map{ $0.id }, at: 0)
|
||||
pendingStatusesObserver.pendingStatuses.insert(contentsOf: newStatuses.map { $0.id }, at: 0)
|
||||
pendingStatusesObserver.feedbackGenerator.impactOccurred()
|
||||
|
||||
// High chance the user is scrolled to the top.
|
||||
|
Loading…
x
Reference in New Issue
Block a user