IceCubesApp/Packages/Status/Sources/Status/List/StatusesFetcher.swift

23 lines
525 B
Swift
Raw Normal View History

import Combine
2022-12-19 11:28:55 +00:00
import Models
2023-01-17 10:36:01 +00:00
import SwiftUI
2022-12-19 11:28:55 +00:00
public enum StatusesState {
public enum PagingState {
case hasNextPage, loadingNextPage, none
2022-12-19 11:28:55 +00:00
}
2023-01-17 10:36:01 +00:00
2022-12-19 11:28:55 +00:00
case loading
case display(statuses: [Status], nextPageState: StatusesState.PagingState)
case error(error: Error)
}
@MainActor
public protocol StatusesFetcher: ObservableObject {
var statusesState: StatusesState { get }
2023-02-25 09:10:27 +00:00
func fetchNewestStatuses() async
2022-12-19 11:28:55 +00:00
func fetchNextPage() async
2023-01-31 07:04:35 +00:00
func statusDidAppear(status: Status)
func statusDidDisappear(status: Status)
2022-12-19 11:28:55 +00:00
}